user32: Don't add scroll bars to mdiclient if the window style doesn't allow it.
authorBruno Jesus <00cpxxx@gmail.com>
Fri, 20 Nov 2015 08:38:16 +0000 (16:38 +0800)
committerAlexandre Julliard <julliard@winehq.org>
Fri, 20 Nov 2015 10:26:16 +0000 (19:26 +0900)
Signed-off-by: Bruno Jesus <00cpxxx@gmail.com>
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
dlls/user32/mdi.c
dlls/user32/tests/win.c

index d0a472a3cb87ba0aa2b31231b45fbe54b70af14f..b5a047307bce2db818a259f6b282d0991dfb76c6 100644 (file)
@@ -1709,6 +1709,7 @@ void WINAPI CalcChildScroll( HWND hwnd, INT scroll )
     SCROLLINFO info;
     RECT childRect, clientRect;
     HWND *list;
+    DWORD style;
 
     GetClientRect( hwnd, &clientRect );
     SetRectEmpty( &childRect );
@@ -1718,7 +1719,7 @@ void WINAPI CalcChildScroll( HWND hwnd, INT scroll )
         int i;
         for (i = 0; list[i]; i++)
         {
-            DWORD style = GetWindowLongW( list[i], GWL_STYLE );
+            style = GetWindowLongW( list[i], GWL_STYLE );
             if (style & WS_MAXIMIZE)
             {
                 HeapFree( GetProcessHeap(), 0, list );
@@ -1740,22 +1741,29 @@ void WINAPI CalcChildScroll( HWND hwnd, INT scroll )
     info.cbSize = sizeof(info);
     info.fMask = SIF_POS | SIF_RANGE;
 
-    /* set the specific */
+    /* set the specific values and apply but only if window style allows */
+    style = GetWindowLongW( hwnd, GWL_STYLE );
     switch( scroll )
     {
        case SB_BOTH:
        case SB_HORZ:
-                       info.nMin = childRect.left;
-                       info.nMax = childRect.right - clientRect.right;
-                       info.nPos = clientRect.left - childRect.left;
-                       SetScrollInfo(hwnd, SB_HORZ, &info, TRUE);
+                        if (style & (WS_HSCROLL | WS_VSCROLL))
+                        {
+                            info.nMin = childRect.left;
+                            info.nMax = childRect.right - clientRect.right;
+                            info.nPos = clientRect.left - childRect.left;
+                            SetScrollInfo(hwnd, SB_HORZ, &info, TRUE);
+                        }
                        if (scroll == SB_HORZ) break;
                        /* fall through */
        case SB_VERT:
-                       info.nMin = childRect.top;
-                       info.nMax = childRect.bottom - clientRect.bottom;
-                       info.nPos = clientRect.top - childRect.top;
-                       SetScrollInfo(hwnd, SB_VERT, &info, TRUE);
+                        if (style & (WS_HSCROLL | WS_VSCROLL))
+                        {
+                            info.nMin = childRect.top;
+                            info.nMax = childRect.bottom - clientRect.bottom;
+                            info.nPos = clientRect.top - childRect.top;
+                            SetScrollInfo(hwnd, SB_VERT, &info, TRUE);
+                        }
                        break;
     }
 }
index cf4ae36e8638b3ad6e1c76f0f26d4aaa347049fe..fc6505fa1476534773b74c382b11059a04487441 100644 (file)
@@ -2136,7 +2136,6 @@ todo_wine
             ok(si.nMax != 100, "expected !100\n");
         }
         else
-todo_wine
             ok(!ret, "style %#x: GetScrollInfo(SB_HORZ) should fail\n", style[i]);
 
         ret = GetScrollInfo(mdi_client, SB_VERT, &si);
@@ -2151,7 +2150,6 @@ todo_wine
             ok(si.nMax != 100, "expected !100\n");
         }
         else
-todo_wine
             ok(!ret, "style %#x: GetScrollInfo(SB_VERT) should fail\n", style[i]);
 
         DestroyWindow(mdi_child);