winex11: Release the clip cursor grab when the clipping window loses focus.

This commit is contained in:
Alexandre Julliard 2011-04-25 10:49:49 +02:00
parent fa2e4bb5de
commit f1f223d001
5 changed files with 14 additions and 5 deletions

View File

@ -258,7 +258,7 @@ void X11DRV_resize_desktop( unsigned int width, unsigned int height )
virtual_screen_rect.right - virtual_screen_rect.left, virtual_screen_rect.right - virtual_screen_rect.left,
virtual_screen_rect.bottom - virtual_screen_rect.top, virtual_screen_rect.bottom - virtual_screen_rect.top,
SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE ); SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE );
X11DRV_ClipCursor( NULL ); ungrab_clipping_window();
SendMessageTimeoutW( HWND_BROADCAST, WM_DISPLAYCHANGE, screen_bpp, SendMessageTimeoutW( HWND_BROADCAST, WM_DISPLAYCHANGE, screen_bpp,
MAKELPARAM( width, height ), SMTO_ABORTIFHUNG, 2000, NULL ); MAKELPARAM( width, height ), SMTO_ABORTIFHUNG, 2000, NULL );
} }

View File

@ -672,7 +672,16 @@ static void X11DRV_FocusOut( HWND hwnd, XEvent *xev )
int revert; int revert;
XIC xic; XIC xic;
if (!hwnd) return; if (!hwnd)
{
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 */
}
return;
}
TRACE( "win %p xwin %lx detail=%s\n", hwnd, event->window, focus_details[event->detail] ); TRACE( "win %p xwin %lx detail=%s\n", hwnd, event->window, focus_details[event->detail] );

View File

@ -447,7 +447,7 @@ static BOOL grab_clipping_window( const RECT *clip )
* *
* Release the pointer grab on the clip window. * Release the pointer grab on the clip window.
*/ */
static void ungrab_clipping_window(void) void ungrab_clipping_window(void)
{ {
Display *display = thread_init_display(); Display *display = thread_init_display();
Window clip_window = init_clip_window(); Window clip_window = init_clip_window();

View File

@ -2002,7 +2002,7 @@ BOOL CDECL X11DRV_CreateWindow( HWND hwnd )
/* create the cursor clipping window */ /* create the cursor clipping window */
attr.override_redirect = TRUE; attr.override_redirect = TRUE;
attr.event_mask = StructureNotifyMask; attr.event_mask = StructureNotifyMask | FocusChangeMask;
wine_tsx11_lock(); wine_tsx11_lock();
data->clip_window = XCreateWindow( data->display, root_window, 0, 0, 1, 1, 0, 0, data->clip_window = XCreateWindow( data->display, root_window, 0, 0, 1, 1, 0, 0,
InputOnly, visual, CWOverrideRedirect | CWEventMask, &attr ); InputOnly, visual, CWOverrideRedirect | CWEventMask, &attr );

View File

@ -829,7 +829,7 @@ extern void CDECL X11DRV_SetFocus( HWND hwnd );
extern void set_window_cursor( Window window, HCURSOR handle ); extern void set_window_cursor( Window window, HCURSOR handle );
extern void sync_window_cursor( Window window ); extern void sync_window_cursor( Window window );
extern LRESULT clip_cursor_notify( HWND hwnd, HWND new_clip_hwnd ); extern LRESULT clip_cursor_notify( HWND hwnd, HWND new_clip_hwnd );
extern BOOL CDECL X11DRV_ClipCursor( LPCRECT clip ); extern void ungrab_clipping_window(void);
extern void X11DRV_InitKeyboard( Display *display ); extern void X11DRV_InitKeyboard( Display *display );
extern DWORD CDECL X11DRV_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout, extern DWORD CDECL X11DRV_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout,
DWORD mask, DWORD flags ); DWORD mask, DWORD flags );