Alexandre Julliard : winex11: Add an option to disable pointer grabs.

Alexandre Julliard julliard at winehq.org
Tue Apr 5 11:23:31 CDT 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Apr  5 11:00:09 2011 +0200

winex11: Add an option to disable pointer grabs.

---

 dlls/winex11.drv/mouse.c       |   29 ++++++++++++++++-------------
 dlls/winex11.drv/x11drv.h      |    1 +
 dlls/winex11.drv/x11drv_main.c |    4 ++++
 3 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 2b793e1..fe9f716 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -938,22 +938,25 @@ BOOL CDECL X11DRV_ClipCursor( LPCRECT clip )
         if (GetWindowThreadProcessId( GetDesktopWindow(), NULL ) == GetCurrentThreadId())
             return TRUE;  /* don't clip in the desktop process */
 
-        TRACE( "clipping to %s\n", wine_dbgstr_rect(clip) );
-        wine_tsx11_lock();
-        XUnmapWindow( display, clip_window );
-        XMoveResizeWindow( display, clip_window,
-                           clip->left - virtual_screen_rect.left, clip->top - virtual_screen_rect.top,
-                           clip->right - clip->left, clip->bottom - clip->top );
-        XMapWindow( display, clip_window );
-        if (!XGrabPointer( display, clip_window, False,
-                           PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
-                           GrabModeAsync, GrabModeAsync, clip_window, None, CurrentTime ))
+        if (grab_pointer)
         {
+            TRACE( "clipping to %s\n", wine_dbgstr_rect(clip) );
+            wine_tsx11_lock();
+            XUnmapWindow( display, clip_window );
+            XMoveResizeWindow( display, clip_window,
+                               clip->left - virtual_screen_rect.left, clip->top - virtual_screen_rect.top,
+                               clip->right - clip->left, clip->bottom - clip->top );
+            XMapWindow( display, clip_window );
+            if (!XGrabPointer( display, clip_window, False,
+                               PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
+                               GrabModeAsync, GrabModeAsync, clip_window, None, CurrentTime ))
+            {
+                wine_tsx11_unlock();
+                clip_rect = *clip;
+                return TRUE;
+            }
             wine_tsx11_unlock();
-            clip_rect = *clip;
-            return TRUE;
         }
-        wine_tsx11_unlock();
     }
 
     /* release the grab if any */
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index a746d08..0a1e3d9 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -598,6 +598,7 @@ extern int use_take_focus;
 extern int use_primary_selection;
 extern int use_system_cursors;
 extern int show_systray;
+extern int grab_pointer;
 extern int usexcomposite;
 extern int managed_mode;
 extern int decorated_mode;
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index 606bc28..cc38be2 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -84,6 +84,7 @@ int use_take_focus = 1;
 int use_primary_selection = 0;
 int use_system_cursors = 1;
 int show_systray = 1;
+int grab_pointer = 1;
 int managed_mode = 1;
 int decorated_mode = 1;
 int private_color_map = 0;
@@ -426,6 +427,9 @@ static void setup_options(void)
     if (!get_config_key( hkey, appkey, "ShowSystray", buffer, sizeof(buffer) ))
         show_systray = IS_OPTION_TRUE( buffer[0] );
 
+    if (!get_config_key( hkey, appkey, "GrabPointer", buffer, sizeof(buffer) ))
+        grab_pointer = IS_OPTION_TRUE( buffer[0] );
+
     screen_depth = 0;
     if (!get_config_key( hkey, appkey, "ScreenDepth", buffer, sizeof(buffer) ))
         screen_depth = atoi(buffer);




More information about the wine-cvs mailing list