From 2adb11dd6159db3ccb8343722d8cc579c2a84552 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 21 Jan 2022 15:47:54 +0800 Subject: [PATCH] uxtheme: Do not call SetWindowTheme() in EnableThemeDialogTexture(). It's no longer necessary to call SetWindowTheme() in EnableThemeDialogTexture() because dialog theming doesn't need to open theme handles associated with the dialog. Calling SetWindowTheme() also sends extra messages. Signed-off-by: Zhiyi Zhang Signed-off-by: Alexandre Julliard --- dlls/uxtheme/draw.c | 7 +------ dlls/uxtheme/tests/system.c | 4 ++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/dlls/uxtheme/draw.c b/dlls/uxtheme/draw.c index 04ea1e79df9..a7942b03f97 100644 --- a/dlls/uxtheme/draw.c +++ b/dlls/uxtheme/draw.c @@ -60,12 +60,7 @@ HRESULT WINAPI EnableThemeDialogTexture(HWND hwnd, DWORD dwFlags) res = SetPropW (hwnd, (LPCWSTR)MAKEINTATOM(atDialogThemeEnabled), UlongToHandle(dwFlags|0x80000000)); /* 0x80000000 serves as a "flags set" flag */ - if (!res) - return HRESULT_FROM_WIN32(GetLastError()); - if (dwFlags & ETDT_USETABTEXTURE) - return SetWindowTheme (hwnd, NULL, L"Tab"); - else - return SetWindowTheme (hwnd, NULL, NULL); + return res ? S_OK : HRESULT_FROM_WIN32(GetLastError()); } /*********************************************************************** diff --git a/dlls/uxtheme/tests/system.c b/dlls/uxtheme/tests/system.c index 3f8f32a9a7b..03e435eb463 100644 --- a/dlls/uxtheme/tests/system.c +++ b/dlls/uxtheme/tests/system.c @@ -2018,7 +2018,7 @@ static void test_EnableThemeDialogTexture(void) hr = EnableThemeDialogTexture(dialog, flags[i]); ok(hr == S_OK, "EnableThemeDialogTexture failed, hr %#x.\n", hr); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, - "EnableThemeDialogTexture first flag", TRUE); + "EnableThemeDialogTexture first flag", FALSE); ret = IsThemeDialogTextureEnabled(dialog); /* Non-zero flags without ETDT_DISABLE enables dialog texture */ todo_wine_if(flags[i] == ETDT_USETABTEXTURE || flags[i] == ETDT_USEAEROWIZARDTABTEXTURE) @@ -2040,7 +2040,7 @@ static void test_EnableThemeDialogTexture(void) hr = EnableThemeDialogTexture(dialog, flags[j]); ok(hr == S_OK, "EnableThemeDialogTexture failed, hr %#x.\n", hr); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, - "EnableThemeDialogTexture second flag", TRUE); + "EnableThemeDialogTexture second flag", FALSE); ret = IsThemeDialogTextureEnabled(dialog); /* If the flag is zero, it will have previous dialog texture status */ if (flags[j])