mirror of
https://github.com/brl/mutter.git
synced 2025-01-30 21:32:19 +00:00
tests: Move away from clutter_event_get_source()
The target actor as seen by the stage is equivalent, so use that. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2311>
This commit is contained in:
parent
9b6253bf3f
commit
5dd818cf1a
@ -185,7 +185,7 @@ input_cb (ClutterActor *actor,
|
||||
gpointer data)
|
||||
{
|
||||
ClutterActor *stage = clutter_actor_get_stage (actor);
|
||||
ClutterActor *source_actor = clutter_event_get_source (event);
|
||||
ClutterActor *source_actor;
|
||||
graphene_point_t position;
|
||||
gchar *state;
|
||||
gchar keybuf[128];
|
||||
@ -195,6 +195,18 @@ input_cb (ClutterActor *actor,
|
||||
device = clutter_event_get_device (event);
|
||||
device_name = clutter_input_device_get_device_name (device);
|
||||
|
||||
if (event->type == CLUTTER_KEY_PRESS ||
|
||||
event->type == CLUTTER_KEY_RELEASE)
|
||||
{
|
||||
source_actor = clutter_stage_get_key_focus (CLUTTER_STAGE (stage));
|
||||
}
|
||||
else
|
||||
{
|
||||
source_actor = clutter_stage_get_device_actor (CLUTTER_STAGE (stage),
|
||||
device,
|
||||
clutter_event_get_event_sequence (event));
|
||||
}
|
||||
|
||||
source = clutter_event_get_source_device (event);
|
||||
if (source)
|
||||
source_name = clutter_input_device_get_device_name (source);
|
||||
|
@ -15,6 +15,7 @@ debug_event_cb (ClutterActor *actor,
|
||||
gpointer data)
|
||||
{
|
||||
gchar keybuf[9], *source = (gchar*)data;
|
||||
ClutterActor *target;
|
||||
int len = 0;
|
||||
|
||||
switch (event->type)
|
||||
@ -93,8 +94,11 @@ debug_event_cb (ClutterActor *actor,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (clutter_event_get_source (event) == actor)
|
||||
printf(" *source*");
|
||||
target = clutter_stage_get_device_actor (clutter_event_get_stage (event),
|
||||
clutter_event_get_device (event),
|
||||
clutter_event_get_event_sequence (event));
|
||||
if (target == actor)
|
||||
printf(" *target*");
|
||||
|
||||
printf("\n");
|
||||
|
||||
@ -142,8 +146,14 @@ toggle_grab_pointer_cb (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
ClutterActor *target;
|
||||
|
||||
/* we only deal with the event if the source is ourself */
|
||||
if (event->button.source == actor)
|
||||
target = clutter_stage_get_device_actor (clutter_event_get_stage (event),
|
||||
clutter_event_get_device (event),
|
||||
clutter_event_get_event_sequence (event));
|
||||
|
||||
if (target == actor)
|
||||
{
|
||||
ClutterStage *stage = CLUTTER_STAGE (clutter_actor_get_stage (actor));
|
||||
ClutterGrab *grab;
|
||||
|
Loading…
x
Reference in New Issue
Block a user