From ea71625cf177f2ad38d4520383e91a4a6152a550 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 19 Nov 2021 15:39:11 +0800 Subject: [PATCH] uxtheme: Do not overwrite system metrics when loading the same theme. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51986 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52025 Signed-off-by: Zhiyi Zhang Signed-off-by: Alexandre Julliard --- dlls/uxtheme/system.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/uxtheme/system.c b/dlls/uxtheme/system.c index bf72baccebb..37c484387ec 100644 --- a/dlls/uxtheme/system.c +++ b/dlls/uxtheme/system.c @@ -421,7 +421,7 @@ static void UXTHEME_SaveSystemMetrics(struct system_metrics *metrics, BOOL send_ */ HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf) { - BOOL ret, loaded_before = FALSE; + BOOL ret, loaded_before = FALSE, same_theme = FALSE; struct system_metrics metrics; DWORD size; HKEY hKey; @@ -430,6 +430,9 @@ HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf) if(tf) { bThemeActive = TRUE; + same_theme = !lstrcmpW(szCurrentTheme, tf->szThemeFile) + && !lstrcmpW(szCurrentColor, tf->pszSelectedColor) + && !lstrcmpW(szCurrentSize, tf->pszSelectedSize); lstrcpynW(szCurrentTheme, tf->szThemeFile, ARRAY_SIZE(szCurrentTheme)); lstrcpynW(szCurrentColor, tf->pszSelectedColor, ARRAY_SIZE(szCurrentColor)); lstrcpynW(szCurrentSize, tf->pszSelectedSize, ARRAY_SIZE(szCurrentSize)); @@ -446,6 +449,8 @@ HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf) WARN("Failed to get LoadedBefore: %d\n", GetLastError()); RegCloseKey(hKey); } + if (loaded_before && same_theme) + return MSSTYLES_SetActiveTheme(tf, FALSE); if (!loaded_before && ret) UXTHEME_SaveUnthemedSystemMetrics(&metrics);