Alexandre Julliard : winex11: Use XGetKeyboardMapping instead of XKeycodeToKeysym.
Alexandre Julliard
julliard at winehq.org
Fri Jun 1 13:25:59 CDT 2012
Module: wine
Branch: master
Commit: c8a22a4d1f13c9b4f91084a2eed5b60083c82c58
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c8a22a4d1f13c9b4f91084a2eed5b60083c82c58
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Jun 1 14:29:02 2012 +0200
winex11: Use XGetKeyboardMapping instead of XKeycodeToKeysym.
---
dlls/winex11.drv/keyboard.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
index 7e49ffb..82fd26a 100644
--- a/dlls/winex11.drv/keyboard.c
+++ b/dlls/winex11.drv/keyboard.c
@@ -61,6 +61,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(keyboard);
WINE_DECLARE_DEBUG_CHANNEL(key);
static int min_keycode, max_keycode, keysyms_per_keycode;
+static KeySym *key_mapping;
static WORD keyc2vkey[256], keyc2scan[256];
static int NumLockMask, ScrollLockMask, AltGrMask; /* mask in the XKeyEvent state */
@@ -1106,7 +1107,7 @@ static inline KeySym keycode_to_keysym( Display *display, KeyCode keycode, int i
#ifdef HAVE_XKB
if (use_xkb) return XkbKeycodeToKeysym(display, keycode, 0, index);
#endif
- return XKeycodeToKeysym(display, keycode, index);
+ return key_mapping[(keycode - min_keycode) * keysyms_per_keycode + index];
}
/* Returns the Windows virtual key code associated with the X event <e> */
@@ -1612,7 +1613,6 @@ static void set_kbd_layout_preload_key(void)
*/
void X11DRV_InitKeyboard( Display *display )
{
- KeySym *ksp;
XModifierKeymap *mmp;
KeySym keysym;
KeyCode *kcp;
@@ -1645,11 +1645,9 @@ void X11DRV_InitKeyboard( Display *display )
wine_tsx11_lock();
XDisplayKeycodes(display, &min_keycode, &max_keycode);
- ksp = XGetKeyboardMapping(display, min_keycode,
- max_keycode + 1 - min_keycode, &keysyms_per_keycode);
- /* We are only interested in keysyms_per_keycode.
- There is no need to hold a local copy of the keysyms table */
- XFree(ksp);
+ if (key_mapping) XFree( key_mapping );
+ key_mapping = XGetKeyboardMapping(display, min_keycode,
+ max_keycode + 1 - min_keycode, &keysyms_per_keycode);
mmp = XGetModifierMapping(display);
kcp = mmp->modifiermap;
More information about the wine-cvs
mailing list