Zhiyi Zhang : comctl32/trackbar: Always use brush from WM_CTLCOLORSTATIC to fill background.

Alexandre Julliard julliard at winehq.org
Wed Feb 9 16:03:49 CST 2022


Module: wine
Branch: master
Commit: 179117a6892401e7ee7f988b5b00341c0981213b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=179117a6892401e7ee7f988b5b00341c0981213b

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Wed Feb  9 16:44:53 2022 +0800

comctl32/trackbar: Always use brush from WM_CTLCOLORSTATIC to fill background.

Fix the track bar of Mupen64-RR-Lua input window having black background. Mupen64-RR-Lua doesn't actually handle
WM_ERASEBKGND even though it returns nonzero. And tests show that only WM_CTLCOLORSTATIC is sent when drawing themed
trackbar background.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/comctl32/tests/misc.c |  2 +-
 dlls/comctl32/trackbar.c   | 12 ++++--------
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/dlls/comctl32/tests/misc.c b/dlls/comctl32/tests/misc.c
index 3a1b5253b58..72674ea5942 100644
--- a/dlls/comctl32/tests/misc.c
+++ b/dlls/comctl32/tests/misc.c
@@ -883,7 +883,7 @@ static void test_themed_background(void)
         {WC_TABCONTROLA, 0, drawthemeparentbackground_seq, TRUE},
         {TOOLBARCLASSNAMEA, 0, empty_seq, TRUE},
         {TOOLTIPS_CLASSA, 0, empty_seq},
-        {TRACKBAR_CLASSA, 0, wm_ctlcolorstatic_seq, TRUE},
+        {TRACKBAR_CLASSA, 0, wm_ctlcolorstatic_seq},
         {WC_TREEVIEWA, 0, treeview_seq},
         {UPDOWN_CLASSA, 0, empty_seq},
         {WC_SCROLLBARA, 0, scrollbar_seq, TRUE},
diff --git a/dlls/comctl32/trackbar.c b/dlls/comctl32/trackbar.c
index 6643752c043..f2cb2a07a8d 100644
--- a/dlls/comctl32/trackbar.c
+++ b/dlls/comctl32/trackbar.c
@@ -899,6 +899,7 @@ TRACKBAR_Refresh (TRACKBAR_INFO *infoPtr, HDC hdcDst)
     HBITMAP hOldBmp = 0, hOffScreenBmp = 0;
     NMCUSTOMDRAW nmcd;
     int gcdrf, icdrf;
+    HBRUSH brush;
 
     if (infoPtr->flags & TB_THUMBCHANGED) {
         TRACKBAR_UpdateThumb (infoPtr);
@@ -943,14 +944,9 @@ TRACKBAR_Refresh (TRACKBAR_INFO *infoPtr, HDC hdcDst)
     /* Erase background */
     if (gcdrf == CDRF_DODEFAULT ||
         notify_customdraw(infoPtr, &nmcd, CDDS_PREERASE) != CDRF_SKIPDEFAULT) {
-        if (GetWindowTheme (infoPtr->hwndSelf)) {
-            DrawThemeParentBackground (infoPtr->hwndSelf, hdc, 0);
-        }
-        else {
-            HBRUSH brush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLORSTATIC,
-                    (WPARAM)hdc, (LPARAM)infoPtr->hwndSelf);
-            FillRect (hdc, &rcClient, brush ? brush : GetSysColorBrush(COLOR_BTNFACE));
-        }
+        brush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLORSTATIC, (WPARAM)hdc,
+                                     (LPARAM)infoPtr->hwndSelf);
+        FillRect(hdc, &rcClient, brush ? brush : GetSysColorBrush(COLOR_BTNFACE));
         if (gcdrf != CDRF_DODEFAULT)
 	    notify_customdraw(infoPtr, &nmcd, CDDS_POSTERASE);
     }




More information about the wine-cvs mailing list