Commit a56df96a authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

winex11: Remember last window that had the XIC focus and use it in ToUnicode()…

winex11: Remember last window that had the XIC focus and use it in ToUnicode() to make dead keys work more reliably.
parent f57c1b77
...@@ -2541,9 +2541,13 @@ INT CDECL X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState ...@@ -2541,9 +2541,13 @@ INT CDECL X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState
e.state = 0; e.state = 0;
e.type = KeyPress; e.type = KeyPress;
focus = GetFocus(); focus = x11drv_thread_data()->last_xic_hwnd;
if (focus) focus = GetAncestor( focus, GA_ROOT ); if (!focus)
if (!focus) focus = GetActiveWindow(); {
focus = GetFocus();
if (focus) focus = GetAncestor( focus, GA_ROOT );
if (!focus) focus = GetActiveWindow();
}
e.window = X11DRV_get_whole_window( focus ); e.window = X11DRV_get_whole_window( focus );
xic = X11DRV_get_ic( focus ); xic = X11DRV_get_ic( focus );
......
...@@ -1862,6 +1862,7 @@ void CDECL X11DRV_DestroyWindow( HWND hwnd ) ...@@ -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_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->hWMIconBitmap) DeleteObject( data->hWMIconBitmap );
if (data->hWMIconMask) DeleteObject( data->hWMIconMask); if (data->hWMIconMask) DeleteObject( data->hWMIconMask);
wine_tsx11_lock(); wine_tsx11_lock();
...@@ -2080,6 +2081,8 @@ XIC X11DRV_get_ic( HWND hwnd ) ...@@ -2080,6 +2081,8 @@ XIC X11DRV_get_ic( HWND hwnd )
XIM xim; XIM xim;
if (!data) return 0; if (!data) return 0;
x11drv_thread_data()->last_xic_hwnd = hwnd;
if (data->xic) return data->xic; if (data->xic) return data->xic;
if (!(xim = x11drv_thread_data()->xim)) return 0; if (!(xim = x11drv_thread_data()->xim)) return 0;
return X11DRV_CreateIC( xim, data ); return X11DRV_CreateIC( xim, data );
......
...@@ -548,6 +548,7 @@ struct x11drv_thread_data ...@@ -548,6 +548,7 @@ struct x11drv_thread_data
Window grab_window; /* window that currently grabs the mouse */ Window grab_window; /* window that currently grabs the mouse */
HWND last_focus; /* last window that had focus */ HWND last_focus; /* last window that had focus */
XIM xim; /* input method */ XIM xim; /* input method */
HWND last_xic_hwnd; /* last xic window */
XFontSet font_set; /* international text drawing font set */ XFontSet font_set; /* international text drawing font set */
Window selection_wnd; /* window used for selection interactions */ Window selection_wnd; /* window used for selection interactions */
HKL kbd_layout; /* active keyboard layout */ HKL kbd_layout; /* active keyboard layout */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment