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

imm32: Update HIMC private data when selecting IME.

parent 9c8b3e6f
...@@ -571,6 +571,7 @@ static void imc_select_hkl( struct imc *imc, HKL hkl ) ...@@ -571,6 +571,7 @@ static void imc_select_hkl( struct imc *imc, HKL hkl )
if (imc->ime->hkl == hkl) return; if (imc->ime->hkl == hkl) return;
imc->ime->pImeSelect( imc->handle, FALSE ); imc->ime->pImeSelect( imc->handle, FALSE );
ime_release( imc->ime ); ime_release( imc->ime );
ImmDestroyIMCC( imc->IMC.hPrivate );
} }
if (!hkl) if (!hkl)
...@@ -578,7 +579,13 @@ static void imc_select_hkl( struct imc *imc, HKL hkl ) ...@@ -578,7 +579,13 @@ static void imc_select_hkl( struct imc *imc, HKL hkl )
else if (!(imc->ime = ime_acquire( hkl ))) else if (!(imc->ime = ime_acquire( hkl )))
WARN( "Failed to acquire IME for HKL %p\n", hkl ); WARN( "Failed to acquire IME for HKL %p\n", hkl );
else else
{
if (!(imc->IMC.hPrivate = ImmCreateIMCC( imc->ime->info.dwPrivateDataSize )))
WARN( "Failed to allocate IME private data for IMC %p\n", imc );
imc->IMC.fdwConversion = imc->ime->info.fdwConversionCaps;
imc->IMC.fdwSentence = imc->ime->info.fdwSentenceCaps;
imc->ime->pImeSelect( imc->handle, TRUE ); imc->ime->pImeSelect( imc->handle, TRUE );
}
} }
static BOOL CALLBACK enum_activate_layout( HIMC himc, LPARAM lparam ) static BOOL CALLBACK enum_activate_layout( HIMC himc, LPARAM lparam )
...@@ -872,15 +879,7 @@ static struct imc *create_input_context( HIMC default_imc ) ...@@ -872,15 +879,7 @@ static struct imc *create_input_context( HIMC default_imc )
LPCANDIDATEINFO ci; LPCANDIDATEINFO ci;
int i; int i;
new_context = calloc( 1, sizeof(*new_context) ); if (!(new_context = calloc( 1, sizeof(*new_context) ))) return NULL;
/* Load the IME */
if (!(new_context->ime = ime_acquire( GetKeyboardLayout( 0 ) )))
{
TRACE("IME dll could not be loaded\n");
free( new_context );
return 0;
}
/* the HIMCCs are never NULL */ /* the HIMCCs are never NULL */
new_context->IMC.hCompStr = ImmCreateBlankCompStr(); new_context->IMC.hCompStr = ImmCreateBlankCompStr();
...@@ -899,12 +898,6 @@ static struct imc *create_input_context( HIMC default_imc ) ...@@ -899,12 +898,6 @@ static struct imc *create_input_context( HIMC default_imc )
for (i = 0; i < ARRAY_SIZE(new_context->IMC.cfCandForm); i++) for (i = 0; i < ARRAY_SIZE(new_context->IMC.cfCandForm); i++)
new_context->IMC.cfCandForm[i].dwIndex = ~0u; new_context->IMC.cfCandForm[i].dwIndex = ~0u;
/* Initialize the IME Private */
new_context->IMC.hPrivate = ImmCreateIMCC( new_context->ime->info.dwPrivateDataSize );
new_context->IMC.fdwConversion = new_context->ime->info.fdwConversionCaps;
new_context->IMC.fdwSentence = new_context->ime->info.fdwSentenceCaps;
if (!default_imc) if (!default_imc)
new_context->handle = NtUserCreateInputContext((UINT_PTR)new_context); new_context->handle = NtUserCreateInputContext((UINT_PTR)new_context);
else if (NtUserUpdateInputContext(default_imc, NtUserInputContextClientPtr, (UINT_PTR)new_context)) else if (NtUserUpdateInputContext(default_imc, NtUserInputContextClientPtr, (UINT_PTR)new_context))
...@@ -915,12 +908,7 @@ static struct imc *create_input_context( HIMC default_imc ) ...@@ -915,12 +908,7 @@ static struct imc *create_input_context( HIMC default_imc )
return 0; return 0;
} }
if (!new_context->ime->pImeSelect( new_context->handle, TRUE )) imc_select_hkl( new_context, GetKeyboardLayout( 0 ) );
{
TRACE("Selection of IME failed\n");
IMM_DestroyContext(new_context);
return 0;
}
SendMessageW( GetFocus(), WM_IME_SELECT, TRUE, (LPARAM)new_context->ime ); SendMessageW( GetFocus(), WM_IME_SELECT, TRUE, (LPARAM)new_context->ime );
TRACE("Created context %p\n", new_context); TRACE("Created context %p\n", new_context);
......
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