clutter: Check source device mode to figure out logical device in events

We look in various ways for the logical device on pointing events, in order
to assign tablet events their own device, detached from the ClutterSeat
pointer.

While this pans out on the native backend, it does not quite match with
X11 behavior where these events do drive the Virtual Core Pointer, this
results in a variety of buglets deriving from this mismatch.

Use the ClutterInputMode instead, to figure out whether the device is
physical and attached to the VCP (The default on X11), or the device is
floating thus should emit events on its own (The new stock behavior on
native backend since the previous commit), and behave accordingly
to what was specified by backend code.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7144
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3114
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3122
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3156
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3393>
This commit is contained in:
Carlos Garnacho 2023-11-13 12:25:56 +01:00 committed by Marge Bot
parent 571acf57d1
commit 5780c10002

View File

@ -1902,7 +1902,8 @@ clutter_event_button_new (ClutterEventType type,
g_set_object (&event->button.source_device, source_device);
if (tool)
if (clutter_input_device_get_device_mode (source_device) ==
CLUTTER_INPUT_MODE_FLOATING)
{
g_set_object (&event->button.device, source_device);
}
@ -1952,7 +1953,8 @@ clutter_event_motion_new (ClutterEventFlags flags,
g_set_object (&event->motion.source_device, source_device);
if (tool)
if (clutter_input_device_get_device_mode (source_device) ==
CLUTTER_INPUT_MODE_FLOATING)
{
g_set_object (&event->motion.device, source_device);
}
@ -1999,7 +2001,8 @@ clutter_event_scroll_smooth_new (ClutterEventFlags flags,
g_set_object (&event->scroll.source_device, source_device);
if (tool)
if (clutter_input_device_get_device_mode (source_device) ==
CLUTTER_INPUT_MODE_FLOATING)
{
g_set_object (&event->scroll.device, source_device);
}
@ -2040,7 +2043,8 @@ clutter_event_scroll_discrete_new (ClutterEventFlags flags,
g_set_object (&event->scroll.source_device, source_device);
if (tool)
if (clutter_input_device_get_device_mode (source_device) ==
CLUTTER_INPUT_MODE_FLOATING)
{
g_set_object (&event->scroll.device, source_device);
}
@ -2072,8 +2076,8 @@ clutter_event_crossing_new (ClutterEventType type,
type == CLUTTER_LEAVE, NULL);
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (source_device), NULL);
if (!!(clutter_input_device_get_capabilities (source_device) &
CLUTTER_INPUT_CAPABILITY_TABLET_TOOL))
if (clutter_input_device_get_device_mode (source_device) ==
CLUTTER_INPUT_MODE_FLOATING)
{
device = source_device;
}