[PATCH] comctrl32/trackbar: Send WM_CTLCOLORSTATIC when drawing background

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Wed Feb 24 03:46:29 CST 2016


Fixes https://bugs.winehq.org/show_bug.cgi?id=38310

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/comctl32/tests/trackbar.c | 29 +++++++++++++++++++++++++++++
 dlls/comctl32/trackbar.c       |  7 ++++++-
 2 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/dlls/comctl32/tests/trackbar.c b/dlls/comctl32/tests/trackbar.c
index adb1b12..fae3e12 100644
--- a/dlls/comctl32/tests/trackbar.c
+++ b/dlls/comctl32/tests/trackbar.c
@@ -380,6 +380,17 @@ static const struct message ignore_selection_test_seq[] = {
     {0}
 };
 
+static const struct message painting_trackbar_wnd_seq[] = {
+    { WM_PAINT, sent},
+    {0}
+};
+
+static const struct message parent_painting_trackbar_wnd_seq[] = {
+    { WM_CTLCOLORSTATIC, sent},
+    { WM_NOTIFY, sent},
+    {0}
+};
+
 static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
     static LONG defwndproc_counter = 0;
     LRESULT ret;
@@ -1202,6 +1213,23 @@ static void test_create(void)
     DestroyWindow(hWndTrackbar);
 }
 
+static void test_painting(void)
+{
+    HWND hWndTrackbar;
+
+    hWndTrackbar = create_trackbar(defaultstyle, hWndParent);
+    ok(hWndTrackbar != NULL, "Expected non NULL value\n");
+
+    flush_sequences(sequences, NUM_MSG_SEQUENCE);
+
+    UpdateWindow(hWndTrackbar);
+
+    ok_sequence(sequences, TRACKBAR_SEQ_INDEX, painting_trackbar_wnd_seq, "painting test sequence", TRUE);
+    ok_sequence(sequences, PARENT_SEQ_INDEX, parent_painting_trackbar_wnd_seq, "parent paint test sequence", FALSE);
+
+    DestroyWindow(hWndTrackbar);
+}
+
 START_TEST(trackbar)
 {
     init_msg_sequences(sequences, NUM_MSG_SEQUENCE);
@@ -1231,6 +1259,7 @@ START_TEST(trackbar)
     test_TBS_AUTOTICKS();
     test_ignore_selection();
     test_initial_state();
+    test_painting();
 
     DestroyWindow(hWndParent);
 }
diff --git a/dlls/comctl32/trackbar.c b/dlls/comctl32/trackbar.c
index 12c3e9d..b150123 100644
--- a/dlls/comctl32/trackbar.c
+++ b/dlls/comctl32/trackbar.c
@@ -908,6 +908,7 @@ TRACKBAR_Refresh (TRACKBAR_INFO *infoPtr, HDC hdcDst)
     HBITMAP hOldBmp = 0, hOffScreenBmp = 0;
     NMCUSTOMDRAW nmcd;
     int gcdrf, icdrf;
+    HBRUSH hBrush;
 
     if (infoPtr->flags & TB_THUMBCHANGED) {
         TRACKBAR_UpdateThumb (infoPtr);
@@ -944,6 +945,9 @@ TRACKBAR_Refresh (TRACKBAR_INFO *infoPtr, HDC hdcDst)
     nmcd.hdr.code = NM_CUSTOMDRAW;
     nmcd.hdc = hdc;
 
+    hBrush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLORSTATIC,
+                                  (WPARAM)hdc, (LPARAM)infoPtr->hwndSelf);
+
     /* start the paint cycle */
     nmcd.rc = rcClient;
     gcdrf = notify_customdraw(infoPtr, &nmcd, CDDS_PREPAINT);
@@ -956,7 +960,8 @@ TRACKBAR_Refresh (TRACKBAR_INFO *infoPtr, HDC hdcDst)
             DrawThemeParentBackground (infoPtr->hwndSelf, hdc, 0);
         }
         else
-	    FillRect (hdc, &rcClient, GetSysColorBrush(COLOR_BTNFACE));
+            FillRect (hdc, &rcClient, hBrush ? hBrush : GetSysColorBrush(COLOR_BTNFACE));
+
         if (gcdrf != CDRF_DODEFAULT)
 	    notify_customdraw(infoPtr, &nmcd, CDDS_POSTERASE);
     }
-- 
1.9.1




More information about the wine-patches mailing list