[PATCH 2/2] [try4] winex11.drv: Separate the (future) user32 code
from the driver code.
Pierre d'Herbemont
pdherbemont at free.fr
Tue Apr 10 07:40:09 CDT 2007
---
dlls/winex11.drv/winpos.c | 56
+++++++++++++++++++++++++-------------------
1 files changed, 32 insertions(+), 24 deletions(-)
-------------- next part --------------
diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c
index 0fb6893..ebcd1ed 100644
--- a/dlls/winex11.drv/winpos.c
+++ b/dlls/winex11.drv/winpos.c
@@ -253,6 +253,7 @@ BOOL X11DRV_GetVisibleRect( HWND hwnd, RECT *rect)
return TRUE;
}
+
/***********************************************************************
* SetWindowPos (X11DRV.@)
*/
@@ -260,18 +261,14 @@ 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, old_style = 0;
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 +299,35 @@ 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 (ret && 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;
- }
+ win->rectWindow = *rectWindow;
+ win->rectClient = *rectClient;
+ old_style = win->dwStyle;
+ win->dwStyle = new_style;
+ }
- if (ret)
+ if (ret || win == WND_DESKTOP)
{
Display *display = thread_display();
+ RECT old_client_rect;
+ DWORD wtid, wpid;
+
+ if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
+
+ wtid = GetWindowThreadProcessId( GetDesktopWindow(), &wpid);
+
+ /* Make sure we don't manipulate the desktop window if we don't own it
+ * (this is equivalent to win == WND_DESKTOP).
+ * We make also sure we don't manipulate the x11 root */
+ if ((hwnd == GetDesktopWindow() && (wtid != GetCurrentThreadId() || wpid != GetCurrentProcessId())) &&
+ data->whole_window == DefaultRootWindow(gdi_display) )
+ {
+ data->whole_rect = data->client_rect = data->window_rect = *rectWindow;
+ goto end;
+ }
+
+ old_client_rect = data->client_rect;
/* invalidate DCEs */
@@ -325,14 +335,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",
@@ -419,7 +425,9 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow,
}
}
}
- WIN_ReleasePtr( win );
+end:
+ if (win != WND_DESKTOP)
+ WIN_ReleasePtr( win );
return ret;
}
More information about the wine-patches
mailing list