[PATCH 2/2] [try3] winex11.drv: Separate the (future) user32 code from the driver code.

Pierre d'Herbemont pdherbemont at free.fr
Sat Apr 7 06:24:15 CDT 2007


---
  dlls/winex11.drv/winpos.c |   61 
+++++++++++++++++++++++++++++---------------
  1 files changed, 40 insertions(+), 21 deletions(-)
-------------- next part --------------
diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c
index 0fb6893..d7c001d 100644
--- a/dlls/winex11.drv/winpos.c
+++ b/dlls/winex11.drv/winpos.c
@@ -254,24 +254,35 @@ BOOL X11DRV_GetVisibleRect( HWND hwnd, RECT *rect)
 }
 
 /***********************************************************************
+ *		X11DRV_SetDesktopWindowPos
+ */
+BOOL X11DRV_SetDesktopWindowPos( HWND hwnd, const RECT *rectWindow)
+{
+    struct x11drv_win_data *data;
+
+    if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
+
+    data->whole_rect = data->client_rect = data->window_rect = *rectWindow;
+
+    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;
+    RECT new_whole_rect, old_screen_rect;
     WND *win;
-    DWORD old_style, new_style;
+    DWORD new_style;
     BOOL ret;
 
-    if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
-
     new_whole_rect = *rectWindow;
     X11DRV_GetVisibleRect( hwnd, &new_whole_rect );
 
-    old_client_rect = data->client_rect;
-
     if (!(win = WIN_GetPtr( hwnd ))) return FALSE;
     if (win == WND_OTHER_PROCESS)
     {
@@ -302,22 +313,34 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
     }
     SERVER_END_REQ;
 
-    if (win == WND_DESKTOP || data->whole_window == DefaultRootWindow(gdi_display))
+    if (win == WND_DESKTOP)
     {
-        data->whole_rect = data->client_rect = data->window_rect = *rectWindow;
-        if (win != WND_DESKTOP)
-        {
-            win->rectWindow   = *rectWindow;
-            win->rectClient   = *rectClient;
-            win->dwStyle      = new_style;
-            WIN_ReleasePtr( win );
-        }
-        return ret;
+        /* Don't attempt to release win as it is WND_DESKTOP */
+        return X11DRV_SetDesktopWindowPos( hwnd, rectWindow );
     }
 
     if (ret)
     {
         Display *display = thread_display();
+        RECT old_client_rect;
+        DWORD old_style;
+
+        win->rectWindow   = *rectWindow;
+        win->rectClient   = *rectClient;
+        old_style         = win->dwStyle;
+        win->dwStyle      = new_style;
+
+        if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
+
+        /* Make sure we don't manipulate the x11 root window */
+        if (data->whole_window == DefaultRootWindow(gdi_display))
+        {
+            data->whole_rect = data->client_rect = data->window_rect = *rectWindow;
+            WIN_ReleasePtr( win );
+            return ret;
+        }
+
+        old_client_rect = data->client_rect;
 
         /* invalidate DCEs */
 
@@ -325,14 +348,10 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
              (swp_flags & (SWP_HIDEWINDOW | SWP_SHOWWINDOW)))
         {
             RECT rect;
-            UnionRect( &rect, rectWindow, &win->rectWindow );
+            UnionRect( &rect, rectWindow, &data->window_rect );
             invalidate_dce( hwnd, &rect );
         }
 
-        win->rectWindow   = *rectWindow;
-        win->rectClient   = *rectClient;
-        old_style         = win->dwStyle;
-        win->dwStyle      = new_style;
         data->window_rect = *rectWindow;
 
         TRACE( "win %p window %s client %s style %08x\n",


More information about the wine-patches mailing list