diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2023-11-27 15:02:08 +0100 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2024-03-20 09:05:36 +0100 |
commit | 3ea36e521426aaba37f3d00de3b57805cc71243e (patch) | |
tree | 38426c93e09a7b9667c6c7ed4d67dcb3ac8a305f /hw/xwayland | |
parent | 96fd7cc8c99b065dbbe7fc2ab0f2f93e841e01ae (diff) |
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 <ofourdan@redhat.com>
Reviewed-By: Kenny Levinsen <kl@kl.wtf>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1197>
Diffstat (limited to 'hw/xwayland')
-rw-r--r-- | hw/xwayland/xwayland-input.c | 6 | ||||
-rw-r--r-- | 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"); |