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

winemac: Delay ime_set_text until ImeToAsciiEx requests it.

parent 80060f21
......@@ -32,6 +32,14 @@
WINE_DEFAULT_DEBUG_CHANNEL(event);
WINE_DECLARE_DEBUG_CHANNEL(imm);
struct ime_update
{
struct ime_set_text_params *comp_params;
DWORD comp_size;
struct ime_set_text_params *result_params;
DWORD result_size;
};
static struct ime_update ime_update;
/* return the name of an Mac event */
static const char *dbgstr_event(int type)
......@@ -170,7 +178,20 @@ static void macdrv_im_set_text(const macdrv_event *event)
if (length)
CFStringGetCharacters(event->im_set_text.text, CFRangeMake(0, length), params->text);
macdrv_client_func(client_func_ime_set_text, params, size);
free(ime_update.comp_params);
ime_update.comp_params = NULL;
if (params->complete)
{
free(ime_update.result_params);
ime_update.result_params = params;
ime_update.result_size = size;
}
else
{
ime_update.comp_params = params;
ime_update.comp_size = size;
}
}
/***********************************************************************
......@@ -179,7 +200,29 @@ static void macdrv_im_set_text(const macdrv_event *event)
static void macdrv_sent_text_input(const macdrv_event *event)
{
TRACE_(imm)("handled: %s\n", event->sent_text_input.handled ? "TRUE" : "FALSE");
*event->sent_text_input.done = event->sent_text_input.handled ? 1 : -1;
*event->sent_text_input.done = event->sent_text_input.handled || ime_update.result_params ? 1 : -1;
}
/***********************************************************************
* macdrv_ime_get_text_input
*/
NTSTATUS macdrv_ime_get_text_input(void *arg)
{
if (ime_update.result_params)
{
macdrv_client_func(client_func_ime_set_text, ime_update.result_params, ime_update.result_size);
free(ime_update.result_params);
ime_update.result_params = NULL;
}
if (ime_update.comp_params)
{
macdrv_client_func(client_func_ime_set_text, ime_update.comp_params, ime_update.comp_size);
free(ime_update.comp_params);
ime_update.comp_params = NULL;
}
return 0;
}
......
......@@ -679,10 +679,16 @@ UINT WINAPI ImeToAsciiEx(UINT uVKey, UINT uScanCode, const LPBYTE lpbKeyState,
return msgs;
}
else if ((lpIMC = LockRealIMC(hIMC)))
else
{
UpdateDataInDefaultIMEWindow( lpIMC, hwnd, FALSE );
UnlockRealIMC(hIMC);
/* trigger the pending client_func_ime_set_text call */
MACDRV_CALL(ime_get_text_input, NULL);
if ((lpIMC = LockRealIMC(hIMC)))
{
UpdateDataInDefaultIMEWindow( lpIMC, hwnd, FALSE );
UnlockRealIMC(hIMC);
}
}
return 0;
}
......
......@@ -277,6 +277,7 @@ extern NTSTATUS macdrv_dnd_have_format(void *arg) DECLSPEC_HIDDEN;
extern NTSTATUS macdrv_dnd_release(void *arg) DECLSPEC_HIDDEN;
extern NTSTATUS macdrv_dnd_retain(void *arg) DECLSPEC_HIDDEN;
extern NTSTATUS macdrv_ime_process_text_input(void *arg) DECLSPEC_HIDDEN;
extern NTSTATUS macdrv_ime_get_text_input(void *arg) DECLSPEC_HIDDEN;
extern NTSTATUS macdrv_notify_icon(void *arg) DECLSPEC_HIDDEN;
extern NTSTATUS macdrv_client_func(enum macdrv_client_funcs func, const void *params,
......
......@@ -635,6 +635,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] =
macdrv_dnd_retain,
macdrv_ime_clear,
macdrv_ime_process_text_input,
macdrv_ime_get_text_input,
macdrv_ime_using_input_method,
macdrv_init,
macdrv_notify_icon,
......@@ -761,6 +762,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
macdrv_dnd_retain,
macdrv_ime_clear,
wow64_ime_process_text_input,
macdrv_ime_get_text_input,
macdrv_ime_using_input_method,
wow64_init,
wow64_notify_icon,
......
......@@ -28,6 +28,7 @@ enum macdrv_funcs
unix_dnd_retain,
unix_ime_clear,
unix_ime_process_text_input,
unix_ime_get_text_input,
unix_ime_using_input_method,
unix_init,
unix_notify_icon,
......
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