aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Ronan Pigott <rpigott@berkeley.edu>2020-11-13 14:05:18 -0700
committerLibravatar Simon Ser <contact@emersion.fr>2020-11-24 09:47:23 +0100
commit32b93ef6ea394a8f0c564d4bded2806c7b595696 (patch)
tree3d8dff7dd3566f36df838aed815583d668df1f64 /sway
parentdocument parse_error (diff)
downloadsway-32b93ef6ea394a8f0c564d4bded2806c7b595696.tar.gz
sway-32b93ef6ea394a8f0c564d4bded2806c7b595696.tar.zst
sway-32b93ef6ea394a8f0c564d4bded2806c7b595696.zip
xdg_shell: allow views to change geometry anytime
Currently, when sway sends a configure with some geometry and the client responds with a different geometry in a commit that acks that configure, sway ignores the new size. Sway applies the surface geometry it had requested to the container, not what was actually committed, in the following transaction. This change allows any client commit to change its surface geometry, even if it is a response to a configure event.
Diffstat (limited to 'sway')
-rw-r--r--sway/desktop/xdg_shell.c37
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);