xorg-x11-server/0018-xwayland-Check-emulation-on-client-toplevel-resize.patch

122 lines
4.6 KiB
Diff
Raw Normal View History

From da3e06f4bed7fa60838ce89a0b45ea73c7d9615c Mon Sep 17 00:00:00 2001
From: Roman Gilg <subdiff@gmail.com>
Date: Fri, 3 Jan 2020 17:55:28 +0100
Subject: [PATCH xserver 18/24] xwayland: Check emulation on client toplevel
resize
When a reparented window is resized directly check the emulation instead of
doing this only when the window manager parent window is resized, what might
never happen.
For that to work we need to make sure that we compare the current size of the
client toplevel when looking for an emulated mode.
Changes by Hans de Goede:
- Remove xwl_window x, y, width and height members as those are no longer used.
- Add check for xwl_window_from_window() returning NULL.
Signed-off-by: Roman Gilg <subdiff@gmail.com>
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 6d98f840da6dfcf2a69e03a1b3fa0bf602ba1f27)
---
hw/xwayland/xwayland.c | 27 +++++++++++----------------
hw/xwayland/xwayland.h | 1 -
2 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index c60a2ce67..898a291fd 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -611,6 +611,7 @@ xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
struct xwl_output *xwl_output;
ClientPtr owner;
WindowPtr window;
+ DrawablePtr drawable;
if (!xwl_screen_has_resolution_change_emulation(xwl_screen))
return FALSE;
@@ -620,6 +621,7 @@ xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
return FALSE;
owner = wClient(window);
+ drawable = &window->drawable;
/* 1. Test if the window matches the emulated mode on one of the outputs
* This path gets hit by most games / libs (e.g. SDL, SFML, OGRE)
@@ -629,10 +631,10 @@ xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
if (!emulated_mode)
continue;
- if (xwl_window->x == xwl_output->x &&
- xwl_window->y == xwl_output->y &&
- xwl_window->width == emulated_mode->width &&
- xwl_window->height == emulated_mode->height) {
+ if (drawable->x == xwl_output->x &&
+ drawable->y == xwl_output->y &&
+ drawable->width == emulated_mode->width &&
+ drawable->height == emulated_mode->height) {
*emulated_mode_ret = emulated_mode;
*xwl_output_ret = xwl_output;
@@ -648,9 +650,9 @@ xwl_window_should_enable_viewport(struct xwl_window *xwl_window,
emulated_mode = xwl_output_get_emulated_mode_for_client(xwl_output, owner);
if (xwl_output && xwl_window->window->overrideRedirect &&
emulated_mode && emulated_mode->from_vidmode &&
- xwl_window->x == 0 && xwl_window->y == 0 &&
- xwl_window->width == xwl_screen->width &&
- xwl_window->height == xwl_screen->height) {
+ drawable->x == 0 && drawable->y == 0 &&
+ drawable->width == xwl_screen->width &&
+ drawable->height == xwl_screen->height) {
*emulated_mode_ret = emulated_mode;
*xwl_output_ret = xwl_output;
@@ -770,8 +772,6 @@ ensure_surface_for_window(WindowPtr window)
xwl_window->xwl_screen = xwl_screen;
xwl_window->window = window;
- xwl_window->width = window->drawable.width;
- xwl_window->height = window->drawable.height;
xwl_window->surface = wl_compositor_create_surface(xwl_screen->compositor);
if (xwl_window->surface == NULL) {
ErrorF("wl_display_create_surface failed\n");
@@ -999,20 +999,15 @@ xwl_resize_window(WindowPtr window,
struct xwl_window *xwl_window;
xwl_screen = xwl_screen_get(screen);
- xwl_window = xwl_window_get(window);
+ xwl_window = xwl_window_from_window(window);
screen->ResizeWindow = xwl_screen->ResizeWindow;
(*screen->ResizeWindow) (window, x, y, width, height, sib);
xwl_screen->ResizeWindow = screen->ResizeWindow;
screen->ResizeWindow = xwl_resize_window;
- if (xwl_window) {
- xwl_window->x = x;
- xwl_window->y = y;
- xwl_window->width = width;
- xwl_window->height = height;
+ if (xwl_window && xwl_window_is_toplevel(window))
xwl_window_check_resolution_change_emulation(xwl_window);
- }
}
static void
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index f5ffadfcc..0d0baac9b 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -184,7 +184,6 @@ struct xwl_window {
struct xwl_screen *xwl_screen;
struct wl_surface *surface;
struct wp_viewport *viewport;
- int32_t x, y, width, height;
float scale_x, scale_y;
struct wl_shell_surface *shell_surface;
WindowPtr window;
--
2.26.2