mirror of
https://github.com/brl/mutter.git
synced 2024-11-30 03:50:47 -05:00
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. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2100>
This commit is contained in:
parent
ac4face82a
commit
527cc51665
@ -694,30 +694,10 @@ emit_event_chain (ClutterEvent *event)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
emit_pointer_event (ClutterEvent *event,
|
emit_event (ClutterEvent *event)
|
||||||
ClutterInputDevice *device)
|
|
||||||
{
|
|
||||||
emit_event_chain (event);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
emit_crossing_event (ClutterEvent *event,
|
|
||||||
ClutterInputDevice *device)
|
|
||||||
{
|
|
||||||
emit_event_chain (event);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
emit_touch_event (ClutterEvent *event,
|
|
||||||
ClutterInputDevice *device)
|
|
||||||
{
|
|
||||||
emit_event_chain (event);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
process_key_event (ClutterEvent *event,
|
|
||||||
ClutterInputDevice *device)
|
|
||||||
{
|
{
|
||||||
|
if (event->type == CLUTTER_KEY_PRESS ||
|
||||||
|
event->type == CLUTTER_KEY_RELEASE)
|
||||||
cally_snoop_key_event ((ClutterKeyEvent *) event);
|
cally_snoop_key_event ((ClutterKeyEvent *) event);
|
||||||
|
|
||||||
emit_event_chain (event);
|
emit_event_chain (event);
|
||||||
@ -912,12 +892,12 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
process_key_event (event, device);
|
emit_event (event);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLUTTER_ENTER:
|
case CLUTTER_ENTER:
|
||||||
emit_crossing_event (event, device);
|
emit_event (event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLUTTER_LEAVE:
|
case CLUTTER_LEAVE:
|
||||||
@ -937,10 +917,10 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
crossing->crossing.source =
|
crossing->crossing.source =
|
||||||
clutter_stage_get_device_actor (CLUTTER_STAGE (stage), device, NULL);
|
clutter_stage_get_device_actor (CLUTTER_STAGE (stage), device, NULL);
|
||||||
|
|
||||||
emit_crossing_event (crossing, device);
|
emit_event (crossing);
|
||||||
clutter_event_free (crossing);
|
clutter_event_free (crossing);
|
||||||
}
|
}
|
||||||
emit_crossing_event (event, device);
|
emit_event (event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLUTTER_MOTION:
|
case CLUTTER_MOTION:
|
||||||
@ -983,7 +963,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
x, y,
|
x, y,
|
||||||
event->any.source);
|
event->any.source);
|
||||||
|
|
||||||
emit_pointer_event (event, device);
|
emit_event (event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1001,7 +981,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
x, y,
|
x, y,
|
||||||
event->any.source);
|
event->any.source);
|
||||||
|
|
||||||
emit_touch_event (event, device);
|
emit_event (event);
|
||||||
|
|
||||||
if (event->type == CLUTTER_TOUCH_END ||
|
if (event->type == CLUTTER_TOUCH_END ||
|
||||||
event->type == CLUTTER_TOUCH_CANCEL)
|
event->type == CLUTTER_TOUCH_CANCEL)
|
||||||
|
Loading…
Reference in New Issue
Block a user