[PATCH 4/4] uxtheme: Draw scroll bar parent background only when theme parts are transparent.

Zhiyi Zhang zzhang at codeweavers.com
Wed Aug 25 01:24:42 CDT 2021


Fix hangs in Source Insight 4 Options->Window->Styles.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/uxtheme/scrollbar.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/dlls/uxtheme/scrollbar.c b/dlls/uxtheme/scrollbar.c
index 386f0446049..a9d5a83f2bb 100644
--- a/dlls/uxtheme/scrollbar.c
+++ b/dlls/uxtheme/scrollbar.c
@@ -100,9 +100,6 @@ void WINAPI UXTHEME_ScrollBarDraw(HWND hwnd, HDC dc, INT bar, enum SCROLL_HITTES
                 thumbstate = SCRBS_PRESSED;
         }
 
-        if (bar == SB_CTL)
-            DrawThemeParentBackground(hwnd, dc, NULL);
-
         if (vertical) {
             int uparrowstate, downarrowstate;
 
@@ -132,16 +129,22 @@ void WINAPI UXTHEME_ScrollBarDraw(HWND hwnd, HDC dc, INT bar, enum SCROLL_HITTES
 
             partrect = *rect;
             partrect.bottom = partrect.top + arrowsize;
+            if (bar == SB_CTL && IsThemeBackgroundPartiallyTransparent(theme, SBP_ARROWBTN, uparrowstate))
+                DrawThemeParentBackground(hwnd, dc, &partrect);
             DrawThemeBackground(theme, dc, SBP_ARROWBTN, uparrowstate, &partrect, NULL);
 
             partrect.bottom = rect->bottom;
             partrect.top = partrect.bottom - arrowsize;
+            if (bar == SB_CTL && IsThemeBackgroundPartiallyTransparent(theme, SBP_ARROWBTN, downarrowstate))
+                DrawThemeParentBackground(hwnd, dc, &partrect);
             DrawThemeBackground(theme, dc, SBP_ARROWBTN, downarrowstate, &partrect, NULL);
 
             if (thumbpos > 0) {
                 partrect.top = rect->top + arrowsize;
                 partrect.bottom = rect->top + thumbpos;
 
+                if (bar == SB_CTL && IsThemeBackgroundPartiallyTransparent(theme, SBP_UPPERTRACKVERT, uppertrackstate))
+                    DrawThemeParentBackground(hwnd, dc, &partrect);
                 DrawThemeBackground(theme, dc, SBP_UPPERTRACKVERT, uppertrackstate, &partrect, NULL);
             }
 
@@ -149,6 +152,8 @@ void WINAPI UXTHEME_ScrollBarDraw(HWND hwnd, HDC dc, INT bar, enum SCROLL_HITTES
                 partrect.top = rect->top + thumbpos;
                 partrect.bottom = partrect.top + thumbsize;
 
+                if (bar == SB_CTL && IsThemeBackgroundPartiallyTransparent(theme, SBP_THUMBBTNVERT, thumbstate))
+                    DrawThemeParentBackground(hwnd, dc, &partrect);
                 DrawThemeBackground(theme, dc, SBP_THUMBBTNVERT, thumbstate, &partrect, NULL);
 
                 if (SUCCEEDED(GetThemePartSize(theme, dc, SBP_GRIPPERVERT, thumbstate, NULL, TS_DRAW, &grippersize))) {
@@ -167,7 +172,11 @@ void WINAPI UXTHEME_ScrollBarDraw(HWND hwnd, HDC dc, INT bar, enum SCROLL_HITTES
             else
                 partrect.top = rect->top + arrowsize;
             if (partrect.bottom > partrect.top)
+            {
+                if (bar == SB_CTL && IsThemeBackgroundPartiallyTransparent(theme, SBP_LOWERTRACKVERT, lowertrackstate))
+                    DrawThemeParentBackground(hwnd, dc, &partrect);
                 DrawThemeBackground(theme, dc, SBP_LOWERTRACKVERT, lowertrackstate, &partrect, NULL);
+            }
         } else {
             int leftarrowstate, rightarrowstate;
 
@@ -197,16 +206,22 @@ void WINAPI UXTHEME_ScrollBarDraw(HWND hwnd, HDC dc, INT bar, enum SCROLL_HITTES
 
             partrect = *rect;
             partrect.right = partrect.left + arrowsize;
+            if (bar == SB_CTL && IsThemeBackgroundPartiallyTransparent(theme, SBP_ARROWBTN, leftarrowstate))
+                DrawThemeParentBackground(hwnd, dc, &partrect);
             DrawThemeBackground(theme, dc, SBP_ARROWBTN, leftarrowstate, &partrect, NULL);
 
             partrect.right = rect->right;
             partrect.left = partrect.right - arrowsize;
+            if (bar == SB_CTL && IsThemeBackgroundPartiallyTransparent(theme, SBP_ARROWBTN, rightarrowstate))
+                DrawThemeParentBackground(hwnd, dc, &partrect);
             DrawThemeBackground(theme, dc, SBP_ARROWBTN, rightarrowstate, &partrect, NULL);
 
             if (thumbpos > 0) {
                 partrect.left = rect->left + arrowsize;
                 partrect.right = rect->left + thumbpos;
 
+                if (bar == SB_CTL && IsThemeBackgroundPartiallyTransparent(theme, SBP_UPPERTRACKHORZ, uppertrackstate))
+                    DrawThemeParentBackground(hwnd, dc, &partrect);
                 DrawThemeBackground(theme, dc, SBP_UPPERTRACKHORZ, uppertrackstate, &partrect, NULL);
             }
 
@@ -214,6 +229,8 @@ void WINAPI UXTHEME_ScrollBarDraw(HWND hwnd, HDC dc, INT bar, enum SCROLL_HITTES
                 partrect.left = rect->left + thumbpos;
                 partrect.right = partrect.left + thumbsize;
 
+                if (bar == SB_CTL && IsThemeBackgroundPartiallyTransparent(theme, SBP_THUMBBTNHORZ, thumbstate))
+                    DrawThemeParentBackground(hwnd, dc, &partrect);
                 DrawThemeBackground(theme, dc, SBP_THUMBBTNHORZ, thumbstate, &partrect, NULL);
 
                 if (SUCCEEDED(GetThemePartSize(theme, dc, SBP_GRIPPERHORZ, thumbstate, NULL, TS_DRAW, &grippersize))) {
@@ -232,7 +249,11 @@ void WINAPI UXTHEME_ScrollBarDraw(HWND hwnd, HDC dc, INT bar, enum SCROLL_HITTES
             else
                 partrect.left = rect->left + arrowsize;
             if (partrect.right > partrect.left)
+            {
+                if (bar == SB_CTL && IsThemeBackgroundPartiallyTransparent(theme, SBP_LOWERTRACKHORZ, lowertrackstate))
+                    DrawThemeParentBackground(hwnd, dc, &partrect);
                 DrawThemeBackground(theme, dc, SBP_LOWERTRACKHORZ, lowertrackstate, &partrect, NULL);
+            }
         }
     }
 
-- 
2.30.2



More information about the wine-devel mailing list