diff options
author | Colin Walters <walters@verbum.org> | 2009-11-12 17:33:15 -0500 |
---|---|---|
committer | Emmanuele Bassi <ebassi@linux.intel.com> | 2009-12-10 22:20:36 +0000 |
commit | 1374b5aac9398852cf3f3482fdf925b52aa31338 (patch) | |
tree | 7519c05769939cf2df6967a3c836316cfd1af7e3 /clutter/clutter-event.c | |
parent | 86ce92eec14aa1aaf7c9ab14a520b66690488213 (diff) | |
download | clutter-1374b5aac9398852cf3f3482fdf925b52aa31338.tar.gz |
Add clutter_get_current_event
When getting signals from higher level toolkits, occasionally
one wants access to the underlying event; say for a Button
widget's "clicked" signal, to get the keyboard state.
Rather than having all of the highlevel widgets emit
ClutterEvent just for the more unusual use cases,
add a global function to access the event state.
http://bugzilla.openedhand.com/show_bug.cgi?id=1888
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Diffstat (limited to 'clutter/clutter-event.c')
-rw-r--r-- | clutter/clutter-event.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/clutter/clutter-event.c b/clutter/clutter-event.c index a74338ecd..2f9cf178a 100644 --- a/clutter/clutter-event.c +++ b/clutter/clutter-event.c @@ -766,6 +766,29 @@ clutter_get_current_event_time (void) } /** + * clutter_get_current_event: + * + * If an event is currently being processed, return that event. + * This function is intended to be used to access event state + * that might not be exposed by higher-level widgets. For + * example, to get the key modifier state from a Button 'clicked' + * event. + * + * Return value: (transfer none): The current ClutterEvent, or %NULL if none + * + * Since: 1.2 + */ +G_CONST_RETURN ClutterEvent * +clutter_get_current_event (void) +{ + ClutterMainContext *context = _clutter_context_get_default (); + + g_return_val_if_fail (context != NULL, NULL); + + return context->current_event; +} + +/** * clutter_input_device_get_device_type: * @device: a #ClutterInputDevice * |