[gtk+/gtk-2-24] Fix gdk_keyval_name() and gdk_keyval_from_name() annotations
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24] Fix gdk_keyval_name() and gdk_keyval_from_name() annotations
- Date: Thu, 10 Mar 2011 12:27:46 +0000 (UTC)
commit 3b3faee6d2299d1554cfc27e829bef7f5775ce62
Author: Martin Pitt <martin pitt ubuntu com>
Date: Thu Mar 10 13:25:55 2011 +0100
Fix gdk_keyval_name() and gdk_keyval_from_name() annotations
Backport annotations from master (which fixes the keyval_name() crash due to
the wrong default transfer annotation), and ensure that the g-ir-scanner
includes them.
https://launchnpad.net/bugs/732484
gdk/Makefile.am | 1 +
gdk/gdkkeynames.c | 27 +++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/gdk/Makefile.am b/gdk/Makefile.am
index 06de1a4..a6cfc47 100644
--- a/gdk/Makefile.am
+++ b/gdk/Makefile.am
@@ -193,6 +193,7 @@ if HAVE_INTROSPECTION
introspection_files = \
$(filter-out gdkkeysyms-compat.h, $(gdk_public_h_sources)) \
$(gdk_c_sources) \
+ gdkkeynames.c \
gdkenumtypes.c \
gdkenumtypes.h
diff --git a/gdk/gdkkeynames.c b/gdk/gdkkeynames.c
index 6b155bc..18f289f 100644
--- a/gdk/gdkkeynames.c
+++ b/gdk/gdkkeynames.c
@@ -45,6 +45,20 @@ gdk_keys_keyval_compare (const void *pkey, const void *pbase)
return (*(int *) pkey) - ((gdk_key *) pbase)->keyval;
}
+/**
+ * gdk_keyval_name:
+ * @keyval: a key value
+ *
+ * Converts a key value into a symbolic name.
+ *
+ * The names are the same as those in the
+ * <filename><gdk/gdkkeysyms.h></filename> header file
+ * but without the leading "GDK_KEY_".
+ *
+ * Return value: (transfer none): a string containing the name of the key,
+ * or %NULL if @keyval is not a valid key. The string should not be
+ * modified.
+ */
gchar*
gdk_keyval_name (guint keyval)
{
@@ -86,6 +100,19 @@ gdk_keys_name_compare (const void *pkey, const void *pbase)
(const char *) (keynames + ((const gdk_key *) pbase)->offset));
}
+/**
+ * gdk_keyval_from_name:
+ * @keyval_name: a key name
+ *
+ * Converts a key name to a key value.
+ *
+ * The names are the same as those in the
+ * <filename><gdk/gdkkeysyms.h></filename> header file
+ * but without the leading "GDK_KEY_".
+ *
+ * Returns: the corresponding key value, or %GDK_KEY_VoidSymbol
+ * if the key name is not a valid key
+ */
guint
gdk_keyval_from_name (const gchar *keyval_name)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]