From 2a96c4cdaf633e50162a1c1ac2c1e282502a4c00 Mon Sep 17 00:00:00 2001 From: John Lindgren Date: Sun, 18 Jan 2026 23:56:13 -0500 Subject: [PATCH] view: avoid restacking when view (or a sub-view) is already in front Currently, every click within a sub-view results in first restacking the parent view in front, and then the sub-view. This is unnecessary and has caused issues in the past, such as with Xaw popups (which we've worked around in d748dc78bc0e by adding an xcb_flush()). It would be better not to do the unnecessary restacking at all. --- src/view.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/view.c b/src/view.c index 2808acb1..415becc8 100644 --- a/src/view.c +++ b/src/view.c @@ -2232,6 +2232,18 @@ void view_move_to_front(struct view *view) { assert(view); + struct server *server = view->server; + assert(!wl_list_empty(&server->views)); + + /* + * Check whether the view is already in front, or is the root + * parent of the view in front (in which case we don't want to + * raise it in front of its sub-view). + */ + struct view *front = wl_container_of(server->views.next, front, link); + if (view == front || view == view_get_root(front)) { + return; + } struct view *root = view_get_root(view); assert(root);