Commit ea71625c authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

uxtheme: Do not overwrite system metrics when loading the same theme.

parent a9e00347
...@@ -421,7 +421,7 @@ static void UXTHEME_SaveSystemMetrics(struct system_metrics *metrics, BOOL send_ ...@@ -421,7 +421,7 @@ static void UXTHEME_SaveSystemMetrics(struct system_metrics *metrics, BOOL send_
*/ */
HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf) HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf)
{ {
BOOL ret, loaded_before = FALSE; BOOL ret, loaded_before = FALSE, same_theme = FALSE;
struct system_metrics metrics; struct system_metrics metrics;
DWORD size; DWORD size;
HKEY hKey; HKEY hKey;
...@@ -430,6 +430,9 @@ HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf) ...@@ -430,6 +430,9 @@ HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf)
if(tf) { if(tf) {
bThemeActive = TRUE; bThemeActive = TRUE;
same_theme = !lstrcmpW(szCurrentTheme, tf->szThemeFile)
&& !lstrcmpW(szCurrentColor, tf->pszSelectedColor)
&& !lstrcmpW(szCurrentSize, tf->pszSelectedSize);
lstrcpynW(szCurrentTheme, tf->szThemeFile, ARRAY_SIZE(szCurrentTheme)); lstrcpynW(szCurrentTheme, tf->szThemeFile, ARRAY_SIZE(szCurrentTheme));
lstrcpynW(szCurrentColor, tf->pszSelectedColor, ARRAY_SIZE(szCurrentColor)); lstrcpynW(szCurrentColor, tf->pszSelectedColor, ARRAY_SIZE(szCurrentColor));
lstrcpynW(szCurrentSize, tf->pszSelectedSize, ARRAY_SIZE(szCurrentSize)); lstrcpynW(szCurrentSize, tf->pszSelectedSize, ARRAY_SIZE(szCurrentSize));
...@@ -446,6 +449,8 @@ HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf) ...@@ -446,6 +449,8 @@ HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf)
WARN("Failed to get LoadedBefore: %d\n", GetLastError()); WARN("Failed to get LoadedBefore: %d\n", GetLastError());
RegCloseKey(hKey); RegCloseKey(hKey);
} }
if (loaded_before && same_theme)
return MSSTYLES_SetActiveTheme(tf, FALSE);
if (!loaded_before && ret) if (!loaded_before && ret)
UXTHEME_SaveUnthemedSystemMetrics(&metrics); UXTHEME_SaveUnthemedSystemMetrics(&metrics);
......
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