[UXTHEME] Improve drawing of the scrollbars when they are too small. CORE-13513
authorGiannis Adamopoulos <gadamopoulos@reactos.org>
Thu, 23 Nov 2017 19:17:03 +0000 (21:17 +0200)
committerGiannis Adamopoulos <gadamopoulos@reactos.org>
Thu, 23 Nov 2017 19:19:03 +0000 (21:19 +0200)
dll/win32/uxtheme/ncscrollbar.c

index 27299f8..8d6f21d 100644 (file)
@@ -126,6 +126,9 @@ static enum SCROLL_HITTEST SCROLL_HitTest( HWND hwnd, SCROLLBARINFO* psbi, BOOL
 
 static void SCROLL_ThemeDrawPart(PDRAW_CONTEXT pcontext, int iPartId,int iStateId,  SCROLLBARINFO* psbi, int htCurrent, int htDown, int htHot, RECT* r)
 {
 
 static void SCROLL_ThemeDrawPart(PDRAW_CONTEXT pcontext, int iPartId,int iStateId,  SCROLLBARINFO* psbi, int htCurrent, int htDown, int htHot, RECT* r)
 {
+    if (r->right <= r->left || r->bottom <= r->top)
+        return;
+
     if(psbi->rgstate[htCurrent] & STATE_SYSTEM_UNAVAILABLE)
         iStateId += BUTTON_DISABLED - BUTTON_NORMAL;
     else if (htHot == htCurrent)
     if(psbi->rgstate[htCurrent] & STATE_SYSTEM_UNAVAILABLE)
         iStateId += BUTTON_DISABLED - BUTTON_NORMAL;
     else if (htHot == htCurrent)
@@ -187,17 +190,22 @@ static void SCROLL_DrawInterior( PDRAW_CONTEXT pcontext, SCROLLBARINFO* psbi,
     r = psbi->rcScrollBar;
     if (vertical)
     {
     r = psbi->rcScrollBar;
     if (vertical)
     {
-        thumbPos += pcontext->wi.rcClient.top - pcontext->wi.rcWindow.top;
+        if (thumbPos)
+            thumbPos += pcontext->wi.rcClient.top - pcontext->wi.rcWindow.top;
         r.top    += psbi->dxyLineButton;
         r.bottom -= (psbi->dxyLineButton);
     }
     else
     {
         r.top    += psbi->dxyLineButton;
         r.bottom -= (psbi->dxyLineButton);
     }
     else
     {
-        thumbPos += pcontext->wi.rcClient.left - pcontext->wi.rcWindow.left;
+        if (thumbPos)
+            thumbPos += pcontext->wi.rcClient.left - pcontext->wi.rcWindow.left;
         r.left  += psbi->dxyLineButton;
         r.right -= psbi->dxyLineButton;
     }
 
         r.left  += psbi->dxyLineButton;
         r.right -= psbi->dxyLineButton;
     }
 
+    if (r.right <= r.left || r.bottom <= r.top)
+        return;
+
     /* Draw the scroll rectangles and thumb */
 
     if (!thumbPos)  /* No thumb to draw */
     /* Draw the scroll rectangles and thumb */
 
     if (!thumbPos)  /* No thumb to draw */