aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-10-07 11:28:07 -0500
committerRonan Pigott <ronan@rjp.ie>2023-10-27 17:36:32 -0700
commit647521244a99f7dbda8fa7c21d7eee781692dc22 (patch)
treea5cf759a956d659f93e24396cb54dc77f31aaeee
parent47263aca289ab4d89ba69a543357603e64719ff6 (diff)
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.
-rw-r--r--sway/desktop/xdg_shell.c7
1 files 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);