From fc5af32cdcd7a4c3ceb0934cc85b616f173892aa Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 22 Jun 2016 17:33:33 +0200 Subject: [PATCH] clutter: Add clutter_event_get_mode_group() This event can be used on pad events to find out the group they pertain to. --- clutter/clutter/clutter-event.c | 21 +++++++++++++++++++++ clutter/clutter/clutter-event.h | 4 ++++ 2 files changed, 25 insertions(+) diff --git a/clutter/clutter/clutter-event.c b/clutter/clutter/clutter-event.c index be9261091..c489ab4da 100644 --- a/clutter/clutter/clutter-event.c +++ b/clutter/clutter/clutter-event.c @@ -2108,3 +2108,24 @@ clutter_event_get_scroll_finish_flags (const ClutterEvent *event) return event->scroll.finish_flags; } + +guint +clutter_event_get_mode_group (const ClutterEvent *event) +{ + g_return_val_if_fail (event->type == CLUTTER_PAD_BUTTON_PRESS || + event->type == CLUTTER_PAD_BUTTON_RELEASE || + event->type == CLUTTER_PAD_RING || + event->type == CLUTTER_PAD_STRIP, 0); + switch (event->type) + { + case CLUTTER_PAD_BUTTON_PRESS: + case CLUTTER_PAD_BUTTON_RELEASE: + return event->pad_button.group; + case CLUTTER_PAD_RING: + return event->pad_ring.group; + case CLUTTER_PAD_STRIP: + return event->pad_strip.group; + default: + return 0; + } +} diff --git a/clutter/clutter/clutter-event.h b/clutter/clutter/clutter-event.h index 73d67ffa6..5478f1d60 100644 --- a/clutter/clutter/clutter-event.h +++ b/clutter/clutter/clutter-event.h @@ -771,6 +771,10 @@ void clutter_event_get_gesture_motion_delta (const Clut ClutterScrollSource clutter_event_get_scroll_source (const ClutterEvent *event); ClutterScrollFinishFlags clutter_event_get_scroll_finish_flags (const ClutterEvent *event); +CLUTTER_AVAILABLE_IN_ALL +guint clutter_event_get_mode_group (const ClutterEvent *event); + + G_END_DECLS #endif /* __CLUTTER_EVENT_H__ */