Commit 01677af4 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

imm32: Use INPUTCONTEXT directly in ImmGetCandidateWindow.

parent cf03ab41
......@@ -1390,25 +1390,21 @@ done:
/***********************************************************************
* ImmGetCandidateWindow (IMM32.@)
*/
BOOL WINAPI ImmGetCandidateWindow(
HIMC hIMC, DWORD dwIndex, LPCANDIDATEFORM lpCandidate)
BOOL WINAPI ImmGetCandidateWindow( HIMC himc, DWORD index, CANDIDATEFORM *candidate )
{
struct imc *data = get_imc_data( hIMC );
TRACE("%p, %ld, %p\n", hIMC, dwIndex, lpCandidate);
if (!data || !lpCandidate)
return FALSE;
INPUTCONTEXT *ctx;
BOOL ret = TRUE;
if (dwIndex >= ARRAY_SIZE(data->IMC.cfCandForm))
return FALSE;
TRACE( "himc %p, index %lu, candidate %p\n", himc, index, candidate );
if (data->IMC.cfCandForm[dwIndex].dwIndex != dwIndex)
return FALSE;
if (!candidate) return FALSE;
*lpCandidate = data->IMC.cfCandForm[dwIndex];
if (!(ctx = ImmLockIMC( himc ))) return FALSE;
if (ctx->cfCandForm[index].dwIndex == -1) ret = FALSE;
else *candidate = ctx->cfCandForm[index];
ImmUnlockIMC( himc );
return TRUE;
return ret;
}
/***********************************************************************
......
......@@ -5653,21 +5653,21 @@ static void test_ImmGetCandidateWindow(void)
ok_eq( 0xcdcdcdcd, cand_form.dwIndex, UINT, "%u" );
ok_ret( 0, ImmGetCandidateWindow( default_himc, 3, &cand_form ) );
ok_eq( 0xcdcdcdcd, cand_form.dwIndex, UINT, "%u" );
todo_wine ok_ret( 1, ImmGetCandidateWindow( default_himc, 4, &cand_form ) );
ok_ret( 1, ImmGetCandidateWindow( default_himc, 4, &cand_form ) );
ok_seq( empty_sequence );
ok_ret( 0, ImmGetCandidateWindow( himc, 0, &cand_form ) );
ok_seq( empty_sequence );
todo_wine ok_seq( empty_sequence );
ok_seq( empty_sequence );
ok( !!ctx, "ImmLockIMC failed, error %lu\n", GetLastError() );
ctx->cfCandForm[0] = expect_form;
todo_wine ok_ret( 1, ImmGetCandidateWindow( himc, 0, &cand_form ) );
todo_wine check_candidate_form( &cand_form, &expect_form );
ok_ret( 1, ImmGetCandidateWindow( himc, 0, &cand_form ) );
check_candidate_form( &cand_form, &expect_form );
ok_seq( empty_sequence );
todo_wine ok_seq( empty_sequence );
ok_seq( empty_sequence );
ok( !!ctx, "ImmLockIMC failed, error %lu\n", GetLastError() );
ctx->cfCandForm[0].dwIndex = -1;
......@@ -6481,8 +6481,8 @@ static void test_ImmSetCandidateWindow(void)
memset( &cand_form, 0xcd, sizeof(cand_form) );
ok_ret( 0, ImmGetCandidateWindow( himc, 0, &cand_form ) );
ok_eq( 0xcdcdcdcd, cand_form.dwStyle, UINT, "%#x" );
todo_wine ok_ret( 1, ImmGetCandidateWindow( himc, 1, &cand_form ) );
todo_wine check_candidate_form( &cand_form, &expect_form );
ok_ret( 1, ImmGetCandidateWindow( himc, 1, &cand_form ) );
check_candidate_form( &cand_form, &expect_form );
ok_ret( 1, ImmGetCandidateWindow( himc, 2, &cand_form ) );
check_candidate_form( &cand_form, &expect_form );
ok_seq( empty_sequence );
......
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