aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2020-06-28 00:29:44 +0200
committerIsaac Freund <ifreund@ifreund.xyz>2020-06-28 00:29:44 +0200
commitb6ef4c5a1ab335337bdab7cc73e564c454d98aa5 (patch)
treed917dcf5aca6e3900a40dd27397b942985668f1a
parent9dfcec72a8904f670a9696b404ebbf6621c8d3c6 (diff)
downloadriver-b6ef4c5a1ab335337bdab7cc73e564c454d98aa5.tar.gz
river-b6ef4c5a1ab335337bdab7cc73e564c454d98aa5.tar.xz
cursor: fix viewAt() ordering
Focused views must be checked first as they are always rendered on top.
-rw-r--r--river/Cursor.zig15
1 files changed, 12 insertions, 3 deletions
diff --git a/river/Cursor.zig b/river/Cursor.zig
index eeae028..c38c0dd 100644
--- a/river/Cursor.zig
+++ b/river/Cursor.zig
@@ -359,8 +359,17 @@ fn layerSurfaceAt(
/// Find the topmost visible view surface (incl. popups) at ox,oy.
fn viewSurfaceAt(output: Output, ox: f64, oy: f64, sx: *f64, sy: *f64) ?*c.wlr_surface {
+ // Focused views are rendered on top, so look for them first.
var it = ViewStack(View).iterator(output.views.first, output.current_focused_tags);
- return while (it.next()) |node| {
- if (node.view.surfaceAt(ox, oy, sx, sy)) |found| break found;
- } else null;
+ while (it.next()) |node| {
+ if (!node.view.focused) continue;
+ if (node.view.surfaceAt(ox, oy, sx, sy)) |found| return found;
+ }
+
+ it = ViewStack(View).iterator(output.views.first, output.current_focused_tags);
+ while (it.next()) |node| {
+ if (node.view.surfaceAt(ox, oy, sx, sy)) |found| return found;
+ }
+
+ return null;
}