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
This commit is contained in:
Emmanuele Bassi 2012-07-18 10:32:53 -04:00
parent a8fcd4dfae
commit 1c03be7346
3 changed files with 26 additions and 0 deletions

View File

@ -1627,3 +1627,26 @@ clutter_event_has_control_modifier (const ClutterEvent *event)
{ {
return (clutter_event_get_state (event) & CLUTTER_CONTROL_MASK) != FALSE; 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;
}

View File

@ -460,6 +460,8 @@ CLUTTER_AVAILABLE_IN_1_12
gboolean clutter_event_has_shift_modifier (const ClutterEvent *event); gboolean clutter_event_has_shift_modifier (const ClutterEvent *event);
CLUTTER_AVAILABLE_IN_1_12 CLUTTER_AVAILABLE_IN_1_12
gboolean clutter_event_has_control_modifier (const ClutterEvent *event); 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, void clutter_event_set_key_symbol (ClutterEvent *event,
guint key_sym); guint key_sym);

View File

@ -670,6 +670,7 @@ clutter_event_get_time
clutter_event_get clutter_event_get
clutter_event_has_control_modifier clutter_event_has_control_modifier
clutter_event_has_shift_modifier clutter_event_has_shift_modifier
clutter_event_is_pointer_emulated
clutter_event_new clutter_event_new
clutter_event_peek clutter_event_peek
clutter_event_put clutter_event_put