aboutsummaryrefslogtreecommitdiff
path: root/src/view.zig
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2020-04-18 16:21:26 +0200
committerIsaac Freund <ifreund@ifreund.xyz>2020-04-18 16:21:26 +0200
commitfb2639a2264a279f20fef2ac385ef1e885026576 (patch)
tree50b8680eeb57f60b9b3c2d3fba9ba1ebc2b06cb8 /src/view.zig
parentbf300db004fbced79fe30ea1947656117f462947 (diff)
downloadriver-fb2639a2264a279f20fef2ac385ef1e885026576.tar.gz
river-fb2639a2264a279f20fef2ac385ef1e885026576.tar.xz
Send surface enter/leave events
Diffstat (limited to 'src/view.zig')
-rw-r--r--src/view.zig16
1 files changed, 16 insertions, 0 deletions
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();
}