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( ...@@ -806,7 +806,7 @@ BOOL WINAPI ImmConfigureIMEW(
return FALSE; return FALSE;
} }
static InputContextData *alloc_input_context_data(void) static InputContextData *create_input_context(HIMC default_imc)
{ {
InputContextData *new_context; InputContextData *new_context;
LPGUIDELINE gl; LPGUIDELINE gl;
...@@ -816,6 +816,7 @@ static InputContextData *alloc_input_context_data(void) ...@@ -816,6 +816,7 @@ static InputContextData *alloc_input_context_data(void)
new_context = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(InputContextData)); new_context = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(InputContextData));
/* Load the IME */ /* Load the IME */
new_context->threadDefault = !!default_imc;
new_context->immKbd = IMM_GetImmHkl(GetKeyboardLayout(0)); new_context->immKbd = IMM_GetImmHkl(GetKeyboardLayout(0));
if (!new_context->immKbd->hIME) if (!new_context->immKbd->hIME)
...@@ -848,6 +849,27 @@ static InputContextData *alloc_input_context_data(void) ...@@ -848,6 +849,27 @@ static InputContextData *alloc_input_context_data(void)
new_context->IMC.fdwConversion = new_context->immKbd->imeInfo.fdwConversionCaps; new_context->IMC.fdwConversion = new_context->immKbd->imeInfo.fdwConversionCaps;
new_context->IMC.fdwSentence = new_context->immKbd->imeInfo.fdwSentenceCaps; 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; return new_context;
} }
...@@ -856,16 +878,7 @@ static InputContextData* get_imc_data(HIMC handle) ...@@ -856,16 +878,7 @@ static InputContextData* get_imc_data(HIMC handle)
InputContextData *ret; InputContextData *ret;
if ((ret = query_imc_data(handle)) || !handle) return ret; if ((ret = query_imc_data(handle)) || !handle) return ret;
if (!(ret = alloc_input_context_data())) return NULL; return create_input_context(handle);
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;
} }
/*********************************************************************** /***********************************************************************
...@@ -875,25 +888,7 @@ HIMC WINAPI ImmCreateContext(void) ...@@ -875,25 +888,7 @@ HIMC WINAPI ImmCreateContext(void)
{ {
InputContextData *new_context; InputContextData *new_context;
if (!(new_context = alloc_input_context_data())) return 0; if (!(new_context = create_input_context(0))) 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);
return new_context->handle; 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