[PATCH 2/2] uxtheme: Do not draw parent background when handling WM_CTLCOLORSTATIC for static controls.

Zhiyi Zhang zzhang at codeweavers.com
Thu Nov 4 01:39:45 CDT 2021


SetBkMode(TRANSPARENT) already indicates that the parent background should remain untouched.
Drawing parent background destroys any previous content that applications drawn and some
applications rely on the content being unchanged.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51914
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/comctl32/tests/static.c | 1 -
 dlls/uxtheme/dialog.c        | 6 +-----
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/dlls/comctl32/tests/static.c b/dlls/comctl32/tests/static.c
index 269dfbb49eb..99738f7b513 100644
--- a/dlls/comctl32/tests/static.c
+++ b/dlls/comctl32/tests/static.c
@@ -458,7 +458,6 @@ static void test_WM_CTLCOLORSTATIC(void)
     todo_wine_if(todo)
     ok(mode == OPAQUE, "Expected mode %#x, got %#x.\n", OPAQUE, mode);
     color = GetPixel(dialog_hdc, 40, 40);
-    todo_wine_if(todo)
     ok(color == 0, "Expected pixel %#x, got %#x.\n", 0, color);
 
     ReleaseDC(child, child_hdc);
diff --git a/dlls/uxtheme/dialog.c b/dlls/uxtheme/dialog.c
index 043346b24e2..a949bfc6579 100644
--- a/dlls/uxtheme/dialog.c
+++ b/dlls/uxtheme/dialog.c
@@ -101,15 +101,11 @@ LRESULT WINAPI UXTHEME_DefDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
                 HDC controlDC = (HDC)wParam;
                 HWND controlWnd = (HWND)lParam;
                 WCHAR controlClass[32];
-                RECT rc;
 
                 GetClassNameW (controlWnd, controlClass, ARRAY_SIZE(controlClass));
                 if (lstrcmpiW (controlClass, WC_STATICW) == 0)
                 {
-                    /* Static control - draw parent background and set text to 
-                     * transparent, so it looks right on tab pages. */
-                    GetClientRect (controlWnd, &rc);
-                    DrawThemeParentBackground (controlWnd, controlDC, &rc);
+                    SetBkColor(controlDC, GetSysColor(COLOR_BTNFACE));
                     SetBkMode (controlDC, TRANSPARENT);
 
                     /* Return NULL brush since we painted the BG already */
-- 
2.32.0



More information about the wine-devel mailing list