xdg_shell: don't update wlr_toplevel if the container has no size yet

3d5ae9813d 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.
This commit is contained in:
Dudemanguy 2023-10-07 11:28:07 -05:00 committed by Ronan Pigott
parent 47263aca28
commit 647521244a

View file

@ -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);