[mutter/wip/carlosg/grabs-pt3: 25/26] clutter: Refactor event emission into a common function
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/grabs-pt3: 25/26] clutter: Refactor event emission into a common function
- Date: Tue, 23 Nov 2021 11:30:19 +0000 (UTC)
commit 03eb03b135f119bc07ea05dc734d0fafc5f1bcfd
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Nov 19 16:49:33 2021 +0100
clutter: Refactor event emission into a common function
Without input device grabs in play, all functions that emit
pointer/key/crossing/touch events are pretty much the same. Remove this
duplication and use a common emit_event() function.
clutter/clutter/clutter-main.c | 55 +++++++++---------------------------------
1 file changed, 12 insertions(+), 43 deletions(-)
---
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
index 9598b3a27f..d9092a9467 100644
--- a/clutter/clutter/clutter-main.c
+++ b/clutter/clutter/clutter-main.c
@@ -694,38 +694,7 @@ emit_event_chain (ClutterEvent *event)
*/
static inline void
-emit_pointer_event (ClutterEvent *event,
- ClutterInputDevice *device)
-{
- if (_clutter_event_process_filters (event))
- return;
-
- emit_event_chain (event);
-}
-
-static inline void
-emit_crossing_event (ClutterEvent *event,
- ClutterInputDevice *device)
-{
- if (_clutter_event_process_filters (event))
- return;
-
- emit_event_chain (event);
-}
-
-static inline void
-emit_touch_event (ClutterEvent *event,
- ClutterInputDevice *device)
-{
- if (_clutter_event_process_filters (event))
- return;
-
- emit_event_chain (event);
-}
-
-static inline void
-process_key_event (ClutterEvent *event,
- ClutterInputDevice *device)
+emit_event (ClutterEvent *event)
{
if (_clutter_event_process_filters (event))
return;
@@ -902,7 +871,7 @@ _clutter_process_event_details (ClutterActor *stage,
}
}
- process_key_event (event, device);
+ emit_event (event);
}
break;
@@ -916,7 +885,7 @@ _clutter_process_event_details (ClutterActor *stage,
{
ClutterActor *actor = NULL;
- emit_crossing_event (event, device);
+ emit_event (event);
actor = update_device_for_event (CLUTTER_STAGE (stage), event, FALSE);
if (actor != stage)
@@ -928,12 +897,12 @@ _clutter_process_event_details (ClutterActor *stage,
crossing->crossing.related = stage;
crossing->crossing.source = actor;
- emit_crossing_event (crossing, device);
+ emit_event (crossing);
clutter_event_free (crossing);
}
}
else
- emit_crossing_event (event, device);
+ emit_event (event);
break;
case CLUTTER_LEAVE:
@@ -953,10 +922,10 @@ _clutter_process_event_details (ClutterActor *stage,
crossing->crossing.source =
clutter_stage_get_device_actor (CLUTTER_STAGE (stage), device, NULL);
- emit_crossing_event (crossing, device);
+ emit_event (crossing);
clutter_event_free (crossing);
}
- emit_crossing_event (event, device);
+ emit_event (event);
break;
case CLUTTER_MOTION:
@@ -1013,7 +982,7 @@ _clutter_process_event_details (ClutterActor *stage,
event->button.source = stage;
- emit_pointer_event (event, device);
+ emit_event (event);
}
else if (event->type == CLUTTER_MOTION)
{
@@ -1023,7 +992,7 @@ _clutter_process_event_details (ClutterActor *stage,
event->motion.source = stage;
- emit_pointer_event (event, device);
+ emit_event (event);
}
break;
@@ -1056,7 +1025,7 @@ _clutter_process_event_details (ClutterActor *stage,
x, y,
event->any.source);
- emit_pointer_event (event, device);
+ emit_event (event);
break;
}
@@ -1087,7 +1056,7 @@ _clutter_process_event_details (ClutterActor *stage,
event->touch.source = stage;
- emit_touch_event (event, device);
+ emit_event (event);
if (event->type == CLUTTER_TOUCH_END ||
event->type == CLUTTER_TOUCH_CANCEL)
@@ -1119,7 +1088,7 @@ _clutter_process_event_details (ClutterActor *stage,
x, y,
event->any.source);
- emit_touch_event (event, device);
+ emit_event (event);
if (event->type == CLUTTER_TOUCH_END ||
event->type == CLUTTER_TOUCH_CANCEL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]