From 90fa6953ea84477c09cb57fd60ded2bb0e33414d Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Mon, 8 Feb 2021 01:05:51 +0100 Subject: shells: Only center tiled views on size change The size of a tiled container cannot change in response to new buffer sizes, so there is no need to commit a new transaction. Instead, simply recenter the view with the new geometry, leaving the full transaction flow for floating containers. --- sway/desktop/xwayland.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'sway/desktop/xwayland.c') diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index e1a2e463..be9503e5 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -406,22 +406,25 @@ static void handle_commit(struct wl_listener *listener, void *data) { } else { struct wlr_box new_geo; get_geometry(view, &new_geo); + bool new_size = new_geo.width != view->geometry.width || + new_geo.height != view->geometry.height || + new_geo.x != view->geometry.x || + new_geo.y != view->geometry.y; - if ((new_geo.width != view->geometry.width || - new_geo.height != view->geometry.height || - new_geo.x != view->geometry.x || - new_geo.y != view->geometry.y)) { + if (new_size) { // The view has unexpectedly sent a new size // eg. The Firefox "Save As" dialog when downloading a file desktop_damage_view(view); - view_update_size(view, new_geo.width, new_geo.height); memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); - desktop_damage_view(view); - transaction_commit_dirty(); - transaction_notify_view_ready_by_geometry(view, + if (container_is_floating(view->container)) { + view_update_size(view, new_geo.width, new_geo.height); + transaction_commit_dirty(); + transaction_notify_view_ready_by_geometry(view, xsurface->x, xsurface->y, new_geo.width, new_geo.height); - } else { - memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); + } else { + view_center_surface(view); + } + desktop_damage_view(view); } } -- cgit v1.2.3-54-g00ecf