Commit ecd8c931 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winex11: Set or clear XIC focus using a xim_set_focus helper.

parent 4e92c572
......@@ -752,7 +752,6 @@ static const char * const focus_modes[] =
static BOOL X11DRV_FocusIn( HWND hwnd, XEvent *xev )
{
XFocusChangeEvent *event = &xev->xfocus;
XIC xic;
if (!hwnd) return FALSE;
......@@ -779,7 +778,8 @@ static BOOL X11DRV_FocusIn( HWND hwnd, XEvent *xev )
return TRUE; /* ignore wm specific NotifyUngrab / NotifyGrab events w.r.t focus */
}
if ((xic = X11DRV_get_ic( hwnd ))) XSetICFocus( xic );
xim_set_focus( hwnd, TRUE );
if (use_take_focus)
{
if (hwnd == NtUserGetForegroundWindow()) clip_fullscreen_window( hwnd, FALSE );
......@@ -806,12 +806,11 @@ static void focus_out( Display *display , HWND hwnd )
HWND hwnd_tmp;
Window focus_win;
int revert;
XIC xic;
if (xim_in_compose_mode()) return;
x11drv_thread_data()->last_focus = hwnd;
if ((xic = X11DRV_get_ic( hwnd ))) XUnsetICFocus( xic );
xim_set_focus( hwnd, FALSE );
if (is_virtual_desktop())
{
......
......@@ -826,6 +826,7 @@ extern void xim_thread_attach( struct x11drv_thread_data *data ) DECLSPEC_HIDDEN
extern BOOL xim_in_compose_mode(void) DECLSPEC_HIDDEN;
extern void X11DRV_XIMLookupChars( const char *str, UINT count ) DECLSPEC_HIDDEN;
extern XIC X11DRV_get_ic( HWND hwnd ) DECLSPEC_HIDDEN;
extern void xim_set_focus( HWND hwnd, BOOL focus ) DECLSPEC_HIDDEN;
#define XEMBED_MAPPED (1 << 0)
......
......@@ -471,3 +471,13 @@ XIC X11DRV_get_ic( HWND hwnd )
return ret;
}
void xim_set_focus( HWND hwnd, BOOL focus )
{
XIC xic;
if (!(xic = X11DRV_get_ic( hwnd ))) return;
if (focus) XSetICFocus( xic );
else XUnsetICFocus( xic );
}
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