xwayland: clean up initialization

This commit is contained in:
Isaac Freund 2020-08-21 16:48:17 +02:00
parent 1fbaaa55b3
commit 5cea3f68e3
No known key found for this signature in database
GPG key ID: 86DED400DDFD7A11
2 changed files with 11 additions and 13 deletions

View file

@ -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;

View file

@ -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