From 5cea3f68e3637344a378129227f3fba1ef89dcee Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Fri, 21 Aug 2020 16:48:17 +0200 Subject: [PATCH] xwayland: clean up initialization --- river/XwaylandUnmanaged.zig | 13 ++++++------- river/XwaylandView.zig | 11 +++++------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/river/XwaylandUnmanaged.zig b/river/XwaylandUnmanaged.zig index 2a59e7d..ed1fa07 100644 --- a/river/XwaylandUnmanaged.zig +++ b/river/XwaylandUnmanaged.zig @@ -31,17 +31,16 @@ root: *Root, wlr_xwayland_surface: *c.wlr_xwayland_surface, // Listeners that are always active over the view's lifetime -liseten_request_configure: c.wl_listener, -listen_destroy: c.wl_listener, -listen_map: c.wl_listener, -listen_unmap: c.wl_listener, +liseten_request_configure: c.wl_listener = undefined, +listen_destroy: c.wl_listener = undefined, +listen_map: c.wl_listener = undefined, +listen_unmap: c.wl_listener = undefined, // Listeners that are only active while the view is mapped -listen_commit: c.wl_listener, +listen_commit: c.wl_listener = undefined, pub fn init(self: *Self, root: *Root, wlr_xwayland_surface: *c.wlr_xwayland_surface) void { - self.root = root; - self.wlr_xwayland_surface = wlr_xwayland_surface; + self.* = .{ .root = root, .wlr_xwayland_surface = wlr_xwayland_surface }; // Add listeners that are active over the view's entire lifetime self.liseten_request_configure.notify = handleRequestConfigure; diff --git a/river/XwaylandView.zig b/river/XwaylandView.zig index 0be1c21..2959624 100644 --- a/river/XwaylandView.zig +++ b/river/XwaylandView.zig @@ -33,16 +33,15 @@ view: *View, wlr_xwayland_surface: *c.wlr_xwayland_surface, // Listeners that are always active over the view's lifetime -listen_destroy: c.wl_listener, -listen_map: c.wl_listener, -listen_unmap: c.wl_listener, +listen_destroy: c.wl_listener = undefined, +listen_map: c.wl_listener = undefined, +listen_unmap: c.wl_listener = undefined, // Listeners that are only active while the view is mapped -listen_commit: c.wl_listener, +listen_commit: c.wl_listener = undefined, pub fn init(self: *Self, view: *View, wlr_xwayland_surface: *c.wlr_xwayland_surface) void { - self.view = view; - self.wlr_xwayland_surface = wlr_xwayland_surface; + self.* = .{ .view = view, .wlr_xwayland_surface = wlr_xwayland_surface }; wlr_xwayland_surface.data = self; // Add listeners that are active over the view's entire lifetime