winex11.drv: Use a separate function to check the valid rects in SetWindowPos

Pierre d'Herbemont pdherbemont at free.fr
Thu Jan 25 15:30:01 CST 2007


Hope this is what Alexandre is requesting.

(I don't send the rest of the set this time, in order not to spam the list)

Pierre.
---
  dlls/winex11.drv/winpos.c |   47 
++++++++++++++++++++++++++++++--------------
  1 files changed, 32 insertions(+), 15 deletions(-)
-------------- next part --------------
diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c
index 95afc40..04fa41f 100644
--- a/dlls/winex11.drv/winpos.c
+++ b/dlls/winex11.drv/winpos.c
@@ -240,23 +240,15 @@ static BOOL fullscreen_state_changed( co
 
 
 /***********************************************************************
- *		SetWindowPos   (X11DRV.@)
+ *		X11DRV_GetVisibleRect
  */
-BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
-                                   const RECT *rectClient, UINT swp_flags, const RECT *valid_rects )
+BOOL X11DRV_GetVisibleRect( HWND hwnd, RECT *rect, const RECT *valid_rects )
 {
     struct x11drv_win_data *data;
-    RECT new_whole_rect, old_client_rect, old_screen_rect;
-    WND *win;
-    DWORD old_style, new_style;
-    BOOL ret;
 
     if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
 
-    new_whole_rect = *rectWindow;
-    X11DRV_window_to_X_rect( data, &new_whole_rect );
-
-    old_client_rect = data->client_rect;
+    X11DRV_X_to_window_rect(data, rect);
 
     if (!IsRectEmpty( &valid_rects[0] ))
     {
@@ -265,17 +257,38 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWN
         if (data->whole_window)
         {
             /* the X server will move the bits for us */
-            x_offset = data->whole_rect.left - new_whole_rect.left;
-            y_offset = data->whole_rect.top - new_whole_rect.top;
+            x_offset = data->whole_rect.left - rect.left;
+            y_offset = data->whole_rect.top - rect.top;
         }
 
         if (x_offset != valid_rects[1].left - valid_rects[0].left ||
             y_offset != valid_rects[1].top - valid_rects[0].top)
         {
-            /* FIXME: should copy the window bits here */
-            valid_rects = NULL;
+            return FALSE;
         }
     }
+    return TRUE;
+}
+
+/***********************************************************************
+ *		SetWindowPos   (X11DRV.@)
+ */
+BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
+                                   const RECT *rectClient, UINT swp_flags, const RECT *valid_rects )
+{
+    struct x11drv_win_data *data;
+    RECT new_whole_rect, old_client_rect, old_screen_rect;
+    WND *win;
+    DWORD old_style, new_style;
+    BOOL ret;
+
+    new_whole_rect = *rectWindow;
+
+    if (!X11DRV_GetVisibleRect( hwnd, &new_whole_rect, valid_rects ))
+    {
+        /* FIXME: should copy the window bits here */
+        valid_rects = NULL;
+    }
 
     if (!(win = WIN_GetPtr( hwnd ))) return FALSE;
     if (win == WND_OTHER_PROCESS)
@@ -307,6 +320,10 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWN
     }
     SERVER_END_REQ;
 
+    if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
+
+    old_client_rect = data->client_rect;
+
     if (win == WND_DESKTOP || data->whole_window == DefaultRootWindow(gdi_display))
     {
         data->whole_rect = data->client_rect = data->window_rect = *rectWindow;


More information about the wine-patches mailing list