[PATCH 2/2] comctl32/pager: Don't block window size changes

Nikolay Sivov nsivov at codeweavers.com
Mon Feb 13 22:47:39 CST 2017


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/comctl32/pager.c       | 31 -------------------------------
 dlls/comctl32/tests/pager.c | 25 ++++++++++++++++++++++++-
 2 files changed, 24 insertions(+), 32 deletions(-)

diff --git a/dlls/comctl32/pager.c b/dlls/comctl32/pager.c
index 171d70e531..a10d3bb30f 100644
--- a/dlls/comctl32/pager.c
+++ b/dlls/comctl32/pager.c
@@ -388,34 +388,6 @@ PAGER_SetPos(PAGER_INFO* infoPtr, INT newPos, BOOL fromBtnPress)
     return 0;
 }
 
-static LRESULT
-PAGER_WindowPosChanging(PAGER_INFO* infoPtr, WINDOWPOS *winpos)
-{
-    if ((infoPtr->dwStyle & CCS_NORESIZE) && !(winpos->flags & SWP_NOSIZE))
-    {
-        /* don't let the app resize the nonscrollable dimension of a control
-         * that was created with CCS_NORESIZE style
-         * (i.e. height for a horizontal pager, or width for a vertical one) */
-
-	/* except if the current dimension is 0 and app is setting for
-	 * first time, then save amount as dimension. - GA 8/01 */
-
-        if (infoPtr->dwStyle & PGS_HORZ)
-	    if (!infoPtr->nHeight && winpos->cy)
-		infoPtr->nHeight = winpos->cy;
-	    else
-		winpos->cy = infoPtr->nHeight;
-        else
-	    if (!infoPtr->nWidth && winpos->cx)
-		infoPtr->nWidth = winpos->cx;
-	    else
-		winpos->cx = infoPtr->nWidth;
-	return 0;
-    }
-
-    return DefWindowProcW (infoPtr->hwndSelf, WM_WINDOWPOSCHANGING, 0, (LPARAM)winpos);
-}
-
 /******************************************************************
  * For the PGM_RECALCSIZE message (but not the other uses in      *
  * this module), the native control does only the following:      *
@@ -1096,9 +1068,6 @@ PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
         case WM_NCPAINT:
             return PAGER_NCPaint (infoPtr, (HRGN)wParam);
 
-        case WM_WINDOWPOSCHANGING:
-            return PAGER_WindowPosChanging (infoPtr, (WINDOWPOS*)lParam);
-
         case WM_STYLECHANGED:
             return PAGER_StyleChanged(infoPtr, wParam, (LPSTYLESTRUCT)lParam);
 
diff --git a/dlls/comctl32/tests/pager.c b/dlls/comctl32/tests/pager.c
index 48753ff774..c22cf273ee 100644
--- a/dlls/comctl32/tests/pager.c
+++ b/dlls/comctl32/tests/pager.c
@@ -170,7 +170,7 @@ static HWND create_pager_control( DWORD style )
 static void test_pager(void)
 {
     HWND pager, child;
-    RECT rect;
+    RECT rect, rect2;
 
     pager = create_pager_control( PGS_HORZ );
     if (!pager)
@@ -204,6 +204,29 @@ static void test_pager(void)
     ok_sequence(sequences, PAGER_SEQ_INDEX, set_pos_seq, "set pos", TRUE);
 
     DestroyWindow( pager );
+
+    /* Test if resizing works */
+    pager = create_pager_control( CCS_NORESIZE );
+    ok(pager != NULL, "failed to create pager control\n");
+
+    GetWindowRect( pager, &rect );
+    MoveWindow( pager, 0, 0, 200, 100, TRUE );
+    GetWindowRect( pager, &rect2 );
+    ok(rect2.right - rect2.left > rect.right - rect.left, "expected pager window to resize, %s\n",
+        wine_dbgstr_rect( &rect2 ));
+
+    DestroyWindow( pager );
+
+    pager = create_pager_control( CCS_NORESIZE | PGS_HORZ );
+    ok(pager != NULL, "failed to create pager control\n");
+
+    GetWindowRect( pager, &rect );
+    MoveWindow( pager, 0, 0, 100, 200, TRUE );
+    GetWindowRect( pager, &rect2 );
+    ok(rect2.bottom - rect2.top > rect.bottom - rect.top, "expected pager window to resize, %s\n",
+        wine_dbgstr_rect( &rect2 ));
+
+    DestroyWindow( pager );
 }
 
 START_TEST(pager)
-- 
2.11.0




More information about the wine-patches mailing list