From fb2639a2264a279f20fef2ac385ef1e885026576 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Sat, 18 Apr 2020 16:21:26 +0200 Subject: Send surface enter/leave events --- src/view.zig | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/view.zig') diff --git a/src/view.zig b/src/view.zig index ea6fdc0..f805acc 100644 --- a/src/view.zig +++ b/src/view.zig @@ -122,6 +122,20 @@ pub const View = struct { } } + /// Move a view from one output to another, sending the required enter/leave + /// events. + pub fn sendToOutput(self: *Self, destination_output: *Output) void { + const node = @fieldParentPtr(ViewStack(View).Node, "view", self); + + self.output.views.remove(node); + destination_output.views.push(node); + + c.wlr_surface_send_leave(self.wlr_xdg_surface.surface, self.output.wlr_output); + c.wlr_surface_send_enter(self.wlr_xdg_surface.surface, destination_output.wlr_output); + + self.output = destination_output; + } + /// Send a close event to the view's client pub fn close(self: Self) void { // Note: we don't call arrange() here as it will be called @@ -162,6 +176,8 @@ pub const View = struct { seat_node.data.focus(view); } + c.wlr_surface_send_enter(view.wlr_xdg_surface.surface, view.output.wlr_output); + view.output.root.arrange(); } -- cgit v1.2.3