diff --git a/river/Decoration.zig b/river/Decoration.zig index ad8920f..4a21fff 100644 --- a/river/Decoration.zig +++ b/river/Decoration.zig @@ -28,17 +28,15 @@ server: *Server, wlr_xdg_toplevel_decoration: *c.wlr_xdg_toplevel_decoration_v1, -listen_destroy: c.wl_listener, -listen_request_mode: c.wl_listener, +listen_destroy: c.wl_listener = undefined, +listen_request_mode: c.wl_listener = undefined, pub fn init( self: *Self, server: *Server, wlr_xdg_toplevel_decoration: *c.wlr_xdg_toplevel_decoration_v1, ) void { - self.server = server; - - self.wlr_xdg_toplevel_decoration = wlr_xdg_toplevel_decoration; + self.* = .{ .server = server, .wlr_xdg_toplevel_decoration = wlr_xdg_toplevel_decoration }; self.listen_destroy.notify = handleDestroy; c.wl_signal_add(&self.wlr_xdg_toplevel_decoration.events.destroy, &self.listen_destroy); diff --git a/river/DecorationManager.zig b/river/DecorationManager.zig index aa191d7..9a84f93 100644 --- a/river/DecorationManager.zig +++ b/river/DecorationManager.zig @@ -29,15 +29,14 @@ server: *Server, wlr_xdg_decoration_manager: *c.wlr_xdg_decoration_manager_v1, -decorations: std.SinglyLinkedList(Decoration), - -listen_new_toplevel_decoration: c.wl_listener, +listen_new_toplevel_decoration: c.wl_listener = undefined, pub fn init(self: *Self, server: *Server) !void { - self.wlr_xdg_decoration_manager = c.wlr_xdg_decoration_manager_v1_create(server.wl_display) orelse - return error.OutOfMemory; - - self.server = server; + self.* = .{ + .server = server, + .wlr_xdg_decoration_manager = c.wlr_xdg_decoration_manager_v1_create(server.wl_display) orelse + return error.OutOfMemory, + }; self.listen_new_toplevel_decoration.notify = handleNewToplevelDecoration; c.wl_signal_add(