xserver: Branch 'master' - 3 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Aug 16 06:44:23 UTC 2023
hw/xwayland/xwayland-screen.c | 15 +++++-----
hw/xwayland/xwayland-window.c | 58 ++++++++++++++++++++++++------------------
2 files changed, 41 insertions(+), 32 deletions(-)
New commits:
commit 8128a21554788b3eda49d28bb8f5eba064dafeaf
Author: Kenny Levinsen <kl at kl.wtf>
Date: Fri Aug 11 14:40:23 2023 +0200
xwayland: Default geometry for undecorated rootful
We specify a sensible default geometry for decorated rootful windows,
but not for undecorated ones. Make the default geometry apply to rootful
windows in general.
Signed-off-by: Kenny Levinsen <kl at kl.wtf>
diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c
index 6b57fbe9d..c00f976a8 100644
--- a/hw/xwayland/xwayland-screen.c
+++ b/hw/xwayland/xwayland-screen.c
@@ -816,14 +816,13 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
}
}
- if (use_fixed_size) {
- if (xwl_screen->rootless) {
- ErrorF("error, cannot set a geometry when running rootless\n");
- return FALSE;
- } else {
- xwl_screen->width = xwl_width;
- xwl_screen->height = xwl_height;
- }
+ if (!xwl_screen->rootless) {
+ use_fixed_size = 1;
+ xwl_screen->width = xwl_width;
+ xwl_screen->height = xwl_height;
+ } else if (use_fixed_size) {
+ ErrorF("error, cannot set a geometry when running rootless\n");
+ return FALSE;
}
#ifdef XWL_HAS_GLAMOR
commit 53b6d4db7edfe5109681a4c1554e83df6d98be3e
Author: Kenny Levinsen <kl at kl.wtf>
Date: Fri Aug 11 11:16:04 2023 +0200
xwayland: Apply root toplevel configure dimensions
While we now have support for resize of the root window through
libdecor, we still ignore toplevel configure dimensions when libdecor is
not in use. This ignores user intent in many Wayland servers, and some
xdg_toplevel states when active have strong requirements for adherence
to configure dimensions.
Resize in response to xdg_toplevel configure dimensions like we do for
libdecor configure events.
Signed-off-by: Kenny Levinsen <kl at kl.wtf>
diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
index c50b5c179..a4f02a058 100644
--- a/hw/xwayland/xwayland-window.c
+++ b/hw/xwayland/xwayland-window.c
@@ -765,6 +765,14 @@ xdg_toplevel_handle_configure(void *data,
int32_t height,
struct wl_array *states)
{
+ struct xwl_window *xwl_window = data;
+
+ /* 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);
}
static void
@@ -823,7 +831,7 @@ xwl_create_root_surface(struct xwl_window *xwl_window)
xdg_toplevel_add_listener(xwl_window->xdg_toplevel,
&xdg_toplevel_listener,
- NULL);
+ xwl_window);
}
xwl_window_rootful_update_title(xwl_window);
commit 4f869c6eda2e3566ecf2ec850301518beb739fe2
Author: Kenny Levinsen <kl at kl.wtf>
Date: Fri Aug 11 17:18:08 2023 +0200
xwayland: Make xwl_window_libdecor_resize reusable
The upcoming handling of plain xdg_toplevel.configure events will need
to use the xwl_window resize helper. Move it outside XWL_HAS_LIBDECOR,
move the remaining dimension logic from handle_libdecor_configure into
it and update the name accordingly.
Signed-off-by: Kenny Levinsen <kl at kl.wtf>
diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
index 3ecb99da2..c50b5c179 100644
--- a/hw/xwayland/xwayland-window.c
+++ b/hw/xwayland/xwayland-window.c
@@ -608,6 +608,30 @@ xwl_window_rootful_set_app_id(struct xwl_window *xwl_window)
xdg_toplevel_set_app_id(xwl_window->xdg_toplevel, app_id);
}
+static void
+xwl_window_maybe_resize(struct xwl_window *xwl_window, int width, int height)
+{
+ struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
+ struct xwl_output *xwl_output;
+ RRModePtr mode;
+
+ /* Clamp the size */
+ width = min(max(width, MIN_ROOTFUL_WIDTH), MAX_ROOTFUL_WIDTH);
+ height = min(max(height, MIN_ROOTFUL_HEIGHT), MAX_ROOTFUL_HEIGHT);
+
+ if (width == xwl_screen->width && height == xwl_screen->height)
+ return;
+
+ xwl_output = xwl_screen_get_fixed_or_first_output(xwl_screen);
+ if (!xwl_randr_add_modes_fixed(xwl_output, width, height))
+ return;
+
+ mode = xwl_output_find_mode(xwl_output, width, height);
+ xwl_output_set_mode_fixed(xwl_output, mode);
+
+ xwl_window_attach_buffer(xwl_window);
+}
+
#ifdef XWL_HAS_LIBDECOR
static void
xwl_window_libdecor_set_size_limits(struct xwl_window *xwl_window)
@@ -632,23 +656,6 @@ xwl_window_update_libdecor_size(struct xwl_window *xwl_window,
}
}
-static void
-xwl_window_libdecor_resize(struct xwl_window *xwl_window, int width, int height)
-{
- struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
- struct xwl_output *xwl_output;
- RRModePtr mode;
-
- xwl_output = xwl_screen_get_fixed_or_first_output(xwl_screen);
- if (!xwl_randr_add_modes_fixed(xwl_output, width, height))
- return;
-
- mode = xwl_output_find_mode(xwl_output, width, height);
- xwl_output_set_mode_fixed(xwl_output, mode);
-
- xwl_window_attach_buffer(xwl_window);
-}
-
static void
handle_libdecor_configure(struct libdecor_frame *frame,
struct libdecor_configuration *configuration,
@@ -662,13 +669,8 @@ handle_libdecor_configure(struct libdecor_frame *frame,
width = xwl_screen->width;
height = xwl_screen->height;
}
- /* Clamp the size */
- width = min(max(width, MIN_ROOTFUL_WIDTH), MAX_ROOTFUL_WIDTH);
- height = min(max(height, MIN_ROOTFUL_HEIGHT), MAX_ROOTFUL_HEIGHT) ;
-
- if (xwl_screen->width != width || xwl_screen->height != height)
- xwl_window_libdecor_resize(xwl_window, width, height);
+ xwl_window_maybe_resize(xwl_window, width, height);
xwl_window_update_libdecor_size(xwl_window, configuration,
xwl_screen->width, xwl_screen->height);
wl_surface_commit(xwl_window->surface);
More information about the xorg-commit
mailing list