From f818ce7e389e4bcf5edcd467a8f59576dff25189 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Mon, 18 May 2020 19:29:12 +0200 Subject: [PATCH] Implement popups for layer shell --- src/LayerSurface.zig | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/LayerSurface.zig b/src/LayerSurface.zig index a90917c..088dd97 100644 --- a/src/LayerSurface.zig +++ b/src/LayerSurface.zig @@ -24,6 +24,7 @@ const c = @import("c.zig"); const Box = @import("Box.zig"); const Log = @import("log.zig").Log; const Output = @import("Output.zig"); +const XdgPopup = @import("XdgPopup.zig"); output: *Output, wlr_layer_surface: *c.wlr_layer_surface_v1, @@ -186,7 +187,10 @@ fn handleCommit(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void { fn handleNewPopup(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void { const self = @fieldParentPtr(Self, "listen_new_popup", listener.?); - Log.Debug.log("new layer surface popup.", .{}); - // TODO: handle popups - unreachable; + const wlr_xdg_popup = @ptrCast(*c.wlr_xdg_popup, @alignCast(@alignOf(*c.wlr_xdg_popup), data)); + const allocator = self.output.root.server.allocator; + + // This will free itself on destroy + var xdg_popup = allocator.create(XdgPopup) catch unreachable; + xdg_popup.init(self.output, &self.box, wlr_xdg_popup); }