aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xwayland.c
diff options
context:
space:
mode:
authorLibravatar Kenny Levinsen <kl@kl.wtf>2021-02-08 01:13:23 +0100
committerLibravatar Simon Ser <contact@emersion.fr>2021-02-09 09:37:10 +0100
commit82b1019658cea14e508de04e49d23c8f9c744159 (patch)
treed6c5bcf78b59d1b33e1dbeffd06b37ba6cd5c702 /sway/desktop/xwayland.c
parentshells: Only center tiled views on size change (diff)
downloadsway-82b1019658cea14e508de04e49d23c8f9c744159.tar.gz
sway-82b1019658cea14e508de04e49d23c8f9c744159.tar.zst
sway-82b1019658cea14e508de04e49d23c8f9c744159.zip
shells: Align geometry change commit handling
xdg_shell and xwayland handled geometry changes differently despite needing mostly identical behavior. The xwayland implementation has been changed to match that of xdg_shell.
Diffstat (limited to 'sway/desktop/xwayland.c')
-rw-r--r--sway/desktop/xwayland.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index be9503e5..8b39cf50 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -399,33 +399,30 @@ static void handle_commit(struct wl_listener *listener, void *data) {
399 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; 399 struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
400 struct wlr_surface_state *state = &xsurface->surface->current; 400 struct wlr_surface_state *state = &xsurface->surface->current;
401 401
402 struct wlr_box new_geo;
403 get_geometry(view, &new_geo);
404 bool new_size = new_geo.width != view->geometry.width ||
405 new_geo.height != view->geometry.height ||
406 new_geo.x != view->geometry.x ||
407 new_geo.y != view->geometry.y;
408
409 if (new_size) {
410 // The view has unexpectedly sent a new size
411 // eg. The Firefox "Save As" dialog when downloading a file
412 desktop_damage_view(view);
413 memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
414 if (container_is_floating(view->container)) {
415 view_update_size(view, new_geo.width, new_geo.height);
416 transaction_commit_dirty();
417 } else {
418 view_center_surface(view);
419 }
420 desktop_damage_view(view);
421 }
422
402 if (view->container->node.instruction) { 423 if (view->container->node.instruction) {
403 get_geometry(view, &view->geometry);
404 transaction_notify_view_ready_by_geometry(view, 424 transaction_notify_view_ready_by_geometry(view,
405 xsurface->x, xsurface->y, state->width, state->height); 425 xsurface->x, xsurface->y, state->width, state->height);
406 } else {
407 struct wlr_box new_geo;
408 get_geometry(view, &new_geo);
409 bool new_size = new_geo.width != view->geometry.width ||
410 new_geo.height != view->geometry.height ||
411 new_geo.x != view->geometry.x ||
412 new_geo.y != view->geometry.y;
413
414 if (new_size) {
415 // The view has unexpectedly sent a new size
416 // eg. The Firefox "Save As" dialog when downloading a file
417 desktop_damage_view(view);
418 memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
419 if (container_is_floating(view->container)) {
420 view_update_size(view, new_geo.width, new_geo.height);
421 transaction_commit_dirty();
422 transaction_notify_view_ready_by_geometry(view,
423 xsurface->x, xsurface->y, new_geo.width, new_geo.height);
424 } else {
425 view_center_surface(view);
426 }
427 desktop_damage_view(view);
428 }
429 } 426 }
430 427
431 view_damage_from(view); 428 view_damage_from(view);