From 1c03be7346ba0c72518ee1972674007a2417c2a2 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 18 Jul 2012 10:32:53 -0400 Subject: [PATCH] event: Expose is-pointer-emulated flag Clutter on X11 already stores this flag to distinguish between events that have been synthesized by the X server and real events. https://bugzilla.gnome.org/show_bug.cgi?id=680174 --- clutter/clutter-event.c | 23 +++++++++++++++++++++++ clutter/clutter-event.h | 2 ++ clutter/clutter.symbols | 1 + 3 files changed, 26 insertions(+) diff --git a/clutter/clutter-event.c b/clutter/clutter-event.c index 48e7aeee2..e963c283c 100644 --- a/clutter/clutter-event.c +++ b/clutter/clutter-event.c @@ -1627,3 +1627,26 @@ clutter_event_has_control_modifier (const ClutterEvent *event) { return (clutter_event_get_state (event) & CLUTTER_CONTROL_MASK) != FALSE; } + +/** + * clutter_event_is_pointer_emulated: + * @event: a #ClutterEvent + * + * Checks whether a pointer @event has been generated by the windowing + * system. The returned value can be used to distinguish between events + * synthesized by the windowing system itself (as opposed by Clutter). + * + * Return value: %TRUE if the event is pointer emulated + * + * Since: 1.12 + */ +gboolean +clutter_event_is_pointer_emulated (const ClutterEvent *event) +{ + g_return_val_if_fail (event != NULL, FALSE); + + if (!is_event_allocated (event)) + return FALSE; + + return ((ClutterEventPrivate *) event)->is_pointer_emulated; +} diff --git a/clutter/clutter-event.h b/clutter/clutter-event.h index 0569b13ab..34566c7bf 100644 --- a/clutter/clutter-event.h +++ b/clutter/clutter-event.h @@ -460,6 +460,8 @@ CLUTTER_AVAILABLE_IN_1_12 gboolean clutter_event_has_shift_modifier (const ClutterEvent *event); CLUTTER_AVAILABLE_IN_1_12 gboolean clutter_event_has_control_modifier (const ClutterEvent *event); +CLUTTER_AVAILABLE_IN_1_12 +gboolean clutter_event_is_pointer_emulated (const ClutterEvent *event); void clutter_event_set_key_symbol (ClutterEvent *event, guint key_sym); diff --git a/clutter/clutter.symbols b/clutter/clutter.symbols index d3a5dd298..22a4b8d60 100644 --- a/clutter/clutter.symbols +++ b/clutter/clutter.symbols @@ -670,6 +670,7 @@ clutter_event_get_time clutter_event_get clutter_event_has_control_modifier clutter_event_has_shift_modifier +clutter_event_is_pointer_emulated clutter_event_new clutter_event_peek clutter_event_put