diff options
-rw-r--r-- | sway/desktop/xdg_shell.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index 4d133a12..f02021e1 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c | |||
@@ -284,28 +284,27 @@ static void handle_commit(struct wl_listener *listener, void *data) { | |||
284 | struct sway_view *view = &xdg_shell_view->view; | 284 | struct sway_view *view = &xdg_shell_view->view; |
285 | struct wlr_xdg_surface *xdg_surface = view->wlr_xdg_surface; | 285 | struct wlr_xdg_surface *xdg_surface = view->wlr_xdg_surface; |
286 | 286 | ||
287 | struct wlr_box new_geo; | ||
288 | wlr_xdg_surface_get_geometry(xdg_surface, &new_geo); | ||
289 | bool new_size = new_geo.width != view->geometry.width || | ||
290 | new_geo.height != view->geometry.height || | ||
291 | new_geo.x != view->geometry.x || | ||
292 | new_geo.y != view->geometry.y; | ||
293 | |||
294 | if (new_size) { | ||
295 | // The view has unexpectedly sent a new size | ||
296 | desktop_damage_view(view); | ||
297 | view_update_size(view, new_geo.width, new_geo.height); | ||
298 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | ||
299 | desktop_damage_view(view); | ||
300 | transaction_commit_dirty(); | ||
301 | } | ||
302 | |||
287 | if (view->container->node.instruction) { | 303 | if (view->container->node.instruction) { |
288 | wlr_xdg_surface_get_geometry(xdg_surface, &view->geometry); | ||
289 | transaction_notify_view_ready_by_serial(view, | 304 | transaction_notify_view_ready_by_serial(view, |
290 | xdg_surface->configure_serial); | 305 | xdg_surface->configure_serial); |
291 | } else { | 306 | } else if (new_size) { |
292 | struct wlr_box new_geo; | 307 | transaction_notify_view_ready_immediately(view); |
293 | wlr_xdg_surface_get_geometry(xdg_surface, &new_geo); | ||
294 | |||
295 | if ((new_geo.width != view->geometry.width || | ||
296 | new_geo.height != view->geometry.height || | ||
297 | new_geo.x != view->geometry.x || | ||
298 | new_geo.y != view->geometry.y)) { | ||
299 | // The view has unexpectedly sent a new size | ||
300 | desktop_damage_view(view); | ||
301 | view_update_size(view, new_geo.width, new_geo.height); | ||
302 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | ||
303 | desktop_damage_view(view); | ||
304 | transaction_commit_dirty(); | ||
305 | transaction_notify_view_ready_immediately(view); | ||
306 | } else { | ||
307 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | ||
308 | } | ||
309 | } | 308 | } |
310 | 309 | ||
311 | view_damage_from(view); | 310 | view_damage_from(view); |