[2/3] user32: Don't add scroll bars to mdiclient if the window style doesn't allow it.

Dmitry Timoshkov dmitry at baikal.ru
Fri Nov 20 02:38:16 CST 2015


From: Bruno Jesus <00cpxxx at gmail.com>

This patch fixes the problem reported in the bug 9435.

Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>
Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/user32/mdi.c       | 28 ++++++++++++++++++----------
 dlls/user32/tests/win.c |  2 --
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c
index d0a472a..b5a0473 100644
--- a/dlls/user32/mdi.c
+++ b/dlls/user32/mdi.c
@@ -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;
     }
 }
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index cf4ae36..fc6505f 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -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);
-- 
2.6.3




More information about the wine-patches mailing list