Commit 51f414bd authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

imm32: Select default IME when creating its data.

parent c850336c
......@@ -806,7 +806,7 @@ BOOL WINAPI ImmConfigureIMEW(
return FALSE;
}
static InputContextData *alloc_input_context_data(void)
static InputContextData *create_input_context(HIMC default_imc)
{
InputContextData *new_context;
LPGUIDELINE gl;
......@@ -816,6 +816,7 @@ static InputContextData *alloc_input_context_data(void)
new_context = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(InputContextData));
/* Load the IME */
new_context->threadDefault = !!default_imc;
new_context->immKbd = IMM_GetImmHkl(GetKeyboardLayout(0));
if (!new_context->immKbd->hIME)
......@@ -848,6 +849,27 @@ static InputContextData *alloc_input_context_data(void)
new_context->IMC.fdwConversion = new_context->immKbd->imeInfo.fdwConversionCaps;
new_context->IMC.fdwSentence = new_context->immKbd->imeInfo.fdwSentenceCaps;
if (!default_imc)
new_context->handle = NtUserCreateInputContext((UINT_PTR)new_context);
else if (NtUserUpdateInputContext(default_imc, NtUserInputContextClientPtr, (UINT_PTR)new_context))
new_context->handle = default_imc;
if (!new_context->handle)
{
free_input_context_data(new_context);
return 0;
}
if (!new_context->immKbd->pImeSelect(new_context->handle, TRUE))
{
TRACE("Selection of IME failed\n");
IMM_DestroyContext(new_context);
return 0;
}
new_context->threadID = GetCurrentThreadId();
SendMessageW(GetFocus(), WM_IME_SELECT, TRUE, (LPARAM)new_context->immKbd);
new_context->immKbd->uSelected++;
TRACE("Created context %p\n", new_context);
return new_context;
}
......@@ -856,16 +878,7 @@ static InputContextData* get_imc_data(HIMC handle)
InputContextData *ret;
if ((ret = query_imc_data(handle)) || !handle) return ret;
if (!(ret = alloc_input_context_data())) return NULL;
ret->threadID = NtUserQueryInputContext(handle, NtUserInputContextThreadId);
ret->handle = handle;
ret->threadDefault = TRUE;
if (!NtUserUpdateInputContext(handle, NtUserInputContextClientPtr, (UINT_PTR)ret))
{
free_input_context_data(ret);
return NULL;
}
return ret;
return create_input_context(handle);
}
/***********************************************************************
......@@ -875,25 +888,7 @@ HIMC WINAPI ImmCreateContext(void)
{
InputContextData *new_context;
if (!(new_context = alloc_input_context_data())) return 0;
if (!(new_context->handle = NtUserCreateInputContext((UINT_PTR)new_context)))
{
free_input_context_data(new_context);
return 0;
}
if (!new_context->immKbd->pImeSelect(new_context->handle, TRUE))
{
TRACE("Selection of IME failed\n");
IMM_DestroyContext(new_context);
return 0;
}
new_context->threadID = GetCurrentThreadId();
SendMessageW(GetFocus(), WM_IME_SELECT, TRUE, (LPARAM)new_context->immKbd);
new_context->immKbd->uSelected++;
TRACE("Created context %p\n",new_context);
if (!(new_context = create_input_context(0))) return 0;
return new_context->handle;
}
......
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