[PATCH 1/5] winex11.drv: Retrieve window visible rects from a new function in order to ease SetWindowPos factorization in user32

Pierre d'Herbemont pdherbemont at free.fr
Tue Jan 23 09:17:19 CST 2007


Hi,

This set of patches is yet an other attempt at factorization of graphics 
drivers. This set obvious goal is to move most of the SetWindowPos code 
into user32.

SetWindowPos factorization is important because the factorization of the 
DCE code is relying on it, and CreateWindow factorization needs DCE code 
to be in user32.

That's also why the other goal of this set is to make the dce_invalidate 
call easily moveable into user32.

Pierre.

---
  dlls/winex11.drv/winpos.c |   32 +++++++++++++++++++++++---------
  1 files changed, 23 insertions(+), 9 deletions(-)
-------------- next part --------------
diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c
index 95afc40..422efd8 100644
--- a/dlls/winex11.drv/winpos.c
+++ b/dlls/winex11.drv/winpos.c
@@ -238,6 +238,20 @@ static BOOL fullscreen_state_changed( co
     return *new_fs_state != old_fs_state;
 }
 
+/***********************************************************************
+ *		X11DRV_GetVisibleRect
+ */
+BOOL X11DRV_GetVisibleRect( HWND hwnd, RECT *visible_rect, RECT *new_whole_rect )
+{
+    struct x11drv_win_data *data;
+
+    if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
+
+    *visible_rect = data->whole_rect;
+    X11DRV_window_to_X_rect( data, new_whole_rect );
+
+    return TRUE;
+}
 
 /***********************************************************************
  *		SetWindowPos   (X11DRV.@)
@@ -246,27 +260,23 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWN
                                    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;
+    RECT new_whole_rect, old_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;
+    ret = X11DRV_GetVisibleRect( hwnd, &old_whole_rect, &new_whole_rect );
 
     if (!IsRectEmpty( &valid_rects[0] ))
     {
         int x_offset = 0, y_offset = 0;
 
-        if (data->whole_window)
+        if (ret)
         {
             /* 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 = old_whole_rect.left - new_whole_rect.left;
+            y_offset = old_whole_rect.top - new_whole_rect.top;
         }
 
         if (x_offset != valid_rects[1].left - valid_rects[0].left ||
@@ -307,6 +317,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