[gtk+] gdk: Refactor gdk_keyval_convert_case()



commit 441359b0a8046457c6f6207ba9f8deaec0d2a395
Author: Benjamin Otte <otte redhat com>
Date:   Tue Apr 16 13:02:23 2013 +0200

    gdk: Refactor gdk_keyval_convert_case()
    
    ... so it doesn't export the function anymore.

 gdk/gdkdisplaymanager.c |  2 --
 gdk/gdkkeys.c           | 57 +++++++++++++++++++++++++------------------------
 gdk/gdkkeysprivate.h    |  5 -----
 3 files changed, 29 insertions(+), 35 deletions(-)
---
diff --git a/gdk/gdkdisplaymanager.c b/gdk/gdkdisplaymanager.c
index cfbd15e..a0afb1c 100644
--- a/gdk/gdkdisplaymanager.c
+++ b/gdk/gdkdisplaymanager.c
@@ -153,8 +153,6 @@ gdk_display_manager_class_init (GdkDisplayManagerClass *klass)
   object_class->set_property = gdk_display_manager_set_property;
   object_class->get_property = gdk_display_manager_get_property;
 
-  klass->keyval_convert_case = _gdk_display_manager_real_keyval_convert_case;
-
   /**
    * GdkDisplayManager::display-opened:
    * @manager: the object on which the signal is emitted
diff --git a/gdk/gdkkeys.c b/gdk/gdkkeys.c
index 9194d7f..60277b6 100644
--- a/gdk/gdkkeys.c
+++ b/gdk/gdkkeys.c
@@ -190,28 +190,6 @@ gdk_keymap_init (GdkKeymap *keymap)
  */
 
 /**
- * gdk_keyval_convert_case:
- * @symbol: a keyval
- * @lower: (out): return location for lowercase version of @symbol
- * @upper: (out): return location for uppercase version of @symbol
- *
- * Obtains the upper- and lower-case versions of the keyval @symbol.
- * Examples of keyvals are #GDK_KEY_a, #GDK_KEY_Enter, #GDK_KEY_F1, etc.
- */
-void
-gdk_keyval_convert_case (guint symbol,
-                         guint *lower,
-                         guint *upper)
-{
-  GdkDisplayManager *manager = _gdk_display_manager_get_nocreate ();
-
-  if (manager)
-    GDK_DISPLAY_MANAGER_GET_CLASS (manager)->keyval_convert_case (manager, symbol, lower, upper);
-  else
-    _gdk_display_manager_real_keyval_convert_case (NULL, symbol, lower, upper);
-}
-
-/**
  * gdk_keyval_to_upper:
  * @keyval: a key value.
  *
@@ -742,14 +720,37 @@ gdk_keyval_from_name (const gchar *keyval_name)
                                                                  keyval_name);
 }
 
+/**
+ * gdk_keyval_convert_case:
+ * @symbol: a keyval
+ * @lower: (out): return location for lowercase version of @symbol
+ * @upper: (out): return location for uppercase version of @symbol
+ *
+ * Obtains the upper- and lower-case versions of the keyval @symbol.
+ * Examples of keyvals are #GDK_KEY_a, #GDK_KEY_Enter, #GDK_KEY_F1, etc.
+ */
 void
-_gdk_display_manager_real_keyval_convert_case (GdkDisplayManager *manager,
-                                               guint              symbol,
-                                               guint             *lower,
-                                               guint             *upper)
+gdk_keyval_convert_case (guint symbol,
+                         guint *lower,
+                         guint *upper)
 {
-  guint xlower = symbol;
-  guint xupper = symbol;
+  GdkDisplayManager *manager;
+  guint xlower, xupper;
+
+  manager = _gdk_display_manager_get_nocreate ();
+  if (manager)
+    {
+      GdkDisplayManagerClass *manager_class = GDK_DISPLAY_MANAGER_GET_CLASS (manager);
+
+      if (manager_class->keyval_convert_case)
+        {
+          manager_class->keyval_convert_case (manager, symbol, lower, upper);
+          return;
+        }
+    }
+
+  xlower = symbol;
+  xupper = symbol;
 
   /* Check for directly encoded 24-bit UCS characters: */
   if ((symbol & 0xff000000) == 0x01000000)
diff --git a/gdk/gdkkeysprivate.h b/gdk/gdkkeysprivate.h
index 211db23..f1c8c16 100644
--- a/gdk/gdkkeysprivate.h
+++ b/gdk/gdkkeysprivate.h
@@ -76,11 +76,6 @@ struct _GdkKeymap
   GdkDisplay *display;
 };
 
-void _gdk_display_manager_real_keyval_convert_case (GdkDisplayManager *manager,
-                                                    guint              symbol,
-                                                    guint             *lower,
-                                                    guint             *upper);
-
 G_END_DECLS
 
 #endif


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