imm32: ImmDestroyContext cannot destroy the default context.

This commit is contained in:
Aric Stewart 2008-04-08 13:26:05 -05:00 committed by Alexandre Julliard
parent 5c8473ba78
commit bb52d30111
1 changed files with 16 additions and 6 deletions

View File

@ -109,6 +109,8 @@ static const WCHAR szwWineIMCProperty[] = {'W','i','n','e','I','m','m','H','I','
#define is_himc_ime_unicode(p) (p->immKbd->imeInfo.fdwProperty & IME_PROP_UNICODE) #define is_himc_ime_unicode(p) (p->immKbd->imeInfo.fdwProperty & IME_PROP_UNICODE)
#define is_kbd_ime_unicode(p) (p->imeInfo.fdwProperty & IME_PROP_UNICODE) #define is_kbd_ime_unicode(p) (p->imeInfo.fdwProperty & IME_PROP_UNICODE)
static BOOL IMM_DestroyContext(HIMC hIMC);
static inline WCHAR *strdupAtoW( const char *str ) static inline WCHAR *strdupAtoW( const char *str )
{ {
WCHAR *ret = NULL; WCHAR *ret = NULL;
@ -150,7 +152,7 @@ static void IMM_InitThreadData(void)
static void IMM_FreeThreadData(void) static void IMM_FreeThreadData(void)
{ {
IMMThreadData* data = TlsGetValue(tlsIndex); IMMThreadData* data = TlsGetValue(tlsIndex);
ImmDestroyContext(data->defaultContext); IMM_DestroyContext(data->defaultContext);
DestroyWindow(data->hwndDefault); DestroyWindow(data->hwndDefault);
HeapFree(GetProcessHeap(),0,data); HeapFree(GetProcessHeap(),0,data);
TRACE("Thread Data Destroyed\n"); TRACE("Thread Data Destroyed\n");
@ -510,7 +512,7 @@ HIMC WINAPI ImmCreateContext(void)
if (!new_context->immKbd->pImeSelect(new_context, TRUE)) if (!new_context->immKbd->pImeSelect(new_context, TRUE))
{ {
TRACE("Selection of IME failed\n"); TRACE("Selection of IME failed\n");
ImmDestroyContext(new_context); IMM_DestroyContext(new_context);
return 0; return 0;
} }
@ -520,10 +522,7 @@ HIMC WINAPI ImmCreateContext(void)
return (HIMC)new_context; return (HIMC)new_context;
} }
/*********************************************************************** static BOOL IMM_DestroyContext(HIMC hIMC)
* ImmDestroyContext (IMM32.@)
*/
BOOL WINAPI ImmDestroyContext(HIMC hIMC)
{ {
InputContextData *data = (InputContextData*)hIMC; InputContextData *data = (InputContextData*)hIMC;
@ -549,6 +548,17 @@ BOOL WINAPI ImmDestroyContext(HIMC hIMC)
return TRUE; return TRUE;
} }
/***********************************************************************
* ImmDestroyContext (IMM32.@)
*/
BOOL WINAPI ImmDestroyContext(HIMC hIMC)
{
if (hIMC != IMM_GetThreadData()->defaultContext)
return IMM_DestroyContext(hIMC);
else
return FALSE;
}
/*********************************************************************** /***********************************************************************
* ImmDisableIME (IMM32.@) * ImmDisableIME (IMM32.@)
*/ */