From 647521244a99f7dbda8fa7c21d7eee781692dc22 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Sat, 7 Oct 2023 11:28:07 -0500 Subject: [PATCH 1/3] xdg_shell: don't update wlr_toplevel if the container has no size yet 3d5ae9813d390ea747462fc0026ee43b7c77d0f2 added logic to change the underlying wlr_toplevel size for floating containers, but it does it even if the container has no actual coordinates yet. This doesn't really make sense to update the toplevel size in this case since there's many things that could affect the initial coordinates (sway commands, fullscreen state, etc.). Skip this by doing a crude check to see if the current container state has any width. --- sway/desktop/xdg_shell.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index c2a985ee..7c01bf16 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -294,8 +294,11 @@ static void handle_commit(struct wl_listener *listener, void *data) { memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); if (container_is_floating(view->container)) { view_update_size(view); - wlr_xdg_toplevel_set_size(view->wlr_xdg_toplevel, view->geometry.width, - view->geometry.height); + // Only set the toplevel size the current container actually has a size. + if (view->container->current.width) { + wlr_xdg_toplevel_set_size(view->wlr_xdg_toplevel, view->geometry.width, + view->geometry.height); + } transaction_commit_dirty_client(); } else { view_center_surface(view); From f2425b4fd64314394aa962cee12b617fb7e5b10f Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Sun, 29 Oct 2023 18:59:25 +0300 Subject: [PATCH 2/3] xdg-shell: send maximized if tiled isn't supported wlroots doesn't do it automatically anymore. --- sway/desktop/xdg_shell.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index 7c01bf16..4c59b42a 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -169,12 +169,19 @@ static void set_tiled(struct sway_view *view, bool tiled) { if (xdg_shell_view_from_view(view) == NULL) { return; } - enum wlr_edges edges = WLR_EDGE_NONE; - if (tiled) { - edges = WLR_EDGE_LEFT | WLR_EDGE_RIGHT | WLR_EDGE_TOP | - WLR_EDGE_BOTTOM; + if (wl_resource_get_version(view->wlr_xdg_toplevel->resource) >= + XDG_TOPLEVEL_STATE_TILED_LEFT_SINCE_VERSION) { + enum wlr_edges edges = WLR_EDGE_NONE; + if (tiled) { + edges = WLR_EDGE_LEFT | WLR_EDGE_RIGHT | WLR_EDGE_TOP | + WLR_EDGE_BOTTOM; + } + wlr_xdg_toplevel_set_tiled(view->wlr_xdg_toplevel, edges); + } else { + // The version is too low for the tiled state; configure as maximized instead + // to stop the client from drawing decorations outside of the toplevel geometry. + wlr_xdg_toplevel_set_maximized(view->wlr_xdg_toplevel, tiled); } - wlr_xdg_toplevel_set_tiled(view->wlr_xdg_toplevel, edges); } static void set_fullscreen(struct sway_view *view, bool fullscreen) { From 6f6b82793d95e3c10d54bcf21ca3f0c76c44b882 Mon Sep 17 00:00:00 2001 From: Bill Li Date: Tue, 31 Oct 2023 11:11:02 +0800 Subject: [PATCH 3/3] chase wlroots!4411 References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4411 fix #7802 --- sway/desktop/output.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 0670b3dd..f2bc4a67 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -706,9 +706,7 @@ static void handle_frame(struct wl_listener *listener, void *user_data) { if (output->max_render_time != 0) { struct timespec now; - clockid_t presentation_clock - = wlr_backend_get_presentation_clock(server.backend); - clock_gettime(presentation_clock, &now); + clock_gettime(CLOCK_MONOTONIC, &now); const long NSEC_IN_SECONDS = 1000000000; struct timespec predicted_refresh = output->last_presentation;