xserver: Branch 'master' - 4 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 18 12:50:41 UTC 2023


 hw/xwayland/xwayland-output.c |    2 +-
 hw/xwayland/xwayland-output.h |    4 ++++
 hw/xwayland/xwayland-screen.c |    5 +++--
 hw/xwayland/xwayland-window.c |   28 +++++++++++++++++-----------
 hw/xwayland/xwayland.c        |    2 +-
 5 files changed, 26 insertions(+), 15 deletions(-)

New commits:
commit 94deed272cbd5cf891d24e24fff6a455757b5fb2
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Tue Jul 18 12:21:55 2023 +0200

    xwayland: Use sensible defaults for rootful size
    
    If "-decorate" is used but no "-geometry" is specified, Xwayland rootful
    would take its size from the actual Wayland outputs combined.
    
    That is not practical, especially when using multiple outputs, as the
    resulting Xwayland window would be much larger than a single monitor.
    
    To avoid that, set a sensible default size for the Xwayland decorate
    window, using 640x480 to match what Xephyr does.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>

diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c
index 0ac44e17b..37ee7da0f 100644
--- a/hw/xwayland/xwayland-screen.c
+++ b/hw/xwayland/xwayland-screen.c
@@ -723,8 +723,8 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
     struct xwl_screen *xwl_screen;
     Pixel red_mask, blue_mask, green_mask;
     int ret, bpc, green_bpc, i;
-    unsigned int xwl_width = 0;
-    unsigned int xwl_height = 0;
+    unsigned int xwl_width = 640;
+    unsigned int xwl_height = 480;
 #ifdef XWL_HAS_GLAMOR
     Bool use_eglstreams = FALSE;
 #endif
@@ -808,6 +808,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
         else if (strcmp(argv[i], "-decorate") == 0) {
 #ifdef XWL_HAS_LIBDECOR
             xwl_screen->decorate = 1;
+            use_fixed_size = 1;
 #else
             ErrorF("This build does not have libdecor support\n");
 #endif
commit 7c85877485495208d65d5d5184149191fa94b58f
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Mon Jul 17 10:00:06 2023 +0200

    Xwayland: Do not mark decorate as experimental
    
    libdecor support seems quite stable, no need to mark that experimental.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>

diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index ca75ad7f1..672dc3168 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -107,7 +107,7 @@ ddxUseMsg(void)
     ErrorF("-noTouchPointerEmulation  disable touch pointer emulation\n");
     ErrorF("-force-xrandr-emulation   force non-native modes to be exposed when viewporter is not exposed by the compositor\n");
 #ifdef XWL_HAS_LIBDECOR
-    ErrorF("-decorate              add decorations to Xwayland when rootful (experimental)\n");
+    ErrorF("-decorate              add decorations to Xwayland when rootful\n");
 #endif
 }
 
commit 516f1b96cd73bdf66e9f3ba8541540870ebac8fb
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Thu Jul 13 17:07:18 2023 +0200

    xwayland: Make Xwayland rootful resizable
    
    By default, the Xwayland window in rootful mode was not resizable.
    
    Make the Xwayland window resizable using libdecor in rootful mode.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>

diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
index ecf18761d..a58a4439a 100644
--- a/hw/xwayland/xwayland-window.c
+++ b/hw/xwayland/xwayland-window.c
@@ -621,21 +621,27 @@ handle_libdecor_configure(struct libdecor_frame *frame,
 {
     struct xwl_window *xwl_window = data;
     struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
+    struct xwl_output *xwl_output;
     struct libdecor_state *state;
+    RRModePtr mode;
+    int width, height;
 
-    state = libdecor_state_new(xwl_screen->width, xwl_screen->height);
-    libdecor_frame_commit(frame, state, configuration);
-    libdecor_state_free(state);
+    if (!libdecor_configuration_get_content_size(configuration, frame, &width, &height)) {
+        width = xwl_screen->width;
+        height = xwl_screen->height;
+    }
 
-    if (libdecor_frame_has_capability(frame, LIBDECOR_ACTION_RESIZE))
-        libdecor_frame_unset_capabilities(frame, LIBDECOR_ACTION_RESIZE);
-    if (libdecor_frame_has_capability(frame, LIBDECOR_ACTION_FULLSCREEN))
-        libdecor_frame_unset_capabilities(frame, LIBDECOR_ACTION_FULLSCREEN);
+    if (xwl_screen->width != width || xwl_screen->height != height) {
+        xwl_output = xwl_screen_get_fixed_or_first_output(xwl_screen);
+        if (xwl_randr_add_modes_fixed(xwl_output, width, height)) {
+            mode = xwl_output_find_mode(xwl_output, width, height);
+            xwl_output_set_mode_fixed(xwl_output, mode);
+        }
+    }
 
-    /* FIXME:
-     * We're not xdg-shell compliant here, we are supposed to adjust to
-     * the given configure size.
-     */
+    state = libdecor_state_new(width, height);
+    libdecor_frame_commit(frame, state, configuration);
+    libdecor_state_free(state);
 
     wl_surface_commit(xwl_window->surface);
 }
commit 63c0a2dfa22011b95a7b70ff98417ff9da47f261
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Thu Jul 13 17:06:05 2023 +0200

    xwayland: Make xwl_randr_add_modes_fixed() public API
    
    This is preparation work for making Xwayland rootful resizeable.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>

diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 738c3320f..fe7a9232e 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -1080,7 +1080,7 @@ mode_sort(const void *left, const void *right)
     return (*mode_b)->mode.width - (*mode_a)->mode.width;
 }
 
-static Bool
+Bool
 xwl_randr_add_modes_fixed(struct xwl_output *xwl_output,
                           int current_width, int current_height)
 {
diff --git a/hw/xwayland/xwayland-output.h b/hw/xwayland/xwayland-output.h
index a95288e4f..bcdf25bec 100644
--- a/hw/xwayland/xwayland-output.h
+++ b/hw/xwayland/xwayland-output.h
@@ -77,6 +77,10 @@ Bool xwl_screen_init_output(struct xwl_screen *xwl_screen);
 
 Bool xwl_screen_init_randr_fixed(struct xwl_screen *xwl_screen);
 
+Bool
+xwl_randr_add_modes_fixed(struct xwl_output *xwl_output,
+                          int current_width, int current_height);
+
 void xwl_output_set_mode_fixed(struct xwl_output *xwl_output,
                                RRModePtr mode);
 


More information about the xorg-commit mailing list