clutter: Fix source device in crossing ClutterEvents
This used to be the HW device that triggered the crossing (i.e.
the mouse moving the pointer, etc), or the logical device if the
crossing event happened through other means than input device
events, e.g. relayouts.
The move to ClutterEvent constructors went a bit too far in
the simplifications and broke these expectations for input-generated
crossing events.
Make this event constructor behave like the other events: receive
a source device, and figure out the corresponding logical device from
there. Also pass the source device as it'd be expected, in the
input-induced crossing event generation paths.
Fixes: a8c62251f8
("clutter: Port stage crossing events to new constructors")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2981
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3256>
This commit is contained in:
parent
162d73c049
commit
89e11e8335
@ -2047,17 +2047,31 @@ ClutterEvent *
|
||||
clutter_event_crossing_new (ClutterEventType type,
|
||||
ClutterEventFlags flags,
|
||||
int64_t timestamp_us,
|
||||
ClutterInputDevice *device,
|
||||
ClutterInputDevice *source_device,
|
||||
ClutterEventSequence *sequence,
|
||||
graphene_point_t coords,
|
||||
ClutterActor *source,
|
||||
ClutterActor *related)
|
||||
{
|
||||
ClutterInputDevice *device;
|
||||
ClutterEvent *event;
|
||||
|
||||
g_return_val_if_fail (type == CLUTTER_ENTER ||
|
||||
type == CLUTTER_LEAVE, NULL);
|
||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 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))
|
||||
{
|
||||
device = source_device;
|
||||
}
|
||||
else
|
||||
{
|
||||
ClutterSeat *seat;
|
||||
|
||||
seat = clutter_input_device_get_seat (source_device);
|
||||
device = clutter_seat_get_pointer (seat);
|
||||
}
|
||||
|
||||
event = clutter_event_new (type);
|
||||
|
||||
@ -2069,6 +2083,7 @@ clutter_event_crossing_new (ClutterEventType type,
|
||||
event->crossing.source = source;
|
||||
event->crossing.related = related;
|
||||
g_set_object (&event->crossing.device, device);
|
||||
g_set_object (&event->crossing.source_device, source_device);
|
||||
|
||||
return event;
|
||||
}
|
||||
|
@ -3476,6 +3476,9 @@ clutter_stage_update_device (ClutterStage *stage,
|
||||
old_actor = clutter_stage_get_device_actor (stage, device, sequence);
|
||||
device_actor_changed = new_actor != old_actor;
|
||||
|
||||
if (!source_device)
|
||||
source_device = device;
|
||||
|
||||
clutter_stage_update_device_entry (stage,
|
||||
device, sequence,
|
||||
point,
|
||||
@ -3519,7 +3522,7 @@ clutter_stage_update_device (ClutterStage *stage,
|
||||
event = clutter_event_crossing_new (CLUTTER_LEAVE,
|
||||
CLUTTER_EVENT_NONE,
|
||||
ms2us (time_ms),
|
||||
device,
|
||||
source_device,
|
||||
sequence,
|
||||
point,
|
||||
old_actor,
|
||||
@ -3540,7 +3543,7 @@ clutter_stage_update_device (ClutterStage *stage,
|
||||
event = clutter_event_crossing_new (CLUTTER_ENTER,
|
||||
CLUTTER_EVENT_NONE,
|
||||
ms2us (time_ms),
|
||||
device,
|
||||
source_device,
|
||||
sequence,
|
||||
point,
|
||||
new_actor,
|
||||
|
Loading…
Reference in New Issue
Block a user