Zhiyi Zhang : winecfg: 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: 53a0d57aff628c73e8da2dbaba0d3c59b0424987
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=53a0d57aff628c73e8da2dbaba0d3c59b0424987

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

winecfg: 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>

---

 programs/winecfg/theme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/programs/winecfg/theme.c b/programs/winecfg/theme.c
index e204a911516..b3a3eeed3ba 100644
--- a/programs/winecfg/theme.c
+++ b/programs/winecfg/theme.c
@@ -1090,7 +1090,7 @@ static void on_draw_item(HWND hDlg, WPARAM wParam, LPARAM lParam)
         HTHEME theme;
         RECT buttonrect;
 
-        theme = OpenThemeData(NULL, WC_BUTTONW);
+        theme = OpenThemeDataForDpi(NULL, WC_BUTTONW, GetDpiForWindow(hDlg));
 
         if (theme) {
             MARGINS margins;




More information about the wine-cvs mailing list