From a30b94651d9f01b4bfa9afd073b7e02861e52f10 Mon Sep 17 00:00:00 2001 From: Alexandre Goujon Date: Thu, 29 Apr 2010 22:22:35 +0200 Subject: [PATCH] winex11: Use XkbKeycodeToKeysym when using XKB. --- dlls/winex11.drv/keyboard.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index 46925f7e68f..893796fb534 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1107,6 +1107,14 @@ static const WORD xfree86_vendor_key_vkey[256] = 0, 0, 0, 0, 0, 0, 0, 0 /* 1008FFF8 */ }; +static inline KeySym keycode_to_keysym( Display *display, KeyCode keycode, int index ) +{ +#ifdef HAVE_XKB + if (use_xkb) return XkbKeycodeToKeysym(display, keycode, 0, index); +#endif + return XKeycodeToKeysym(display, keycode, index); +} + /* Returns the Windows virtual key code associated with the X event */ /* x11 lock must be held */ static WORD EVENT_event_to_vkey( XIC xic, XKeyEvent *e) @@ -1505,7 +1513,7 @@ X11DRV_KEYBOARD_DetectLayout( Display *display ) for (keyc = min_keycode; keyc <= max_keycode; keyc++) { /* get data for keycode from X server */ for (i = 0; i < syms; i++) { - if (!(keysym = XKeycodeToKeysym (display, keyc, i))) continue; + if (!(keysym = keycode_to_keysym (display, keyc, i))) continue; /* Allow both one-byte and two-byte national keysyms */ if ((keysym < 0x8000) && (keysym != ' ')) { @@ -1717,12 +1725,12 @@ void X11DRV_InitKeyboard( Display *display ) int k; for (k = 0; k < keysyms_per_keycode; k += 1) - if (XKeycodeToKeysym(display, *kcp, k) == XK_Num_Lock) + if (keycode_to_keysym(display, *kcp, k) == XK_Num_Lock) { NumLockMask = 1 << i; TRACE_(key)("NumLockMask is %x\n", NumLockMask); } - else if (XKeycodeToKeysym(display, *kcp, k) == XK_Scroll_Lock) + else if (keycode_to_keysym(display, *kcp, k) == XK_Scroll_Lock) { ScrollLockMask = 1 << i; TRACE_(key)("ScrollLockMask is %x\n", ScrollLockMask); @@ -1774,7 +1782,7 @@ void X11DRV_InitKeyboard( Display *display ) /* we seem to need to search the layout-dependent scancodes */ int maxlen=0,maxval=-1,ok; for (i=0; i