winex11.drv: Clients should pass only KeyPress events to XmbLookupString

Dmitry Timoshkov dmitry at codeweavers.com
Mon Feb 19 02:19:44 CST 2007


Hello,

this patch has been sent by Dean Kusler to wine-patches some time ago, but for
some reason he didn't resend it with a minor problem fixed pointed out by me.

This patch should fix the bug #6323.

Changelog:
    Dean Kusler <deankus at gmail.com>
    winex11.drv: Clients should pass only KeyPress events to XmbLookupString.

---
 dlls/winex11.drv/keyboard.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
index 33564cf..c025a38 100644
--- a/dlls/winex11.drv/keyboard.c
+++ b/dlls/winex11.drv/keyboard.c
@@ -1124,7 +1124,8 @@ static WORD EVENT_event_to_vkey( XIC xic, XKeyEvent *e)
     Status status;
     char buf[24];
 
-    if (xic)
+    /* Clients should pass only KeyPress events to XmbLookupString */
+    if (xic && e->type == KeyPress)
         XmbLookupString(xic, e, buf, sizeof(buf), &keysym, &status);
     else
         XLookupString(e, buf, sizeof(buf), &keysym, NULL);
@@ -1365,7 +1366,8 @@ void X11DRV_KeyEvent( HWND hwnd, XEvent *xev )
 		event->type, event->window, event->state, event->keycode);
 
     wine_tsx11_lock();
-    if (xic)
+    /* Clients should pass only KeyPress events to XmbLookupString */
+    if (xic && event->type == KeyPress)
         ascii_chars = XmbLookupString(xic, event, Str, sizeof(Str), &keysym, &status);
     else
         ascii_chars = XLookupString(event, Str, sizeof(Str), &keysym, NULL);
@@ -2486,6 +2488,9 @@ INT X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, LPBYTE lpKeyState,
     TRACE_(key)("type %d, window %lx, state 0x%04x, keycode 0x%04x\n",
 		e.type, e.window, e.state, e.keycode);
 
+    /* Clients should pass only KeyPress events to XmbLookupString,
+     * e.type was set to KeyPress above.
+     */
     if (xic)
         ret = XmbLookupString(xic, &e, lpChar, sizeof(lpChar), &keysym, &status);
     else
-- 
1.5.0






More information about the wine-patches mailing list