[gtk+] gdk: Unvfuncify generic key functions
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gdk: Unvfuncify generic key functions
- Date: Tue, 16 Apr 2013 13:38:09 +0000 (UTC)
commit 0990c11a83ef514b459687ac43cb2737efe9b8e6
Author: Benjamin Otte <otte redhat com>
Date: Tue Apr 16 15:27:15 2013 +0200
gdk: Unvfuncify generic key functions
This makes Wayland and X11 no longer call into XKB and libX11 for these
functions but use GDK's own copy of these functions, just like the
win32, quartz and broadway backends.
gdk/gdkdisplaymanager.c | 9 ------
gdk/gdkdisplaymanagerprivate.h | 13 --------
gdk/gdkkeys.c | 35 ++------------------
gdk/wayland/gdkdisplaymanager-wayland.c | 38 ----------------------
gdk/x11/gdkdisplaymanager-x11.c | 3 --
gdk/x11/gdkkeys-x11.c | 57 ---------------------------------
gdk/x11/gdkprivate-x11.h | 8 -----
7 files changed, 2 insertions(+), 161 deletions(-)
---
diff --git a/gdk/gdkdisplaymanager.c b/gdk/gdkdisplaymanager.c
index a0afb1c..7ec4078 100644
--- a/gdk/gdkdisplaymanager.c
+++ b/gdk/gdkdisplaymanager.c
@@ -397,15 +397,6 @@ gdk_display_manager_peek (void)
return manager;
}
-/* Used for cases where we don't actually want to instantiate a
- * display manager if none exists. Internal only.
- */
-GdkDisplayManager *
-_gdk_display_manager_get_nocreate (void)
-{
- return manager;
-}
-
/**
* gdk_display_manager_get_default_display:
* @manager: a #GdkDisplayManager
diff --git a/gdk/gdkdisplaymanagerprivate.h b/gdk/gdkdisplaymanagerprivate.h
index a8885a3..0f6d4b2 100644
--- a/gdk/gdkdisplaymanagerprivate.h
+++ b/gdk/gdkdisplaymanagerprivate.h
@@ -44,24 +44,11 @@ struct _GdkDisplayManagerClass
GdkDisplay * (*open_display) (GdkDisplayManager *manager,
const gchar *name);
- /* FIXME the following should really be frontend-only, not vfuncs */
- guint (*lookup_keyval) (GdkDisplayManager *manager,
- const gchar *name);
- gchar * (*get_keyval_name) (GdkDisplayManager *manager,
- guint keyval);
- void (*keyval_convert_case) (GdkDisplayManager *manager,
- guint keyval,
- guint *lower,
- guint *upper);
-
/* signals */
void (*display_opened) (GdkDisplayManager *manager,
GdkDisplay *display);
};
-GdkDisplayManager *
-_gdk_display_manager_get_nocreate (void);
-
void _gdk_display_manager_add_display (GdkDisplayManager *manager,
GdkDisplay *display);
void _gdk_display_manager_remove_display (GdkDisplayManager *manager,
diff --git a/gdk/gdkkeys.c b/gdk/gdkkeys.c
index 3026cfc..a0202ca 100644
--- a/gdk/gdkkeys.c
+++ b/gdk/gdkkeys.c
@@ -693,16 +693,7 @@ gdk_keymap_get_modifier_mask (GdkKeymap *keymap,
gchar *
gdk_keyval_name (guint keyval)
{
- GdkDisplayManagerClass *manager_class;
- GdkDisplayManager *manager;
-
- manager = gdk_display_manager_get ();
- manager_class = GDK_DISPLAY_MANAGER_GET_CLASS (manager);
-
- if (manager_class->get_keyval_name)
- return manager_class->get_keyval_name (manager, keyval);
- else
- return _gdk_keyval_name (keyval);
+ return _gdk_keyval_name (keyval);
}
/**
@@ -721,16 +712,7 @@ gdk_keyval_name (guint keyval)
guint
gdk_keyval_from_name (const gchar *keyval_name)
{
- GdkDisplayManagerClass *manager_class;
- GdkDisplayManager *manager;
-
- manager = gdk_display_manager_get ();
- manager_class = GDK_DISPLAY_MANAGER_GET_CLASS (manager);
-
- if (manager_class->lookup_keyval)
- return manager_class->lookup_keyval (manager, keyval_name);
- else
- return _gdk_keyval_from_name (keyval_name);
+ return _gdk_keyval_from_name (keyval_name);
}
/**
@@ -747,21 +729,8 @@ gdk_keyval_convert_case (guint symbol,
guint *lower,
guint *upper)
{
- 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;
diff --git a/gdk/wayland/gdkdisplaymanager-wayland.c b/gdk/wayland/gdkdisplaymanager-wayland.c
index 4b8ded5..902ac16 100644
--- a/gdk/wayland/gdkdisplaymanager-wayland.c
+++ b/gdk/wayland/gdkdisplaymanager-wayland.c
@@ -27,8 +27,6 @@
#include "gdkwayland.h"
#include "gdkinternals.h"
-#include <xkbcommon/xkbcommon.h>
-
struct _GdkWaylandDisplayManager
{
GdkDisplayManager parent;
@@ -97,40 +95,6 @@ gdk_wayland_display_manager_open_display (GdkDisplayManager *manager,
return _gdk_wayland_display_open (name);
}
-static guint
-gdk_wayland_display_manager_lookup_keyval (GdkDisplayManager *manager,
- const gchar *keyval_name)
-{
- g_return_val_if_fail (keyval_name != NULL, 0);
-
- return xkb_keysym_from_name (keyval_name, 0);
-}
-
-static gchar *
-gdk_wayland_display_manager_get_keyval_name (GdkDisplayManager *manager,
- guint keyval)
-{
- static char buf[128];
-
- switch (keyval)
- {
- case 0:
- return NULL;
- case GDK_KEY_Page_Up:
- return "Page_Up";
- case GDK_KEY_Page_Down:
- return "Page_Down";
- case GDK_KEY_KP_Page_Up:
- return "KP_Page_Up";
- case GDK_KEY_KP_Page_Down:
- return "KP_Page_Down";
- }
-
- xkb_keysym_get_name(keyval, buf, sizeof (buf));
-
- return buf;
-}
-
static void
gdk_wayland_display_manager_class_init (GdkWaylandDisplayManagerClass *class)
{
@@ -140,8 +104,6 @@ gdk_wayland_display_manager_class_init (GdkWaylandDisplayManagerClass *class)
object_class->finalize = gdk_wayland_display_manager_finalize;
manager_class->open_display = gdk_wayland_display_manager_open_display;
- manager_class->lookup_keyval = gdk_wayland_display_manager_lookup_keyval;
- manager_class->get_keyval_name = gdk_wayland_display_manager_get_keyval_name;
}
static void
diff --git a/gdk/x11/gdkdisplaymanager-x11.c b/gdk/x11/gdkdisplaymanager-x11.c
index adf3d15..52a2c2b 100644
--- a/gdk/x11/gdkdisplaymanager-x11.c
+++ b/gdk/x11/gdkdisplaymanager-x11.c
@@ -113,7 +113,4 @@ gdk_x11_display_manager_class_init (GdkX11DisplayManagerClass *class)
object_class->finalize = gdk_x11_display_manager_finalize;
manager_class->open_display = gdk_x11_display_manager_open_display;
- manager_class->lookup_keyval = _gdk_x11_display_manager_lookup_keyval;
- manager_class->get_keyval_name = _gdk_x11_display_manager_get_keyval_name;
- manager_class->keyval_convert_case = _gdk_x11_display_manager_keyval_convert_case;
}
diff --git a/gdk/x11/gdkkeys-x11.c b/gdk/x11/gdkkeys-x11.c
index 4dba9d4..631af1f 100644
--- a/gdk/x11/gdkkeys-x11.c
+++ b/gdk/x11/gdkkeys-x11.c
@@ -1382,63 +1382,6 @@ gdk_x11_keymap_translate_keyboard_state (GdkKeymap *keymap,
return tmp_keyval != NoSymbol;
}
-/* Key handling not part of the keymap */
-gchar*
-_gdk_x11_display_manager_get_keyval_name (GdkDisplayManager *manager,
- guint keyval)
-{
- switch (keyval)
- {
- case GDK_KEY_Page_Up:
- return "Page_Up";
- case GDK_KEY_Page_Down:
- return "Page_Down";
- case GDK_KEY_KP_Page_Up:
- return "KP_Page_Up";
- case GDK_KEY_KP_Page_Down:
- return "KP_Page_Down";
- }
-
- return XKeysymToString (keyval);
-}
-
-guint
-_gdk_x11_display_manager_lookup_keyval (GdkDisplayManager *manager,
- const gchar *keyval_name)
-{
- g_return_val_if_fail (keyval_name != NULL, 0);
-
- return XStringToKeysym (keyval_name);
-}
-
-void
-_gdk_x11_display_manager_keyval_convert_case (GdkDisplayManager *manager,
- guint symbol,
- guint *lower,
- guint *upper)
-{
- KeySym xlower = 0;
- KeySym xupper = 0;
-
- /* Check for directly encoded 24-bit UCS characters: */
- if ((symbol & 0xff000000) == 0x01000000)
- {
- if (lower)
- *lower = gdk_unicode_to_keyval (g_unichar_tolower (symbol & 0x00ffffff));
- if (upper)
- *upper = gdk_unicode_to_keyval (g_unichar_toupper (symbol & 0x00ffffff));
- return;
- }
-
- if (symbol)
- XConvertCase (symbol, &xlower, &xupper);
-
- if (lower)
- *lower = xlower;
- if (upper)
- *upper = xupper;
-}
-
/**
* gdk_x11_keymap_get_group_for_state:
* @keymap: a #GdkX11Keymap
diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h
index cbeb303..defd47e 100644
--- a/gdk/x11/gdkprivate-x11.h
+++ b/gdk/x11/gdkprivate-x11.h
@@ -252,14 +252,6 @@ GdkAtom _gdk_x11_display_manager_atom_intern (GdkDisplayManager *manager,
gboolean copy_name);
gchar * _gdk_x11_display_manager_get_atom_name (GdkDisplayManager *manager,
GdkAtom atom);
-guint _gdk_x11_display_manager_lookup_keyval (GdkDisplayManager *manager,
- const gchar *name);
-gchar * _gdk_x11_display_manager_get_keyval_name (GdkDisplayManager *manager,
- guint keyval);
-void _gdk_x11_display_manager_keyval_convert_case (GdkDisplayManager *manager,
- guint symbol,
- guint *lower,
- guint *upper);
GdkCursor *_gdk_x11_display_get_cursor_for_type (GdkDisplay *display,
GdkCursorType type);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]