From e143cdeca9f39c3e5c4bd14c67920e22ec95670e Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Fri, 15 Mar 2024 13:21:45 +0100 Subject: [PATCH] pointer-gestures: move to input manager We definitely should not create duplicates of the global for each seat. Not that we really support multi-seat yet, but someday. --- river/Cursor.zig | 14 ++++++-------- river/InputManager.zig | 2 ++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/river/Cursor.zig b/river/Cursor.zig index cb1973e..b0538d1 100644 --- a/river/Cursor.zig +++ b/river/Cursor.zig @@ -121,7 +121,6 @@ inflight_mode: Mode = .passthrough, seat: *Seat, wlr_cursor: *wlr.Cursor, -pointer_gestures: *wlr.PointerGesturesV1, /// Xcursor manager for the currently configured Xcursor theme. xcursor_manager: *wlr.XcursorManager, @@ -204,7 +203,6 @@ pub fn init(cursor: *Cursor, seat: *Seat) !void { cursor.* = .{ .seat = seat, .wlr_cursor = wlr_cursor, - .pointer_gestures = try wlr.PointerGesturesV1.create(server.wl_server), .xcursor_manager = xcursor_manager, .hide_cursor_timer = try event_loop.addTimer(*Cursor, handleHideCursorTimeout, cursor), }; @@ -423,7 +421,7 @@ fn handlePinchBegin( event: *wlr.Pointer.event.PinchBegin, ) void { const cursor = @fieldParentPtr(Cursor, "pinch_begin", listener); - cursor.pointer_gestures.sendPinchBegin( + server.input_manager.pointer_gestures.sendPinchBegin( cursor.seat.wlr_seat, event.time_msec, event.fingers, @@ -435,7 +433,7 @@ fn handlePinchUpdate( event: *wlr.Pointer.event.PinchUpdate, ) void { const cursor = @fieldParentPtr(Cursor, "pinch_update", listener); - cursor.pointer_gestures.sendPinchUpdate( + server.input_manager.pointer_gestures.sendPinchUpdate( cursor.seat.wlr_seat, event.time_msec, event.dx, @@ -450,7 +448,7 @@ fn handlePinchEnd( event: *wlr.Pointer.event.PinchEnd, ) void { const cursor = @fieldParentPtr(Cursor, "pinch_end", listener); - cursor.pointer_gestures.sendPinchEnd( + server.input_manager.pointer_gestures.sendPinchEnd( cursor.seat.wlr_seat, event.time_msec, event.cancelled, @@ -462,7 +460,7 @@ fn handleSwipeBegin( event: *wlr.Pointer.event.SwipeBegin, ) void { const cursor = @fieldParentPtr(Cursor, "swipe_begin", listener); - cursor.pointer_gestures.sendSwipeBegin( + server.input_manager.pointer_gestures.sendSwipeBegin( cursor.seat.wlr_seat, event.time_msec, event.fingers, @@ -474,7 +472,7 @@ fn handleSwipeUpdate( event: *wlr.Pointer.event.SwipeUpdate, ) void { const cursor = @fieldParentPtr(Cursor, "swipe_update", listener); - cursor.pointer_gestures.sendSwipeUpdate( + server.input_manager.pointer_gestures.sendSwipeUpdate( cursor.seat.wlr_seat, event.time_msec, event.dx, @@ -487,7 +485,7 @@ fn handleSwipeEnd( event: *wlr.Pointer.event.SwipeEnd, ) void { const cursor = @fieldParentPtr(Cursor, "swipe_end", listener); - cursor.pointer_gestures.sendSwipeEnd( + server.input_manager.pointer_gestures.sendSwipeEnd( cursor.seat.wlr_seat, event.time_msec, event.cancelled, diff --git a/river/InputManager.zig b/river/InputManager.zig index ce88642..ff7bb05 100644 --- a/river/InputManager.zig +++ b/river/InputManager.zig @@ -45,6 +45,7 @@ new_input: wl.Listener(*wlr.InputDevice) = wl.Listener(*wlr.InputDevice).init(ha idle_notifier: *wlr.IdleNotifierV1, relative_pointer_manager: *wlr.RelativePointerManagerV1, +pointer_gestures: *wlr.PointerGesturesV1, virtual_pointer_manager: *wlr.VirtualPointerManagerV1, virtual_keyboard_manager: *wlr.VirtualKeyboardManagerV1, pointer_constraints: *wlr.PointerConstraintsV1, @@ -80,6 +81,7 @@ pub fn init(input_manager: *InputManager) !void { // These are automatically freed when the display is destroyed .idle_notifier = try wlr.IdleNotifierV1.create(server.wl_server), .relative_pointer_manager = try wlr.RelativePointerManagerV1.create(server.wl_server), + .pointer_gestures = try wlr.PointerGesturesV1.create(server.wl_server), .virtual_pointer_manager = try wlr.VirtualPointerManagerV1.create(server.wl_server), .virtual_keyboard_manager = try wlr.VirtualKeyboardManagerV1.create(server.wl_server), .pointer_constraints = try wlr.PointerConstraintsV1.create(server.wl_server),