xserver: Branch 'master' - 4 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Nov 16 10:22:09 UTC 2023


 hw/xwayland/xwayland-output.c |   10 ++++++++++
 hw/xwayland/xwayland-types.h  |    1 +
 hw/xwayland/xwayland-window.c |   30 ++++++++++++++++++++++++++++--
 hw/xwayland/xwayland-window.h |    3 ++-
 4 files changed, 41 insertions(+), 3 deletions(-)

New commits:
commit a797776ff29e67b5dd60aebf3cef144a743d3cb4
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Thu Nov 9 10:40:53 2023 +0100

    xwayland: Do not resize when running fullscreen
    
    When running fullscreen, if an X11 client has changed the resolution,
    Xwayland is using a viewport to emulate the expected resolution.
    
    When changing focus, the Wayland compositor will send a configure event
    with the actual surface size, not the size of the emulated XRandR
    resolution.
    
    As a result, changing focus while XRandR emulation (and hence the
    viewport) is active in Xwayland will revert the resolution to the actual
    output size, defeating the XRandR emulation.
    
    To avoid that issue, only change the size when not running fullscreen.
    
    Fixes: 53b6d4db7 - xwayland: Apply root toplevel configure dimensions
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Kenny Levinsen <kl at kl.wtf>

diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
index 92ec4995c..4978f37c7 100644
--- a/hw/xwayland/xwayland-window.c
+++ b/hw/xwayland/xwayland-window.c
@@ -789,13 +789,16 @@ xdg_toplevel_handle_configure(void *data,
                               struct wl_array *states)
 {
     struct xwl_window *xwl_window = data;
+    struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
 
     /* Maintain our current size if no dimensions are requested */
     if (width == 0 && height == 0)
         return;
 
-    /* This will be committed by the xdg_surface.configure handler */
-    xwl_window_maybe_resize(xwl_window, width, height);
+    if (!xwl_screen->fullscreen) {
+        /* This will be committed by the xdg_surface.configure handler */
+        xwl_window_maybe_resize(xwl_window, width, height);
+    }
 }
 
 static void
commit 06eb7271a92fb677837811d42452d38d6fb68f25
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Fri Nov 10 09:17:20 2023 +0100

    xwayland: Update the fullscreen window on output change
    
    Make sure to update the fullscreen rootful window configuration whenever
    the output setup changes.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Kenny Levinsen <kl at kl.wtf>

diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index fe7a9232e..f26fb5a4f 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -601,6 +601,7 @@ static void
 apply_output_change(struct xwl_output *xwl_output)
 {
     struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
+    struct xwl_window *xwl_window;
     struct xwl_output *it;
     int mode_width, mode_height, count;
     int width = 0, height = 0, has_this_output = 0;
@@ -658,6 +659,15 @@ apply_output_change(struct xwl_output *xwl_output)
         update_screen_size(xwl_screen, width, height);
     else
         RRTellChanged(xwl_screen->screen);
+
+    /* If running rootful and fullscreen, make sure to match the new setup */
+    if (xwl_screen->fullscreen) {
+        /* The root window may not yet be created */
+        if (xwl_screen->screen->root) {
+            xwl_window = xwl_window_get(xwl_screen->screen->root);
+            xwl_window_rootful_update_fullscreen(xwl_window, xwl_output);
+        }
+    }
 }
 
 static void
commit 73b9ff53c39a56c8d84a20214e9f8da162d56059
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Fri Nov 10 09:08:57 2023 +0100

    xwayland: Add a helper function to update fullscreen
    
    Whenever the output configuration changes, if Xwayland is running
    fullscreen, we may need to update the viewport in use or even update the
    output on which Xwayland is currently running fullscreen.
    
    Add a new helper function xwl_window_rootful_update_fullscreen() that
    will recompute the fullscreen state and the viewport setup so that the
    fullscreen Xwayland rootful window matches the new setup.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Kenny Levinsen <kl at kl.wtf>

diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
index a4f02a058..92ec4995c 100644
--- a/hw/xwayland/xwayland-window.c
+++ b/hw/xwayland/xwayland-window.c
@@ -569,6 +569,29 @@ xwl_window_set_fullscreen(struct xwl_window *xwl_window)
     return TRUE;
 }
 
+void
+xwl_window_rootful_update_fullscreen(struct xwl_window *xwl_window,
+                                     struct xwl_output *xwl_output)
+{
+    struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
+
+    if (!xwl_screen->fullscreen)
+        return;
+
+    if (xwl_window->window != xwl_screen->screen->root)
+        return;
+
+    if (xwl_window->wl_output_fullscreen != xwl_output->output)
+        return;
+
+    /* The size and position of the output may have changed, clear our
+     * output to make sure the next call to xwl_window_set_fullscreen()
+     * recomputes the size and updates the viewport as needed.
+     */
+    xwl_window->wl_output_fullscreen = NULL;
+    xwl_window_set_fullscreen(xwl_window);
+}
+
 void
 xwl_window_rootful_update_title(struct xwl_window *xwl_window)
 {
diff --git a/hw/xwayland/xwayland-window.h b/hw/xwayland/xwayland-window.h
index 45ae16da0..7fbb2a623 100644
--- a/hw/xwayland/xwayland-window.h
+++ b/hw/xwayland/xwayland-window.h
@@ -135,7 +135,8 @@ Bool xwl_window_has_viewport_enabled(struct xwl_window *xwl_window);
 Bool xwl_window_is_toplevel(WindowPtr window);
 void xwl_window_check_resolution_change_emulation(struct xwl_window *xwl_window);
 void xwl_window_rootful_update_title(struct xwl_window *xwl_window);
-
+void xwl_window_rootful_update_fullscreen(struct xwl_window *xwl_window,
+                                          struct xwl_output *xwl_output);
 void xwl_window_set_window_pixmap(WindowPtr window, PixmapPtr pixmap);
 
 Bool xwl_realize_window(WindowPtr window);
commit 2f84e3fe0d1bb22a44c8a4a9eb4c9bd92f66b1a3
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Fri Nov 10 09:06:35 2023 +0100

    xwayland: Add xwl_output to the Xwayland types
    
    No functional change.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Kenny Levinsen <kl at kl.wtf>

diff --git a/hw/xwayland/xwayland-types.h b/hw/xwayland/xwayland-types.h
index e70e56320..927a07168 100644
--- a/hw/xwayland/xwayland-types.h
+++ b/hw/xwayland/xwayland-types.h
@@ -31,5 +31,6 @@ struct xwl_window;
 struct xwl_screen;
 struct xwl_egl_backend;
 struct xwl_drm_lease;
+struct xwl_output;
 
 #endif /* XWAYLAND_TYPES_H */


More information about the xorg-commit mailing list