- Fix scrollbar show/update conditions in SCROLL_SetScrollInfo: we DO
authorVitaly Lipatov <lav@etersoft.ru>
Thu, 24 Feb 2005 19:38:56 +0000 (19:38 +0000)
committerAlexandre Julliard <julliard@winehq.org>
Thu, 24 Feb 2005 19:38:56 +0000 (19:38 +0000)
  NOT show scroll bar if only page parameter changing when scrollbar
  is disabled.
- Removed bChangeParams from SCROLL_SetScrollInfo as unneeded flag.

dlls/user/scroll.c

index bdb9c724c68fb6b495176889864b88647d38da88..798c0d812406ba7e70e40732203e578a6109f4e1 100644 (file)
@@ -1493,14 +1493,13 @@ INT WINAPI SetScrollInfo(HWND hwnd, INT nBar, const SCROLLINFO *info, BOOL bRedr
         return SCROLL_SetScrollInfo( hwnd, nBar, info, bRedraw );
 }
 
-static INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar, const SCROLLINFO *info, BOOL bRedraw )
+static INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar, LPCSCROLLINFO info, BOOL bRedraw )
 {
     /* Update the scrollbar state and set action flags according to
      * what has to be done graphics wise. */
 
     SCROLLBAR_INFO *infoPtr;
     UINT new_flags;
-    BOOL bChangeParams = FALSE; /* don't show/hide scrollbar if params don't change */
     INT action = 0;
 
     /* handle invalid data structure */
@@ -1521,11 +1520,10 @@ static INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar, const SCROLLINFO *info, BO
 
     if (info->fMask & SIF_PAGE)
     {
-       if( infoPtr->page != info->nPage )
+       if( infoPtr->page != info->nPage && info->nPage >= 0)
        {
             infoPtr->page = info->nPage;
             action |= SA_SSI_REFRESH;
-           bChangeParams = TRUE;
        }
     }
 
@@ -1548,9 +1546,9 @@ static INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar, const SCROLLINFO *info, BO
         if ((info->nMin > info->nMax) ||
             ((UINT)(info->nMax - info->nMin) >= 0x80000000))
         {
+            action |= SA_SSI_REFRESH;
             infoPtr->minVal = 0;
             infoPtr->maxVal = 0;
-            bChangeParams = TRUE;
         }
         else
         {
@@ -1560,13 +1558,11 @@ static INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar, const SCROLLINFO *info, BO
                 action |= SA_SSI_REFRESH;
                 infoPtr->minVal = info->nMin;
                 infoPtr->maxVal = info->nMax;
-                bChangeParams = TRUE;
            }
         }
     }
 
     /* Make sure the page size is valid */
-
     if (infoPtr->page < 0) infoPtr->page = 0;
     else if (infoPtr->page > infoPtr->maxVal - infoPtr->minVal + 1 )
         infoPtr->page = infoPtr->maxVal - infoPtr->minVal + 1;
@@ -1600,16 +1596,16 @@ static INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar, const SCROLLINFO *info, BO
                 new_flags = ESB_DISABLE_BOTH;
                 action |= SA_SSI_REFRESH;
            }
-            else if ((nBar != SB_CTL) && bChangeParams)
+            else if ((nBar != SB_CTL) && (action & SA_SSI_REFRESH))
            {
                 action = SA_SSI_HIDE;
-               goto done;
             }
         }
-        else  /* Show and enable scroll-bar */
+        else  /* Show and enable scroll-bar only if no page only changed. */
+        if (info->fMask != SIF_PAGE)
         {
-           new_flags = 0;
-            if ((nBar != SB_CTL) && bChangeParams)
+           new_flags = ESB_ENABLE_BOTH;
+            if ((nBar != SB_CTL) && ( (action & SA_SSI_REFRESH) ))
                 action |= SA_SSI_SHOW;
         }