Fix cursor init segfault

This commit is contained in:
2023-12-31 00:16:29 +01:00
parent 823004b6eb
commit a7219bcbd2
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -21,7 +21,7 @@ pub const Cursor = struct {
self.cursor.attachInputDevice(device);
}
pub fn create(server: *Server) !*Cursor {
pub fn create(server: *Server, output_layout: *wlr.OutputLayout) !*Cursor {
const self = try gpa.create(Cursor);
errdefer gpa.destroy(self);
self.* = .{
@@ -30,7 +30,7 @@ pub const Cursor = struct {
.cursor_mgr = try wlr.XcursorManager.create(null, 24),
};
self.cursor.attachOutputLayout(server.output_layout);
self.cursor.attachOutputLayout(output_layout);
try self.cursor_mgr.load(1);
self.cursor.events.motion.add(&self.motion);
+1 -1
View File
@@ -50,7 +50,7 @@ pub const Server = struct {
.seat = try wlr.Seat.create(wl_server, "default"),
.events = undefined,
.socket = try wl_server.addSocketAuto(&buf),
.cursor = try Cursor.create(self),
.cursor = try Cursor.create(self, output_layout),
};
errdefer self.destroy();