[PATCH 2/2] uxtheme: Use system DPI for OpenThemeData() without valid window handles.

Zhiyi Zhang wine at gitlab.winehq.org
Wed Jul 6 01:51:49 CDT 2022


From: Zhiyi Zhang <zzhang at codeweavers.com>

Tested manually on Wine for 96, 120, 144, 168, 192 and 216 DPI.

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

diff --git a/dlls/uxtheme/system.c b/dlls/uxtheme/system.c
index 05b86e40b1a..c7ae319da28 100644
--- a/dlls/uxtheme/system.c
+++ b/dlls/uxtheme/system.c
@@ -663,7 +663,7 @@ HTHEME WINAPI OpenThemeDataEx(HWND hwnd, LPCWSTR pszClassList, DWORD flags)
 
     dpi = GetDpiForWindow(hwnd);
     if (!dpi)
-        dpi = 96;
+        dpi = GetDpiForSystem();
 
     return open_theme_data(hwnd, pszClassList, flags, dpi);
 }
diff --git a/dlls/uxtheme/tests/system.c b/dlls/uxtheme/tests/system.c
index 65387561544..22762ecd4a9 100644
--- a/dlls/uxtheme/tests/system.c
+++ b/dlls/uxtheme/tests/system.c
@@ -1122,12 +1122,10 @@ static void test_GetThemePartSize(void)
 
     hr = GetThemePartSize(htheme, hdc, BP_CHECKBOX, CBS_CHECKEDNORMAL, NULL, TS_DRAW, &size);
     ok(hr == S_OK, "GetThemePartSize failed, hr %#lx.\n", hr);
-    todo_wine_if(target_dpi != 96)
     ok(compare_uint(size.cx, expected, 1) && compare_uint(size.cy, expected, 1),
        "Got unexpected size %ldx%ld.\n", size.cx, size.cy);
     hr = GetThemePartSize(htheme, NULL, BP_CHECKBOX, CBS_CHECKEDNORMAL, NULL, TS_DRAW, &size);
     ok(hr == S_OK, "GetThemePartSize failed, hr %#lx.\n", hr);
-    todo_wine_if(target_dpi != 96)
     ok(compare_uint(size.cx, expected, 1) && compare_uint(size.cy, expected, 1),
        "Got unexpected size %ldx%ld.\n", size.cx, size.cy);
     CloseThemeData(htheme);
@@ -1145,12 +1143,10 @@ static void test_GetThemePartSize(void)
     htheme = OpenThemeData(NULL, WC_BUTTONW);
     hr = GetThemePartSize(htheme, hdc, BP_CHECKBOX, CBS_CHECKEDNORMAL, NULL, TS_DRAW, &size);
     ok(hr == S_OK, "GetThemePartSize failed, hr %#lx.\n", hr);
-    todo_wine_if(target_dpi != 96)
     ok(compare_uint(size.cx, expected, 1) && compare_uint(size.cy, expected, 1),
        "Got unexpected size %ldx%ld.\n", size.cx, size.cy);
     hr = GetThemePartSize(htheme, NULL, BP_CHECKBOX, CBS_CHECKEDNORMAL, NULL, TS_DRAW, &size);
     ok(hr == S_OK, "GetThemePartSize failed, hr %#lx.\n", hr);
-    todo_wine_if(target_dpi != 96)
     ok(compare_uint(size.cx, expected, 1) && compare_uint(size.cy, expected, 1),
        "Got unexpected size %ldx%ld.\n", size.cx, size.cy);
     CloseThemeData(htheme);
-- 
GitLab

https://gitlab.winehq.org/wine/wine/-/merge_requests/387



More information about the wine-devel mailing list