Fix Nokia SDK 2.0 for Java installer buttons not changing state after clicking.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/uxtheme/metric.c | 30 +++++++++++++++++++++++++++--- dlls/uxtheme/tests/system.c | 22 ++++------------------ 2 files changed, 31 insertions(+), 21 deletions(-)
diff --git a/dlls/uxtheme/metric.c b/dlls/uxtheme/metric.c index b7c173740d7..3ef199bcca7 100644 --- a/dlls/uxtheme/metric.c +++ b/dlls/uxtheme/metric.c @@ -228,8 +228,32 @@ HRESULT WINAPI GetThemeSysString(HTHEME hTheme, int iStringID, HRESULT WINAPI GetThemeTransitionDuration(HTHEME hTheme, int iPartId, int iStateIdFrom, int iStateIdTo, int iPropId, DWORD *pdwDuration) { - FIXME("(%p, %u, %u, %u, %u, %p) stub\n", hTheme, iPartId, iStateIdFrom, iStateIdTo, - iPropId, pdwDuration); + INTLIST intlist; + HRESULT hr;
- return E_NOTIMPL; + TRACE("(%p, %d, %d, %d, %d, %p)\n", hTheme, iPartId, iStateIdFrom, iStateIdTo, iPropId, + pdwDuration); + + if (!pdwDuration || iStateIdFrom < 1 || iStateIdTo < 1) + return E_INVALIDARG; + + hr = GetThemeIntList(hTheme, iPartId, 0, iPropId, &intlist); + if (FAILED(hr)) + { + if (hr == E_PROP_ID_UNSUPPORTED) + *pdwDuration = 0; + + return hr; + } + + if (intlist.iValueCount < 1 || iStateIdFrom > intlist.iValues[0] + || iStateIdTo > intlist.iValues[0] + || intlist.iValueCount != 1 + intlist.iValues[0] * intlist.iValues[0]) + { + *pdwDuration = 0; + return E_INVALIDARG; + } + + *pdwDuration = intlist.iValues[1 + intlist.iValues[0] * (iStateIdFrom - 1) + (iStateIdTo - 1)]; + return S_OK; } diff --git a/dlls/uxtheme/tests/system.c b/dlls/uxtheme/tests/system.c index 57901e6affb..10857115061 100644 --- a/dlls/uxtheme/tests/system.c +++ b/dlls/uxtheme/tests/system.c @@ -1329,74 +1329,64 @@ static void test_GetThemeTransitionDuration(void) duration = 0xdeadbeef; hr = pGetThemeTransitionDuration(NULL, BP_PUSHBUTTON, PBS_NORMAL, PBS_DEFAULTED_ANIMATING, TMT_TRANSITIONDURATIONS, &duration); - todo_wine ok(hr == E_HANDLE, "GetThemeTransitionDuration failed, hr %#x.\n", hr); ok(duration == 0xdeadbeef, "Expected duration %#x, got %#x.\n", 0xdeadbeef, duration);
+ /* Crash on Wine. HTHEME is not a pointer that can be directly referenced. */ + if (strcmp(winetest_platform, "wine")) + { duration = 0xdeadbeef; hr = pGetThemeTransitionDuration((HTHEME)0xdeadbeef, BP_PUSHBUTTON, PBS_NORMAL, PBS_DEFAULTED_ANIMATING, TMT_TRANSITIONDURATIONS, &duration); todo_wine ok(hr == E_HANDLE, "GetThemeTransitionDuration failed, hr %#x.\n", hr); ok(duration == 0xdeadbeef, "Expected duration %#x, got %#x.\n", 0xdeadbeef, duration); + }
duration = 0xdeadbeef; hr = pGetThemeTransitionDuration(theme, 0xdeadbeef, PBS_NORMAL, PBS_DEFAULTED_ANIMATING, TMT_TRANSITIONDURATIONS, &duration); - todo_wine ok(hr == E_PROP_ID_UNSUPPORTED, "GetThemeTransitionDuration failed, hr %#x.\n", hr); - todo_wine ok(duration == 0, "Expected duration %#x, got %#x.\n", 0, duration);
duration = 0xdeadbeef; hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_NORMAL - 1, PBS_DEFAULTED_ANIMATING, TMT_TRANSITIONDURATIONS, &duration); - todo_wine ok(hr == E_INVALIDARG, "GetThemeTransitionDuration failed, hr %#x.\n", hr); ok(duration == 0xdeadbeef, "Expected duration %#x, got %#x.\n", 0xdeadbeef, duration);
duration = 0xdeadbeef; hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_DEFAULTED_ANIMATING + 1, PBS_DEFAULTED_ANIMATING, TMT_TRANSITIONDURATIONS, &duration); - todo_wine ok(hr == E_INVALIDARG, "GetThemeTransitionDuration failed, hr %#x.\n", hr); - todo_wine ok(duration == 0, "Expected duration %#x, got %#x.\n", 0, duration);
duration = 0xdeadbeef; hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_NORMAL, PBS_NORMAL - 1, TMT_TRANSITIONDURATIONS, &duration); - todo_wine ok(hr == E_INVALIDARG, "GetThemeTransitionDuration failed, hr %#x.\n", hr); ok(duration == 0xdeadbeef, "Expected duration %#x, got %#x.\n", 0xdeadbeef, duration);
duration = 0xdeadbeef; hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_NORMAL, PBS_DEFAULTED_ANIMATING + 1, TMT_TRANSITIONDURATIONS, &duration); - todo_wine ok(hr == E_INVALIDARG, "GetThemeTransitionDuration failed, hr %#x.\n", hr); - todo_wine ok(duration == 0, "Expected duration %#x, got %#x.\n", 0, duration);
duration = 0xdeadbeef; hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_NORMAL, PBS_DEFAULTED_ANIMATING, TMT_BACKGROUND, &duration); - todo_wine ok(hr == E_PROP_ID_UNSUPPORTED, "GetThemeTransitionDuration failed, hr %#x.\n", hr); - todo_wine ok(duration == 0, "Expected duration %#x, got %#x.\n", 0, duration);
duration = 0xdeadbeef; hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_NORMAL, PBS_DEFAULTED_ANIMATING, 0xdeadbeef, &duration); - todo_wine ok(hr == E_PROP_ID_UNSUPPORTED, "GetThemeTransitionDuration failed, hr %#x.\n", hr); - todo_wine ok(duration == 0, "Expected duration %#x, got %#x.\n", 0, duration);
hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, PBS_NORMAL, PBS_DEFAULTED_ANIMATING, TMT_TRANSITIONDURATIONS, NULL); - todo_wine ok(hr == E_INVALIDARG, "GetThemeTransitionDuration failed, hr %#x.\n", hr);
/* Parts that don't have TMT_TRANSITIONDURATIONS */ @@ -1406,9 +1396,7 @@ static void test_GetThemeTransitionDuration(void) duration = 0xdeadbeef; hr = pGetThemeTransitionDuration(theme, BP_GROUPBOX, GBS_NORMAL, GBS_DISABLED, TMT_TRANSITIONDURATIONS, &duration); - todo_wine ok(hr == E_PROP_ID_UNSUPPORTED, "GetThemeTransitionDuration failed, hr %#x.\n", hr); - todo_wine ok(duration == 0, "Expected duration %#x, got %#x.\n", 0, duration);
/* Test parsing TMT_TRANSITIONDURATIONS property. TMT_TRANSITIONDURATIONS is a vista+ property */ @@ -1436,10 +1424,8 @@ static void test_GetThemeTransitionDuration(void) duration = 0xdeadbeef; hr = pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, from_state, to_state, TMT_TRANSITIONDURATIONS, &duration); - todo_wine ok(hr == S_OK, "GetThemeTransitionDuration failed, hr %#x.\n", hr); expected = intlist.iValues[1 + intlist.iValues[0] * (from_state - 1) + (to_state - 1)]; - todo_wine ok(duration == expected, "Expected duration %d, got %d.\n", expected, duration);
winetest_pop_context();