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

Alexandre Julliard julliard at winehq.org
Mon Apr 25 12:47:12 CDT 2011


Module: wine
Branch: master
Commit: f1f223d00161bb7b22af7d3383bb14c770adcad2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f1f223d00161bb7b22af7d3383bb14c770adcad2

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Apr 25 10:49:49 2011 +0200

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

---

 dlls/winex11.drv/desktop.c |    2 +-
 dlls/winex11.drv/event.c   |   11 ++++++++++-
 dlls/winex11.drv/mouse.c   |    2 +-
 dlls/winex11.drv/window.c  |    2 +-
 dlls/winex11.drv/x11drv.h  |    2 +-
 5 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c
index eefc74c..fe4a040 100644
--- a/dlls/winex11.drv/desktop.c
+++ b/dlls/winex11.drv/desktop.c
@@ -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.bottom - virtual_screen_rect.top,
                       SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE );
-        X11DRV_ClipCursor( NULL );
+        ungrab_clipping_window();
         SendMessageTimeoutW( HWND_BROADCAST, WM_DISPLAYCHANGE, screen_bpp,
                              MAKELPARAM( width, height ), SMTO_ABORTIFHUNG, 2000, NULL );
     }
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index b338236..0233a61 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -672,7 +672,16 @@ static void X11DRV_FocusOut( HWND hwnd, XEvent *xev )
     int revert;
     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] );
 
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index b447b7e..1e783d2 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -447,7 +447,7 @@ static BOOL grab_clipping_window( const RECT *clip )
  *
  * Release the pointer grab on the clip window.
  */
-static void ungrab_clipping_window(void)
+void ungrab_clipping_window(void)
 {
     Display *display = thread_init_display();
     Window clip_window = init_clip_window();
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index ba544cd..32a3f4c 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -2002,7 +2002,7 @@ BOOL CDECL X11DRV_CreateWindow( HWND hwnd )
 
         /* create the cursor clipping window */
         attr.override_redirect = TRUE;
-        attr.event_mask = StructureNotifyMask;
+        attr.event_mask = StructureNotifyMask | FocusChangeMask;
         wine_tsx11_lock();
         data->clip_window = XCreateWindow( data->display, root_window, 0, 0, 1, 1, 0, 0,
                                            InputOnly, visual, CWOverrideRedirect | CWEventMask, &attr );
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 48394ac..cfe2509 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -829,7 +829,7 @@ extern void CDECL X11DRV_SetFocus( HWND hwnd );
 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 BOOL CDECL X11DRV_ClipCursor( LPCRECT clip );
+extern void ungrab_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 );




More information about the wine-cvs mailing list