From b2fbdf2d87e21c724d82eb59ef7f5dae26b39c7e Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Wed, 8 Apr 2020 17:43:00 +0200 Subject: Add keybind to close views --- src/view.zig | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/view.zig') diff --git a/src/view.zig b/src/view.zig index 17a0621..71a00f2 100644 --- a/src/view.zig +++ b/src/view.zig @@ -126,6 +126,13 @@ pub const View = struct { } } + /// 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 + // automatically when the view is unmapped. + c.wlr_xdg_toplevel_send_close(self.wlr_xdg_surface); + } + fn handleMap(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void { // Called when the surface is mapped, or ready to display on-screen. const view = @fieldParentPtr(View, "listen_map", listener.?); -- cgit v1.2.3