aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2020-11-13 14:05:18 -0700
committerFurkan Sahin <furkan-dev@proton.me>2020-11-13 14:05:18 -0700
commit87965daf4d1b1c44358fd8f5e0cdea0137cb5944 (patch)
tree3d8dff7dd3566f36df838aed815583d668df1f64
parent6f0830fa0c79d7951c2184e36dadf58292096f34 (diff)
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.
-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) {
struct sway_view *view = &xdg_shell_view->view;
struct wlr_xdg_surface *xdg_surface = view->wlr_xdg_surface;
+ struct wlr_box new_geo;
+ wlr_xdg_surface_get_geometry(xdg_surface, &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
+ 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();
+ }
+
if (view->container->node.instruction) {
- wlr_xdg_surface_get_geometry(xdg_surface, &view->geometry);
transaction_notify_view_ready_by_serial(view,
xdg_surface->configure_serial);
- } else {
- struct wlr_box new_geo;
- wlr_xdg_surface_get_geometry(xdg_surface, &new_geo);
-
- 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)) {
- // The view has unexpectedly sent a new size
- 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_immediately(view);
- } else {
- memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
- }
+ } else if (new_size) {
+ transaction_notify_view_ready_immediately(view);
}
view_damage_from(view);