frontend: Fix VNC mirror screen rotation

The following config allows to mirror the LVDS output to VNC:

|[output]
|name=LVDS-1
|transform=rotate-270
|
|[output]
|name=vnc
|mirror-of=LVDS-1

However, the current code only takes the scale into account, not the
relative transformation. In case of rotate 90 or 270 the width and height
have to be swapped. Add it.

Closes: https://gitlab.freedesktop.org/wayland/weston/-/issues/1076
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
This commit is contained in:
Kurt Kanzenbach 2025-07-09 15:07:44 +02:00 committed by Marius Vlad
parent d69e816b54
commit c6484574a6

View file

@ -3331,6 +3331,21 @@ wet_output_compute_output_from_mirror(struct weston_output *output,
mode->height = output->native_mode_copy.height /
mirror->current_scale;
/* Switch width and height for transform 90 or 270 */
switch (output->transform) {
case WL_OUTPUT_TRANSFORM_90:
case WL_OUTPUT_TRANSFORM_270:
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
case WL_OUTPUT_TRANSFORM_FLIPPED_270: {
int32_t tmp = mode->width;
mode->width = mode->height;
mode->height = tmp;
break;
}
default:
break;
}
mode->refresh = output->native_mode_copy.refresh;
*scale = output->current_scale;
}