Dmitry Timoshkov : winex11: Remember last window that had the XIC focus and use it in ToUnicode() to make dead keys work more reliably.

Alexandre Julliard julliard at winehq.org
Tue Oct 5 14:41:44 CDT 2010


Module: wine
Branch: stable
Commit: 1e73c66677f9fdff570624af367b09dce6358893
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1e73c66677f9fdff570624af367b09dce6358893

Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date:   Fri Jul 23 22:21:58 2010 +0900

winex11: Remember last window that had the XIC focus and use it in ToUnicode() to make dead keys work more reliably.
(cherry picked from commit a56df96a0e6063a44c83ffd8fc330b1f92c02f10)

---

 dlls/winex11.drv/keyboard.c |   10 +++++++---
 dlls/winex11.drv/window.c   |    3 +++
 dlls/winex11.drv/x11drv.h   |    1 +
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
index d9da4d2..02fd6bb 100644
--- a/dlls/winex11.drv/keyboard.c
+++ b/dlls/winex11.drv/keyboard.c
@@ -2541,9 +2541,13 @@ INT CDECL X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState
     e.state = 0;
     e.type = KeyPress;
 
-    focus = GetFocus();
-    if (focus) focus = GetAncestor( focus, GA_ROOT );
-    if (!focus) focus = GetActiveWindow();
+    focus = x11drv_thread_data()->last_xic_hwnd;
+    if (!focus)
+    {
+        focus = GetFocus();
+        if (focus) focus = GetAncestor( focus, GA_ROOT );
+        if (!focus) focus = GetActiveWindow();
+    }
     e.window = X11DRV_get_whole_window( focus );
     xic = X11DRV_get_ic( focus );
 
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index eb6432e..b3118cc 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -1862,6 +1862,7 @@ void CDECL X11DRV_DestroyWindow( HWND hwnd )
     }
 
     if (thread_data->last_focus == hwnd) thread_data->last_focus = 0;
+    if (thread_data->last_xic_hwnd == hwnd) thread_data->last_xic_hwnd = 0;
     if (data->hWMIconBitmap) DeleteObject( data->hWMIconBitmap );
     if (data->hWMIconMask) DeleteObject( data->hWMIconMask);
     wine_tsx11_lock();
@@ -2080,6 +2081,8 @@ XIC X11DRV_get_ic( HWND hwnd )
     XIM xim;
 
     if (!data) return 0;
+
+    x11drv_thread_data()->last_xic_hwnd = hwnd;
     if (data->xic) return data->xic;
     if (!(xim = x11drv_thread_data()->xim)) return 0;
     return X11DRV_CreateIC( xim, data );
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 1cd610d..0e82a65 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -549,6 +549,7 @@ struct x11drv_thread_data
     Window   grab_window;          /* window that currently grabs the mouse */
     HWND     last_focus;           /* last window that had focus */
     XIM      xim;                  /* input method */
+    HWND     last_xic_hwnd;        /* last xic window */
     XFontSet font_set;             /* international text drawing font set */
     Window   selection_wnd;        /* window used for selection interactions */
     HKL      kbd_layout;           /* active keyboard layout */




More information about the wine-cvs mailing list