[mutter/wip/tablet-protocol-v2: 14/65] clutter: Add clutter_event_get_mode_group()



commit eb3e14cb6b2aa7ccdb4102feec6d3e2bf549cd44
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jun 22 17:33:33 2016 +0200

    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(+), 0 deletions(-)
---
diff --git a/clutter/clutter/clutter-event.c b/clutter/clutter/clutter-event.c
index 05682fb..b31785b 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 73d67ff..5478f1d 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__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]