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.
This commit is contained in:
Isaac Freund 2024-03-15 13:21:45 +01:00
parent 451387a4a9
commit e143cdeca9
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11
2 changed files with 8 additions and 8 deletions

View File

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

View File

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