1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

imm32: Use INPUTCONTEXT directly in ImmSetConversionStatus.

This commit is contained in:
Rémi Bernon 2023-04-06 01:01:37 +02:00 committed by Alexandre Julliard
parent 67ddc3146c
commit 1cd71e92be
2 changed files with 20 additions and 24 deletions

View file

@ -2635,36 +2635,33 @@ BOOL WINAPI ImmSetCompositionWindow(
/*********************************************************************** /***********************************************************************
* ImmSetConversionStatus (IMM32.@) * ImmSetConversionStatus (IMM32.@)
*/ */
BOOL WINAPI ImmSetConversionStatus( BOOL WINAPI ImmSetConversionStatus( HIMC himc, DWORD conversion, DWORD sentence )
HIMC hIMC, DWORD fdwConversion, DWORD fdwSentence)
{ {
DWORD oldConversion, oldSentence; DWORD old_conversion, old_sentence;
struct imc *data = get_imc_data( hIMC ); INPUTCONTEXT *ctx;
TRACE("%p %ld %ld\n", hIMC, fdwConversion, fdwSentence); TRACE( "himc %p, conversion %#lx, sentence %#lx\n", himc, conversion, sentence );
if (!data) if (NtUserQueryInputContext( himc, NtUserInputContextThreadId ) != GetCurrentThreadId()) return FALSE;
if (!(ctx = ImmLockIMC( himc ))) return FALSE;
if (conversion != ctx->fdwConversion)
{ {
SetLastError(ERROR_INVALID_HANDLE); old_conversion = ctx->fdwConversion;
return FALSE; ctx->fdwConversion = conversion;
ImmNotifyIME( himc, NI_CONTEXTUPDATED, old_conversion, IMC_SETCONVERSIONMODE );
SendMessageW( ctx->hWnd, WM_IME_NOTIFY, IMN_SETCONVERSIONMODE, 0 );
} }
if (NtUserQueryInputContext( hIMC, NtUserInputContextThreadId ) != GetCurrentThreadId()) return FALSE; if (sentence != ctx->fdwSentence)
{
old_sentence = ctx->fdwSentence;
ctx->fdwSentence = sentence;
ImmNotifyIME( himc, NI_CONTEXTUPDATED, old_sentence, IMC_SETSENTENCEMODE );
SendMessageW( ctx->hWnd, WM_IME_NOTIFY, IMN_SETSENTENCEMODE, 0 );
}
if ( fdwConversion != data->IMC.fdwConversion ) ImmUnlockIMC( himc );
{
oldConversion = data->IMC.fdwConversion;
data->IMC.fdwConversion = fdwConversion;
ImmNotifyIME(hIMC, NI_CONTEXTUPDATED, oldConversion, IMC_SETCONVERSIONMODE);
imc_notify_ime( data, IMN_SETCONVERSIONMODE, 0 );
}
if ( fdwSentence != data->IMC.fdwSentence )
{
oldSentence = data->IMC.fdwSentence;
data->IMC.fdwSentence = fdwSentence;
ImmNotifyIME(hIMC, NI_CONTEXTUPDATED, oldSentence, IMC_SETSENTENCEMODE);
imc_notify_ime( data, IMN_SETSENTENCEMODE, 0 );
}
return TRUE; return TRUE;
} }

View file

@ -4219,7 +4219,6 @@ static void test_ImmSetConversionStatus(void)
.hkl = expect_ime, .himc = default_himc, .hkl = expect_ime, .himc = default_himc,
.func = IME_NOTIFY, .notify = {.action = NI_CONTEXTUPDATED, .index = 0xdeadbeef, .value = IMC_SETCONVERSIONMODE}, .func = IME_NOTIFY, .notify = {.action = NI_CONTEXTUPDATED, .index = 0xdeadbeef, .value = IMC_SETCONVERSIONMODE},
}, },
{.todo = TRUE}, /* spurious calls */
{0}, {0},
}; };
const struct ime_call set_conversion_status_2_seq[] = const struct ime_call set_conversion_status_2_seq[] =