layer-surface: clean up initialization

This commit is contained in:
Isaac Freund 2020-08-21 16:53:04 +02:00
parent eb21e03b42
commit 37ea1bac36
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -30,26 +30,24 @@ 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,
box: Box, box: Box = undefined,
state: c.wlr_layer_surface_v1_state, state: c.wlr_layer_surface_v1_state,
// Listeners active the entire lifetime of the layser surface // Listeners active the entire lifetime of the layser surface
listen_destroy: c.wl_listener, listen_destroy: c.wl_listener = undefined,
listen_map: c.wl_listener, listen_map: c.wl_listener = undefined,
listen_unmap: c.wl_listener, listen_unmap: c.wl_listener = undefined,
// Listeners only active while the layer surface is mapped // Listeners only active while the layer surface is mapped
listen_commit: c.wl_listener, listen_commit: c.wl_listener = undefined,
listen_new_popup: c.wl_listener, listen_new_popup: c.wl_listener = undefined,
pub fn init( pub fn init(self: *Self, output: *Output, wlr_layer_surface: *c.wlr_layer_surface_v1) void {
self: *Self, self.* = .{
output: *Output, .output = output,
wlr_layer_surface: *c.wlr_layer_surface_v1, .wlr_layer_surface = wlr_layer_surface,
) void { .state = wlr_layer_surface.current,
self.output = output; };
self.wlr_layer_surface = wlr_layer_surface;
self.state = wlr_layer_surface.current;
wlr_layer_surface.data = self; wlr_layer_surface.data = self;
// Temporarily add to the output's list to allow for inital arrangement // Temporarily add to the output's list to allow for inital arrangement