From 8d69490fb73e4bfa3437b1c76f709be4788c96d1 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Mon, 4 Jul 2022 23:18:12 +0800 Subject: [PATCH] uxtheme: Use system DPI for OpenThemeData() without valid window handles. 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 --- 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);