[gtk+/xi2] Add gtk_get_current_event_device().



commit c3b75c83d0b56dd18eab8577b2b37477aed3c219
Author: Carlos Garnacho <carlos gnome org>
Date:   Sat Oct 17 14:20:54 2009 +0200

    Add gtk_get_current_event_device().
    
    This function gets the GdkDevice for the event currently being processed
    by GTK+.

 gtk/gtk.symbols |    1 +
 gtk/gtkmain.c   |   17 +++++++++++++++++
 gtk/gtkmain.h   |    1 +
 3 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 841780b..71d08c5 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -2363,6 +2363,7 @@ gtk_list_store_swap
 #if IN_FILE(__GTK_MAIN_C__)
 gtk_get_option_group
 gtk_get_current_event
+gtk_get_current_event_device
 gtk_get_current_event_state
 gtk_get_current_event_time
 #ifndef GTK_DISABLE_DEPRECATED
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index dd08499..5522131 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -2262,6 +2262,23 @@ gtk_get_current_event_state (GdkModifierType *state)
 }
 
 /**
+ * gtk_get_current_event_device:
+ *
+ * If there is a current event and it has a device, return that
+ * device, otherwise return %NULL.
+ *
+ * Returns: a #GdkDevice, or %NULL
+ **/
+GdkDevice *
+gtk_get_current_event_device (void)
+{
+  if (current_events)
+    return gdk_event_get_device (current_events->data);
+  else
+    return NULL;
+}
+
+/**
  * gtk_get_event_widget:
  * @event: a #GdkEvent
  *
diff --git a/gtk/gtkmain.h b/gtk/gtkmain.h
index 975057e..63bd030 100644
--- a/gtk/gtkmain.h
+++ b/gtk/gtkmain.h
@@ -209,6 +209,7 @@ void	   gtk_key_snooper_remove  (guint	    snooper_handler_id);
 GdkEvent*       gtk_get_current_event       (void);
 guint32         gtk_get_current_event_time  (void);
 gboolean        gtk_get_current_event_state (GdkModifierType *state);
+GdkDevice *     gtk_get_current_event_device (void);
 
 GtkWidget* gtk_get_event_widget	   (GdkEvent	   *event);
 



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