From f8dcd80de51bf96b5e2a3dbeb39746b8b9236f7e Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 9 Jul 2008 21:45:07 -0700 Subject: [PATCH 2/2] user32: Set WM_NOSIZE for windows smaller than SM_CXMINTRACK/SM_CYMINTRACK. --- dlls/user32/tests/msg.c | 12 ++++++------ dlls/user32/winpos.c | 38 +++++++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 4da8fe3..871dd1e 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -4583,11 +4583,11 @@ static void test_wmsize(void) const struct wmsize_test wm[] = { { { 100, 50 }, { 100, 50 }, 0, 1, { 0, 0, sysX, 50 }, - { 1, 0, 0, 0, 0, 0, 0, 0, 0 } + { 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, { { 150, 5 }, { 150, 5 }, 0, 1, { 0, 0, 150, sysY }, - { 1, 0, 0, 0, 0, 0, 0, 0, 0 } + { 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, { { 160, 150 }, { 160, 150 }, 0, 1, { 0, 0, 160, 150 }, @@ -4615,11 +4615,11 @@ static void test_wmsize(void) }, { { 100, 50 }, { 100, 50 }, SWP_NOZORDER, 1, { 0, 0, sysX, 50 }, - { 1, 0, 0, 0, 0, 0, 0, 0, 0 } + { 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, { { 150, 5 }, { 150, 5 }, SWP_NOZORDER, 1, { 0, 0, 150, sysY }, - { 1, 0, 0, 0, 0, 0, 0, 0, 0 } + { 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, { { 160, 150 }, { 160, 150 }, SWP_NOZORDER, 1, { 0, 0, 160, 150 }, @@ -4647,11 +4647,11 @@ static void test_wmsize(void) }, { { 100, 50 }, { 100, 50 }, SWP_NOMOVE, 1, { 0, 0, sysX, 50 }, - { 1, 0, 0, 0, 0, 0, 0, 0, 0 } + { 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, { { 150, 5 }, { 150, 5 }, SWP_NOMOVE, 1, { 0, 0, 150, sysY }, - { 1, 0, 0, 0, 0, 0, 0, 0, 0 } + { 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, { { 160, 150 }, { 160, 150 }, SWP_NOMOVE, 1, { 0, 0, 160, 150 }, diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c index acfd481..ad6f4c6 100644 --- a/dlls/user32/winpos.c +++ b/dlls/user32/winpos.c @@ -1702,10 +1702,11 @@ done: * SWP_DoNCCalcSize */ static UINT SWP_DoNCCalcSize( WINDOWPOS* pWinpos, const RECT* pNewWindowRect, RECT* pNewClientRect, - RECT *validRects ) + RECT *validRects, BOOL windowTooSmall ) { UINT wvrFlags = 0; WND *wndPtr; + BOOL canRemoveNosize = TRUE; if (!(wndPtr = WIN_GetPtr( pWinpos->hwnd )) || wndPtr == WND_OTHER_PROCESS) return 0; @@ -1736,17 +1737,23 @@ static UINT SWP_DoNCCalcSize( WINDOWPOS* pWinpos, const RECT* pNewWindowRect, RE pNewClientRect->top != wndPtr->rectClient.top ) pWinpos->flags &= ~SWP_NOCLIENTMOVE; - if( (pNewClientRect->right - pNewClientRect->left != - wndPtr->rectClient.right - wndPtr->rectClient.left)) - pWinpos->flags &= ~SWP_NOCLIENTSIZE; - else - wvrFlags &= ~WVR_HREDRAW; - - if (pNewClientRect->bottom - pNewClientRect->top != - wndPtr->rectClient.bottom - wndPtr->rectClient.top) - pWinpos->flags &= ~SWP_NOCLIENTSIZE; - else - wvrFlags &= ~WVR_VREDRAW; + if ( windowTooSmall ) + if ((pWinpos->flags & (SWP_NOMOVE|SWP_NOSIZE)) == SWP_NOMOVE) + canRemoveNosize = FALSE; + if ( canRemoveNosize ) + { + if( (pNewClientRect->right - pNewClientRect->left != + wndPtr->rectClient.right - wndPtr->rectClient.left)) + pWinpos->flags &= ~SWP_NOCLIENTSIZE; + else + wvrFlags &= ~WVR_HREDRAW; + + if (pNewClientRect->bottom - pNewClientRect->top != + wndPtr->rectClient.bottom - wndPtr->rectClient.top) + pWinpos->flags &= ~SWP_NOCLIENTSIZE; + else + wvrFlags &= ~WVR_VREDRAW; + } validRects[0] = params.rgrc[1]; validRects[1] = params.rgrc[2]; @@ -1942,6 +1949,7 @@ BOOL USER_SetWindowPos( WINDOWPOS * winpos ) { RECT newWindowRect, newClientRect, valid_rects[2]; UINT orig_flags; + BOOL windowTooSmall = FALSE; orig_flags = winpos->flags; @@ -1961,6 +1969,10 @@ BOOL USER_SetWindowPos( WINDOWPOS * winpos ) else if (winpos->cy > 32767) winpos->cy = 32767; } + if ( winpos->cx < GetSystemMetrics(SM_CXMINTRACK) + || winpos->cy < GetSystemMetrics(SM_CYMINTRACK) ) + windowTooSmall = TRUE; + if (!SWP_DoWinPosChanging( winpos, &newWindowRect, &newClientRect )) return FALSE; /* Fix redundant flags */ @@ -1974,7 +1986,7 @@ BOOL USER_SetWindowPos( WINDOWPOS * winpos ) /* Common operations */ - SWP_DoNCCalcSize( winpos, &newWindowRect, &newClientRect, valid_rects ); + SWP_DoNCCalcSize( winpos, &newWindowRect, &newClientRect, valid_rects, windowTooSmall ); if (!set_window_pos( winpos->hwnd, winpos->hwndInsertAfter, winpos->flags, &newWindowRect, &newClientRect, valid_rects )) -- 1.5.2.5