[PATCH 2/4 - try2] 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
Wed Jan 24 08:01:34 CST 2007


---
  dlls/winex11.drv/winpos.c |   27 +++++++++++++++++++++------
  1 files changed, 21 insertions(+), 6 deletions(-)
-------------- next part --------------
diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c
index 1991b82..f72730c 100644
--- a/dlls/winex11.drv/winpos.c
+++ b/dlls/winex11.drv/winpos.c
@@ -238,6 +238,21 @@ static BOOL fullscreen_state_changed( co
     return *new_fs_state != old_fs_state;
 }
 
+/***********************************************************************
+ *		X11DRV_GetVisibleRect
+ *
+ *  Return TRUE if there is an associated X window, and if rect has
+ *  succesfully been updated.
+ */
+BOOL X11DRV_GetVisibleRect( HWND hwnd, RECT *rect )
+{
+    struct x11drv_win_data *data;
+    if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
+
+    X11DRV_window_to_X_rect( data, rect );
+
+    return data->whole_window;
+}
 
 /***********************************************************************
  *		SetWindowPos   (X11DRV.@)
@@ -251,12 +266,8 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWN
     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, &new_whole_rect );
 
     if (!(win = WIN_GetPtr( hwnd ))) return FALSE;
     if (win == WND_OTHER_PROCESS)
@@ -269,7 +280,7 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWN
     {
         int x_offset = 0, y_offset = 0;
 
-        if (data->whole_window)
+        if (ret)
         {
             /* the graphics driver will move the bits for us */
             x_offset = win->rectWindow.left - rectWindow->left;
@@ -308,6 +319,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