clutter: Add clutter_event_get_mode_group()

This event can be used on pad events to find out the group they
pertain to.
This commit is contained in:
Carlos Garnacho 2016-06-22 17:33:33 +02:00
parent b71d7058db
commit fc5af32cdc
2 changed files with 25 additions and 0 deletions

View File

@ -2108,3 +2108,24 @@ clutter_event_get_scroll_finish_flags (const ClutterEvent *event)
return event->scroll.finish_flags; 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;
}
}

View File

@ -771,6 +771,10 @@ void clutter_event_get_gesture_motion_delta (const Clut
ClutterScrollSource clutter_event_get_scroll_source (const ClutterEvent *event); ClutterScrollSource clutter_event_get_scroll_source (const ClutterEvent *event);
ClutterScrollFinishFlags clutter_event_get_scroll_finish_flags (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 G_END_DECLS
#endif /* __CLUTTER_EVENT_H__ */ #endif /* __CLUTTER_EVENT_H__ */