Implement popups for layer shell

This commit is contained in:
Isaac Freund 2020-05-18 19:29:12 +02:00
parent bbfe3bfd60
commit f818ce7e38
No known key found for this signature in database
GPG key ID: 86DED400DDFD7A11

View file

@ -24,6 +24,7 @@ const c = @import("c.zig");
const Box = @import("Box.zig"); const Box = @import("Box.zig");
const Log = @import("log.zig").Log; const Log = @import("log.zig").Log;
const Output = @import("Output.zig"); const Output = @import("Output.zig");
const XdgPopup = @import("XdgPopup.zig");
output: *Output, output: *Output,
wlr_layer_surface: *c.wlr_layer_surface_v1, 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 { fn handleNewPopup(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
const self = @fieldParentPtr(Self, "listen_new_popup", listener.?); const self = @fieldParentPtr(Self, "listen_new_popup", listener.?);
Log.Debug.log("new layer surface popup.", .{}); const wlr_xdg_popup = @ptrCast(*c.wlr_xdg_popup, @alignCast(@alignOf(*c.wlr_xdg_popup), data));
// TODO: handle popups const allocator = self.output.root.server.allocator;
unreachable;
// This will free itself on destroy
var xdg_popup = allocator.create(XdgPopup) catch unreachable;
xdg_popup.init(self.output, &self.box, wlr_xdg_popup);
} }