Commit a28722f5 authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Reset the clipping when the desktop window loses focus.

parent 6a3255bb
......@@ -143,7 +143,7 @@ Window CDECL X11DRV_create_desktop( UINT width, UINT height )
/* Create window */
win_attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | EnterWindowMask |
PointerMotionMask | ButtonPressMask | ButtonReleaseMask;
PointerMotionMask | ButtonPressMask | ButtonReleaseMask | FocusChangeMask;
win_attr.cursor = XCreateFontCursor( display, XC_top_left_arrow );
if (visual != DefaultVisual( display, DefaultScreen(display) ))
......
......@@ -706,6 +706,7 @@ static void X11DRV_FocusIn( HWND hwnd, XEvent *xev )
TRACE( "win %p xwin %lx detail=%s\n", hwnd, event->window, focus_details[event->detail] );
if (event->detail == NotifyPointer) return;
if (hwnd == GetDesktopWindow()) return;
if ((xic = X11DRV_get_ic( hwnd )))
{
......@@ -740,20 +741,13 @@ static void X11DRV_FocusOut( HWND hwnd, XEvent *xev )
int revert;
XIC xic;
if (!hwnd)
TRACE( "win %p xwin %lx detail=%s\n", hwnd, event->window, focus_details[event->detail] );
if (event->detail == NotifyPointer)
{
if (event->detail == NotifyPointer && event->window == x11drv_thread_data()->clip_window)
{
TRACE( "clip window lost focus\n" );
ungrab_clipping_window();
ClipCursor( NULL ); /* make sure the clip rectangle is reset too */
}
if (!hwnd && event->window == x11drv_thread_data()->clip_window) reset_clipping_window();
return;
}
TRACE( "win %p xwin %lx detail=%s\n", hwnd, event->window, focus_details[event->detail] );
if (event->detail == NotifyPointer) return;
if (ximInComposeMode) return;
x11drv_thread_data()->last_focus = hwnd;
......@@ -763,8 +757,12 @@ static void X11DRV_FocusOut( HWND hwnd, XEvent *xev )
XUnsetICFocus( xic );
wine_tsx11_unlock();
}
if (root_window != DefaultRootWindow(event->display))
{
if (hwnd == GetDesktopWindow()) reset_clipping_window();
return;
}
if (hwnd != GetForegroundWindow()) return;
if (root_window != DefaultRootWindow(event->display)) return;
SendMessageW( hwnd, WM_CANCELMODE, 0, 0 );
/* don't reset the foreground window, if the window which is
......
......@@ -449,6 +449,17 @@ void ungrab_clipping_window(void)
}
/***********************************************************************
* reset_clipping_window
*
* Forcibly reset the window clipping on external events.
*/
void reset_clipping_window(void)
{
ungrab_clipping_window();
ClipCursor( NULL ); /* make sure the clip rectangle is reset too */
}
/***********************************************************************
* clip_cursor_notify
*
* Notification function called upon receiving a WM_X11DRV_CLIP_CURSOR.
......
......@@ -831,6 +831,7 @@ extern void set_window_cursor( Window window, HCURSOR handle );
extern void sync_window_cursor( Window window );
extern LRESULT clip_cursor_notify( HWND hwnd, HWND new_clip_hwnd );
extern void ungrab_clipping_window(void);
extern void reset_clipping_window(void);
extern void X11DRV_InitKeyboard( Display *display );
extern DWORD CDECL X11DRV_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout,
DWORD mask, DWORD flags );
......
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