mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 12:52:14 +00:00
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,
|
clutter_event_crossing_new (ClutterEventType type,
|
||||||
ClutterEventFlags flags,
|
ClutterEventFlags flags,
|
||||||
int64_t timestamp_us,
|
int64_t timestamp_us,
|
||||||
ClutterInputDevice *device,
|
ClutterInputDevice *source_device,
|
||||||
ClutterEventSequence *sequence,
|
ClutterEventSequence *sequence,
|
||||||
graphene_point_t coords,
|
graphene_point_t coords,
|
||||||
ClutterActor *source,
|
ClutterActor *source,
|
||||||
ClutterActor *related)
|
ClutterActor *related)
|
||||||
{
|
{
|
||||||
|
ClutterInputDevice *device;
|
||||||
ClutterEvent *event;
|
ClutterEvent *event;
|
||||||
|
|
||||||
g_return_val_if_fail (type == CLUTTER_ENTER ||
|
g_return_val_if_fail (type == CLUTTER_ENTER ||
|
||||||
type == CLUTTER_LEAVE, NULL);
|
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);
|
event = clutter_event_new (type);
|
||||||
|
|
||||||
@ -2069,6 +2083,7 @@ clutter_event_crossing_new (ClutterEventType type,
|
|||||||
event->crossing.source = source;
|
event->crossing.source = source;
|
||||||
event->crossing.related = related;
|
event->crossing.related = related;
|
||||||
g_set_object (&event->crossing.device, device);
|
g_set_object (&event->crossing.device, device);
|
||||||
|
g_set_object (&event->crossing.source_device, source_device);
|
||||||
|
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
@ -3476,6 +3476,9 @@ clutter_stage_update_device (ClutterStage *stage,
|
|||||||
old_actor = clutter_stage_get_device_actor (stage, device, sequence);
|
old_actor = clutter_stage_get_device_actor (stage, device, sequence);
|
||||||
device_actor_changed = new_actor != old_actor;
|
device_actor_changed = new_actor != old_actor;
|
||||||
|
|
||||||
|
if (!source_device)
|
||||||
|
source_device = device;
|
||||||
|
|
||||||
clutter_stage_update_device_entry (stage,
|
clutter_stage_update_device_entry (stage,
|
||||||
device, sequence,
|
device, sequence,
|
||||||
point,
|
point,
|
||||||
@ -3519,7 +3522,7 @@ clutter_stage_update_device (ClutterStage *stage,
|
|||||||
event = clutter_event_crossing_new (CLUTTER_LEAVE,
|
event = clutter_event_crossing_new (CLUTTER_LEAVE,
|
||||||
CLUTTER_EVENT_NONE,
|
CLUTTER_EVENT_NONE,
|
||||||
ms2us (time_ms),
|
ms2us (time_ms),
|
||||||
device,
|
source_device,
|
||||||
sequence,
|
sequence,
|
||||||
point,
|
point,
|
||||||
old_actor,
|
old_actor,
|
||||||
@ -3540,7 +3543,7 @@ clutter_stage_update_device (ClutterStage *stage,
|
|||||||
event = clutter_event_crossing_new (CLUTTER_ENTER,
|
event = clutter_event_crossing_new (CLUTTER_ENTER,
|
||||||
CLUTTER_EVENT_NONE,
|
CLUTTER_EVENT_NONE,
|
||||||
ms2us (time_ms),
|
ms2us (time_ms),
|
||||||
device,
|
source_device,
|
||||||
sequence,
|
sequence,
|
||||||
point,
|
point,
|
||||||
new_actor,
|
new_actor,
|
||||||
|
Loading…
Reference in New Issue
Block a user