chromium/chromium-97.0.4692.71-fix-tag-dragging-in-Mutter.patch

47 lines
2.0 KiB
Diff
Raw Permalink Normal View History

From 3806f28918ea23291749ff4775339075a5f394e8 Mon Sep 17 00:00:00 2001
From: Tom Anderson <thomasanderson@chromium.org>
Date: Thu, 6 Jan 2022 00:59:40 +0000
Subject: [PATCH] [X11] Fix tag dragging in Mutter
We used to use a BFS to find the target window for tag dragging, but
this causes windows underneath (like the window for the desktop
wallpaper) to take precedence over nested windows.
This CL switches to a DFS.
R=sky
Bug: 1279532
Change-Id: Ib569e9270be60bcb4fff088517dfe295697608b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3355470
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/main@{#955976}
---
ui/platform_window/x11/x11_topmost_window_finder.cc | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/ui/platform_window/x11/x11_topmost_window_finder.cc b/ui/platform_window/x11/x11_topmost_window_finder.cc
index 2e16393487b..e20bf0abf0e 100644
--- a/ui/platform_window/x11/x11_topmost_window_finder.cc
+++ b/ui/platform_window/x11/x11_topmost_window_finder.cc
@@ -44,15 +44,8 @@ bool EnumerateChildren(ShouldStopIteratingCallback should_stop_iterating,
for (iter = windows.rbegin(); iter != windows.rend(); iter++) {
if (IsWindowNamed(*iter) && should_stop_iterating.Run(*iter))
return true;
- }
-
- // If we're at this point, we didn't find the window we're looking for at the
- // current level, so we need to recurse to the next level. We use a second
- // loop because the recursion and call to XQueryTree are expensive and is only
- // needed for a small number of cases.
- if (++depth <= max_depth) {
- for (iter = windows.rbegin(); iter != windows.rend(); iter++) {
- if (EnumerateChildren(should_stop_iterating, *iter, max_depth, depth))
+ if (depth < max_depth) {
+ if (EnumerateChildren(should_stop_iterating, *iter, max_depth, depth + 1))
return true;
}
}