Fix many of the scrollbar issues. However, MDI Scrollbars are still not
working perfectly. Patch by tinus <o112w8r02(a)sneakemail.com>om>. Fixes bug
606
Modified: trunk/reactos/lib/user32/windows/mdi.c
Modified: trunk/reactos/subsys/win32k/ntuser/scrollbar.c
_____
Modified: trunk/reactos/lib/user32/windows/mdi.c
--- trunk/reactos/lib/user32/windows/mdi.c 2005-05-02 11:38:48 UTC
(rev 14945)
+++ trunk/reactos/lib/user32/windows/mdi.c 2005-05-02 11:42:41 UTC
(rev 14946)
@@ -2034,8 +2034,16 @@
#ifndef __REACTOS__
HWND *list;
#else
+ WINDOWINFO WindowInfo;
HWND hWndCurrent;
#endif
+ /* The rectangle returned by GetClientRect always has 0,0 as top
left
+ * because it is in client coordinates. The rectangles returned by
+ * GetWindowRect are in screen coordinates to make this
complicated.
+ *
+ * Apparently (in ReactOS at least) the rcClient returned by
GetWindowInfo
+ * is in screen coordinates too.
+ */
GetClientRect( hwnd, &clientRect );
SetRectEmpty( &childRect );
@@ -2063,6 +2071,13 @@
HeapFree( GetProcessHeap(), 0, list );
}
#else
+ WindowInfo.cbSize = sizeof(WindowInfo);
+ if (!GetWindowInfo(hwnd, &WindowInfo))
+ {
+ ERR("Can't get window info\n");
+ return;
+ }
+
hWndCurrent = GetWindow(hwnd, GW_CHILD);
while (hWndCurrent != NULL)
{
@@ -2077,6 +2092,9 @@
RECT WindowRect;
GetWindowRect( hWndCurrent, &WindowRect );
+ OffsetRect(&WindowRect,
+ -WindowInfo.rcClient.left,
+ -WindowInfo.rcClient.top);
UnionRect( &childRect, &WindowRect, &childRect );
}
hWndCurrent = GetWindow(hWndCurrent, GW_HWNDNEXT);
@@ -2086,23 +2104,30 @@
/* set common info values */
info.cbSize = sizeof(info);
- info.fMask = SIF_POS | SIF_RANGE;
+ info.fMask = SIF_POS | SIF_RANGE | SIF_PAGE;
- /* set the specific */
+ /* set the specific scrollbars*/
+ /* Note how we set nPos to 0 because we scroll the clients instead
of
+ * the window, and we set nPage to 1 bigger than the clientRect
because
+ * otherwise the scrollbar never disables. This causes a somewhat
ugly
+ * effect though while scrolling.
+ */
switch( scroll )
{
case SB_BOTH:
case SB_HORZ:
info.nMin = childRect.left;
- info.nMax = childRect.right - clientRect.right;
- info.nPos = clientRect.left - childRect.left;
+ info.nMax = childRect.right;
+ info.nPos = 0;
+ info.nPage = 1 + clientRect.right -
clientRect.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;
+ info.nMax = childRect.bottom;
+ info.nPos = 0;
+ info.nPage = 1 + clientRect.bottom -
clientRect.top;
SetScrollInfo(hwnd, SB_VERT, &info, TRUE);
break;
}
_____
Modified: trunk/reactos/subsys/win32k/ntuser/scrollbar.c
--- trunk/reactos/subsys/win32k/ntuser/scrollbar.c 2005-05-02
11:38:48 UTC (rev 14945)
+++ trunk/reactos/subsys/win32k/ntuser/scrollbar.c 2005-05-02
11:42:41 UTC (rev 14946)
@@ -360,7 +360,7 @@
/* Check if the scrollbar should be hidden or disabled */
if (0 != (lpsi->fMask & (SIF_RANGE | SIF_PAGE |
SIF_DISABLENOSCROLL)))
{
- if (Info->nMin >= Info->nMax - max(Info->nPage - 1, 0))
+ if (Info->nMin >= (int)(Info->nMax - max(Info->nPage - 1, 0)))
{
/* Hide or disable scroll-bar */
if (0 != (lpsi->fMask & SIF_DISABLENOSCROLL))