Aric Stewart : x11drv: If a keyboard layout is an IME only check the loword when comparing to the x11 keyboard layout .

Alexandre Julliard julliard at winehq.org
Thu Dec 18 08:08:54 CST 2008


Module: wine
Branch: master
Commit: 0c53ce5d202a4978d098e3edfde377940aba4a13
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0c53ce5d202a4978d098e3edfde377940aba4a13

Author: Aric Stewart <aric at codeweavers.com>
Date:   Wed Dec 17 10:12:30 2008 -0600

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 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
index ee2773b..bb62091 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))




More information about the wine-cvs mailing list