For example, set ETDT_USETABTEXTURE first and then set ETDT_ENABLE to activate dialog theming.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/uxtheme/draw.c | 28 +++++++++++++++++++++++----- dlls/uxtheme/tests/system.c | 8 ++------ 2 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/dlls/uxtheme/draw.c b/dlls/uxtheme/draw.c index b6e5f0230e5..4aac46f3fed 100644 --- a/dlls/uxtheme/draw.c +++ b/dlls/uxtheme/draw.c @@ -52,14 +52,32 @@ extern ATOM atDialogThemeEnabled; /*********************************************************************** * EnableThemeDialogTexture (UXTHEME.@) */ -HRESULT WINAPI EnableThemeDialogTexture(HWND hwnd, DWORD dwFlags) +HRESULT WINAPI EnableThemeDialogTexture(HWND hwnd, DWORD new_flag) { + DWORD old_flag = 0; BOOL res;
- TRACE("(%p,0x%08x\n", hwnd, dwFlags); - res = SetPropW (hwnd, (LPCWSTR)MAKEINTATOM(atDialogThemeEnabled), - UlongToHandle(dwFlags|0x80000000)); - /* 0x80000000 serves as a "flags set" flag */ + TRACE("(%p,%#x\n", hwnd, new_flag); + + new_flag &= ETDT_VALIDBITS; + + if (new_flag == 0) + return S_OK; + + if (new_flag & ETDT_DISABLE) + { + new_flag = ETDT_DISABLE; + old_flag = 0; + } + + if (new_flag & ~ETDT_DISABLE) + { + old_flag = HandleToUlong(GetPropW(hwnd, (LPCWSTR)MAKEINTATOM(atDialogThemeEnabled))); + old_flag &= ~ETDT_DISABLE; + } + + new_flag = new_flag | old_flag; + res = SetPropW(hwnd, (LPCWSTR)MAKEINTATOM(atDialogThemeEnabled), UlongToHandle(new_flag)); return res ? S_OK : HRESULT_FROM_WIN32(GetLastError()); }
diff --git a/dlls/uxtheme/tests/system.c b/dlls/uxtheme/tests/system.c index 93994fa8364..4a5a6d291fc 100644 --- a/dlls/uxtheme/tests/system.c +++ b/dlls/uxtheme/tests/system.c @@ -1645,16 +1645,15 @@ static void test_EnableThemeDialogTexture(void) { DWORD flag; BOOL enabled; - BOOL todo; } invalid_flag_tests[] = { - {0, FALSE, TRUE}, + {0, FALSE}, {ETDT_DISABLE | ETDT_ENABLE, FALSE}, {ETDT_ENABLETAB | ETDT_ENABLEAEROWIZARDTAB, TRUE}, {ETDT_USETABTEXTURE | ETDT_USEAEROWIZARDTABTEXTURE, TRUE}, {ETDT_VALIDBITS, FALSE}, - {~ETDT_VALIDBITS, FALSE, TRUE}, + {~ETDT_VALIDBITS, FALSE}, {~ETDT_VALIDBITS | ETDT_DISABLE, FALSE} };
@@ -1989,7 +1988,6 @@ static void test_EnableThemeDialogTexture(void) hr = EnableThemeDialogTexture(dialog, invalid_flag_tests[i].flag); ok(hr == S_OK, "EnableThemeDialogTexture failed, hr %#x.\n", hr); ret = IsThemeDialogTextureEnabled(dialog); - todo_wine_if(invalid_flag_tests[i].todo) ok(ret == invalid_flag_tests[i].enabled, "Wrong dialog texture status.\n"); EndDialog(dialog, 0);
@@ -2020,7 +2018,6 @@ static void test_EnableThemeDialogTexture(void) "EnableThemeDialogTexture first flag", FALSE); ret = IsThemeDialogTextureEnabled(dialog); /* Non-zero flags without ETDT_DISABLE enables dialog texture */ - todo_wine_if(flags[i] == 0) ok(ret == (!(flags[i] & ETDT_DISABLE) && flags[i]), "Wrong dialog texture status.\n");
child = GetDlgItem(dialog, 100); @@ -2045,7 +2042,6 @@ static void test_EnableThemeDialogTexture(void) if (flags[j]) ok(ret == !(flags[j] & ETDT_DISABLE), "Wrong dialog texture status.\n"); else - todo_wine_if(!flags[i] || flags[i] == ETDT_DISABLE || flags[i] == (ETDT_DISABLE | ETDT_ENABLE)) ok(ret == (!(flags[i] & ETDT_DISABLE) && flags[i]), "Wrong dialog texture status.\n"); lr = SendMessageA(dialog, WM_ERASEBKGND, (WPARAM)child_hdc, 0); ok(lr != 0, "WM_ERASEBKGND failed.\n");