[mutter/wip/carlosg/no-event-source: 17/24] tests: Move away from clutter_event_get_source()
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/no-event-source: 17/24] tests: Move away from clutter_event_get_source()
- Date: Fri, 4 Mar 2022 10:58:31 +0000 (UTC)
commit 5dd818cf1a83165e20e5aa0318d8410e044f1972
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Feb 25 13:06:20 2022 +0100
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>
src/tests/clutter/interactive/test-events.c | 14 +++++++++++++-
src/tests/clutter/interactive/test-grab.c | 18 ++++++++++++++----
2 files changed, 27 insertions(+), 5 deletions(-)
---
diff --git a/src/tests/clutter/interactive/test-events.c b/src/tests/clutter/interactive/test-events.c
index 6d741f944f..7f9a776f31 100644
--- a/src/tests/clutter/interactive/test-events.c
+++ b/src/tests/clutter/interactive/test-events.c
@@ -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);
diff --git a/src/tests/clutter/interactive/test-grab.c b/src/tests/clutter/interactive/test-grab.c
index 0fb2989cd0..6e7eda2fc4 100644
--- a/src/tests/clutter/interactive/test-grab.c
+++ b/src/tests/clutter/interactive/test-grab.c
@@ -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,9 +94,12 @@ 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");
return FALSE;
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]