aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Dudemanguy <random342@airmail.cc>2023-10-07 11:28:07 -0500
committerLibravatar Ronan Pigott <ronan@rjp.ie>2023-10-27 17:36:32 -0700
commit647521244a99f7dbda8fa7c21d7eee781692dc22 (patch)
treea5cf759a956d659f93e24396cb54dc77f31aaeee
parentview: check if the buffer was uploaded on save (diff)
downloadsway-647521244a99f7dbda8fa7c21d7eee781692dc22.tar.gz
sway-647521244a99f7dbda8fa7c21d7eee781692dc22.tar.zst
sway-647521244a99f7dbda8fa7c21d7eee781692dc22.zip
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) {
294 memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); 294 memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
295 if (container_is_floating(view->container)) { 295 if (container_is_floating(view->container)) {
296 view_update_size(view); 296 view_update_size(view);
297 wlr_xdg_toplevel_set_size(view->wlr_xdg_toplevel, view->geometry.width, 297 // Only set the toplevel size the current container actually has a size.
298 view->geometry.height); 298 if (view->container->current.width) {
299 wlr_xdg_toplevel_set_size(view->wlr_xdg_toplevel, view->geometry.width,
300 view->geometry.height);
301 }
299 transaction_commit_dirty_client(); 302 transaction_commit_dirty_client();
300 } else { 303 } else {
301 view_center_surface(view); 304 view_center_surface(view);