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
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 );
......
......@@ -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 );
......
......@@ -548,6 +548,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 */
......
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