From 647521244a99f7dbda8fa7c21d7eee781692dc22 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Sat, 7 Oct 2023 11:28:07 -0500 Subject: [PATCH] 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 c2a985ee2..7c01bf168 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);