1
0
Fork 0

seat/impl: Add signal for pointer motions

This signal is emitted directly in the input thread.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
This commit is contained in:
Jonas Ådahl 2022-12-21 18:52:47 +01:00
parent f4b76727db
commit ef64279035

View file

@ -94,6 +94,7 @@ enum
TOUCH_MODE,
BELL,
MODS_STATE_CHANGED,
POINTER_POSITION_CHANGED_IN_IMPL,
N_SIGNALS
};
@ -932,6 +933,10 @@ meta_seat_impl_notify_relative_motion_in_impl (MetaSeatImpl *seat_impl,
event->motion.dx_constrained = dx_constrained;
event->motion.dy_constrained = dy_constrained;
g_signal_emit (seat_impl, signals[POINTER_POSITION_CHANGED_IN_IMPL], 0,
&GRAPHENE_POINT_INIT (seat_impl->pointer_x,
seat_impl->pointer_y));
queue_event (seat_impl, event);
}
@ -947,6 +952,10 @@ meta_seat_impl_notify_absolute_motion_in_impl (MetaSeatImpl *seat_impl,
event = new_absolute_motion_event (seat_impl, input_device, time_us, x, y, axes);
g_signal_emit (seat_impl, signals[POINTER_POSITION_CHANGED_IN_IMPL], 0,
&GRAPHENE_POINT_INIT (seat_impl->pointer_x,
seat_impl->pointer_y));
queue_event (seat_impl, event);
}
@ -1590,6 +1599,10 @@ notify_absolute_motion_in_impl (ClutterInputDevice *input_device,
seat_impl = seat_impl_from_device (input_device);
event = new_absolute_motion_event (seat_impl, input_device, time_us, x, y, axes);
g_signal_emit (seat_impl, signals[POINTER_POSITION_CHANGED_IN_IMPL], 0,
&GRAPHENE_POINT_INIT (seat_impl->pointer_x,
seat_impl->pointer_y));
queue_event (seat_impl, event);
}
@ -3637,6 +3650,13 @@ meta_seat_impl_class_init (MetaSeatImplClass *klass)
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
signals[POINTER_POSITION_CHANGED_IN_IMPL] =
g_signal_new ("pointer-position-changed-in-impl",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 1,
GRAPHENE_TYPE_POINT);
g_object_class_install_properties (object_class, N_PROPS, props);
}