Zhiyi Zhang : uxtheme: Use OpenThemeDataForDpi() to create a theme handle not associated to a window.

Alexandre Julliard julliard at winehq.org
Wed Sep 1 15:45:09 CDT 2021


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

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Wed Sep  1 14:37:54 2021 +0800

uxtheme: Use OpenThemeDataForDpi() to create a theme handle not associated to a window.

If a window is not passed to OpenThemeData(), OpenThemeData() assumes the DPI is 96 according to
tests. And GetThemePartSize() should select theme parts according to the DPI stored in theme
handles rather than using GDI device contexts. Thus, OpenThemeDataForDpi() should be used in place
of OpenThemeData() when DPI is not 96 and theme handles shouldn't be associated with a window.

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

---

 dlls/uxtheme/scrollbar.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/dlls/uxtheme/scrollbar.c b/dlls/uxtheme/scrollbar.c
index a9d5a83f2bb..0e42de7d77f 100644
--- a/dlls/uxtheme/scrollbar.c
+++ b/dlls/uxtheme/scrollbar.c
@@ -41,7 +41,11 @@ void WINAPI UXTHEME_ScrollBarDraw(HWND hwnd, HDC dc, INT bar, enum SCROLL_HITTES
     HTHEME theme;
     DWORD style;
 
-    theme = bar == SB_CTL ? GetWindowTheme(hwnd) : OpenThemeData(NULL, WC_SCROLLBARW);
+    if (bar == SB_CTL)
+        theme = GetWindowTheme(hwnd);
+    else
+        theme = OpenThemeDataForDpi(NULL, WC_SCROLLBARW, GetDpiForWindow(hwnd));
+
     if (!theme)
     {
         user_api.pScrollBarDraw(hwnd, dc, bar, hit_test, tracking_info, draw_arrows, draw_interior,




More information about the wine-cvs mailing list