Alexandre Julliard : winex11: Only update the fullscreen pointer grab when something has changed.

Alexandre Julliard julliard at winehq.org
Thu May 12 13:57:51 CDT 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu May 12 16:24:58 2011 +0200

winex11: Only update the fullscreen pointer grab when something has changed.

---

 dlls/winex11.drv/desktop.c |    2 +-
 dlls/winex11.drv/event.c   |    2 +-
 dlls/winex11.drv/mouse.c   |   17 ++++++++++++-----
 dlls/winex11.drv/x11drv.h  |    2 +-
 4 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c
index b45f786..acba18b 100644
--- a/dlls/winex11.drv/desktop.c
+++ b/dlls/winex11.drv/desktop.c
@@ -200,7 +200,7 @@ static BOOL CALLBACK update_windows_on_desktop_resize( HWND hwnd, LPARAM lparam
                               DefaultScreen(display), mask, &changes );
         wine_tsx11_unlock();
     }
-    if (hwnd == GetForegroundWindow()) clip_fullscreen_window( hwnd );
+    if (hwnd == GetForegroundWindow()) clip_fullscreen_window( hwnd, TRUE );
     return TRUE;
 }
 
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index d2ab40a..6ef1e07 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -716,7 +716,7 @@ static void X11DRV_FocusIn( HWND hwnd, XEvent *xev )
     }
     if (use_take_focus)
     {
-        if (hwnd == GetForegroundWindow()) clip_fullscreen_window( hwnd );
+        if (hwnd == GetForegroundWindow()) clip_fullscreen_window( hwnd, FALSE );
         return;
     }
 
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 3e1a78f..5fd7338 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -419,11 +419,11 @@ static BOOL grab_clipping_window( const RECT *clip, BOOL only_with_xinput )
         if (msg_hwnd) DestroyWindow( msg_hwnd );
         return FALSE;
     }
+    clip_rect = *clip;
     if (msg_hwnd)
     {
         data->clip_hwnd = msg_hwnd;
         sync_window_cursor( clip_window );
-        clip_rect = *clip;
         SendMessageW( GetDesktopWindow(), WM_X11DRV_CLIP_CURSOR, 0, (LPARAM)msg_hwnd );
     }
     return TRUE;
@@ -502,9 +502,10 @@ LRESULT clip_cursor_notify( HWND hwnd, HWND new_clip_hwnd )
  *
  * Turn on clipping if the active window is fullscreen.
  */
-BOOL clip_fullscreen_window( HWND hwnd )
+BOOL clip_fullscreen_window( HWND hwnd, BOOL reset )
 {
     struct x11drv_win_data *data;
+    struct x11drv_thread_data *thread_data;
     RECT rect;
     DWORD style;
 
@@ -516,7 +517,9 @@ BOOL clip_fullscreen_window( HWND hwnd )
     /* maximized windows don't count as full screen */
     if ((style & WS_MAXIMIZE) && (style & WS_CAPTION) == WS_CAPTION) return FALSE;
     if (!is_window_rect_fullscreen( &data->whole_rect )) return FALSE;
-    if (GetTickCount() - x11drv_thread_data()->clip_reset < 1000) return FALSE;
+    if (!(thread_data = x11drv_thread_data())) return FALSE;
+    if (GetTickCount() - thread_data->clip_reset < 1000) return FALSE;
+    if (!reset && thread_data->clip_hwnd) return FALSE;  /* already clipping */
     SetRect( &rect, 0, 0, screen_width, screen_height );
     if (!grab_fullscreen)
     {
@@ -576,7 +579,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
     {
         hwnd = GetAncestor( hwnd, GA_ROOT );
         if ((input->u.mi.dwFlags & (MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_RIGHTDOWN)) && hwnd == GetForegroundWindow())
-            clip_fullscreen_window( hwnd );
+            clip_fullscreen_window( hwnd, FALSE );
     }
 
     /* update the wine server Z-order */
@@ -1280,7 +1283,11 @@ BOOL CDECL X11DRV_ClipCursor( LPCRECT clip )
         else /* if currently clipping, check if we should switch to fullscreen clipping */
         {
             struct x11drv_thread_data *data = x11drv_thread_data();
-            if (data && data->clip_hwnd && clip_fullscreen_window( foreground )) return TRUE;
+            if (data && data->clip_hwnd)
+            {
+                if (EqualRect( clip, &clip_rect ) || clip_fullscreen_window( foreground, TRUE ))
+                    return TRUE;
+            }
         }
     }
     ungrab_clipping_window();
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index fc6902b..ca7a379 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -846,7 +846,7 @@ 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 BOOL clip_fullscreen_window( HWND hwnd );
+extern BOOL clip_fullscreen_window( HWND hwnd, BOOL reset );
 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