aboutsummaryrefslogtreecommitdiff
path: root/src/XdgToplevel.zig
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2020-05-08 14:51:10 +0200
committerIsaac Freund <ifreund@ifreund.xyz>2020-05-08 14:51:10 +0200
commitac735719cfc086c54ff939786823b29de2c24c0a (patch)
treec8ee87c720b067bbf8a757e8ea098d2b87393141 /src/XdgToplevel.zig
parent71d580b81173c6e6f93354c6e783972a6aa37b27 (diff)
downloadriver-ac735719cfc086c54ff939786823b29de2c24c0a.tar.gz
river-ac735719cfc086c54ff939786823b29de2c24c0a.tar.xz
Implement initial Xwayland support
Diffstat (limited to 'src/XdgToplevel.zig')
-rw-r--r--src/XdgToplevel.zig34
1 files changed, 14 insertions, 20 deletions
diff --git a/src/XdgToplevel.zig b/src/XdgToplevel.zig
index f1433e6..a9c2040 100644
--- a/src/XdgToplevel.zig
+++ b/src/XdgToplevel.zig
@@ -88,6 +88,18 @@ pub fn forEachSurface(
c.wlr_xdg_surface_for_each_surface(self.wlr_xdg_surface, iterator, user_data);
}
+/// 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) ?*c.wlr_surface {
+ return c.wlr_xdg_surface_surface_at(
+ self.wlr_xdg_surface,
+ ox - @intToFloat(f64, self.view.current_box.x),
+ oy - @intToFloat(f64, self.view.current_box.y),
+ sx,
+ sy,
+ );
+}
+
/// Called when the xdg surface is destroyed
fn handleDestroy(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
const self = @fieldParentPtr(Self, "listen_destroy", listener.?);
@@ -151,16 +163,7 @@ fn handleMap(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
view.setFloating(true);
}
- // Focus the newly mapped view. Note: if a seat is focusing a different output
- // it will continue to do so.
- var it = root.server.input_manager.seats.first;
- while (it) |seat_node| : (it = seat_node.next) {
- seat_node.data.focus(view);
- }
-
- c.wlr_surface_send_enter(self.wlr_xdg_surface.surface, view.output.wlr_output);
-
- root.arrange();
+ view.map();
}
/// Called when the surface is unmapped and will no longer be displayed.
@@ -168,16 +171,7 @@ fn handleUnmap(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
const self = @fieldParentPtr(Self, "listen_unmap", listener.?);
const root = self.view.output.root;
- self.view.wlr_surface = null;
-
- // Inform all seats that the view has been unmapped so they can handle focus
- var it = root.server.input_manager.seats.first;
- while (it) |node| : (it = node.next) {
- const seat = &node.data;
- seat.handleViewUnmap(self.view);
- }
-
- root.arrange();
+ self.view.unmap();
// Remove listeners that are only active while mapped
c.wl_list_remove(&self.listen_commit.link);