2000-12-06 05:31:30 +00:00
|
|
|
/* GDK - The GIMP Drawing Kit
|
|
|
|
* Copyright (C) 2000 Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2010-12-16 04:49:31 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-12-06 05:31:30 +00:00
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
*/
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
#include "config.h"
|
2004-03-06 03:38:59 +00:00
|
|
|
|
2010-12-21 04:32:48 +00:00
|
|
|
#include "gdkx11keys.h"
|
2010-12-11 05:14:53 +00:00
|
|
|
#include "gdkkeysprivate.h"
|
|
|
|
#include "gdkkeysyms.h"
|
2010-10-15 02:05:51 +00:00
|
|
|
#include "gdkprivate-x11.h"
|
|
|
|
#include "gdkdisplay-x11.h"
|
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
#ifdef HAVE_XKB
|
|
|
|
#include <X11/XKBlib.h>
|
2002-05-14 19:15:46 +00:00
|
|
|
|
|
|
|
/* OSF-4.0 is apparently missing this macro
|
|
|
|
*/
|
|
|
|
# ifndef XkbKeySymEntry
|
|
|
|
# define XkbKeySymEntry(d,k,sl,g) \
|
2010-12-16 04:49:31 +00:00
|
|
|
(XkbKeySym(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))))
|
2002-05-14 19:15:46 +00:00
|
|
|
# endif
|
|
|
|
#endif /* HAVE_XKB */
|
2002-04-25 22:29:14 +00:00
|
|
|
|
2004-11-29 14:25:22 +00:00
|
|
|
typedef struct _DirectionCacheEntry DirectionCacheEntry;
|
|
|
|
|
|
|
|
struct _DirectionCacheEntry
|
|
|
|
{
|
|
|
|
guint serial;
|
|
|
|
Atom group_atom;
|
|
|
|
PangoDirection direction;
|
|
|
|
};
|
|
|
|
|
2010-12-21 04:32:48 +00:00
|
|
|
struct _GdkX11Keymap
|
2002-04-25 22:29:14 +00:00
|
|
|
{
|
|
|
|
GdkKeymap parent_instance;
|
2004-11-29 14:25:22 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
gint min_keycode;
|
|
|
|
gint max_keycode;
|
|
|
|
KeySym* keymap;
|
|
|
|
gint keysyms_per_keycode;
|
|
|
|
XModifierKeymap* mod_keymap;
|
2002-10-18 19:26:43 +00:00
|
|
|
guint lock_keysym;
|
2002-04-25 22:29:14 +00:00
|
|
|
GdkModifierType group_switch_mask;
|
2002-10-18 19:26:43 +00:00
|
|
|
GdkModifierType num_lock_mask;
|
2005-09-06 17:56:01 +00:00
|
|
|
GdkModifierType modmap[8];
|
2002-04-25 22:29:14 +00:00
|
|
|
PangoDirection current_direction;
|
2008-09-29 20:40:45 +00:00
|
|
|
guint sun_keypad : 1;
|
|
|
|
guint have_direction : 1;
|
|
|
|
guint caps_lock_state : 1;
|
2010-07-01 22:45:06 +00:00
|
|
|
guint num_lock_state : 1;
|
2002-04-25 22:29:14 +00:00
|
|
|
guint current_serial;
|
2004-11-29 14:25:22 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
#ifdef HAVE_XKB
|
|
|
|
XkbDescPtr xkb_desc;
|
2004-11-29 14:25:22 +00:00
|
|
|
/* We cache the directions */
|
|
|
|
Atom current_group_atom;
|
|
|
|
guint current_cache_serial;
|
|
|
|
/* A cache of size four should be more than enough, people usually
|
|
|
|
* have two groups around, and the xkb limit is four. It still
|
|
|
|
* works correct for more than four groups. It's just the
|
|
|
|
* cache.
|
|
|
|
*/
|
|
|
|
DirectionCacheEntry group_direction_cache[4];
|
2002-04-25 22:29:14 +00:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2010-12-21 04:32:48 +00:00
|
|
|
struct _GdkX11KeymapClass
|
2002-04-25 22:29:14 +00:00
|
|
|
{
|
2010-12-21 04:32:48 +00:00
|
|
|
GdkKeymapClass parent_class;
|
|
|
|
};
|
2002-04-25 22:29:14 +00:00
|
|
|
|
2010-12-21 04:32:48 +00:00
|
|
|
#define KEYMAP_USE_XKB(keymap) GDK_X11_DISPLAY ((keymap)->display)->use_xkb
|
|
|
|
#define KEYMAP_XDISPLAY(keymap) GDK_DISPLAY_XDISPLAY ((keymap)->display)
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2010-12-21 04:32:48 +00:00
|
|
|
G_DEFINE_TYPE (GdkX11Keymap, gdk_x11_keymap, GDK_TYPE_KEYMAP)
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
|
|
static void
|
2010-12-21 04:32:48 +00:00
|
|
|
gdk_x11_keymap_init (GdkX11Keymap *keymap)
|
2002-04-25 22:29:14 +00:00
|
|
|
{
|
|
|
|
keymap->min_keycode = 0;
|
|
|
|
keymap->max_keycode = 0;
|
|
|
|
|
|
|
|
keymap->keymap = NULL;
|
|
|
|
keymap->keysyms_per_keycode = 0;
|
|
|
|
keymap->mod_keymap = NULL;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-10-18 19:26:43 +00:00
|
|
|
keymap->num_lock_mask = 0;
|
2003-08-25 20:22:39 +00:00
|
|
|
keymap->sun_keypad = FALSE;
|
2002-04-25 22:29:14 +00:00
|
|
|
keymap->group_switch_mask = 0;
|
2010-09-08 17:35:51 +00:00
|
|
|
keymap->lock_keysym = GDK_KEY_Caps_Lock;
|
2002-04-25 22:29:14 +00:00
|
|
|
keymap->have_direction = FALSE;
|
2004-11-29 14:25:22 +00:00
|
|
|
keymap->current_serial = 0;
|
|
|
|
|
2002-10-16 19:20:57 +00:00
|
|
|
#ifdef HAVE_XKB
|
2002-04-25 22:29:14 +00:00
|
|
|
keymap->xkb_desc = NULL;
|
2004-11-29 14:25:22 +00:00
|
|
|
keymap->current_group_atom = 0;
|
|
|
|
keymap->current_cache_serial = 0;
|
2002-10-16 19:20:57 +00:00
|
|
|
#endif
|
2000-12-06 05:31:30 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
}
|
2000-12-06 05:31:30 +00:00
|
|
|
|
2005-11-10 12:09:42 +00:00
|
|
|
static void
|
2010-12-21 04:32:48 +00:00
|
|
|
gdk_x11_keymap_finalize (GObject *object)
|
2005-11-10 12:09:42 +00:00
|
|
|
{
|
2010-12-21 04:32:48 +00:00
|
|
|
GdkX11Keymap *keymap_x11 = GDK_X11_KEYMAP (object);
|
2005-11-10 12:09:42 +00:00
|
|
|
|
|
|
|
if (keymap_x11->keymap)
|
|
|
|
XFree (keymap_x11->keymap);
|
|
|
|
|
|
|
|
if (keymap_x11->mod_keymap)
|
|
|
|
XFreeModifiermap (keymap_x11->mod_keymap);
|
|
|
|
|
|
|
|
#ifdef HAVE_XKB
|
|
|
|
if (keymap_x11->xkb_desc)
|
2006-08-06 06:01:18 +00:00
|
|
|
XkbFreeKeyboard (keymap_x11->xkb_desc, XkbAllComponentsMask, True);
|
2005-11-10 12:09:42 +00:00
|
|
|
#endif
|
|
|
|
|
2010-12-21 04:32:48 +00:00
|
|
|
G_OBJECT_CLASS (gdk_x11_keymap_parent_class)->finalize (object);
|
2005-11-10 12:09:42 +00:00
|
|
|
}
|
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
static inline void
|
2010-12-21 04:32:48 +00:00
|
|
|
update_keyrange (GdkX11Keymap *keymap_x11)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
if (keymap_x11->max_keycode == 0)
|
|
|
|
XDisplayKeycodes (KEYMAP_XDISPLAY (GDK_KEYMAP (keymap_x11)),
|
2010-12-16 04:49:31 +00:00
|
|
|
&keymap_x11->min_keycode, &keymap_x11->max_keycode);
|
2000-12-06 05:31:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_XKB
|
|
|
|
|
2005-09-06 17:56:01 +00:00
|
|
|
static void
|
|
|
|
update_modmap (Display *display,
|
2010-12-21 04:32:48 +00:00
|
|
|
GdkX11Keymap *keymap_x11)
|
2005-09-06 17:56:01 +00:00
|
|
|
{
|
|
|
|
static struct {
|
|
|
|
const gchar *name;
|
|
|
|
Atom atom;
|
|
|
|
GdkModifierType mask;
|
|
|
|
} vmods[] = {
|
|
|
|
{ "Meta", 0, GDK_META_MASK },
|
|
|
|
{ "Super", 0, GDK_SUPER_MASK },
|
|
|
|
{ "Hyper", 0, GDK_HYPER_MASK },
|
|
|
|
{ NULL, 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
gint i, j, k;
|
|
|
|
|
|
|
|
if (!vmods[0].atom)
|
|
|
|
for (i = 0; vmods[i].name; i++)
|
|
|
|
vmods[i].atom = XInternAtom (display, vmods[i].name, FALSE);
|
|
|
|
|
2005-09-07 01:31:23 +00:00
|
|
|
for (i = 0; i < 8; i++)
|
|
|
|
keymap_x11->modmap[i] = 1 << i;
|
|
|
|
|
2005-09-06 17:56:01 +00:00
|
|
|
for (i = 0; i < XkbNumVirtualMods; i++)
|
|
|
|
{
|
|
|
|
for (j = 0; vmods[j].atom; j++)
|
2010-12-16 04:49:31 +00:00
|
|
|
{
|
|
|
|
if (keymap_x11->xkb_desc->names->vmods[i] == vmods[j].atom)
|
|
|
|
{
|
|
|
|
for (k = 0; k < 8; k++)
|
|
|
|
{
|
|
|
|
if (keymap_x11->xkb_desc->server->vmods[i] & (1 << k))
|
|
|
|
keymap_x11->modmap[k] |= vmods[j].mask;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-09-06 17:56:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
static XkbDescPtr
|
2010-12-21 04:32:48 +00:00
|
|
|
get_xkb (GdkX11Keymap *keymap_x11)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
2010-12-20 18:20:10 +00:00
|
|
|
GdkX11Display *display_x11 = GDK_X11_DISPLAY (GDK_KEYMAP (keymap_x11)->display);
|
2002-04-25 22:29:14 +00:00
|
|
|
Display *xdisplay = display_x11->xdisplay;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
update_keyrange (keymap_x11);
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
if (keymap_x11->xkb_desc == NULL)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
2005-09-09 22:50:15 +00:00
|
|
|
keymap_x11->xkb_desc = XkbGetMap (xdisplay, XkbKeySymsMask | XkbKeyTypesMask | XkbModifierMapMask | XkbVirtualModsMask, XkbUseCoreKbd);
|
2002-04-25 22:29:14 +00:00
|
|
|
if (keymap_x11->xkb_desc == NULL)
|
2006-04-12 04:20:28 +00:00
|
|
|
{
|
2010-12-16 04:49:31 +00:00
|
|
|
g_error ("Failed to get keymap");
|
2006-04-12 04:20:28 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2001-06-08 16:07:00 +00:00
|
|
|
|
2005-09-06 17:56:01 +00:00
|
|
|
XkbGetNames (xdisplay, XkbGroupNamesMask | XkbVirtualModNamesMask, keymap_x11->xkb_desc);
|
|
|
|
|
|
|
|
update_modmap (xdisplay, keymap_x11);
|
2000-12-06 05:31:30 +00:00
|
|
|
}
|
2002-04-25 22:29:14 +00:00
|
|
|
else if (keymap_x11->current_serial != display_x11->keymap_serial)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
2005-09-09 22:50:15 +00:00
|
|
|
XkbGetUpdatedMap (xdisplay, XkbKeySymsMask | XkbKeyTypesMask | XkbModifierMapMask | XkbVirtualModsMask,
|
2010-12-16 04:49:31 +00:00
|
|
|
keymap_x11->xkb_desc);
|
2005-09-06 17:56:01 +00:00
|
|
|
XkbGetNames (xdisplay, XkbGroupNamesMask | XkbVirtualModNamesMask, keymap_x11->xkb_desc);
|
|
|
|
|
|
|
|
update_modmap (xdisplay, keymap_x11);
|
2000-12-06 05:31:30 +00:00
|
|
|
}
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
keymap_x11->current_serial = display_x11->keymap_serial;
|
2000-12-06 05:31:30 +00:00
|
|
|
|
2010-07-01 22:45:06 +00:00
|
|
|
if (keymap_x11->num_lock_mask == 0)
|
|
|
|
keymap_x11->num_lock_mask = XkbKeysymToModifiers (KEYMAP_XDISPLAY (GDK_KEYMAP (keymap_x11)), XK_Num_Lock);
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
return keymap_x11->xkb_desc;
|
2000-12-06 05:31:30 +00:00
|
|
|
}
|
|
|
|
#endif /* HAVE_XKB */
|
|
|
|
|
2001-03-03 21:34:19 +00:00
|
|
|
/* Whether we were able to turn on detectable-autorepeat using
|
|
|
|
* XkbSetDetectableAutorepeat. If FALSE, we'll fall back
|
|
|
|
* to checking the next event with XPending().
|
|
|
|
*/
|
|
|
|
|
2002-03-04 20:19:04 +00:00
|
|
|
/* Find the index of the group/level pair within the keysyms for a key.
|
2004-06-25 15:21:43 +00:00
|
|
|
* We round up the number of keysyms per keycode to the next even number,
|
|
|
|
* otherwise we lose a whole group of keys
|
2002-03-04 20:19:04 +00:00
|
|
|
*/
|
2002-04-25 22:29:14 +00:00
|
|
|
#define KEYSYM_INDEX(keymap_impl, group, level) \
|
2004-11-29 14:25:22 +00:00
|
|
|
(2 * ((group) % (gint)((keymap_impl->keysyms_per_keycode + 1) / 2)) + (level))
|
2002-10-18 19:26:43 +00:00
|
|
|
#define KEYSYM_IS_KEYPAD(s) (((s) >= 0xff80 && (s) <= 0xffbd) || \
|
|
|
|
((s) >= 0x11000000 && (s) <= 0x1100ffff))
|
2002-03-04 20:19:04 +00:00
|
|
|
|
2004-11-29 14:25:22 +00:00
|
|
|
static gint
|
|
|
|
get_symbol (const KeySym *syms,
|
2010-12-21 04:32:48 +00:00
|
|
|
GdkX11Keymap *keymap_x11,
|
|
|
|
gint group,
|
|
|
|
gint level)
|
2004-06-25 15:21:43 +00:00
|
|
|
{
|
2004-11-29 14:25:22 +00:00
|
|
|
gint index;
|
2004-06-25 15:21:43 +00:00
|
|
|
|
|
|
|
index = KEYSYM_INDEX(keymap_x11, group, level);
|
2005-11-10 17:38:09 +00:00
|
|
|
if (index >= keymap_x11->keysyms_per_keycode)
|
2004-06-25 15:21:43 +00:00
|
|
|
return NoSymbol;
|
|
|
|
|
|
|
|
return syms[index];
|
|
|
|
}
|
|
|
|
|
2005-11-10 17:38:09 +00:00
|
|
|
static void
|
2010-12-16 04:49:31 +00:00
|
|
|
set_symbol (KeySym *syms,
|
2010-12-21 04:32:48 +00:00
|
|
|
GdkX11Keymap *keymap_x11,
|
2010-12-16 04:49:31 +00:00
|
|
|
gint group,
|
|
|
|
gint level,
|
|
|
|
KeySym sym)
|
2005-11-10 17:38:09 +00:00
|
|
|
{
|
|
|
|
gint index;
|
|
|
|
|
|
|
|
index = KEYSYM_INDEX(keymap_x11, group, level);
|
|
|
|
if (index >= keymap_x11->keysyms_per_keycode)
|
|
|
|
return;
|
|
|
|
|
|
|
|
syms[index] = sym;
|
|
|
|
}
|
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
static void
|
2010-12-21 04:32:48 +00:00
|
|
|
update_keymaps (GdkX11Keymap *keymap_x11)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
2010-12-20 18:20:10 +00:00
|
|
|
GdkX11Display *display_x11 = GDK_X11_DISPLAY (GDK_KEYMAP (keymap_x11)->display);
|
2002-04-25 22:29:14 +00:00
|
|
|
Display *xdisplay = display_x11->xdisplay;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
#ifdef HAVE_XKB
|
2002-04-25 22:29:14 +00:00
|
|
|
g_assert (!KEYMAP_USE_XKB (GDK_KEYMAP (keymap_x11)));
|
2000-12-06 05:31:30 +00:00
|
|
|
#endif
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
if (keymap_x11->keymap == NULL ||
|
|
|
|
keymap_x11->current_serial != display_x11->keymap_serial)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gint map_size;
|
2002-03-04 20:19:04 +00:00
|
|
|
gint keycode;
|
2001-09-03 01:43:53 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
keymap_x11->current_serial = display_x11->keymap_serial;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
update_keyrange (keymap_x11);
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
if (keymap_x11->keymap)
|
|
|
|
XFree (keymap_x11->keymap);
|
2000-12-06 05:31:30 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
if (keymap_x11->mod_keymap)
|
|
|
|
XFreeModifiermap (keymap_x11->mod_keymap);
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
keymap_x11->keymap = XGetKeyboardMapping (xdisplay, keymap_x11->min_keycode,
|
2010-12-16 04:49:31 +00:00
|
|
|
keymap_x11->max_keycode - keymap_x11->min_keycode + 1,
|
|
|
|
&keymap_x11->keysyms_per_keycode);
|
2000-12-06 05:31:30 +00:00
|
|
|
|
2002-03-04 20:19:04 +00:00
|
|
|
|
2010-10-05 23:18:25 +00:00
|
|
|
/* GDK_KEY_ISO_Left_Tab, as usually configured through XKB, really messes
|
2002-03-04 20:19:04 +00:00
|
|
|
* up the whole idea of "consumed modifiers" because shift is consumed.
|
2010-10-05 23:18:25 +00:00
|
|
|
* However, <shift>Tab is not usually GDK_KEY_ISO_Left_Tab without XKB,
|
2002-03-04 20:19:04 +00:00
|
|
|
* we we fudge the map here.
|
|
|
|
*/
|
2002-04-25 22:29:14 +00:00
|
|
|
keycode = keymap_x11->min_keycode;
|
2002-10-04 18:59:49 +00:00
|
|
|
while (keycode <= keymap_x11->max_keycode)
|
2002-03-04 20:19:04 +00:00
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
KeySym *syms = keymap_x11->keymap + (keycode - keymap_x11->min_keycode) * keymap_x11->keysyms_per_keycode;
|
2010-12-16 04:49:31 +00:00
|
|
|
/* Check both groups */
|
|
|
|
for (i = 0 ; i < 2 ; i++)
|
|
|
|
{
|
|
|
|
if (get_symbol (syms, keymap_x11, i, 0) == GDK_KEY_Tab)
|
|
|
|
set_symbol (syms, keymap_x11, i, 1, GDK_KEY_ISO_Left_Tab);
|
|
|
|
}
|
2002-03-15 10:06:02 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If there is one keysym and the key symbol has upper and lower
|
|
|
|
* case variants fudge the keymap
|
|
|
|
*/
|
2004-06-25 15:21:43 +00:00
|
|
|
if (get_symbol (syms, keymap_x11, 0, 1) == 0)
|
2002-03-15 10:06:02 +00:00
|
|
|
{
|
|
|
|
guint lower;
|
|
|
|
guint upper;
|
|
|
|
|
2004-06-25 15:21:43 +00:00
|
|
|
gdk_keyval_convert_case (get_symbol (syms, keymap_x11, 0, 0), &lower, &upper);
|
2002-03-15 10:06:02 +00:00
|
|
|
if (lower != upper)
|
|
|
|
{
|
2010-12-16 04:49:31 +00:00
|
|
|
set_symbol (syms, keymap_x11, 0, 0, lower);
|
|
|
|
set_symbol (syms, keymap_x11, 0, 1, upper);
|
2002-03-15 10:06:02 +00:00
|
|
|
}
|
|
|
|
}
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-03-04 20:19:04 +00:00
|
|
|
++keycode;
|
|
|
|
}
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
keymap_x11->mod_keymap = XGetModifierMapping (xdisplay);
|
2000-12-06 05:31:30 +00:00
|
|
|
|
2010-09-08 17:35:51 +00:00
|
|
|
keymap_x11->lock_keysym = GDK_KEY_VoidSymbol;
|
2002-04-25 22:29:14 +00:00
|
|
|
keymap_x11->group_switch_mask = 0;
|
2002-10-18 19:26:43 +00:00
|
|
|
keymap_x11->num_lock_mask = 0;
|
2005-09-07 01:31:23 +00:00
|
|
|
|
|
|
|
for (i = 0; i < 8; i++)
|
2010-12-16 04:49:31 +00:00
|
|
|
keymap_x11->modmap[i] = 1 << i;
|
|
|
|
|
2003-08-25 20:22:39 +00:00
|
|
|
/* There are 8 sets of modifiers, with each set containing
|
|
|
|
* max_keypermod keycodes.
|
2000-12-06 05:31:30 +00:00
|
|
|
*/
|
2002-04-25 22:29:14 +00:00
|
|
|
map_size = 8 * keymap_x11->mod_keymap->max_keypermod;
|
2003-08-25 20:22:39 +00:00
|
|
|
for (i = 0; i < map_size; i++)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
2003-08-25 20:22:39 +00:00
|
|
|
/* Get the key code at this point in the map. */
|
2002-04-25 22:29:14 +00:00
|
|
|
gint keycode = keymap_x11->mod_keymap->modifiermap[i];
|
2003-08-25 20:22:39 +00:00
|
|
|
gint j;
|
|
|
|
KeySym *syms;
|
2010-12-16 04:49:31 +00:00
|
|
|
guint mask;
|
2003-08-25 20:22:39 +00:00
|
|
|
|
|
|
|
/* Ignore invalid keycodes. */
|
|
|
|
if (keycode < keymap_x11->min_keycode ||
|
|
|
|
keycode > keymap_x11->max_keycode)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
syms = keymap_x11->keymap + (keycode - keymap_x11->min_keycode) * keymap_x11->keysyms_per_keycode;
|
|
|
|
|
2010-12-16 04:49:31 +00:00
|
|
|
mask = 0;
|
|
|
|
for (j = 0; j < keymap_x11->keysyms_per_keycode; j++)
|
|
|
|
{
|
|
|
|
if (syms[j] == GDK_KEY_Meta_L ||
|
|
|
|
syms[j] == GDK_KEY_Meta_R)
|
|
|
|
mask |= GDK_META_MASK;
|
|
|
|
else if (syms[j] == GDK_KEY_Hyper_L ||
|
|
|
|
syms[j] == GDK_KEY_Hyper_R)
|
|
|
|
mask |= GDK_HYPER_MASK;
|
|
|
|
else if (syms[j] == GDK_KEY_Super_L ||
|
|
|
|
syms[j] == GDK_KEY_Super_R)
|
|
|
|
mask |= GDK_SUPER_MASK;
|
|
|
|
}
|
|
|
|
|
|
|
|
keymap_x11->modmap[i/keymap_x11->mod_keymap->max_keypermod] |= mask;
|
2005-09-06 17:56:01 +00:00
|
|
|
|
2003-08-25 20:22:39 +00:00
|
|
|
/* The fourth modifier, GDK_MOD1_MASK is 1 << 3.
|
2010-12-16 04:49:31 +00:00
|
|
|
* Each group of max_keypermod entries refers to the same modifier.
|
2003-08-25 20:22:39 +00:00
|
|
|
*/
|
2003-08-26 14:04:52 +00:00
|
|
|
mask = 1 << (i / keymap_x11->mod_keymap->max_keypermod);
|
2003-08-25 20:22:39 +00:00
|
|
|
|
|
|
|
switch (mask)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
2003-08-25 20:22:39 +00:00
|
|
|
case GDK_LOCK_MASK:
|
|
|
|
/* Get the Lock keysym. If any keysym bound to the Lock modifier
|
|
|
|
* is Caps_Lock, we will interpret the modifier as Caps_Lock;
|
|
|
|
* otherwise, if any is bound to Shift_Lock, we will interpret
|
|
|
|
* the modifier as Shift_Lock. Otherwise, the lock modifier
|
2010-12-16 04:49:31 +00:00
|
|
|
* has no effect.
|
2003-08-25 20:22:39 +00:00
|
|
|
*/
|
2010-12-16 04:49:31 +00:00
|
|
|
for (j = 0; j < keymap_x11->keysyms_per_keycode; j++)
|
|
|
|
{
|
|
|
|
if (syms[j] == GDK_KEY_Caps_Lock)
|
|
|
|
keymap_x11->lock_keysym = GDK_KEY_Caps_Lock;
|
|
|
|
else if (syms[j] == GDK_KEY_Shift_Lock &&
|
|
|
|
keymap_x11->lock_keysym == GDK_KEY_VoidSymbol)
|
|
|
|
keymap_x11->lock_keysym = GDK_KEY_Shift_Lock;
|
|
|
|
}
|
2003-08-25 20:22:39 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_CONTROL_MASK:
|
|
|
|
case GDK_SHIFT_MASK:
|
|
|
|
case GDK_MOD1_MASK:
|
|
|
|
/* Some keyboard maps are known to map Mode_Switch as an
|
|
|
|
* extra Mod1 key. In circumstances like that, it won't be
|
|
|
|
* used to switch groups.
|
|
|
|
*/
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
/* Find the Mode_Switch and Num_Lock modifiers. */
|
2002-10-18 19:26:43 +00:00
|
|
|
for (j = 0; j < keymap_x11->keysyms_per_keycode; j++)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
2010-09-08 17:35:51 +00:00
|
|
|
if (syms[j] == GDK_KEY_Mode_switch)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
|
|
|
/* This modifier swaps groups */
|
2002-10-07 16:06:31 +00:00
|
|
|
keymap_x11->group_switch_mask |= mask;
|
2000-12-06 05:31:30 +00:00
|
|
|
}
|
2010-09-08 17:35:51 +00:00
|
|
|
else if (syms[j] == GDK_KEY_Num_Lock)
|
2002-10-18 19:26:43 +00:00
|
|
|
{
|
2003-08-25 20:22:39 +00:00
|
|
|
/* This modifier is used for Num_Lock */
|
2002-10-18 19:26:43 +00:00
|
|
|
keymap_x11->num_lock_mask |= mask;
|
|
|
|
}
|
2000-12-06 05:31:30 +00:00
|
|
|
}
|
2003-08-25 20:22:39 +00:00
|
|
|
break;
|
2000-12-06 05:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
2003-08-25 20:22:39 +00:00
|
|
|
|
|
|
|
/* Hack: The Sun X server puts the keysym to use when the Num Lock
|
|
|
|
* modifier is on in the third element of the keysym array, instead
|
|
|
|
* of the second.
|
|
|
|
*/
|
|
|
|
if ((strcmp (ServerVendor (xdisplay), "Sun Microsystems, Inc.") == 0) &&
|
|
|
|
(keymap_x11->keysyms_per_keycode > 2))
|
|
|
|
keymap_x11->sun_keypad = TRUE;
|
|
|
|
else
|
|
|
|
keymap_x11->sun_keypad = FALSE;
|
2000-12-06 05:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static const KeySym*
|
2010-12-21 04:32:48 +00:00
|
|
|
get_keymap (GdkX11Keymap *keymap_x11)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
update_keymaps (keymap_x11);
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
return keymap_x11->keymap;
|
2000-12-06 05:31:30 +00:00
|
|
|
}
|
|
|
|
|
2004-04-18 15:10:59 +00:00
|
|
|
#define GET_EFFECTIVE_KEYMAP(keymap) get_effective_keymap ((keymap), G_STRFUNC)
|
|
|
|
|
2004-05-10 20:51:19 +00:00
|
|
|
static GdkKeymap *
|
2004-04-18 15:10:59 +00:00
|
|
|
get_effective_keymap (GdkKeymap *keymap,
|
2010-12-16 04:49:31 +00:00
|
|
|
const char *function)
|
2004-04-18 15:10:59 +00:00
|
|
|
{
|
|
|
|
if (!keymap)
|
|
|
|
{
|
|
|
|
GDK_NOTE (MULTIHEAD,
|
2010-12-16 04:49:31 +00:00
|
|
|
g_message ("reverting to default display keymap in %s",
|
|
|
|
function));
|
2004-04-18 15:10:59 +00:00
|
|
|
return gdk_keymap_get_default ();
|
|
|
|
}
|
|
|
|
|
|
|
|
return keymap;
|
|
|
|
}
|
|
|
|
|
2001-06-08 16:07:00 +00:00
|
|
|
#if HAVE_XKB
|
Make gdkx.h the only installed header from gdk/x11. All structures in
Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com>
Make gdkx.h the only installed header from gdk/x11.
All structures in gdk/x11 are opaque.
* gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h:
Don't install gdk{drawable,pixmap,window}-x11.h.
* gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c:
Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11,
GdkVisualClass into C files.
* gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static.
* gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c,
gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c}
Add public functions to replace previously exported direct
structure access.
gdk_x11_colormap_get_{xdisplay,xcolormap}
gdk_x11_cursor_get_{xdisplay,xcursor},
gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual,
gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage},
gdk_x11_gc_get_{xdisplay,ximage}
* gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo,
GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals.
Fix a number of variables and functions that were exported
"accidentally" from GDK.
* gdk/**.[ch]: gdk => _gdk for gdk_visual_init,
gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit,
gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data,
gdk_event_notify, gdk_queued_events, gdk_queued_tail,
gdk_event_new, gdk_events_queue, gdk_events_unqueue,
gdk_event_queue_find_first, gdk_event_queue_remove_link,
gdk_event_queue_append, gdk_event_button_generate,
gdk_debug_flags, gdk_default_filters, gdk_parent_root.
* gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c,
gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}:
gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks,
gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window,
gdk_use_xshm, gdk_input_ignore_core.
* gdk/x11/xsettings-common.h (xsettings_list_insert): Add
#defines to namespace functions into the private _gdk_
namespace.
* gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window ()
to replace gdk_parent_root exported variable. Adjust and
deprecate GDK_ROOT_PARENT().
* demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix
GDK_ROOT_PARENT usage, remove includes of port-specific
headers.
* gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for
_gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core,
gdk_input_devices, _gdk_input_windows, gdk_init_input_core.
* gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c}
docs/Changes-2.0.txt: Remove gdk_wm_protocols,
gdk_wm_delete_window functions, gdk_wm_take_focus,
use gdk_atom_intern() instead.
* gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h}
gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h}
gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h}
gtk/gtkselection.c
Unexport gdk_selection_property, just use
gdk_atom_intern ("GDK_SELECTION").
* gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}:
Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type,
GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate,
GdkVisualprivate, gdk_x11_gc_flush.
Make a number of public exports of variables into functions
to increase encapsulation.
* gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h
gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer,
move to gdkinternals.h. Add gdk_device_get_core_pointer ().
* gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h
docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code,
gdk_error_warnings.
* gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h}
docs/Changes-2.0.txt:
s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen()
s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow()
Add gdk_x11_get_default_xdisplay().
* gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c
win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c
gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class,
Don't export gdk_progclass, move --class command line
option and handling to common portion of GDK.
Miscellaneous fixes:
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix
g_return_val_if_fail that should have been g_return_if_fail.
* gdk/gdkinternals.h gdk/gdkprivate.h: Move
gdk_synthesize_window_state() to the semi-public gdkprivate.h.
* gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded
X11 dependency.
* gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO:
Remove unused gdk_key_repeat_disable/restore.
* linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c
x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def:
Remove unused gdk_null_window_warnings variable.
* gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox;
it can be retrieved from the repository; it is too far
from functional to be worth having people check out;
it would be easier to start from scratch, I suspect.
* gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID().
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
Add some space for future expansion to multihead.
* gdk/gdkdrawable.h: Add four reserved function pointers
for future expansion of GdkDrawableClass.
* gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer
where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
|
|
|
static PangoDirection
|
2010-12-16 04:49:31 +00:00
|
|
|
get_direction (XkbDescRec *xkb,
|
2010-12-21 04:32:48 +00:00
|
|
|
gint group)
|
2004-11-29 14:25:22 +00:00
|
|
|
{
|
|
|
|
gint code;
|
|
|
|
|
|
|
|
gint rtl_minus_ltr = 0; /* total number of RTL keysyms minus LTR ones */
|
|
|
|
|
|
|
|
for (code = xkb->min_key_code; code <= xkb->max_key_code; code++)
|
|
|
|
{
|
2006-09-20 17:47:28 +00:00
|
|
|
gint level = 0;
|
|
|
|
KeySym sym = XkbKeySymEntry (xkb, code, level, group);
|
|
|
|
PangoDirection dir = pango_unichar_direction (gdk_keyval_to_unicode (sym));
|
2004-11-29 14:25:22 +00:00
|
|
|
|
2006-09-20 17:47:28 +00:00
|
|
|
switch (dir)
|
2010-12-16 04:49:31 +00:00
|
|
|
{
|
|
|
|
case PANGO_DIRECTION_RTL:
|
|
|
|
rtl_minus_ltr++;
|
|
|
|
break;
|
|
|
|
case PANGO_DIRECTION_LTR:
|
|
|
|
rtl_minus_ltr--;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2004-11-29 14:25:22 +00:00
|
|
|
}
|
2006-09-20 17:47:28 +00:00
|
|
|
|
2004-11-29 14:25:22 +00:00
|
|
|
if (rtl_minus_ltr > 0)
|
|
|
|
return PANGO_DIRECTION_RTL;
|
|
|
|
else
|
|
|
|
return PANGO_DIRECTION_LTR;
|
|
|
|
}
|
|
|
|
|
2007-06-30 01:43:04 +00:00
|
|
|
static PangoDirection
|
2010-12-21 04:32:48 +00:00
|
|
|
get_direction_from_cache (GdkX11Keymap *keymap_x11,
|
|
|
|
XkbDescPtr xkb,
|
|
|
|
gint group)
|
2001-06-08 16:07:00 +00:00
|
|
|
{
|
2007-06-30 01:43:04 +00:00
|
|
|
Atom group_atom = xkb->names->groups[group];
|
2001-06-08 16:07:00 +00:00
|
|
|
|
2007-06-30 01:43:04 +00:00
|
|
|
gboolean cache_hit = FALSE;
|
|
|
|
DirectionCacheEntry *cache = keymap_x11->group_direction_cache;
|
2004-11-29 14:25:22 +00:00
|
|
|
|
2007-06-30 01:43:04 +00:00
|
|
|
PangoDirection direction = PANGO_DIRECTION_NEUTRAL;
|
|
|
|
gint i;
|
2002-04-25 22:29:14 +00:00
|
|
|
|
2007-06-30 01:43:04 +00:00
|
|
|
if (keymap_x11->have_direction)
|
|
|
|
{
|
|
|
|
/* lookup in cache */
|
|
|
|
for (i = 0; i < G_N_ELEMENTS (keymap_x11->group_direction_cache); i++)
|
|
|
|
{
|
2010-12-16 04:49:31 +00:00
|
|
|
if (cache[i].group_atom == group_atom)
|
|
|
|
{
|
|
|
|
cache_hit = TRUE;
|
|
|
|
cache[i].serial = keymap_x11->current_cache_serial++; /* freshen */
|
|
|
|
direction = cache[i].direction;
|
|
|
|
group_atom = cache[i].group_atom;
|
|
|
|
break;
|
|
|
|
}
|
2007-06-30 01:43:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* initialize cache */
|
|
|
|
for (i = 0; i < G_N_ELEMENTS (keymap_x11->group_direction_cache); i++)
|
2010-12-16 04:49:31 +00:00
|
|
|
{
|
|
|
|
cache[i].group_atom = 0;
|
|
|
|
cache[i].serial = keymap_x11->current_cache_serial;
|
|
|
|
}
|
2007-06-30 01:43:04 +00:00
|
|
|
keymap_x11->current_cache_serial++;
|
|
|
|
}
|
2004-11-29 14:25:22 +00:00
|
|
|
|
2007-06-30 01:43:04 +00:00
|
|
|
/* insert in cache */
|
|
|
|
if (!cache_hit)
|
|
|
|
{
|
|
|
|
gint oldest = 0;
|
2004-11-29 14:25:22 +00:00
|
|
|
|
2007-06-30 01:43:04 +00:00
|
|
|
direction = get_direction (xkb, group);
|
2004-11-29 14:25:22 +00:00
|
|
|
|
2007-06-30 01:43:04 +00:00
|
|
|
/* remove the oldest entry */
|
|
|
|
for (i = 0; i < G_N_ELEMENTS (keymap_x11->group_direction_cache); i++)
|
2010-12-16 04:49:31 +00:00
|
|
|
{
|
|
|
|
if (cache[i].serial < cache[oldest].serial)
|
|
|
|
oldest = i;
|
|
|
|
}
|
|
|
|
|
2007-06-30 01:43:04 +00:00
|
|
|
cache[oldest].group_atom = group_atom;
|
|
|
|
cache[oldest].direction = direction;
|
|
|
|
cache[oldest].serial = keymap_x11->current_cache_serial++;
|
|
|
|
}
|
2004-11-29 14:25:22 +00:00
|
|
|
|
2007-06-30 01:43:04 +00:00
|
|
|
return direction;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
get_num_groups (GdkKeymap *keymap,
|
2010-12-16 04:49:31 +00:00
|
|
|
XkbDescPtr xkb)
|
2007-06-30 01:43:04 +00:00
|
|
|
{
|
|
|
|
Display *display = KEYMAP_XDISPLAY (keymap);
|
|
|
|
XkbGetControls(display, XkbSlowKeysMask, xkb);
|
|
|
|
XkbGetUpdatedMap (display, XkbKeySymsMask | XkbKeyTypesMask |
|
2010-12-16 04:49:31 +00:00
|
|
|
XkbModifierMapMask | XkbVirtualModsMask, xkb);
|
2007-06-30 01:43:04 +00:00
|
|
|
return xkb->ctrls->num_groups;
|
|
|
|
}
|
2004-11-29 14:25:22 +00:00
|
|
|
|
2008-09-29 20:40:45 +00:00
|
|
|
static gboolean
|
2010-12-21 04:32:48 +00:00
|
|
|
update_direction (GdkX11Keymap *keymap_x11,
|
2010-12-16 04:49:31 +00:00
|
|
|
gint group)
|
2007-06-30 01:43:04 +00:00
|
|
|
{
|
|
|
|
XkbDescPtr xkb = get_xkb (keymap_x11);
|
|
|
|
Atom group_atom;
|
2008-09-29 20:40:45 +00:00
|
|
|
gboolean had_direction;
|
|
|
|
PangoDirection old_direction;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2008-09-29 20:40:45 +00:00
|
|
|
had_direction = keymap_x11->have_direction;
|
|
|
|
old_direction = keymap_x11->current_direction;
|
2007-06-30 01:43:04 +00:00
|
|
|
|
|
|
|
group_atom = xkb->names->groups[group];
|
|
|
|
|
|
|
|
/* a group change? */
|
|
|
|
if (!keymap_x11->have_direction || keymap_x11->current_group_atom != group_atom)
|
|
|
|
{
|
|
|
|
keymap_x11->current_direction = get_direction_from_cache (keymap_x11, xkb, group);
|
|
|
|
keymap_x11->current_group_atom = group_atom;
|
2004-11-29 14:25:22 +00:00
|
|
|
keymap_x11->have_direction = TRUE;
|
2001-09-07 11:43:20 +00:00
|
|
|
}
|
2008-09-29 20:40:45 +00:00
|
|
|
|
|
|
|
return !had_direction || old_direction != keymap_x11->current_direction;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2010-12-21 04:32:48 +00:00
|
|
|
update_lock_state (GdkX11Keymap *keymap_x11,
|
2008-09-29 20:40:45 +00:00
|
|
|
gint locked_mods)
|
|
|
|
{
|
|
|
|
gboolean caps_lock_state;
|
2010-07-01 22:45:06 +00:00
|
|
|
gboolean num_lock_state;
|
|
|
|
|
2008-09-29 20:40:45 +00:00
|
|
|
caps_lock_state = keymap_x11->caps_lock_state;
|
2010-07-01 22:45:06 +00:00
|
|
|
num_lock_state = keymap_x11->num_lock_state;
|
2008-09-29 20:40:45 +00:00
|
|
|
|
|
|
|
keymap_x11->caps_lock_state = (locked_mods & GDK_LOCK_MASK) != 0;
|
2010-07-01 22:45:06 +00:00
|
|
|
keymap_x11->num_lock_state = (locked_mods & keymap_x11->num_lock_mask) != 0;
|
|
|
|
|
|
|
|
return (caps_lock_state != keymap_x11->caps_lock_state)
|
|
|
|
|| (num_lock_state != keymap_x11->num_lock_state);
|
2001-06-08 16:07:00 +00:00
|
|
|
}
|
|
|
|
|
2010-12-16 04:49:31 +00:00
|
|
|
/* keep this in sync with the XkbSelectEventDetails()
|
|
|
|
* call in gdk_display_open()
|
2005-09-20 05:28:34 +00:00
|
|
|
*/
|
2001-06-08 16:07:00 +00:00
|
|
|
void
|
2010-12-16 04:49:31 +00:00
|
|
|
_gdk_x11_keymap_state_changed (GdkDisplay *display,
|
|
|
|
XEvent *xevent)
|
2001-06-08 16:07:00 +00:00
|
|
|
{
|
2010-12-20 18:20:10 +00:00
|
|
|
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
2005-09-20 05:28:34 +00:00
|
|
|
XkbEvent *xkb_event = (XkbEvent *)xevent;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
if (display_x11->keymap)
|
2001-06-08 16:07:00 +00:00
|
|
|
{
|
2010-12-21 04:32:48 +00:00
|
|
|
GdkX11Keymap *keymap_x11 = GDK_X11_KEYMAP (display_x11->keymap);
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2008-09-29 20:40:45 +00:00
|
|
|
if (update_direction (keymap_x11, XkbStateGroup (&xkb_event->state)))
|
2010-12-16 04:49:31 +00:00
|
|
|
g_signal_emit_by_name (keymap_x11, "direction-changed");
|
2008-09-29 20:40:45 +00:00
|
|
|
|
|
|
|
if (update_lock_state (keymap_x11, xkb_event->state.locked_mods))
|
2010-07-01 22:45:06 +00:00
|
|
|
g_signal_emit_by_name (keymap_x11, "state-changed");
|
2001-06-08 16:07:00 +00:00
|
|
|
}
|
|
|
|
}
|
2002-09-23 21:35:00 +00:00
|
|
|
|
2002-10-08 13:27:04 +00:00
|
|
|
#endif /* HAVE_XKB */
|
|
|
|
|
2002-09-23 21:35:00 +00:00
|
|
|
void
|
2010-12-16 04:49:31 +00:00
|
|
|
_gdk_x11_keymap_keys_changed (GdkDisplay *display)
|
2002-09-23 21:35:00 +00:00
|
|
|
{
|
2010-12-20 18:20:10 +00:00
|
|
|
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-09-23 21:35:00 +00:00
|
|
|
++display_x11->keymap_serial;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-09-23 21:35:00 +00:00
|
|
|
if (display_x11->keymap)
|
|
|
|
g_signal_emit_by_name (display_x11->keymap, "keys_changed", 0);
|
|
|
|
}
|
|
|
|
|
2010-12-06 19:01:12 +00:00
|
|
|
static PangoDirection
|
|
|
|
gdk_x11_keymap_get_direction (GdkKeymap *keymap)
|
2001-06-08 16:07:00 +00:00
|
|
|
{
|
2004-04-18 15:10:59 +00:00
|
|
|
keymap = GET_EFFECTIVE_KEYMAP (keymap);
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2001-06-21 17:45:26 +00:00
|
|
|
#if HAVE_XKB
|
2002-04-25 22:29:14 +00:00
|
|
|
if (KEYMAP_USE_XKB (keymap))
|
2001-06-08 16:07:00 +00:00
|
|
|
{
|
2010-12-21 04:32:48 +00:00
|
|
|
GdkX11Keymap *keymap_x11 = GDK_X11_KEYMAP (keymap);
|
2005-09-20 05:28:34 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
if (!keymap_x11->have_direction)
|
2010-12-16 04:49:31 +00:00
|
|
|
{
|
2010-12-21 04:32:48 +00:00
|
|
|
GdkDisplay *display = keymap->display;
|
2010-12-16 04:49:31 +00:00
|
|
|
XkbStateRec state_rec;
|
|
|
|
|
|
|
|
XkbGetState (GDK_DISPLAY_XDISPLAY (display), XkbUseCoreKbd,
|
|
|
|
&state_rec);
|
|
|
|
update_direction (keymap_x11, XkbStateGroup (&state_rec));
|
|
|
|
}
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
return keymap_x11->current_direction;
|
2001-06-21 17:45:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif /* HAVE_XKB */
|
2004-11-29 14:25:22 +00:00
|
|
|
return PANGO_DIRECTION_NEUTRAL;
|
2001-06-08 16:07:00 +00:00
|
|
|
}
|
|
|
|
|
2010-12-06 19:01:12 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_x11_keymap_have_bidi_layouts (GdkKeymap *keymap)
|
2007-06-30 01:43:04 +00:00
|
|
|
{
|
|
|
|
keymap = GET_EFFECTIVE_KEYMAP (keymap);
|
|
|
|
|
|
|
|
#if HAVE_XKB
|
|
|
|
if (KEYMAP_USE_XKB (keymap))
|
|
|
|
{
|
2010-12-21 04:32:48 +00:00
|
|
|
GdkX11Keymap *keymap_x11 = GDK_X11_KEYMAP (keymap);
|
2007-06-30 01:43:04 +00:00
|
|
|
XkbDescPtr xkb = get_xkb (keymap_x11);
|
|
|
|
int num_groups = get_num_groups (keymap, xkb);
|
|
|
|
|
|
|
|
int i;
|
|
|
|
gboolean have_ltr_keyboard = FALSE;
|
|
|
|
gboolean have_rtl_keyboard = FALSE;
|
|
|
|
|
|
|
|
for (i = 0; i < num_groups; i++)
|
|
|
|
{
|
2010-12-16 04:49:31 +00:00
|
|
|
if (get_direction_from_cache (keymap_x11, xkb, i) == PANGO_DIRECTION_RTL)
|
|
|
|
have_rtl_keyboard = TRUE;
|
|
|
|
else
|
|
|
|
have_ltr_keyboard = TRUE;
|
2007-06-30 01:43:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return have_ltr_keyboard && have_rtl_keyboard;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif /* HAVE_XKB */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-12-06 19:01:12 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_x11_keymap_get_caps_lock_state (GdkKeymap *keymap)
|
2008-09-29 20:40:45 +00:00
|
|
|
{
|
|
|
|
keymap = GET_EFFECTIVE_KEYMAP (keymap);
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2010-12-21 04:32:48 +00:00
|
|
|
return GDK_X11_KEYMAP (keymap)->caps_lock_state;
|
2008-09-29 20:40:45 +00:00
|
|
|
}
|
|
|
|
|
2010-12-06 19:01:12 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_x11_keymap_get_num_lock_state (GdkKeymap *keymap)
|
2010-07-01 22:45:06 +00:00
|
|
|
{
|
|
|
|
keymap = GET_EFFECTIVE_KEYMAP (keymap);
|
|
|
|
|
2010-12-21 04:32:48 +00:00
|
|
|
return GDK_X11_KEYMAP (keymap)->num_lock_state;
|
2010-07-01 22:45:06 +00:00
|
|
|
}
|
2008-09-29 20:40:45 +00:00
|
|
|
|
2010-12-06 19:01:12 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_x11_keymap_get_entries_for_keyval (GdkKeymap *keymap,
|
2010-12-16 04:49:31 +00:00
|
|
|
guint keyval,
|
|
|
|
GdkKeymapKey **keys,
|
|
|
|
gint *n_keys)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
|
|
|
GArray *retval;
|
2010-12-21 04:32:48 +00:00
|
|
|
GdkX11Keymap *keymap_x11;
|
2000-12-06 05:31:30 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (keymap == NULL || GDK_IS_KEYMAP (keymap), FALSE);
|
|
|
|
g_return_val_if_fail (keys != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (n_keys != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (keyval != 0, FALSE);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
2004-04-18 15:10:59 +00:00
|
|
|
keymap = GET_EFFECTIVE_KEYMAP (keymap);
|
2010-12-21 04:32:48 +00:00
|
|
|
keymap_x11 = GDK_X11_KEYMAP (keymap);
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
retval = g_array_new (FALSE, FALSE, sizeof (GdkKeymapKey));
|
|
|
|
|
|
|
|
#ifdef HAVE_XKB
|
2002-04-25 22:29:14 +00:00
|
|
|
if (KEYMAP_USE_XKB (keymap))
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
|
|
|
/* See sec 15.3.4 in XKB docs */
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
XkbDescRec *xkb = get_xkb (keymap_x11);
|
2000-12-06 05:31:30 +00:00
|
|
|
gint keycode;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
keycode = keymap_x11->min_keycode;
|
2000-12-06 05:31:30 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
while (keycode <= keymap_x11->max_keycode)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
|
|
|
gint max_shift_levels = XkbKeyGroupsWidth (xkb, keycode); /* "key width" */
|
|
|
|
gint group = 0;
|
|
|
|
gint level = 0;
|
|
|
|
gint total_syms = XkbKeyNumSyms (xkb, keycode);
|
|
|
|
gint i = 0;
|
|
|
|
KeySym *entry;
|
|
|
|
|
|
|
|
/* entry is an array with all syms for group 0, all
|
|
|
|
* syms for group 1, etc. and for each group the
|
|
|
|
* shift level syms are in order
|
|
|
|
*/
|
|
|
|
entry = XkbKeySymsPtr (xkb, keycode);
|
|
|
|
|
|
|
|
while (i < total_syms)
|
|
|
|
{
|
|
|
|
/* check out our cool loop invariant */
|
|
|
|
g_assert (i == (group * max_shift_levels + level));
|
|
|
|
|
|
|
|
if (entry[i] == keyval)
|
|
|
|
{
|
|
|
|
/* Found a match */
|
|
|
|
GdkKeymapKey key;
|
|
|
|
|
|
|
|
key.keycode = keycode;
|
|
|
|
key.group = group;
|
|
|
|
key.level = level;
|
|
|
|
|
|
|
|
g_array_append_val (retval, key);
|
|
|
|
|
2010-12-16 04:49:31 +00:00
|
|
|
g_assert (XkbKeySymEntry (xkb, keycode, level, group) ==
|
|
|
|
keyval);
|
2000-12-06 05:31:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
++level;
|
|
|
|
|
|
|
|
if (level == max_shift_levels)
|
|
|
|
{
|
|
|
|
level = 0;
|
|
|
|
++group;
|
|
|
|
}
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
++keycode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
const KeySym *map = get_keymap (keymap_x11);
|
2000-12-06 05:31:30 +00:00
|
|
|
gint keycode;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
keycode = keymap_x11->min_keycode;
|
2002-10-04 18:59:49 +00:00
|
|
|
while (keycode <= keymap_x11->max_keycode)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
const KeySym *syms = map + (keycode - keymap_x11->min_keycode) * keymap_x11->keysyms_per_keycode;
|
2000-12-06 05:31:30 +00:00
|
|
|
gint i = 0;
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
while (i < keymap_x11->keysyms_per_keycode)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
|
|
|
if (syms[i] == keyval)
|
|
|
|
{
|
|
|
|
/* found a match */
|
|
|
|
GdkKeymapKey key;
|
|
|
|
|
|
|
|
key.keycode = keycode;
|
|
|
|
|
|
|
|
/* The "classic" non-XKB keymap has 2 levels per group */
|
|
|
|
key.group = i / 2;
|
|
|
|
key.level = i % 2;
|
|
|
|
|
|
|
|
g_array_append_val (retval, key);
|
|
|
|
}
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (retval->len > 0)
|
|
|
|
{
|
|
|
|
*keys = (GdkKeymapKey*) retval->data;
|
|
|
|
*n_keys = retval->len;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*keys = NULL;
|
|
|
|
*n_keys = 0;
|
|
|
|
}
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
g_array_free (retval, retval->len > 0 ? FALSE : TRUE);
|
|
|
|
|
|
|
|
return *n_keys > 0;
|
|
|
|
}
|
|
|
|
|
2010-12-06 19:01:12 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_x11_keymap_get_entries_for_keycode (GdkKeymap *keymap,
|
2010-12-16 04:49:31 +00:00
|
|
|
guint hardware_keycode,
|
|
|
|
GdkKeymapKey **keys,
|
|
|
|
guint **keyvals,
|
|
|
|
gint *n_entries)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
2010-12-21 04:32:48 +00:00
|
|
|
GdkX11Keymap *keymap_x11;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
GArray *key_array;
|
|
|
|
GArray *keyval_array;
|
|
|
|
|
|
|
|
g_return_val_if_fail (keymap == NULL || GDK_IS_KEYMAP (keymap), FALSE);
|
|
|
|
g_return_val_if_fail (n_entries != NULL, FALSE);
|
|
|
|
|
2004-04-18 15:10:59 +00:00
|
|
|
keymap = GET_EFFECTIVE_KEYMAP (keymap);
|
2010-12-21 04:32:48 +00:00
|
|
|
keymap_x11 = GDK_X11_KEYMAP (keymap);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
|
|
update_keyrange (keymap_x11);
|
2000-12-06 05:31:30 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
if (hardware_keycode < keymap_x11->min_keycode ||
|
|
|
|
hardware_keycode > keymap_x11->max_keycode)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
|
|
|
if (keys)
|
|
|
|
*keys = NULL;
|
|
|
|
if (keyvals)
|
|
|
|
*keyvals = NULL;
|
|
|
|
|
|
|
|
*n_entries = 0;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
if (keys)
|
|
|
|
key_array = g_array_new (FALSE, FALSE, sizeof (GdkKeymapKey));
|
|
|
|
else
|
|
|
|
key_array = NULL;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
if (keyvals)
|
|
|
|
keyval_array = g_array_new (FALSE, FALSE, sizeof (guint));
|
|
|
|
else
|
|
|
|
keyval_array = NULL;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
#ifdef HAVE_XKB
|
2002-04-25 22:29:14 +00:00
|
|
|
if (KEYMAP_USE_XKB (keymap))
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
|
|
|
/* See sec 15.3.4 in XKB docs */
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
XkbDescRec *xkb = get_xkb (keymap_x11);
|
2000-12-06 05:31:30 +00:00
|
|
|
gint max_shift_levels;
|
|
|
|
gint group = 0;
|
|
|
|
gint level = 0;
|
|
|
|
gint total_syms;
|
|
|
|
gint i = 0;
|
|
|
|
KeySym *entry;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
max_shift_levels = XkbKeyGroupsWidth (xkb, hardware_keycode); /* "key width" */
|
|
|
|
total_syms = XkbKeyNumSyms (xkb, hardware_keycode);
|
|
|
|
|
|
|
|
/* entry is an array with all syms for group 0, all
|
|
|
|
* syms for group 1, etc. and for each group the
|
|
|
|
* shift level syms are in order
|
|
|
|
*/
|
|
|
|
entry = XkbKeySymsPtr (xkb, hardware_keycode);
|
|
|
|
|
|
|
|
while (i < total_syms)
|
2010-12-16 04:49:31 +00:00
|
|
|
{
|
|
|
|
/* check out our cool loop invariant */
|
2000-12-06 05:31:30 +00:00
|
|
|
g_assert (i == (group * max_shift_levels + level));
|
|
|
|
|
|
|
|
if (key_array)
|
|
|
|
{
|
|
|
|
GdkKeymapKey key;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
key.keycode = hardware_keycode;
|
|
|
|
key.group = group;
|
|
|
|
key.level = level;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
g_array_append_val (key_array, key);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (keyval_array)
|
|
|
|
g_array_append_val (keyval_array, entry[i]);
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
++level;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
if (level == max_shift_levels)
|
|
|
|
{
|
|
|
|
level = 0;
|
|
|
|
++group;
|
|
|
|
}
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
const KeySym *map = get_keymap (keymap_x11);
|
2000-12-06 05:31:30 +00:00
|
|
|
const KeySym *syms;
|
|
|
|
gint i = 0;
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
syms = map + (hardware_keycode - keymap_x11->min_keycode) * keymap_x11->keysyms_per_keycode;
|
2000-12-06 05:31:30 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
while (i < keymap_x11->keysyms_per_keycode)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
|
|
|
if (key_array)
|
|
|
|
{
|
|
|
|
GdkKeymapKey key;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
key.keycode = hardware_keycode;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
/* The "classic" non-XKB keymap has 2 levels per group */
|
|
|
|
key.group = i / 2;
|
|
|
|
key.level = i % 2;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
g_array_append_val (key_array, key);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (keyval_array)
|
|
|
|
g_array_append_val (keyval_array, syms[i]);
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-04-12 17:57:30 +00:00
|
|
|
*n_entries = 0;
|
2000-12-06 05:31:30 +00:00
|
|
|
|
2006-04-12 17:57:30 +00:00
|
|
|
if (keys)
|
|
|
|
{
|
|
|
|
*n_entries = key_array->len;
|
|
|
|
*keys = (GdkKeymapKey*) g_array_free (key_array, FALSE);
|
2000-12-06 05:31:30 +00:00
|
|
|
}
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2006-04-12 17:57:30 +00:00
|
|
|
if (keyvals)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
2006-04-12 17:57:30 +00:00
|
|
|
*n_entries = keyval_array->len;
|
|
|
|
*keyvals = (guint*) g_array_free (keyval_array, FALSE);
|
2000-12-06 05:31:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return *n_entries > 0;
|
|
|
|
}
|
|
|
|
|
2010-12-06 19:01:12 +00:00
|
|
|
static guint
|
|
|
|
gdk_x11_keymap_lookup_key (GdkKeymap *keymap,
|
2010-12-16 04:49:31 +00:00
|
|
|
const GdkKeymapKey *key)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
2010-12-21 04:32:48 +00:00
|
|
|
GdkX11Keymap *keymap_x11;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
g_return_val_if_fail (keymap == NULL || GDK_IS_KEYMAP (keymap), 0);
|
|
|
|
g_return_val_if_fail (key != NULL, 0);
|
|
|
|
g_return_val_if_fail (key->group < 4, 0);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
2004-04-18 15:10:59 +00:00
|
|
|
keymap = GET_EFFECTIVE_KEYMAP (keymap);
|
2010-12-21 04:32:48 +00:00
|
|
|
keymap_x11 = GDK_X11_KEYMAP (keymap);
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
#ifdef HAVE_XKB
|
2002-04-25 22:29:14 +00:00
|
|
|
if (KEYMAP_USE_XKB (keymap))
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
XkbDescRec *xkb = get_xkb (keymap_x11);
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
return XkbKeySymEntry (xkb, key->keycode, key->level, key->group);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
const KeySym *map = get_keymap (keymap_x11);
|
|
|
|
const KeySym *syms = map + (key->keycode - keymap_x11->min_keycode) * keymap_x11->keysyms_per_keycode;
|
2004-06-25 15:21:43 +00:00
|
|
|
return get_symbol (syms, keymap_x11, key->group, key->level);
|
2000-12-06 05:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_XKB
|
2003-08-21 19:23:39 +00:00
|
|
|
/* This is copied straight from XFree86 Xlib, to:
|
|
|
|
* - add the group and level return.
|
|
|
|
* - change the interpretation of mods_rtrn as described
|
|
|
|
* in the docs for gdk_keymap_translate_keyboard_state()
|
|
|
|
* It's unchanged for ease of diff against the Xlib sources; don't
|
|
|
|
* reformat it.
|
2000-12-06 05:31:30 +00:00
|
|
|
*/
|
|
|
|
static Bool
|
|
|
|
MyEnhancedXkbTranslateKeyCode(register XkbDescPtr xkb,
|
|
|
|
KeyCode key,
|
|
|
|
register unsigned int mods,
|
|
|
|
unsigned int * mods_rtrn,
|
|
|
|
KeySym * keysym_rtrn,
|
2009-10-29 02:39:35 +00:00
|
|
|
int * group_rtrn,
|
|
|
|
int * level_rtrn)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
|
|
|
XkbKeyTypeRec *type;
|
|
|
|
int col,nKeyGroups;
|
|
|
|
unsigned preserve,effectiveGroup;
|
|
|
|
KeySym *syms;
|
|
|
|
|
|
|
|
if (mods_rtrn!=NULL)
|
|
|
|
*mods_rtrn = 0;
|
|
|
|
|
|
|
|
nKeyGroups= XkbKeyNumGroups(xkb,key);
|
|
|
|
if ((!XkbKeycodeInRange(xkb,key))||(nKeyGroups==0)) {
|
|
|
|
if (keysym_rtrn!=NULL)
|
|
|
|
*keysym_rtrn = NoSymbol;
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
|
|
|
|
syms = XkbKeySymsPtr(xkb,key);
|
|
|
|
|
|
|
|
/* find the offset of the effective group */
|
|
|
|
col = 0;
|
|
|
|
effectiveGroup= XkbGroupForCoreState(mods);
|
|
|
|
if ( effectiveGroup>=nKeyGroups ) {
|
|
|
|
unsigned groupInfo= XkbKeyGroupInfo(xkb,key);
|
|
|
|
switch (XkbOutOfRangeGroupAction(groupInfo)) {
|
|
|
|
default:
|
|
|
|
effectiveGroup %= nKeyGroups;
|
|
|
|
break;
|
|
|
|
case XkbClampIntoRange:
|
|
|
|
effectiveGroup = nKeyGroups-1;
|
|
|
|
break;
|
|
|
|
case XkbRedirectIntoRange:
|
|
|
|
effectiveGroup = XkbOutOfRangeGroupNumber(groupInfo);
|
|
|
|
if (effectiveGroup>=nKeyGroups)
|
|
|
|
effectiveGroup= 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
col= effectiveGroup*XkbKeyGroupsWidth(xkb,key);
|
|
|
|
type = XkbKeyKeyType(xkb,key,effectiveGroup);
|
|
|
|
|
|
|
|
preserve= 0;
|
|
|
|
if (type->map) { /* find the column (shift level) within the group */
|
|
|
|
register int i;
|
|
|
|
register XkbKTMapEntryPtr entry;
|
2010-12-16 04:49:31 +00:00
|
|
|
/* ---- Begin section modified for GDK ---- */
|
|
|
|
int found = 0;
|
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
for (i=0,entry=type->map;i<type->map_count;i++,entry++) {
|
2010-12-16 04:49:31 +00:00
|
|
|
if (mods_rtrn) {
|
|
|
|
int bits = 0;
|
|
|
|
unsigned long tmp = entry->mods.mask;
|
|
|
|
while (tmp) {
|
|
|
|
if ((tmp & 1) == 1)
|
|
|
|
bits++;
|
|
|
|
tmp >>= 1;
|
|
|
|
}
|
|
|
|
/* We always add one-modifiers levels to mods_rtrn since
|
|
|
|
* they can't wipe out bits in the state unless the
|
|
|
|
* level would be triggered. But return other modifiers
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
if (bits == 1 || (mods&type->mods.mask)==entry->mods.mask)
|
|
|
|
*mods_rtrn |= entry->mods.mask;
|
|
|
|
}
|
|
|
|
|
2003-08-21 19:23:39 +00:00
|
|
|
if (!found&&entry->active&&((mods&type->mods.mask)==entry->mods.mask)) {
|
2000-12-06 05:31:30 +00:00
|
|
|
col+= entry->level;
|
|
|
|
if (type->preserve)
|
|
|
|
preserve= type->preserve[i].mask;
|
|
|
|
|
|
|
|
if (level_rtrn)
|
|
|
|
*level_rtrn = entry->level;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2003-08-21 19:23:39 +00:00
|
|
|
found = 1;
|
2000-12-06 05:31:30 +00:00
|
|
|
}
|
|
|
|
}
|
2010-12-16 04:49:31 +00:00
|
|
|
/* ---- End section modified for GDK ---- */
|
2000-12-06 05:31:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (keysym_rtrn!=NULL)
|
|
|
|
*keysym_rtrn= syms[col];
|
|
|
|
if (mods_rtrn) {
|
2010-12-16 04:49:31 +00:00
|
|
|
/* ---- Begin section modified for GDK ---- */
|
2003-08-21 19:23:39 +00:00
|
|
|
*mods_rtrn &= ~preserve;
|
2010-12-16 04:49:31 +00:00
|
|
|
/* ---- End section modified for GDK ---- */
|
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
/* ---- Begin stuff GDK comments out of the original Xlib version ---- */
|
|
|
|
/* This is commented out because xkb_info is a private struct */
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
/* The Motif VTS doesn't get the help callback called if help
|
2010-12-16 04:49:31 +00:00
|
|
|
* is bound to Shift+<whatever>, and it appears as though it
|
|
|
|
* is XkbTranslateKeyCode that is causing the problem. The
|
|
|
|
* core X version of XTranslateKey always OR's in ShiftMask
|
|
|
|
* and LockMask for mods_rtrn, so this "fix" keeps this behavior
|
2000-12-06 05:31:30 +00:00
|
|
|
* and solves the VTS problem.
|
|
|
|
*/
|
|
|
|
if ((xkb->dpy)&&(xkb->dpy->xkb_info)&&
|
|
|
|
(xkb->dpy->xkb_info->xlib_ctrls&XkbLC_AlwaysConsumeShiftAndLock)) { *mods_rtrn|= (ShiftMask|LockMask);
|
|
|
|
}
|
|
|
|
#endif
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
/* ---- End stuff GDK comments out of the original Xlib version ---- */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ---- Begin stuff GDK adds to the original Xlib version ---- */
|
|
|
|
|
|
|
|
if (group_rtrn)
|
|
|
|
*group_rtrn = effectiveGroup;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
/* ---- End stuff GDK adds to the original Xlib version ---- */
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2005-11-10 17:38:09 +00:00
|
|
|
return (syms[col] != NoSymbol);
|
2000-12-06 05:31:30 +00:00
|
|
|
}
|
|
|
|
#endif /* HAVE_XKB */
|
|
|
|
|
2002-10-18 19:26:43 +00:00
|
|
|
/* Translates from keycode/state to keysymbol using the traditional interpretation
|
|
|
|
* of the keyboard map. See section 12.7 of the Xlib reference manual
|
|
|
|
*/
|
|
|
|
static guint
|
2010-12-21 04:32:48 +00:00
|
|
|
translate_keysym (GdkX11Keymap *keymap_x11,
|
2010-12-16 04:49:31 +00:00
|
|
|
guint hardware_keycode,
|
|
|
|
gint group,
|
|
|
|
GdkModifierType state,
|
|
|
|
gint *effective_group,
|
|
|
|
gint *effective_level)
|
2002-10-18 19:26:43 +00:00
|
|
|
{
|
|
|
|
const KeySym *map = get_keymap (keymap_x11);
|
|
|
|
const KeySym *syms = map + (hardware_keycode - keymap_x11->min_keycode) * keymap_x11->keysyms_per_keycode;
|
|
|
|
|
2004-06-25 15:21:43 +00:00
|
|
|
#define SYM(k,g,l) get_symbol (syms, k,g,l)
|
2002-10-18 19:26:43 +00:00
|
|
|
|
|
|
|
GdkModifierType shift_modifiers;
|
|
|
|
gint shift_level;
|
|
|
|
guint tmp_keyval;
|
2003-08-25 20:22:39 +00:00
|
|
|
gint num_lock_index;
|
2002-10-18 19:26:43 +00:00
|
|
|
|
|
|
|
shift_modifiers = GDK_SHIFT_MASK;
|
2010-09-08 17:35:51 +00:00
|
|
|
if (keymap_x11->lock_keysym == GDK_KEY_Shift_Lock)
|
2002-10-18 19:26:43 +00:00
|
|
|
shift_modifiers |= GDK_LOCK_MASK;
|
|
|
|
|
|
|
|
/* Fall back to the first group if the passed in group is empty
|
|
|
|
*/
|
|
|
|
if (!(SYM (keymap_x11, group, 0) || SYM (keymap_x11, group, 1)) &&
|
|
|
|
(SYM (keymap_x11, 0, 0) || SYM (keymap_x11, 0, 1)))
|
|
|
|
group = 0;
|
|
|
|
|
2003-08-25 20:22:39 +00:00
|
|
|
/* Hack: On Sun, the Num Lock modifier uses the third element in the
|
|
|
|
* keysym array, and Mode_Switch does not apply for a keypad key.
|
|
|
|
*/
|
|
|
|
if (keymap_x11->sun_keypad)
|
|
|
|
{
|
|
|
|
num_lock_index = 2;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2003-08-25 20:22:39 +00:00
|
|
|
if (group != 0)
|
2010-12-16 04:49:31 +00:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < keymap_x11->keysyms_per_keycode; i++)
|
|
|
|
if (KEYSYM_IS_KEYPAD (SYM (keymap_x11, 0, i)))
|
|
|
|
group = 0;
|
|
|
|
}
|
2003-08-25 20:22:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
num_lock_index = 1;
|
|
|
|
|
|
|
|
if ((state & keymap_x11->num_lock_mask) &&
|
|
|
|
KEYSYM_IS_KEYPAD (SYM (keymap_x11, group, num_lock_index)))
|
2002-10-18 19:26:43 +00:00
|
|
|
{
|
|
|
|
/* Shift, Shift_Lock cancel Num_Lock
|
|
|
|
*/
|
2003-08-25 20:22:39 +00:00
|
|
|
shift_level = (state & shift_modifiers) ? 0 : num_lock_index;
|
|
|
|
if (!SYM (keymap_x11, group, shift_level) && SYM (keymap_x11, group, 0))
|
|
|
|
shift_level = 0;
|
|
|
|
|
2002-10-18 19:26:43 +00:00
|
|
|
tmp_keyval = SYM (keymap_x11, group, shift_level);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-02-01 18:15:09 +00:00
|
|
|
/* Fall back to the first level if no symbol for the level
|
2002-10-18 19:26:43 +00:00
|
|
|
* we were passed.
|
|
|
|
*/
|
|
|
|
shift_level = (state & shift_modifiers) ? 1 : 0;
|
|
|
|
if (!SYM (keymap_x11, group, shift_level) && SYM (keymap_x11, group, 0))
|
2010-12-16 04:49:31 +00:00
|
|
|
shift_level = 0;
|
|
|
|
|
2002-10-18 19:26:43 +00:00
|
|
|
tmp_keyval = SYM (keymap_x11, group, shift_level);
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2010-09-08 17:35:51 +00:00
|
|
|
if (keymap_x11->lock_keysym == GDK_KEY_Caps_Lock && (state & GDK_LOCK_MASK) != 0)
|
2010-12-16 04:49:31 +00:00
|
|
|
{
|
|
|
|
guint upper = gdk_keyval_to_upper (tmp_keyval);
|
|
|
|
if (upper != tmp_keyval)
|
|
|
|
tmp_keyval = upper;
|
|
|
|
}
|
2002-10-18 19:26:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (effective_group)
|
|
|
|
*effective_group = group;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-10-18 19:26:43 +00:00
|
|
|
if (effective_level)
|
|
|
|
*effective_level = shift_level;
|
|
|
|
|
|
|
|
return tmp_keyval;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-10-18 19:26:43 +00:00
|
|
|
#undef SYM
|
|
|
|
}
|
|
|
|
|
2010-12-06 19:01:12 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_x11_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
2010-12-16 04:49:31 +00:00
|
|
|
guint hardware_keycode,
|
|
|
|
GdkModifierType state,
|
|
|
|
gint group,
|
|
|
|
guint *keyval,
|
|
|
|
gint *effective_group,
|
|
|
|
gint *level,
|
|
|
|
GdkModifierType *consumed_modifiers)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
2010-12-21 04:32:48 +00:00
|
|
|
GdkX11Keymap *keymap_x11;
|
2000-12-06 05:31:30 +00:00
|
|
|
KeySym tmp_keyval = NoSymbol;
|
2002-02-21 17:14:10 +00:00
|
|
|
guint tmp_modifiers;
|
2000-12-06 05:31:30 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (keymap == NULL || GDK_IS_KEYMAP (keymap), FALSE);
|
|
|
|
g_return_val_if_fail (group < 4, FALSE);
|
2004-04-18 15:10:59 +00:00
|
|
|
|
2010-12-16 04:49:31 +00:00
|
|
|
keymap = GET_EFFECTIVE_KEYMAP (keymap);
|
2010-12-21 04:32:48 +00:00
|
|
|
keymap_x11 = GDK_X11_KEYMAP (keymap);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
if (keyval)
|
|
|
|
*keyval = NoSymbol;
|
|
|
|
if (effective_group)
|
|
|
|
*effective_group = 0;
|
|
|
|
if (level)
|
|
|
|
*level = 0;
|
2002-02-21 17:14:10 +00:00
|
|
|
if (consumed_modifiers)
|
|
|
|
*consumed_modifiers = 0;
|
2000-12-06 05:31:30 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
update_keyrange (keymap_x11);
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
if (hardware_keycode < keymap_x11->min_keycode ||
|
|
|
|
hardware_keycode > keymap_x11->max_keycode)
|
2000-12-06 05:31:30 +00:00
|
|
|
return FALSE;
|
2005-09-06 17:56:01 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
#ifdef HAVE_XKB
|
2002-04-25 22:29:14 +00:00
|
|
|
if (KEYMAP_USE_XKB (keymap))
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
XkbDescRec *xkb = get_xkb (keymap_x11);
|
2000-12-06 05:31:30 +00:00
|
|
|
|
|
|
|
/* replace bits 13 and 14 with the provided group */
|
|
|
|
state &= ~(1 << 13 | 1 << 14);
|
|
|
|
state |= group << 13;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
MyEnhancedXkbTranslateKeyCode (xkb,
|
|
|
|
hardware_keycode,
|
|
|
|
state,
|
2002-02-21 17:14:10 +00:00
|
|
|
&tmp_modifiers,
|
2000-12-06 05:31:30 +00:00
|
|
|
&tmp_keyval,
|
|
|
|
effective_group,
|
|
|
|
level);
|
|
|
|
|
2002-02-21 17:14:10 +00:00
|
|
|
if (state & ~tmp_modifiers & LockMask)
|
2010-12-16 04:49:31 +00:00
|
|
|
tmp_keyval = gdk_keyval_to_upper (tmp_keyval);
|
2002-02-21 17:14:10 +00:00
|
|
|
|
|
|
|
/* We need to augment the consumed modifiers with LockMask, since
|
|
|
|
* we handle that ourselves, and also with the group bits
|
|
|
|
*/
|
|
|
|
tmp_modifiers |= LockMask | 1 << 13 | 1 << 14;
|
2000-12-06 05:31:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
2002-10-18 19:26:43 +00:00
|
|
|
GdkModifierType bit;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-10-18 19:26:43 +00:00
|
|
|
tmp_modifiers = 0;
|
2002-03-04 20:19:04 +00:00
|
|
|
|
2002-10-18 19:26:43 +00:00
|
|
|
/* We see what modifiers matter by trying the translation with
|
|
|
|
* and without each possible modifier
|
2002-03-04 20:19:04 +00:00
|
|
|
*/
|
2002-10-18 19:26:43 +00:00
|
|
|
for (bit = GDK_SHIFT_MASK; bit < GDK_BUTTON1_MASK; bit <<= 1)
|
2010-12-16 04:49:31 +00:00
|
|
|
{
|
|
|
|
/* Handling of the group here is a bit funky; a traditional
|
|
|
|
* X keyboard map can have more than two groups, but no way
|
|
|
|
* of accessing the extra groups is defined. We allow a
|
|
|
|
* caller to pass in any group to this function, but we
|
|
|
|
* only can represent switching between group 0 and 1 in
|
|
|
|
* consumed modifiers.
|
|
|
|
*/
|
|
|
|
if (translate_keysym (keymap_x11, hardware_keycode,
|
|
|
|
(bit == keymap_x11->group_switch_mask) ? 0 : group,
|
|
|
|
state & ~bit,
|
|
|
|
NULL, NULL) !=
|
|
|
|
translate_keysym (keymap_x11, hardware_keycode,
|
|
|
|
(bit == keymap_x11->group_switch_mask) ? 1 : group,
|
|
|
|
state | bit,
|
|
|
|
NULL, NULL))
|
|
|
|
tmp_modifiers |= bit;
|
|
|
|
}
|
|
|
|
|
2002-10-18 19:26:43 +00:00
|
|
|
tmp_keyval = translate_keysym (keymap_x11, hardware_keycode,
|
2010-12-16 04:49:31 +00:00
|
|
|
group, state,
|
|
|
|
level, effective_group);
|
2002-02-21 17:14:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (consumed_modifiers)
|
|
|
|
*consumed_modifiers = tmp_modifiers;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-02-21 17:14:10 +00:00
|
|
|
if (keyval)
|
|
|
|
*keyval = tmp_keyval;
|
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
return tmp_keyval != NoSymbol;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Key handling not part of the keymap */
|
|
|
|
gchar*
|
2010-12-17 00:00:01 +00:00
|
|
|
_gdk_x11_display_manager_get_keyval_name (GdkDisplayManager *manager,
|
|
|
|
guint keyval)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
2002-02-27 00:24:11 +00:00
|
|
|
switch (keyval)
|
|
|
|
{
|
2010-09-08 17:35:51 +00:00
|
|
|
case GDK_KEY_Page_Up:
|
2002-02-27 00:24:11 +00:00
|
|
|
return "Page_Up";
|
2010-09-08 17:35:51 +00:00
|
|
|
case GDK_KEY_Page_Down:
|
2002-02-27 00:24:11 +00:00
|
|
|
return "Page_Down";
|
2010-09-08 17:35:51 +00:00
|
|
|
case GDK_KEY_KP_Page_Up:
|
2002-02-27 00:24:11 +00:00
|
|
|
return "KP_Page_Up";
|
2010-09-08 17:35:51 +00:00
|
|
|
case GDK_KEY_KP_Page_Down:
|
2002-02-27 00:24:11 +00:00
|
|
|
return "KP_Page_Down";
|
|
|
|
}
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
return XKeysymToString (keyval);
|
|
|
|
}
|
|
|
|
|
|
|
|
guint
|
2010-12-17 00:00:01 +00:00
|
|
|
_gdk_x11_display_manager_lookup_keyval (GdkDisplayManager *manager,
|
|
|
|
const gchar *keyval_name)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (keyval_name != NULL, 0);
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
return XStringToKeysym (keyval_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HAVE_XCONVERTCASE
|
|
|
|
void
|
2010-12-17 00:00:01 +00:00
|
|
|
_gdk_x11_display_manager_keyval_convert_case (GdkDisplayManager *manager,
|
|
|
|
guint symbol,
|
|
|
|
guint *lower,
|
|
|
|
guint *upper)
|
2000-12-06 05:31:30 +00:00
|
|
|
{
|
|
|
|
KeySym xlower = 0;
|
|
|
|
KeySym xupper = 0;
|
|
|
|
|
2002-03-01 22:09:27 +00:00
|
|
|
/* Check for directly encoded 24-bit UCS characters: */
|
|
|
|
if ((symbol & 0xff000000) == 0x01000000)
|
|
|
|
{
|
|
|
|
if (lower)
|
2010-12-16 04:49:31 +00:00
|
|
|
*lower = gdk_unicode_to_keyval (g_unichar_tolower (symbol & 0x00ffffff));
|
2002-03-01 22:09:27 +00:00
|
|
|
if (upper)
|
2010-12-16 04:49:31 +00:00
|
|
|
*upper = gdk_unicode_to_keyval (g_unichar_toupper (symbol & 0x00ffffff));
|
2002-03-01 22:09:27 +00:00
|
|
|
return;
|
|
|
|
}
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2000-12-06 05:31:30 +00:00
|
|
|
if (symbol)
|
|
|
|
XConvertCase (symbol, &xlower, &xupper);
|
|
|
|
|
|
|
|
if (lower)
|
|
|
|
*lower = xlower;
|
|
|
|
if (upper)
|
|
|
|
*upper = xupper;
|
2010-12-16 04:49:31 +00:00
|
|
|
}
|
2010-12-17 00:00:01 +00:00
|
|
|
#else /* !HAVE_XCONVERTCASE */
|
|
|
|
void
|
|
|
|
_gdk_x11_display_manager_keyval_convert_case (GdkDisplayManager *manager,
|
|
|
|
guint symbol,
|
|
|
|
guint *lower,
|
|
|
|
guint *upper)
|
|
|
|
{
|
|
|
|
guint xlower = symbol;
|
|
|
|
guint xupper = symbol;
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (symbol >> 8)
|
|
|
|
{
|
|
|
|
case 0: /* Latin 1 */
|
|
|
|
if ((symbol >= GDK_KEY_A) && (symbol <= GDK_KEY_Z))
|
|
|
|
xlower += (GDK_KEY_a - GDK_KEY_A);
|
|
|
|
else if ((symbol >= GDK_KEY_a) && (symbol <= GDK_KEY_z))
|
|
|
|
xupper -= (GDK_KEY_a - GDK_KEY_A);
|
|
|
|
else if ((symbol >= GDK_KEY_Agrave) && (symbol <= GDK_KEY_Odiaeresis))
|
|
|
|
xlower += (GDK_KEY_agrave - GDK_KEY_Agrave);
|
|
|
|
else if ((symbol >= GDK_KEY_agrave) && (symbol <= GDK_KEY_odiaeresis))
|
|
|
|
xupper -= (GDK_KEY_agrave - GDK_KEY_Agrave);
|
|
|
|
else if ((symbol >= GDK_KEY_Ooblique) && (symbol <= GDK_KEY_Thorn))
|
|
|
|
xlower += (GDK_KEY_oslash - GDK_KEY_Ooblique);
|
|
|
|
else if ((symbol >= GDK_KEY_oslash) && (symbol <= GDK_KEY_thorn))
|
|
|
|
xupper -= (GDK_KEY_oslash - GDK_KEY_Ooblique);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: /* Latin 2 */
|
|
|
|
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
|
|
|
if (symbol == GDK_KEY_Aogonek)
|
|
|
|
xlower = GDK_KEY_aogonek;
|
|
|
|
else if (symbol >= GDK_KEY_Lstroke && symbol <= GDK_KEY_Sacute)
|
|
|
|
xlower += (GDK_KEY_lstroke - GDK_KEY_Lstroke);
|
|
|
|
else if (symbol >= GDK_KEY_Scaron && symbol <= GDK_KEY_Zacute)
|
|
|
|
xlower += (GDK_KEY_scaron - GDK_KEY_Scaron);
|
|
|
|
else if (symbol >= GDK_KEY_Zcaron && symbol <= GDK_KEY_Zabovedot)
|
|
|
|
xlower += (GDK_KEY_zcaron - GDK_KEY_Zcaron);
|
|
|
|
else if (symbol == GDK_KEY_aogonek)
|
|
|
|
xupper = GDK_KEY_Aogonek;
|
|
|
|
else if (symbol >= GDK_KEY_lstroke && symbol <= GDK_KEY_sacute)
|
|
|
|
xupper -= (GDK_KEY_lstroke - GDK_KEY_Lstroke);
|
|
|
|
else if (symbol >= GDK_KEY_scaron && symbol <= GDK_KEY_zacute)
|
|
|
|
xupper -= (GDK_KEY_scaron - GDK_KEY_Scaron);
|
|
|
|
else if (symbol >= GDK_KEY_zcaron && symbol <= GDK_KEY_zabovedot)
|
|
|
|
xupper -= (GDK_KEY_zcaron - GDK_KEY_Zcaron);
|
|
|
|
else if (symbol >= GDK_KEY_Racute && symbol <= GDK_KEY_Tcedilla)
|
|
|
|
xlower += (GDK_KEY_racute - GDK_KEY_Racute);
|
|
|
|
else if (symbol >= GDK_KEY_racute && symbol <= GDK_KEY_tcedilla)
|
|
|
|
xupper -= (GDK_KEY_racute - GDK_KEY_Racute);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: /* Latin 3 */
|
|
|
|
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
|
|
|
if (symbol >= GDK_KEY_Hstroke && symbol <= GDK_KEY_Hcircumflex)
|
|
|
|
xlower += (GDK_KEY_hstroke - GDK_KEY_Hstroke);
|
|
|
|
else if (symbol >= GDK_KEY_Gbreve && symbol <= GDK_KEY_Jcircumflex)
|
|
|
|
xlower += (GDK_KEY_gbreve - GDK_KEY_Gbreve);
|
|
|
|
else if (symbol >= GDK_KEY_hstroke && symbol <= GDK_KEY_hcircumflex)
|
|
|
|
xupper -= (GDK_KEY_hstroke - GDK_KEY_Hstroke);
|
|
|
|
else if (symbol >= GDK_KEY_gbreve && symbol <= GDK_KEY_jcircumflex)
|
|
|
|
xupper -= (GDK_KEY_gbreve - GDK_KEY_Gbreve);
|
|
|
|
else if (symbol >= GDK_KEY_Cabovedot && symbol <= GDK_KEY_Scircumflex)
|
|
|
|
xlower += (GDK_KEY_cabovedot - GDK_KEY_Cabovedot);
|
|
|
|
else if (symbol >= GDK_KEY_cabovedot && symbol <= GDK_KEY_scircumflex)
|
|
|
|
xupper -= (GDK_KEY_cabovedot - GDK_KEY_Cabovedot);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: /* Latin 4 */
|
|
|
|
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
|
|
|
if (symbol >= GDK_KEY_Rcedilla && symbol <= GDK_KEY_Tslash)
|
|
|
|
xlower += (GDK_KEY_rcedilla - GDK_KEY_Rcedilla);
|
|
|
|
else if (symbol >= GDK_KEY_rcedilla && symbol <= GDK_KEY_tslash)
|
|
|
|
xupper -= (GDK_KEY_rcedilla - GDK_KEY_Rcedilla);
|
|
|
|
else if (symbol == GDK_KEY_ENG)
|
|
|
|
xlower = GDK_KEY_eng;
|
|
|
|
else if (symbol == GDK_KEY_eng)
|
|
|
|
xupper = GDK_KEY_ENG;
|
|
|
|
else if (symbol >= GDK_KEY_Amacron && symbol <= GDK_KEY_Umacron)
|
|
|
|
xlower += (GDK_KEY_amacron - GDK_KEY_Amacron);
|
|
|
|
else if (symbol >= GDK_KEY_amacron && symbol <= GDK_KEY_umacron)
|
|
|
|
xupper -= (GDK_KEY_amacron - GDK_KEY_Amacron);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 6: /* Cyrillic */
|
|
|
|
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
|
|
|
if (symbol >= GDK_KEY_Serbian_DJE && symbol <= GDK_KEY_Serbian_DZE)
|
|
|
|
xlower -= (GDK_KEY_Serbian_DJE - GDK_KEY_Serbian_dje);
|
|
|
|
else if (symbol >= GDK_KEY_Serbian_dje && symbol <= GDK_KEY_Serbian_dze)
|
|
|
|
xupper += (GDK_KEY_Serbian_DJE - GDK_KEY_Serbian_dje);
|
|
|
|
else if (symbol >= GDK_KEY_Cyrillic_YU && symbol <= GDK_KEY_Cyrillic_HARDSIGN)
|
|
|
|
xlower -= (GDK_KEY_Cyrillic_YU - GDK_KEY_Cyrillic_yu);
|
|
|
|
else if (symbol >= GDK_KEY_Cyrillic_yu && symbol <= GDK_KEY_Cyrillic_hardsign)
|
|
|
|
xupper += (GDK_KEY_Cyrillic_YU - GDK_KEY_Cyrillic_yu);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 7: /* Greek */
|
|
|
|
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
|
|
|
if (symbol >= GDK_KEY_Greek_ALPHAaccent && symbol <= GDK_KEY_Greek_OMEGAaccent)
|
|
|
|
xlower += (GDK_KEY_Greek_alphaaccent - GDK_KEY_Greek_ALPHAaccent);
|
|
|
|
else if (symbol >= GDK_KEY_Greek_alphaaccent && symbol <= GDK_KEY_Greek_omegaaccent &&
|
|
|
|
symbol != GDK_KEY_Greek_iotaaccentdieresis &&
|
|
|
|
symbol != GDK_KEY_Greek_upsilonaccentdieresis)
|
|
|
|
xupper -= (GDK_KEY_Greek_alphaaccent - GDK_KEY_Greek_ALPHAaccent);
|
|
|
|
else if (symbol >= GDK_KEY_Greek_ALPHA && symbol <= GDK_KEY_Greek_OMEGA)
|
|
|
|
xlower += (GDK_KEY_Greek_alpha - GDK_KEY_Greek_ALPHA);
|
|
|
|
else if (symbol >= GDK_KEY_Greek_alpha && symbol <= GDK_KEY_Greek_omega &&
|
|
|
|
symbol != GDK_KEY_Greek_finalsmallsigma)
|
|
|
|
xupper -= (GDK_KEY_Greek_alpha - GDK_KEY_Greek_ALPHA);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lower)
|
|
|
|
*lower = xlower;
|
|
|
|
if (upper)
|
|
|
|
*upper = xupper;
|
|
|
|
}
|
|
|
|
#endif
|
2002-03-04 20:19:04 +00:00
|
|
|
|
|
|
|
gint
|
2002-04-25 22:29:14 +00:00
|
|
|
_gdk_x11_get_group_for_state (GdkDisplay *display,
|
2010-12-16 04:49:31 +00:00
|
|
|
GdkModifierType state)
|
2002-03-04 20:19:04 +00:00
|
|
|
{
|
2010-12-20 18:20:10 +00:00
|
|
|
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2002-03-04 20:19:04 +00:00
|
|
|
#ifdef HAVE_XKB
|
2002-04-25 22:29:14 +00:00
|
|
|
if (display_x11->use_xkb)
|
2002-03-04 20:19:04 +00:00
|
|
|
{
|
|
|
|
return XkbGroupForCoreState (state);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
2010-12-21 04:32:48 +00:00
|
|
|
GdkX11Keymap *keymap_impl = GDK_X11_KEYMAP (gdk_keymap_get_for_display (display));
|
2002-04-25 22:29:14 +00:00
|
|
|
update_keymaps (keymap_impl);
|
|
|
|
return (state & keymap_impl->group_switch_mask) ? 1 : 0;
|
2002-03-04 20:19:04 +00:00
|
|
|
}
|
|
|
|
}
|
2005-03-16 03:17:27 +00:00
|
|
|
|
2005-09-06 17:56:01 +00:00
|
|
|
void
|
2010-12-16 04:49:31 +00:00
|
|
|
_gdk_x11_keymap_add_virt_mods (GdkKeymap *keymap,
|
|
|
|
GdkModifierType *modifiers)
|
2005-09-06 17:56:01 +00:00
|
|
|
{
|
2010-12-21 04:32:48 +00:00
|
|
|
GdkX11Keymap *keymap_x11;
|
2005-09-06 17:56:01 +00:00
|
|
|
int i;
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2005-09-06 17:56:01 +00:00
|
|
|
keymap = GET_EFFECTIVE_KEYMAP (keymap);
|
2010-12-21 04:32:48 +00:00
|
|
|
keymap_x11 = GDK_X11_KEYMAP (keymap);
|
2005-09-06 17:56:01 +00:00
|
|
|
|
2010-02-12 20:45:16 +00:00
|
|
|
for (i = 3; i < 8; i++)
|
|
|
|
{
|
|
|
|
if ((1 << i) & *modifiers)
|
|
|
|
{
|
2010-12-16 04:49:31 +00:00
|
|
|
if (keymap_x11->modmap[i] & GDK_MOD1_MASK)
|
|
|
|
*modifiers |= GDK_MOD1_MASK;
|
|
|
|
else if (keymap_x11->modmap[i] & GDK_SUPER_MASK)
|
|
|
|
*modifiers |= GDK_SUPER_MASK;
|
|
|
|
else if (keymap_x11->modmap[i] & GDK_HYPER_MASK)
|
|
|
|
*modifiers |= GDK_HYPER_MASK;
|
|
|
|
else if (keymap_x11->modmap[i] & GDK_META_MASK)
|
|
|
|
*modifiers |= GDK_META_MASK;
|
2010-02-12 20:45:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-06 19:01:12 +00:00
|
|
|
static void
|
|
|
|
gdk_x11_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
2010-12-16 04:49:31 +00:00
|
|
|
GdkModifierType *state)
|
2010-02-12 20:45:16 +00:00
|
|
|
{
|
2010-12-21 04:32:48 +00:00
|
|
|
GdkX11Keymap *keymap_x11;
|
2010-02-12 20:45:16 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
keymap = GET_EFFECTIVE_KEYMAP (keymap);
|
2010-12-21 04:32:48 +00:00
|
|
|
keymap_x11 = GDK_X11_KEYMAP (keymap);
|
2010-02-12 20:45:16 +00:00
|
|
|
|
2005-09-06 17:56:01 +00:00
|
|
|
for (i = 3; i < 8; i++)
|
|
|
|
{
|
2010-03-23 03:10:38 +00:00
|
|
|
if ((1 << i) & *state)
|
2005-09-06 17:56:01 +00:00
|
|
|
{
|
2010-12-16 04:49:31 +00:00
|
|
|
if (keymap_x11->modmap[i] & GDK_MOD1_MASK)
|
|
|
|
*state |= GDK_MOD1_MASK;
|
|
|
|
if (keymap_x11->modmap[i] & GDK_SUPER_MASK)
|
|
|
|
*state |= GDK_SUPER_MASK;
|
|
|
|
if (keymap_x11->modmap[i] & GDK_HYPER_MASK)
|
|
|
|
*state |= GDK_HYPER_MASK;
|
|
|
|
if (keymap_x11->modmap[i] & GDK_META_MASK)
|
|
|
|
*state |= GDK_META_MASK;
|
2005-09-06 17:56:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-09 22:50:15 +00:00
|
|
|
gboolean
|
2010-12-16 04:49:31 +00:00
|
|
|
_gdk_x11_keymap_key_is_modifier (GdkKeymap *keymap,
|
|
|
|
guint keycode)
|
2005-09-09 22:50:15 +00:00
|
|
|
{
|
2010-12-21 04:32:48 +00:00
|
|
|
GdkX11Keymap *keymap_x11;
|
2005-09-09 22:50:15 +00:00
|
|
|
gint i;
|
|
|
|
|
2010-12-16 04:49:31 +00:00
|
|
|
keymap = GET_EFFECTIVE_KEYMAP (keymap);
|
2010-12-21 04:32:48 +00:00
|
|
|
keymap_x11 = GDK_X11_KEYMAP (keymap);
|
2005-09-09 22:50:15 +00:00
|
|
|
|
|
|
|
if (keycode < keymap_x11->min_keycode ||
|
|
|
|
keycode > keymap_x11->max_keycode)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
#ifdef HAVE_XKB
|
|
|
|
if (KEYMAP_USE_XKB (keymap))
|
|
|
|
{
|
|
|
|
XkbDescRec *xkb = get_xkb (keymap_x11);
|
2010-12-16 04:49:31 +00:00
|
|
|
|
2008-06-17 02:11:47 +00:00
|
|
|
if (xkb->map->modmap && xkb->map->modmap[keycode] != 0)
|
2010-12-16 04:49:31 +00:00
|
|
|
return TRUE;
|
2005-09-09 22:50:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
for (i = 0; i < 8 * keymap_x11->mod_keymap->max_keypermod; i++)
|
2010-12-16 04:49:31 +00:00
|
|
|
{
|
|
|
|
if (keycode == keymap_x11->mod_keymap->modifiermap[i])
|
|
|
|
return TRUE;
|
|
|
|
}
|
2005-09-09 22:50:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-12-06 19:01:12 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_x11_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
2010-12-16 04:49:31 +00:00
|
|
|
GdkModifierType *state)
|
2009-12-21 16:15:28 +00:00
|
|
|
{
|
2010-12-21 04:32:48 +00:00
|
|
|
GdkX11Keymap *keymap_x11;
|
2009-12-21 16:15:28 +00:00
|
|
|
const guint vmods[] = {
|
|
|
|
GDK_SUPER_MASK, GDK_HYPER_MASK, GDK_META_MASK
|
|
|
|
};
|
|
|
|
int i, j;
|
|
|
|
gboolean retval;
|
|
|
|
|
|
|
|
keymap = GET_EFFECTIVE_KEYMAP (keymap);
|
2010-12-21 04:32:48 +00:00
|
|
|
keymap_x11 = GDK_X11_KEYMAP (keymap);
|
2010-09-07 04:10:26 +00:00
|
|
|
|
|
|
|
if (KEYMAP_USE_XKB (keymap))
|
|
|
|
get_xkb (keymap_x11);
|
2009-12-21 16:15:28 +00:00
|
|
|
|
|
|
|
retval = TRUE;
|
|
|
|
|
|
|
|
for (j = 0; j < 3; j++)
|
|
|
|
{
|
|
|
|
if (*state & vmods[j])
|
|
|
|
{
|
|
|
|
for (i = 3; i < 8; i++)
|
|
|
|
{
|
|
|
|
if (keymap_x11->modmap[i] & vmods[j])
|
|
|
|
{
|
|
|
|
if (*state & (1 << i))
|
|
|
|
retval = FALSE;
|
|
|
|
else
|
|
|
|
*state |= 1 << i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
2010-12-06 19:01:12 +00:00
|
|
|
|
|
|
|
static void
|
2010-12-21 04:32:48 +00:00
|
|
|
gdk_x11_keymap_class_init (GdkX11KeymapClass *klass)
|
2010-12-06 19:01:12 +00:00
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GdkKeymapClass *keymap_class = GDK_KEYMAP_CLASS (klass);
|
|
|
|
|
2010-12-21 04:32:48 +00:00
|
|
|
object_class->finalize = gdk_x11_keymap_finalize;
|
2010-12-06 19:01:12 +00:00
|
|
|
|
|
|
|
keymap_class->get_direction = gdk_x11_keymap_get_direction;
|
|
|
|
keymap_class->have_bidi_layouts = gdk_x11_keymap_have_bidi_layouts;
|
|
|
|
keymap_class->get_caps_lock_state = gdk_x11_keymap_get_caps_lock_state;
|
|
|
|
keymap_class->get_num_lock_state = gdk_x11_keymap_get_num_lock_state;
|
|
|
|
keymap_class->get_entries_for_keyval = gdk_x11_keymap_get_entries_for_keyval;
|
|
|
|
keymap_class->get_entries_for_keycode = gdk_x11_keymap_get_entries_for_keycode;
|
|
|
|
keymap_class->lookup_key = gdk_x11_keymap_lookup_key;
|
|
|
|
keymap_class->translate_keyboard_state = gdk_x11_keymap_translate_keyboard_state;
|
|
|
|
keymap_class->add_virtual_modifiers = gdk_x11_keymap_add_virtual_modifiers;
|
|
|
|
keymap_class->map_virtual_modifiers = gdk_x11_keymap_map_virtual_modifiers;
|
|
|
|
}
|