[gtk+] Add a vfunc for gdk_keymap_get_for_display
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Add a vfunc for gdk_keymap_get_for_display
- Date: Tue, 21 Dec 2010 17:14:23 +0000 (UTC)
commit 62e9bb06a0004b540c5d10b28b22dc7771b4bd58
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Dec 16 00:08:42 2010 -0500
Add a vfunc for gdk_keymap_get_for_display
gdk/gdkdisplay.c | 16 ++++++++++++++++
gdk/gdkdisplayprivate.h | 2 ++
gdk/x11/gdkdisplay-x11.c | 17 +++++++++++++++++
gdk/x11/gdkkeys-x11.c | 33 ++++-----------------------------
gdk/x11/gdkprivate-x11.h | 2 ++
5 files changed, 41 insertions(+), 29 deletions(-)
---
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index bacefc9..06b4f56 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -2535,3 +2535,19 @@ _gdk_display_create_window_impl (GdkDisplay *display,
attributes,
attributes_mask);
}
+
+/**
+ * gdk_keymap_get_for_display:
+ * @display: the #GdkDisplay.
+ *
+ * Returns the #GdkKeymap attached to @display.
+ *
+ * Return value: (transfer none): the #GdkKeymap attached to @display.
+ *
+ * Since: 2.2
+ */
+GdkKeymap*
+gdk_keymap_get_for_display (GdkDisplay *display)
+{
+ return GDK_DISPLAY_GET_CLASS (display)->get_keymap (display);
+}
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h
index 4b15302..2d5630a 100644
--- a/gdk/gdkdisplayprivate.h
+++ b/gdk/gdkdisplayprivate.h
@@ -191,6 +191,8 @@ struct _GdkDisplayClass
GdkWindowAttr *attributes,
gint attributes_mask);
+ GdkKeymap * (*get_keymap) (GdkDisplay *display);
+
/* Signals */
void (*closed) (GdkDisplay *display,
gboolean is_error);
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 2ecc335..3f58562 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -32,6 +32,7 @@
#include "gdkscreen.h"
#include "gdkinternals.h"
#include "gdkdeviceprivate.h"
+#include "gdkkeysprivate.h"
#include "gdkdevicemanager.h"
#include "xsettings-client.h"
#include "gdkdisplay-x11.h"
@@ -2680,6 +2681,21 @@ gdk_x11_display_event_data_free (GdkDisplay *display,
{
}
+static GdkKeymap *
+gdk_x11_display_get_keymap (GdkDisplay *display)
+{
+ GdkDisplayX11 *display_x11;
+ g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
+ display_x11 = GDK_DISPLAY_X11 (display);
+
+ if (!display_x11->keymap)
+ display_x11->keymap = g_object_new (_gdk_keymap_x11_get_type (), NULL);
+
+ display_x11->keymap->display = display;
+
+ return display_x11->keymap;
+}
+
static void
_gdk_display_x11_class_init (GdkDisplayX11Class * class)
{
@@ -2726,4 +2742,5 @@ _gdk_display_x11_class_init (GdkDisplayX11Class * class)
display_class->event_data_copy = gdk_x11_display_event_data_copy;
display_class->event_data_free = gdk_x11_display_event_data_free;
display_class->create_window_impl = _gdk_x11_display_create_window_impl;
+ display_class->get_keymap = gdk_x11_display_get_keymap;
}
diff --git a/gdk/x11/gdkkeys-x11.c b/gdk/x11/gdkkeys-x11.c
index 5aa0d26..c18aac1 100644
--- a/gdk/x11/gdkkeys-x11.c
+++ b/gdk/x11/gdkkeys-x11.c
@@ -52,7 +52,7 @@
typedef struct _GdkKeymapX11 GdkKeymapX11;
typedef struct _GdkKeymapClass GdkKeymapX11Class;
-#define GDK_TYPE_KEYMAP_X11 (gdk_keymap_x11_get_type ())
+#define GDK_TYPE_KEYMAP_X11 (_gdk_keymap_x11_get_type ())
#define GDK_KEYMAP_X11(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_KEYMAP_X11, GdkKeymapX11))
#define GDK_IS_KEYMAP_X11(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_KEYMAP_X11))
@@ -102,15 +102,15 @@ struct _GdkKeymapX11
#define KEYMAP_USE_XKB(keymap) GDK_DISPLAY_X11 ((keymap)->display)->use_xkb
#define KEYMAP_XDISPLAY(keymap) GDK_DISPLAY_XDISPLAY ((keymap)->display)
-static GType gdk_keymap_x11_get_type (void);
+GType _gdk_keymap_x11_get_type (void);
static void gdk_keymap_x11_class_init (GdkKeymapX11Class *klass);
static void gdk_keymap_x11_init (GdkKeymapX11 *keymap);
static void gdk_keymap_x11_finalize (GObject *object);
static GdkKeymapClass *parent_class = NULL;
-static GType
-gdk_keymap_x11_get_type (void)
+GType
+_gdk_keymap_x11_get_type (void)
{
static GType object_type = 0;
@@ -275,31 +275,6 @@ get_xkb (GdkKeymapX11 *keymap_x11)
* to checking the next event with XPending().
*/
-/**
- * gdk_keymap_get_for_display:
- * @display: the #GdkDisplay.
- *
- * Returns the #GdkKeymap attached to @display.
- *
- * Return value: (transfer none): the #GdkKeymap attached to @display.
- *
- * Since: 2.2
- **/
-GdkKeymap*
-gdk_keymap_get_for_display (GdkDisplay *display)
-{
- GdkDisplayX11 *display_x11;
- g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
- display_x11 = GDK_DISPLAY_X11 (display);
-
- if (!display_x11->keymap)
- display_x11->keymap = g_object_new (gdk_keymap_x11_get_type (), NULL);
-
- display_x11->keymap->display = display;
-
- return display_x11->keymap;
-}
-
/* Find the index of the group/level pair within the keysyms for a key.
* We round up the number of keysyms per keycode to the next even number,
* otherwise we lose a whole group of keys
diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h
index 88b5ef2..2d5ba3e 100644
--- a/gdk/x11/gdkprivate-x11.h
+++ b/gdk/x11/gdkprivate-x11.h
@@ -123,6 +123,8 @@ gboolean _gdk_x11_moveresize_handle_event (XEvent *event);
gboolean _gdk_x11_moveresize_configure_done (GdkDisplay *display,
GdkWindow *window);
+GType _gdk_keymap_x11_get_type (void);
+
void _gdk_x11_keymap_state_changed (GdkDisplay *display,
XEvent *event);
void _gdk_x11_keymap_keys_changed (GdkDisplay *display);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]