river-status: clean up initialization

This commit is contained in:
Isaac Freund 2020-08-21 19:47:57 +02:00
parent a201ced77d
commit 5098553fb4
No known key found for this signature in database
GPG key ID: 86DED400DDFD7A11

View file

@ -38,18 +38,19 @@ wl_global: *c.wl_global,
args_map: std.AutoHashMap(u32, std.ArrayList([]const u8)), args_map: std.AutoHashMap(u32, std.ArrayList([]const u8)),
listen_display_destroy: c.wl_listener, listen_display_destroy: c.wl_listener = undefined,
pub fn init(self: *Self, server: *Server) !void { pub fn init(self: *Self, server: *Server) !void {
self.wl_global = c.wl_global_create( self.* = .{
.wl_global = c.wl_global_create(
server.wl_display, server.wl_display,
&c.zriver_control_v1_interface, &c.zriver_control_v1_interface,
protocol_version, protocol_version,
self, self,
bind, bind,
) orelse return error.OutOfMemory; ) orelse return error.OutOfMemory,
.args_map = std.AutoHashMap(u32, std.ArrayList([]const u8)).init(util.gpa),
self.args_map = std.AutoHashMap(u32, std.ArrayList([]const u8)).init(util.gpa); };
self.listen_display_destroy.notify = handleDisplayDestroy; self.listen_display_destroy.notify = handleDisplayDestroy;
c.wl_display_add_destroy_listener(server.wl_display, &self.listen_display_destroy); c.wl_display_add_destroy_listener(server.wl_display, &self.listen_display_destroy);