Commit 7be103bb authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

comctl32: 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: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 615a90e2
...@@ -1317,7 +1317,7 @@ static LRESULT DATETIME_NCPaint (HWND hwnd, HRGN region) ...@@ -1317,7 +1317,7 @@ static LRESULT DATETIME_NCPaint (HWND hwnd, HRGN region)
RECT r; RECT r;
HDC dc; HDC dc;
theme = OpenThemeData(NULL, WC_EDITW); theme = OpenThemeDataForDpi(NULL, WC_EDITW, GetDpiForWindow(hwnd));
if (!theme) if (!theme)
return DefWindowProcW(hwnd, WM_NCPAINT, (WPARAM)region, 0); return DefWindowProcW(hwnd, WM_NCPAINT, (WPARAM)region, 0);
......
...@@ -434,7 +434,7 @@ HOTKEY_NCPaint (HWND hwnd, HRGN region) ...@@ -434,7 +434,7 @@ HOTKEY_NCPaint (HWND hwnd, HRGN region)
RECT r; RECT r;
HDC dc; HDC dc;
theme = OpenThemeData(NULL, WC_EDITW); theme = OpenThemeDataForDpi(NULL, WC_EDITW, GetDpiForWindow(hwnd));
if (!theme) if (!theme)
return DefWindowProcW(hwnd, WM_NCPAINT, (WPARAM)region, 0); return DefWindowProcW(hwnd, WM_NCPAINT, (WPARAM)region, 0);
......
...@@ -5313,7 +5313,7 @@ TOOLBAR_Create (HWND hwnd, const CREATESTRUCTW *lpcs) ...@@ -5313,7 +5313,7 @@ TOOLBAR_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
SystemParametersInfoW (SPI_GETICONTITLELOGFONT, 0, &logFont, 0); SystemParametersInfoW (SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW (&logFont); infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW (&logFont);
infoPtr->hTheme = OpenThemeData (NULL, themeClass); infoPtr->hTheme = OpenThemeDataForDpi (NULL, themeClass, GetDpiForWindow (hwnd));
TOOLBAR_CheckStyle (infoPtr); TOOLBAR_CheckStyle (infoPtr);
...@@ -6550,7 +6550,7 @@ TOOLBAR_SysColorChange (void) ...@@ -6550,7 +6550,7 @@ TOOLBAR_SysColorChange (void)
static LRESULT theme_changed (TOOLBAR_INFO *infoPtr) static LRESULT theme_changed (TOOLBAR_INFO *infoPtr)
{ {
CloseThemeData (infoPtr->hTheme); CloseThemeData (infoPtr->hTheme);
infoPtr->hTheme = OpenThemeData (NULL, themeClass); infoPtr->hTheme = OpenThemeDataForDpi (NULL, themeClass, GetDpiForWindow (infoPtr->hwndSelf));
InvalidateRect (infoPtr->hwndSelf, NULL, TRUE); InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment