diff options
| author | Kenny Levinsen <kl@kl.wtf> | 2021-02-08 01:13:23 +0100 | 
|---|---|---|
| committer | Simon Ser <contact@emersion.fr> | 2021-02-09 09:37:10 +0100 | 
| commit | 82b1019658cea14e508de04e49d23c8f9c744159 (patch) | |
| tree | d6c5bcf78b59d1b33e1dbeffd06b37ba6cd5c702 /sway/desktop | |
| parent | 90fa6953ea84477c09cb57fd60ded2bb0e33414d (diff) | |
| download | sway-82b1019658cea14e508de04e49d23c8f9c744159.tar.xz | |
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')
| -rw-r--r-- | sway/desktop/xwayland.c | 45 | 
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) {  	struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;  	struct wlr_surface_state *state = &xsurface->surface->current; +	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_size) { +		// The view has unexpectedly sent a new size +		// eg. The Firefox "Save As" dialog when downloading a file +		desktop_damage_view(view); +		memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); +		if (container_is_floating(view->container)) { +			view_update_size(view, new_geo.width, new_geo.height); +			transaction_commit_dirty(); +		} else { +			view_center_surface(view); +		} +		desktop_damage_view(view); +	} +  	if (view->container->node.instruction) { -		get_geometry(view, &view->geometry);  		transaction_notify_view_ready_by_geometry(view,  				xsurface->x, xsurface->y, state->width, state->height); -	} 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_size) { -			// The view has unexpectedly sent a new size -			// eg. The Firefox "Save As" dialog when downloading a file -			desktop_damage_view(view); -			memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); -			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 { -				view_center_surface(view); -			} -			desktop_damage_view(view); -		}  	}  	view_damage_from(view);  | 
