From 3ea36e521426aaba37f3d00de3b57805cc71243e Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Mon, 27 Nov 2023 15:02:08 +0100 Subject: [PATCH] xwayland: Always set the viewport scale factor When the viewport is disabled, set the scale x/y back to 1.0 so that we can apply the scale factor regardless of the viewport being enabled. Signed-off-by: Olivier Fourdan Reviewed-By: Kenny Levinsen Acked-by: Peter Hutterer Part-of: --- hw/xwayland/xwayland-input.c | 6 ++---- hw/xwayland/xwayland-window.c | 4 ++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c index 502581425..fcf3ee91e 100644 --- a/hw/xwayland/xwayland-input.c +++ b/hw/xwayland/xwayland-input.c @@ -663,10 +663,8 @@ dispatch_absolute_motion(struct xwl_seat *xwl_seat) event_x *= xwl_screen->global_surface_scale; event_y *= xwl_screen->global_surface_scale; - if (xwl_window_has_viewport_enabled(xwl_seat->focus_window)) { - event_x *= xwl_seat->focus_window->viewport_scale_x; - event_y *= xwl_seat->focus_window->viewport_scale_y; - } + event_x *= xwl_seat->focus_window->viewport_scale_x; + event_y *= xwl_seat->focus_window->viewport_scale_y; x = drawable_x + event_x; y = drawable_y + event_y; diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c index 00cdbdd58..09d69df3c 100644 --- a/hw/xwayland/xwayland-window.c +++ b/hw/xwayland/xwayland-window.c @@ -260,6 +260,8 @@ xwl_window_disable_viewport(struct xwl_window *xwl_window) DebugF("XWAYLAND: disabling viewport\n"); wp_viewport_destroy(xwl_window->viewport); xwl_window->viewport = NULL; + xwl_window->viewport_scale_x = 1.0; + xwl_window->viewport_scale_y = 1.0; } static void @@ -977,6 +979,8 @@ ensure_surface_for_window(WindowPtr window) xwl_window->xwl_screen = xwl_screen; xwl_window->window = window; + xwl_window->viewport_scale_x = 1.0; + xwl_window->viewport_scale_y = 1.0; xwl_window->surface = wl_compositor_create_surface(xwl_screen->compositor); if (xwl_window->surface == NULL) { ErrorF("wl_display_create_surface failed\n");