From 841b6550a91ecbcc0cd0dc9c741af28dbcfc96f4 Mon Sep 17 00:00:00 2001 From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Sat, 26 Feb 2022 01:57:45 +0100 Subject: [PATCH] xwayland.c: Fix positioning with multiple queued configure events Prevents a single action like ToggleDecorations + ToggleMaximize to position the view somewhere with negative coordinates when unmaximizing. It may still position the view on negative coordinates but later commit events will fix the position. This issue only exists on xwayland because there are no configure serials which we could use to ignore all repositioning until we are at the latest desired state. --- src/xwayland.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/xwayland.c b/src/xwayland.c index 23a4cbc2..090f49a0 100644 --- a/src/xwayland.c +++ b/src/xwayland.c @@ -14,13 +14,19 @@ handle_commit(struct wl_listener *listener, void *data) view->h = view->surface->current.height; if (view->pending_move_resize.update_x) { + /* Adjust x for queued up configure events */ view->x = view->pending_move_resize.x + view->pending_move_resize.width - view->w; - view->pending_move_resize.update_x = false; } if (view->pending_move_resize.update_y) { + /* Adjust y for queued up configure events */ view->y = view->pending_move_resize.y + view->pending_move_resize.height - view->h; + } + if ((int)view->pending_move_resize.width == view->w + && (int)view->pending_move_resize.height == view->h) { + /* We reached the end of all queued size changing configure events */ + view->pending_move_resize.update_x = false; view->pending_move_resize.update_y = false; } ssd_update_geometry(view, false);