user32: Use WIN_GetRectangles where possible instead of accessing the window structure.

This commit is contained in:
Alexandre Julliard 2010-09-07 14:41:07 +02:00
parent c5bf4976f1
commit 141defbd54
6 changed files with 78 additions and 116 deletions

View file

@ -57,11 +57,8 @@ static const WCHAR imm32W[] = { 'i','m','m','3','2','\0' };
static void DEFWND_HandleWindowPosChanged( HWND hwnd, const WINDOWPOS *winpos )
{
RECT rect;
WND *wndPtr = WIN_GetPtr( hwnd );
rect = wndPtr->rectClient;
WIN_ReleasePtr( wndPtr );
WIN_GetRectangles( hwnd, COORDS_PARENT, NULL, &rect );
if (!(winpos->flags & SWP_NOCLIENTMOVE))
SendMessageW( hwnd, WM_MOVE, 0, MAKELONG(rect.left, rect.top));

View file

@ -477,19 +477,13 @@ LRESULT NC_HandleNCCalcSize( HWND hwnd, RECT *winRect )
*
* Get the 'inside' rectangle of a window, i.e. the whole window rectangle
* but without the borders (if any).
* The rectangle is in window coordinates (for drawing with GetWindowDC()).
*/
static void NC_GetInsideRect( HWND hwnd, RECT *rect, DWORD style, DWORD ex_style )
static void NC_GetInsideRect( HWND hwnd, enum coords_relative relative, RECT *rect,
DWORD style, DWORD ex_style )
{
WND *wndPtr = WIN_GetPtr( hwnd );
WIN_GetRectangles( hwnd, relative, rect, NULL );
if (!wndPtr || wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP) return;
rect->top = rect->left = 0;
rect->right = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
rect->bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
if (style & WS_ICONIC) goto END;
if (style & WS_ICONIC) return;
/* Remove frame from rectangle */
if (HAS_THICKFRAME( style, ex_style ))
@ -514,9 +508,6 @@ static void NC_GetInsideRect( HWND hwnd, RECT *rect, DWORD style, DWORD ex_style
if (ex_style & WS_EX_STATICEDGE)
InflateRect (rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER));
}
END:
WIN_ReleasePtr( wndPtr );
}
@ -708,7 +699,7 @@ BOOL NC_DrawSysButton (HWND hwnd, HDC hdc, BOOL down)
DWORD style = GetWindowLongW( hwnd, GWL_STYLE );
DWORD ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE );
NC_GetInsideRect( hwnd, &rect, style, ex_style );
NC_GetInsideRect( hwnd, COORDS_WINDOW, &rect, style, ex_style );
DrawIconEx (hdc, rect.left + 2, rect.top + 1, hIcon,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON), 0, 0, DI_NORMAL);
@ -733,7 +724,7 @@ static void NC_DrawCloseButton (HWND hwnd, HDC hdc, BOOL down, BOOL bGrayed)
DWORD style = GetWindowLongW( hwnd, GWL_STYLE );
DWORD ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE );
NC_GetInsideRect( hwnd, &rect, style, ex_style );
NC_GetInsideRect( hwnd, COORDS_WINDOW, &rect, style, ex_style );
/* A tool window has a smaller Close button */
if (ex_style & WS_EX_TOOLWINDOW)
@ -778,7 +769,7 @@ static void NC_DrawMaxButton(HWND hwnd,HDC hdc,BOOL down, BOOL bGrayed)
flags = (style & WS_MAXIMIZE) ? DFCS_CAPTIONRESTORE : DFCS_CAPTIONMAX;
NC_GetInsideRect( hwnd, &rect, style, ex_style );
NC_GetInsideRect( hwnd, COORDS_WINDOW, &rect, style, ex_style );
if (style & WS_SYSMENU)
rect.right -= GetSystemMetrics(SM_CXSIZE);
rect.left = rect.right - GetSystemMetrics(SM_CXSIZE);
@ -806,7 +797,7 @@ static void NC_DrawMinButton(HWND hwnd,HDC hdc,BOOL down, BOOL bGrayed)
/* never draw minimize box when window has WS_EX_TOOLWINDOW style */
if (ex_style & WS_EX_TOOLWINDOW) return;
NC_GetInsideRect( hwnd, &rect, style, ex_style );
NC_GetInsideRect( hwnd, COORDS_WINDOW, &rect, style, ex_style );
if (style & WS_SYSMENU)
rect.right -= GetSystemMetrics(SM_CXSIZE);
if (style & (WS_MAXIMIZEBOX|WS_MINIMIZEBOX))
@ -994,7 +985,7 @@ static void NC_DoNCPaint( HWND hwnd, HRGN clip, BOOL suppress_menupaint )
DWORD dwStyle, dwExStyle;
WORD flags;
HRGN hrgn;
RECT rectClient, rectWindow;
RECT rectClient;
int has_menu;
if (!(wndPtr = WIN_GetPtr( hwnd )) || wndPtr == WND_OTHER_PROCESS) return;
@ -1002,7 +993,6 @@ static void NC_DoNCPaint( HWND hwnd, HRGN clip, BOOL suppress_menupaint )
dwStyle = wndPtr->dwStyle;
dwExStyle = wndPtr->dwExStyle;
flags = wndPtr->flags;
rectWindow = wndPtr->rectWindow;
WIN_ReleasePtr( wndPtr );
if ( dwStyle & WS_MINIMIZE ||
@ -1019,8 +1009,7 @@ static void NC_DoNCPaint( HWND hwnd, HRGN clip, BOOL suppress_menupaint )
Now, how is the "system" supposed to tell what happened?
*/
GetClientRect( hwnd, &rectClient );
MapWindowPoints( hwnd, 0, (POINT *)&rectClient, 2 );
WIN_GetRectangles( hwnd, COORDS_SCREEN, NULL, &rectClient );
hrgn = CreateRectRgnIndirect( &rectClient );
if (clip > (HRGN)1)
@ -1035,9 +1024,7 @@ static void NC_DoNCPaint( HWND hwnd, HRGN clip, BOOL suppress_menupaint )
if (!hdc) return;
rect.top = rect.left = 0;
rect.right = rectWindow.right - rectWindow.left;
rect.bottom = rectWindow.bottom - rectWindow.top;
WIN_GetRectangles( hwnd, COORDS_WINDOW, &rect, NULL );
GetClipBox( hdc, &rectClip );
SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
@ -1222,15 +1209,10 @@ void NC_GetSysPopupPos( HWND hwnd, RECT* rect )
{
DWORD style = GetWindowLongW( hwnd, GWL_STYLE );
DWORD ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE );
WND *wndPtr = WIN_GetPtr( hwnd );
if (!wndPtr || wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP) return;
NC_GetInsideRect( hwnd, rect, style, ex_style );
OffsetRect( rect, wndPtr->rectWindow.left, wndPtr->rectWindow.top);
if (style & WS_CHILD) ClientToScreen( GetParent(hwnd), (POINT *)rect );
NC_GetInsideRect( hwnd, COORDS_SCREEN, rect, style, ex_style );
rect->right = rect->left + GetSystemMetrics(SM_CYCAPTION) - 1;
rect->bottom = rect->top + GetSystemMetrics(SM_CYCAPTION) - 1;
WIN_ReleasePtr( wndPtr );
}
}
@ -1633,7 +1615,6 @@ LRESULT NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam )
BOOL WINAPI GetTitleBarInfo(HWND hwnd, PTITLEBARINFO tbi) {
DWORD dwStyle;
DWORD dwExStyle;
RECT wndRect;
TRACE("(%p %p)\n", hwnd, tbi);
@ -1649,13 +1630,7 @@ BOOL WINAPI GetTitleBarInfo(HWND hwnd, PTITLEBARINFO tbi) {
}
dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
dwExStyle = GetWindowLongW(hwnd, GWL_EXSTYLE);
NC_GetInsideRect(hwnd, &tbi->rcTitleBar, dwStyle, dwExStyle);
GetWindowRect(hwnd, &wndRect);
tbi->rcTitleBar.top += wndRect.top;
tbi->rcTitleBar.left += wndRect.left;
tbi->rcTitleBar.right += wndRect.left;
NC_GetInsideRect(hwnd, COORDS_SCREEN, &tbi->rcTitleBar, dwStyle, dwExStyle);
tbi->rcTitleBar.bottom = tbi->rcTitleBar.top;
if(dwExStyle & WS_EX_TOOLWINDOW)

View file

@ -396,23 +396,18 @@ static void make_dc_dirty( struct dce *dce )
* rectangle. In addition, pWnd->parent DCEs may need to be updated if
* DCX_CLIPCHILDREN flag is set.
*/
void invalidate_dce( HWND hwnd, const RECT *rect )
void invalidate_dce( HWND hwnd, const RECT *extra_rect )
{
RECT window_rect, extra_rect;
RECT window_rect;
struct dce *dce;
HWND hwndScope = GetAncestor( hwnd, GA_PARENT );
if (!hwndScope) return;
GetWindowRect( hwnd, &window_rect );
if (rect)
{
extra_rect = *rect;
MapWindowPoints( hwndScope, 0, (POINT *)&extra_rect, 2 );
}
TRACE("%p scope hwnd = %p %s (%s)\n",
hwnd, hwndScope, wine_dbgstr_rect(&window_rect), wine_dbgstr_rect(rect) );
hwnd, hwndScope, wine_dbgstr_rect(&window_rect), wine_dbgstr_rect(extra_rect) );
/* walk all DCEs and fixup non-empty entries */
@ -439,7 +434,7 @@ void invalidate_dce( HWND hwnd, const RECT *rect )
RECT dce_rect, tmp;
GetWindowRect( dce->hwnd, &dce_rect );
if (IntersectRect( &tmp, &dce_rect, &window_rect ) ||
(rect && IntersectRect( &tmp, &dce_rect, &extra_rect )))
(extra_rect && IntersectRect( &tmp, &dce_rect, extra_rect )))
make_dc_dirty( dce );
}
}

