aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2021-09-27 18:34:59 +0200
committerIsaac Freund <ifreund@ifreund.xyz>2021-09-27 18:34:59 +0200
commita3fdb294b311216bec388f97a52148ff8e1155cd (patch)
treef830c6a68b13905ead2f27a07abaa18cd57a98ee
parentb8ebbc29cf42a36e97666bf9757a9bc354e31925 (diff)
downloadriver-a3fdb294b311216bec388f97a52148ff8e1155cd.tar.gz
river-a3fdb294b311216bec388f97a52148ff8e1155cd.tar.xz
Cursor: implement surfaceAt() for XwaylandUnmanaged
-rw-r--r--river/Cursor.zig25
1 files changed, 19 insertions, 6 deletions
diff --git a/river/Cursor.zig b/river/Cursor.zig
index efdefee..bce0c71 100644
--- a/river/Cursor.zig
+++ b/river/Cursor.zig
@@ -38,6 +38,7 @@ const Output = @import("Output.zig");
const Seat = @import("Seat.zig");
const View = @import("View.zig");
const ViewStack = @import("view_stack.zig").ViewStack;
+const XwaylandUnmanaged = @import("XwaylandUnmanaged.zig");
const Mode = union(enum) {
passthrough: void,
@@ -249,6 +250,7 @@ fn handleButton(listener: *wl.Listener(*wlr.Pointer.event.Button), event: *wlr.P
self.seat.setFocusRaw(.{ .layer = layer_surface });
}
},
+ .xwayland_unmanaged => assert(build_options.xwayland),
}
_ = self.seat.wlr_seat.pointerNotifyButton(event.time_msec, event.button, event.state);
}
@@ -420,6 +422,7 @@ const SurfaceAtResult = struct {
parent: union(enum) {
view: *View,
layer_surface: *LayerSurface,
+ xwayland_unmanaged: if (build_options.xwayland) *XwaylandUnmanaged else void,
},
};
@@ -461,7 +464,7 @@ pub fn surfaceAt(self: Self) ?SurfaceAtResult {
if (layerSurfaceAt(output.getLayer(.overlay).*, ox, oy)) |s| return s;
if (fullscreen_view) |view| {
- //if (build_options.xwayland) if (xwaylandUnmanagedSurfaceAt(ly, lx)) |s| return s;
+ if (build_options.xwayland) if (xwaylandUnmanagedSurfaceAt(ly, lx)) |s| return s;
var sx: f64 = undefined;
var sy: f64 = undefined;
if (view.surfaceAt(ox, oy, &sx, &sy)) |found| {
@@ -479,7 +482,7 @@ pub fn surfaceAt(self: Self) ?SurfaceAtResult {
if (layerSurfaceAt(output.getLayer(.top).*, ox, oy)) |s| return s;
- //if (build_options.xwayland) if (xwaylandUnmanagedSurfaceAt(lx, ly)) |s| return s;
+ if (build_options.xwayland) if (xwaylandUnmanagedSurfaceAt(lx, ly)) |s| return s;
if (viewSurfaceAt(output, ox, oy)) |s| return s;
@@ -603,16 +606,25 @@ fn viewSurfaceAt(output: *const Output, ox: f64, oy: f64) ?SurfaceAtResult {
return null;
}
-fn xwaylandUnmanagedSurfaceAt(lx: f64, ly: f64) ?*wlr.Surface {
+fn xwaylandUnmanagedSurfaceAt(lx: f64, ly: f64) ?SurfaceAtResult {
var it = server.root.xwayland_unmanaged_views.first;
while (it) |node| : (it = node.next) {
const xwayland_surface = node.data.xwayland_surface;
+ var sx: f64 = undefined;
+ var sy: f64 = undefined;
if (xwayland_surface.surface.?.surfaceAt(
lx - @intToFloat(f64, xwayland_surface.x),
ly - @intToFloat(f64, xwayland_surface.y),
- sx,
- sy,
- )) |found| return found;
+ &sx,
+ &sy,
+ )) |found| {
+ return SurfaceAtResult{
+ .surface = found,
+ .sx = sx,
+ .sy = sy,
+ .parent = .{ .xwayland_unmanaged = &node.data },
+ };
+ }
}
return null;
}
@@ -832,6 +844,7 @@ fn passthrough(self: *Self, time: u32) void {
}
},
.layer_surface => {},
+ .xwayland_unmanaged => assert(build_options.xwayland),
}
}
}