Cursor: remove surfaceAt()

We now use the wlr_scene API to find out what is at the cursor location.
This commit is contained in:
Isaac Freund
2023-01-29 12:03:41 +01:00
parent 4f0ce8fceb
commit 683ed0f04e
6 changed files with 152 additions and 307 deletions

View File

@ -28,6 +28,7 @@ const server = &@import("main.zig").server;
const util = @import("util.zig");
const Output = @import("Output.zig");
const SceneNodeData = @import("SceneNodeData.zig");
const Seat = @import("Seat.zig");
const ViewStack = @import("view_stack.zig").ViewStack;
const XdgToplevel = @import("XdgToplevel.zig");
@ -113,12 +114,14 @@ draw_borders: bool = true,
request_activate: wl.Listener(*wlr.XdgActivationV1.event.RequestActivate) =
wl.Listener(*wlr.XdgActivationV1.event.RequestActivate).init(handleRequestActivate),
pub fn init(self: *Self, output: *Output, tree: *wlr.SceneTree, impl: Impl) void {
pub fn init(self: *Self, output: *Output, tree: *wlr.SceneTree, impl: Impl) error{OutOfMemory}!void {
const initial_tags = blk: {
const tags = output.current.tags & server.config.spawn_tagmask;
break :blk if (tags != 0) tags else output.current.tags;
};
try SceneNodeData.attach(&tree.node, .{ .view = self });
self.* = .{
.impl = impl,
.output = output,
@ -371,15 +374,6 @@ pub inline fn forEachSurface(
}
}
/// Return the surface at output coordinates ox, oy and set sx, sy to the
/// corresponding surface-relative coordinates, if there is a surface.
pub fn surfaceAt(self: Self, ox: f64, oy: f64, sx: *f64, sy: *f64) ?*wlr.Surface {
return switch (self.impl) {
.xdg_toplevel => |xdg_toplevel| xdg_toplevel.surfaceAt(ox, oy, sx, sy),
.xwayland_view => |xwayland_view| xwayland_view.surfaceAt(ox, oy, sx, sy),
};
}
/// Return the current title of the view if any.
pub fn getTitle(self: Self) ?[*:0]const u8 {
return switch (self.impl) {