commit 647521244a99f7dbda8fa7c21d7eee781692dc22
parent 47263aca289ab4d89ba69a543357603e64719ff6
Author: Dudemanguy <random342@airmail.cc>
Date: Sat, 7 Oct 2023 11:28:07 -0500
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.
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git 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);