Commit 62e9bb06 authored by Matthias Clasen's avatar Matthias Clasen

Add a vfunc for gdk_keymap_get_for_display

parent a97b1891
......@@ -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);
}
......@@ -191,6 +191,8 @@ struct _GdkDisplayClass
GdkWindowAttr *attributes,
gint attributes_mask);
GdkKeymap * (*get_keymap) (GdkDisplay *display);
/* Signals */
void (*closed) (GdkDisplay *display,
gboolean is_error);
......
......@@ -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;
}
......@@ -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
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment