[gtk+/xi2] GdkDevice: Add gdk_device_get_key().



commit 28ceae2ef05fd368184a52cce54f86222b7ae1d9
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Mar 13 15:05:57 2010 +0100

    GdkDevice: Add gdk_device_get_key().

 gdk/gdk.symbols |    1 +
 gdk/gdkdevice.c |   36 ++++++++++++++++++++++++++++++++++++
 gdk/gdkdevice.h |    4 ++++
 3 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index ff310ca..05db588 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -410,6 +410,7 @@ gdk_device_get_associated_device
 gdk_device_get_axis
 gdk_device_get_has_cursor
 gdk_device_get_history
+gdk_device_get_key
 gdk_device_get_mode
 gdk_device_get_name
 gdk_device_get_source
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index cf8af3b..d0fbd7b 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -556,6 +556,42 @@ gdk_device_set_mode (GdkDevice    *device,
 }
 
 /**
+ * gdk_device_get_key:
+ * @device: a #GdkDevice.
+ * @index: the index of the macro button to get.
+ * @keyval: return value for the keyval.
+ * @modifiers: return value for modifiers.
+ *
+ * If @index has a valid keyval, this function will return %TRUE
+ * and fill in @keyval and @modifiers with the keyval settings.
+ *
+ * Returns: %TRUE if keyval is set for @index.
+ *
+ * Since: 2.20
+ **/
+gboolean
+gdk_device_get_key (GdkDevice       *device,
+                    guint            index,
+                    guint           *keyval,
+                    GdkModifierType *modifiers)
+{
+  g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
+  g_return_val_if_fail (index < device->num_keys, FALSE);
+
+  if (!device->keys[index].keyval &&
+      !device->keys[index].modifiers)
+    return FALSE;
+
+  if (keyval)
+    *keyval = device->keys[index].keyval;
+
+  if (modifiers)
+    *modifiers = device->keys[index].modifiers;
+
+  return TRUE;
+}
+
+/**
  * gdk_device_set_key:
  * @device: a #GdkDevice.
  * @index: the index of the macro button to set.
diff --git a/gdk/gdkdevice.h b/gdk/gdkdevice.h
index 805b095..94ee630 100644
--- a/gdk/gdkdevice.h
+++ b/gdk/gdkdevice.h
@@ -218,6 +218,10 @@ GdkInputMode   gdk_device_get_mode      (GdkDevice      *device);
 gboolean       gdk_device_set_mode      (GdkDevice      *device,
 					 GdkInputMode    mode);
 
+gboolean       gdk_device_get_key       (GdkDevice       *device,
+                                         guint            index,
+                                         guint           *keyval,
+                                         GdkModifierType *modifiers);
 void           gdk_device_set_key       (GdkDevice      *device,
 					 guint           index_,
 					 guint           keyval,



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