View file

@ -223,23 +223,26 @@ static BOOL SCROLL_GetScrollBarRect( HWND hwnd, INT nBar, RECT *lprect,
switch(nBar)
{
case SB_HORZ:
lprect->left = wndPtr->rectClient.left - wndPtr->rectWindow.left;
lprect->top = wndPtr->rectClient.bottom - wndPtr->rectWindow.top;
lprect->right = wndPtr->rectClient.right - wndPtr->rectWindow.left;
lprect->bottom = lprect->top + GetSystemMetrics(SM_CYHSCROLL);
WIN_GetRectangles( hwnd, COORDS_WINDOW, NULL, lprect );
lprect->top = lprect->bottom;
lprect->bottom += GetSystemMetrics(SM_CYHSCROLL);
if(wndPtr->dwStyle & WS_VSCROLL)
lprect->right++;
vertical = FALSE;
break;
case SB_VERT:
WIN_GetRectangles( hwnd, COORDS_WINDOW, NULL, lprect );
if((wndPtr->dwExStyle & WS_EX_LEFTSCROLLBAR) != 0)
lprect->left = wndPtr->rectClient.left - wndPtr->rectWindow.left - GetSystemMetrics(SM_CXVSCROLL);
{
lprect->right = lprect->left;
lprect->left -= GetSystemMetrics(SM_CXVSCROLL);
}
else
lprect->left = wndPtr->rectClient.right - wndPtr->rectWindow.left;
lprect->top = wndPtr->rectClient.top - wndPtr->rectWindow.top;
lprect->right = lprect->left + GetSystemMetrics(SM_CXVSCROLL);
lprect->bottom = wndPtr->rectClient.bottom - wndPtr->rectWindow.top;
{
lprect->left = lprect->right;
lprect->right += GetSystemMetrics(SM_CXVSCROLL);
}
if(wndPtr->dwStyle & WS_HSCROLL)
lprect->bottom++;
vertical = TRUE;
@ -1095,14 +1098,11 @@ void SCROLL_TrackScrollBar( HWND hwnd, INT scrollbar, POINT pt )
if (scrollbar != SB_CTL)
{
WND *wndPtr = WIN_GetPtr( hwnd );
if (!wndPtr || wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP) return;
xoffset = wndPtr->rectClient.left - wndPtr->rectWindow.left;
yoffset = wndPtr->rectClient.top - wndPtr->rectWindow.top;
WIN_ReleasePtr( wndPtr );
RECT rect;
WIN_GetRectangles( hwnd, COORDS_CLIENT, &rect, NULL );
ScreenToClient( hwnd, &pt );
pt.x += xoffset;
pt.y += yoffset;
pt.x -= rect.left;
pt.y -= rect.top;
}
SCROLL_HandleScrollEvent( hwnd, scrollbar, WM_LBUTTONDOWN, pt );

View file

@ -1386,22 +1386,17 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module,
/* send WM_NCCALCSIZE */
if ((wndPtr = WIN_GetPtr(hwnd)))
if (WIN_GetRectangles( hwnd, COORDS_PARENT, &rect, NULL ))
{
/* yes, even if the CBT hook was called with HWND_TOP */
POINT pt;
HWND insert_after = (wndPtr->dwStyle & WS_CHILD) ? HWND_BOTTOM : HWND_TOP;
RECT window_rect = wndPtr->rectWindow;
RECT client_rect = window_rect;
WIN_ReleasePtr( wndPtr );
HWND insert_after = (GetWindowLongW( hwnd, GWL_STYLE ) & WS_CHILD) ? HWND_BOTTOM : HWND_TOP;
RECT client_rect = rect;
/* the rectangle is in screen coords for WM_NCCALCSIZE when wparam is FALSE */
pt.x = pt.y = 0;
MapWindowPoints( parent, 0, &pt, 1 );
OffsetRect( &client_rect, pt.x, pt.y );
MapWindowPoints( parent, 0, (POINT *)&client_rect, 2 );
SendMessageW( hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&client_rect );
OffsetRect( &client_rect, -pt.x, -pt.y );
set_window_pos( hwnd, insert_after, SWP_NOACTIVATE, &window_rect, &client_rect, NULL );
MapWindowPoints( 0, parent, (POINT *)&client_rect, 2 );
set_window_pos( hwnd, insert_after, SWP_NOACTIVATE, &rect, &client_rect, NULL );
}
else return 0;
@ -1425,8 +1420,8 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module,
wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP) return 0;
if (!(wndPtr->flags & WIN_NEED_SIZE))
{
rect = wndPtr->rectClient;
WIN_ReleasePtr( wndPtr );
WIN_GetRectangles( hwnd, COORDS_PARENT, NULL, &rect );
SendMessageW( hwnd, WM_SIZE, SIZE_RESTORED,
MAKELONG(rect.right-rect.left, rect.bottom-rect.top));
SendMessageW( hwnd, WM_MOVE, 0, MAKELONG( rect.left, rect.top ) );

View file

@ -771,16 +771,14 @@ static POINT WINPOS_FindIconPos( HWND hwnd, POINT pt )
tmp = CreateRectRgn( 0, 0, 0, 0 );
for (child = GetWindow( parent, GW_HWNDFIRST ); child; child = GetWindow( child, GW_HWNDNEXT ))
{
WND *childPtr;
if (child == hwnd) continue;
if ((GetWindowLongW( child, GWL_STYLE ) & (WS_VISIBLE|WS_MINIMIZE)) != (WS_VISIBLE|WS_MINIMIZE))
continue;
if (!(childPtr = WIN_GetPtr( child )) || childPtr == WND_OTHER_PROCESS)
continue;
SetRectRgn( tmp, childPtr->rectWindow.left, childPtr->rectWindow.top,
childPtr->rectWindow.right, childPtr->rectWindow.bottom );
CombineRgn( hrgn, hrgn, tmp, RGN_OR );
WIN_ReleasePtr( childPtr );
if (WIN_GetRectangles( child, COORDS_PARENT, &rect, NULL ))
{
SetRectRgn( tmp, rect.left, rect.top, rect.right, rect.bottom );
CombineRgn( hrgn, hrgn, tmp, RGN_OR );
}
}
DeleteObject( tmp );
@ -1057,9 +1055,11 @@ static BOOL show_window( HWND hwnd, INT cmd )
{
/* should happen only in CreateWindowEx() */
int wParam = SIZE_RESTORED;
RECT client = wndPtr->rectClient;
LPARAM lparam = MAKELONG( client.right - client.left, client.bottom - client.top );
RECT client;
LPARAM lparam;
WIN_GetRectangles( hwnd, COORDS_PARENT, NULL, &client );
lparam = MAKELONG( client.right - client.left, client.bottom - client.top );
wndPtr->flags &= ~WIN_NEED_SIZE;
if (wndPtr->dwStyle & WS_MAXIMIZE) wParam = SIZE_MAXIMIZED;
else if (wndPtr->dwStyle & WS_MINIMIZE)
@ -1504,6 +1504,7 @@ static void dump_winpos_flags(UINT flags)
static BOOL SWP_DoWinPosChanging( WINDOWPOS* pWinpos, RECT* pNewWindowRect, RECT* pNewClientRect )
{
WND *wndPtr;
RECT window_rect, client_rect;
/* Send WM_WINDOWPOSCHANGING message */
@ -1515,9 +1516,9 @@ static BOOL SWP_DoWinPosChanging( WINDOWPOS* pWinpos, RECT* pNewWindowRect, RECT
/* Calculate new position and size */
*pNewWindowRect = wndPtr->rectWindow;
*pNewClientRect = (wndPtr->dwStyle & WS_MINIMIZE) ? wndPtr->rectWindow
: wndPtr->rectClient;
WIN_GetRectangles( pWinpos->hwnd, COORDS_PARENT, &window_rect, &client_rect );
*pNewWindowRect = window_rect;
*pNewClientRect = (wndPtr->dwStyle & WS_MINIMIZE) ? window_rect : client_rect;
if (!(pWinpos->flags & SWP_NOSIZE))
{
@ -1536,11 +1537,11 @@ static BOOL SWP_DoWinPosChanging( WINDOWPOS* pWinpos, RECT* pNewWindowRect, RECT
{
pNewWindowRect->left = pWinpos->x;
pNewWindowRect->top = pWinpos->y;
pNewWindowRect->right += pWinpos->x - wndPtr->rectWindow.left;
pNewWindowRect->bottom += pWinpos->y - wndPtr->rectWindow.top;
pNewWindowRect->right += pWinpos->x - window_rect.left;
pNewWindowRect->bottom += pWinpos->y - window_rect.top;
OffsetRect( pNewClientRect, pWinpos->x - wndPtr->rectWindow.left,
pWinpos->y - wndPtr->rectWindow.top );
OffsetRect( pNewClientRect, pWinpos->x - window_rect.left,
pWinpos->y - window_rect.top );
}
pWinpos->flags |= SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE;
@ -1548,7 +1549,7 @@ static BOOL SWP_DoWinPosChanging( WINDOWPOS* pWinpos, RECT* pNewWindowRect, RECT
pWinpos->hwnd, pWinpos->hwndInsertAfter, pWinpos->x, pWinpos->y,
pWinpos->cx, pWinpos->cy, pWinpos->flags );
TRACE( "current %s style %08x new %s\n",
wine_dbgstr_rect( &wndPtr->rectWindow ), wndPtr->dwStyle,
wine_dbgstr_rect( &window_rect ), wndPtr->dwStyle,
wine_dbgstr_rect( pNewWindowRect ));
WIN_ReleasePtr( wndPtr );
@ -1706,9 +1707,9 @@ static UINT SWP_DoNCCalcSize( WINDOWPOS* pWinpos, const RECT* pNewWindowRect, RE
RECT *validRects )
{
UINT wvrFlags = 0;
WND *wndPtr;
RECT window_rect, client_rect;
if (!(wndPtr = WIN_GetPtr( pWinpos->hwnd )) || wndPtr == WND_OTHER_PROCESS) return 0;
WIN_GetRectangles( pWinpos->hwnd, COORDS_PARENT, &window_rect, &client_rect );
/* Send WM_NCCALCSIZE message to get new client area */
if( (pWinpos->flags & (SWP_FRAMECHANGED | SWP_NOSIZE)) != SWP_NOSIZE )
@ -1717,34 +1718,31 @@ static UINT SWP_DoNCCalcSize( WINDOWPOS* pWinpos, const RECT* pNewWindowRect, RE
WINDOWPOS winposCopy;
params.rgrc[0] = *pNewWindowRect;
params.rgrc[1] = wndPtr->rectWindow;
params.rgrc[2] = wndPtr->rectClient;
params.rgrc[1] = window_rect;
params.rgrc[2] = client_rect;
params.lppos = &winposCopy;
winposCopy = *pWinpos;
WIN_ReleasePtr( wndPtr );
wvrFlags = SendMessageW( pWinpos->hwnd, WM_NCCALCSIZE, TRUE, (LPARAM)&params );
*pNewClientRect = params.rgrc[0];
if (!(wndPtr = WIN_GetPtr( pWinpos->hwnd )) || wndPtr == WND_OTHER_PROCESS) return 0;
TRACE( "hwnd %p old win %s old client %s new win %s new client %s\n", pWinpos->hwnd,
wine_dbgstr_rect(&wndPtr->rectWindow), wine_dbgstr_rect(&wndPtr->rectClient),
wine_dbgstr_rect(&window_rect), wine_dbgstr_rect(&client_rect),
wine_dbgstr_rect(pNewWindowRect), wine_dbgstr_rect(pNewClientRect) );
if( pNewClientRect->left != wndPtr->rectClient.left ||
pNewClientRect->top != wndPtr->rectClient.top )
if( pNewClientRect->left != client_rect.left ||
pNewClientRect->top != client_rect.top )
pWinpos->flags &= ~SWP_NOCLIENTMOVE;
if( (pNewClientRect->right - pNewClientRect->left !=
wndPtr->rectClient.right - wndPtr->rectClient.left))
client_rect.right - client_rect.left))
pWinpos->flags &= ~SWP_NOCLIENTSIZE;
else
wvrFlags &= ~WVR_HREDRAW;
if (pNewClientRect->bottom - pNewClientRect->top !=
wndPtr->rectClient.bottom - wndPtr->rectClient.top)
client_rect.bottom - client_rect.top)
pWinpos->flags &= ~SWP_NOCLIENTSIZE;
else
wvrFlags &= ~WVR_VREDRAW;
@ -1755,8 +1753,8 @@ static UINT SWP_DoNCCalcSize( WINDOWPOS* pWinpos, const RECT* pNewWindowRect, RE
else
{
if (!(pWinpos->flags & SWP_NOMOVE) &&
(pNewClientRect->left != wndPtr->rectClient.left ||
pNewClientRect->top != wndPtr->rectClient.top))
(pNewClientRect->left != client_rect.left ||
pNewClientRect->top != client_rect.top))
pWinpos->flags &= ~SWP_NOCLIENTMOVE;
}
@ -1765,9 +1763,8 @@ static UINT SWP_DoNCCalcSize( WINDOWPOS* pWinpos, const RECT* pNewWindowRect, RE
SetRectEmpty( &validRects[0] );
SetRectEmpty( &validRects[1] );
}
else get_valid_rects( &wndPtr->rectClient, pNewClientRect, wvrFlags, validRects );
else get_valid_rects( &client_rect, pNewClientRect, wvrFlags, validRects );
WIN_ReleasePtr( wndPtr );
return wvrFlags;
}
@ -1775,6 +1772,7 @@ static UINT SWP_DoNCCalcSize( WINDOWPOS* pWinpos, const RECT* pNewWindowRect, RE
static BOOL fixup_flags( WINDOWPOS *winpos )
{
HWND parent;
RECT window_rect;
WND *wndPtr = WIN_GetPtr( winpos->hwnd );
BOOL ret = TRUE;
@ -1806,11 +1804,12 @@ static BOOL fixup_flags( WINDOWPOS *winpos )
if (!(winpos->flags & SWP_SHOWWINDOW)) winpos->flags |= SWP_NOREDRAW;
}
if ((wndPtr->rectWindow.right - wndPtr->rectWindow.left == winpos->cx) &&
(wndPtr->rectWindow.bottom - wndPtr->rectWindow.top == winpos->cy))
WIN_GetRectangles( winpos->hwnd, COORDS_PARENT, &window_rect, NULL );
if ((window_rect.right - window_rect.left == winpos->cx) &&
(window_rect.bottom - window_rect.top == winpos->cy))
winpos->flags |= SWP_NOSIZE; /* Already the right size */
if ((wndPtr->rectWindow.left == winpos->x) && (wndPtr->rectWindow.top == winpos->y))
if ((window_rect.left == winpos->x) && (window_rect.top == winpos->y))
winpos->flags |= SWP_NOMOVE; /* Already the right position */
if ((wndPtr->dwStyle & (WS_POPUP | WS_CHILD)) != WS_CHILD)
@ -1887,10 +1886,11 @@ BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
USER_Driver->pWindowPosChanging( hwnd, insert_after, swp_flags,
window_rect, client_rect, &visible_rect );
WIN_GetRectangles( hwnd, COORDS_SCREEN, &old_window_rect, NULL );
if (!(win = WIN_GetPtr( hwnd ))) return FALSE;
if (win == WND_DESKTOP || win == WND_OTHER_PROCESS) return FALSE;
old_window_rect = win->rectWindow;
SERVER_START_REQ( set_window_pos )
{
req->handle = wine_server_user_handle( hwnd );