user32: Make GetWindowPlacement() work for other process windows.
Dmitry Timoshkov
dmitry at codeweavers.com
Fri Aug 27 03:44:36 CDT 2010
This patch fixes the problem reported in the bug 12001.
---
dlls/user32/winpos.c | 55 ++++++++++++++++++++++---------------------------
1 files changed, 25 insertions(+), 30 deletions(-)
diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index e5e4e0c..311459b 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -1146,11 +1146,11 @@ UINT WINAPI GetInternalWindowPos( HWND hwnd, LPRECT rectWnd,
*/
BOOL WINAPI GetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *wndpl )
{
- WND *pWnd = WIN_GetPtr( hwnd );
-
- if (!pWnd) return FALSE;
+ RECT window_rect;
+ POINT min_pos, max_pos;
+ DWORD style;
- if (pWnd == WND_DESKTOP)
+ if (hwnd == GetDesktopWindow())
{
wndpl->length = sizeof(*wndpl);
wndpl->showCmd = SW_SHOWNORMAL;
@@ -1162,41 +1162,36 @@ BOOL WINAPI GetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *wndpl )
GetWindowRect( hwnd, &wndpl->rcNormalPosition );
return TRUE;
}
- if (pWnd == WND_OTHER_PROCESS)
- {
- if (IsWindow( hwnd )) FIXME( "not supported on other process window %p\n", hwnd );
- return FALSE;
- }
- /* update the placement according to the current style */
- if (pWnd->dwStyle & WS_MINIMIZE)
- {
- pWnd->min_pos.x = pWnd->rectWindow.left;
- pWnd->min_pos.y = pWnd->rectWindow.top;
- }
- else if (pWnd->dwStyle & WS_MAXIMIZE)
+ if (!WIN_GetRectangles( hwnd, &window_rect, NULL )) return FALSE;
+
+ style = GetWindowLongW( hwnd, GWL_STYLE );
+
+ min_pos.x = -1;
+ min_pos.y = -1;
+ max_pos.x = -1;
+ max_pos.y = -1;
+
+ if (style & WS_MINIMIZE)
{
- pWnd->max_pos.x = pWnd->rectWindow.left;
- pWnd->max_pos.y = pWnd->rectWindow.top;
+ min_pos.x = window_rect.left;
+ min_pos.y = window_rect.top;
}
- else
+ else if (style & WS_MAXIMIZE)
{
- pWnd->normal_rect = pWnd->rectWindow;
+ max_pos.x = window_rect.left;
+ max_pos.y = window_rect.top;
}
wndpl->length = sizeof(*wndpl);
- if( pWnd->dwStyle & WS_MINIMIZE )
+ if( style & WS_MINIMIZE )
wndpl->showCmd = SW_SHOWMINIMIZED;
else
- wndpl->showCmd = ( pWnd->dwStyle & WS_MAXIMIZE ) ? SW_SHOWMAXIMIZED : SW_SHOWNORMAL ;
- if( pWnd->flags & WIN_RESTORE_MAX )
- wndpl->flags = WPF_RESTORETOMAXIMIZED;
- else
- wndpl->flags = 0;
- wndpl->ptMinPosition = pWnd->min_pos;
- wndpl->ptMaxPosition = pWnd->max_pos;
- wndpl->rcNormalPosition = pWnd->normal_rect;
- WIN_ReleasePtr( pWnd );
+ wndpl->showCmd = ( style & WS_MAXIMIZE ) ? SW_SHOWMAXIMIZED : SW_SHOWNORMAL ;
+ wndpl->flags = 0; /* FIXME */
+ wndpl->ptMinPosition = min_pos;
+ wndpl->ptMaxPosition = max_pos;
+ wndpl->rcNormalPosition = window_rect;
TRACE( "%p: returning min %d,%d max %d,%d normal %s\n",
hwnd, wndpl->ptMinPosition.x, wndpl->ptMinPosition.y,
--
1.7.0.6
More information about the wine-patches
mailing list