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>
This commit is contained in:
parent
96fd7cc8c9
commit
3ea36e5214
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue