xdg-decoration: clean up initialization
This commit is contained in:
parent
5098553fb4
commit
163fa47822
@ -28,17 +28,15 @@ server: *Server,
|
|||||||
|
|
||||||
wlr_xdg_toplevel_decoration: *c.wlr_xdg_toplevel_decoration_v1,
|
wlr_xdg_toplevel_decoration: *c.wlr_xdg_toplevel_decoration_v1,
|
||||||
|
|
||||||
listen_destroy: c.wl_listener,
|
listen_destroy: c.wl_listener = undefined,
|
||||||
listen_request_mode: c.wl_listener,
|
listen_request_mode: c.wl_listener = undefined,
|
||||||
|
|
||||||
pub fn init(
|
pub fn init(
|
||||||
self: *Self,
|
self: *Self,
|
||||||
server: *Server,
|
server: *Server,
|
||||||
wlr_xdg_toplevel_decoration: *c.wlr_xdg_toplevel_decoration_v1,
|
wlr_xdg_toplevel_decoration: *c.wlr_xdg_toplevel_decoration_v1,
|
||||||
) void {
|
) void {
|
||||||
self.server = server;
|
self.* = .{ .server = server, .wlr_xdg_toplevel_decoration = wlr_xdg_toplevel_decoration };
|
||||||
|
|
||||||
self.wlr_xdg_toplevel_decoration = wlr_xdg_toplevel_decoration;
|
|
||||||
|
|
||||||
self.listen_destroy.notify = handleDestroy;
|
self.listen_destroy.notify = handleDestroy;
|
||||||
c.wl_signal_add(&self.wlr_xdg_toplevel_decoration.events.destroy, &self.listen_destroy);
|
c.wl_signal_add(&self.wlr_xdg_toplevel_decoration.events.destroy, &self.listen_destroy);
|
||||||
|
@ -29,15 +29,14 @@ server: *Server,
|
|||||||
|
|
||||||
wlr_xdg_decoration_manager: *c.wlr_xdg_decoration_manager_v1,
|
wlr_xdg_decoration_manager: *c.wlr_xdg_decoration_manager_v1,
|
||||||
|
|
||||||
decorations: std.SinglyLinkedList(Decoration),
|
listen_new_toplevel_decoration: c.wl_listener = undefined,
|
||||||
|
|
||||||
listen_new_toplevel_decoration: c.wl_listener,
|
|
||||||
|
|
||||||
pub fn init(self: *Self, server: *Server) !void {
|
pub fn init(self: *Self, server: *Server) !void {
|
||||||
self.wlr_xdg_decoration_manager = c.wlr_xdg_decoration_manager_v1_create(server.wl_display) orelse
|
self.* = .{
|
||||||
return error.OutOfMemory;
|
.server = server,
|
||||||
|
.wlr_xdg_decoration_manager = c.wlr_xdg_decoration_manager_v1_create(server.wl_display) orelse
|
||||||
self.server = server;
|
return error.OutOfMemory,
|
||||||
|
};
|
||||||
|
|
||||||
self.listen_new_toplevel_decoration.notify = handleNewToplevelDecoration;
|
self.listen_new_toplevel_decoration.notify = handleNewToplevelDecoration;
|
||||||
c.wl_signal_add(
|
c.wl_signal_add(
|
||||||
|
Loading…
Reference in New Issue
Block a user