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

This commit is contained in:
Dmitry Timoshkov 2010-07-23 22:21:58 +09:00 committed by Alexandre Julliard
parent f57c1b77dd
commit a56df96a0e
3 changed files with 11 additions and 3 deletions

View File

@ -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 );

View File

@ -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 );

View File

@ -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 */