From 0c53ce5d202a4978d098e3edfde377940aba4a13 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Wed, 17 Dec 2008 10:12:30 -0600 Subject: [PATCH] x11drv: If a keyboard layout is an IME only check the loword when comparing to the x11 keyboard layout. --- dlls/winex11.drv/keyboard.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index ee2773ba7a5..bb62091532b 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -69,6 +69,7 @@ static WORD keyc2vkey[256], keyc2scan[256]; static int NumLockMask, ScrollLockMask, AltGrMask; /* mask in the XKeyEvent state */ static char KEYBOARD_MapDeadKeysym(KeySym keysym); +HKL X11DRV_GetKeyboardLayout(DWORD dwThreadid); /* Keyboard translation tables */ #define MAIN_LEN 49 @@ -1838,6 +1839,17 @@ void X11DRV_InitKeyboard( Display *display ) wine_tsx11_unlock(); } +static BOOL match_x11_keyboard_layout(HKL hkl) +{ + const DWORD isIME = 0xE0000000; + HKL xHkl = X11DRV_GetKeyboardLayout(0); + + /* if the layout is an IME, only match the low word (LCID) */ + if (((ULONG_PTR)hkl & isIME) == isIME) + return (LOWORD(hkl) == LOWORD(xHkl)); + else + return (hkl == xHkl); +} /********************************************************************** * GetAsyncKeyState (X11DRV.@) @@ -2111,7 +2123,7 @@ UINT X11DRV_MapVirtualKeyEx(UINT wCode, UINT wMapType, HKL hkl) #define returnMVK(value) { TRACE("returning 0x%x.\n",value); return value; } TRACE("wCode=0x%x, wMapType=%d, hkl %p\n", wCode, wMapType, hkl); - if (hkl != X11DRV_GetKeyboardLayout(0)) + if (!match_x11_keyboard_layout(hkl)) FIXME("keyboard layout %p is not supported\n", hkl); switch(wMapType) @@ -2459,7 +2471,7 @@ INT X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState, return 0; } - if (hkl != X11DRV_GetKeyboardLayout(0)) + if (!match_x11_keyboard_layout(hkl)) FIXME("keyboard layout %p is not supported\n", hkl); if ((lpKeyState[VK_MENU] & 0x80) && (lpKeyState[VK_CONTROL] & 0x80))