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.* = .{
server.wl_display, .wl_global = c.wl_global_create(
&c.zriver_control_v1_interface, server.wl_display,
protocol_version, &c.zriver_control_v1_interface,
self, protocol_version,
bind, self,
) orelse return error.OutOfMemory; bind,
) orelse return error.OutOfMemory,
self.args_map = std.AutoHashMap(u32, std.ArrayList([]const u8)).init(util.gpa); .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);