Commit 8ed99016 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winemac: Use unixlib interface for IME calls.

parent 340d1b7a
...@@ -577,7 +577,7 @@ BOOL WINAPI ImeProcessKey(HIMC hIMC, UINT vKey, LPARAM lKeyData, const LPBYTE lp ...@@ -577,7 +577,7 @@ BOOL WINAPI ImeProcessKey(HIMC hIMC, UINT vKey, LPARAM lKeyData, const LPBYTE lp
return FALSE; return FALSE;
} }
inIME = macdrv_using_input_method(); inIME = MACDRV_CALL(ime_using_input_method, NULL);
lpIMC = LockRealIMC(hIMC); lpIMC = LockRealIMC(hIMC);
if (lpIMC) if (lpIMC)
{ {
...@@ -658,6 +658,7 @@ BOOL WINAPI ImeSetActiveContext(HIMC hIMC, BOOL fFlag) ...@@ -658,6 +658,7 @@ BOOL WINAPI ImeSetActiveContext(HIMC hIMC, BOOL fFlag)
UINT WINAPI ImeToAsciiEx(UINT uVKey, UINT uScanCode, const LPBYTE lpbKeyState, UINT WINAPI ImeToAsciiEx(UINT uVKey, UINT uScanCode, const LPBYTE lpbKeyState,
LPDWORD lpdwTransKey, UINT fuState, HIMC hIMC) LPDWORD lpdwTransKey, UINT fuState, HIMC hIMC)
{ {
struct process_text_input_params params;
UINT vkey; UINT vkey;
LPINPUTCONTEXT lpIMC; LPINPUTCONTEXT lpIMC;
LPIMEPRIVATE myPrivate; LPIMEPRIVATE myPrivate;
...@@ -690,7 +691,13 @@ UINT WINAPI ImeToAsciiEx(UINT uVKey, UINT uScanCode, const LPBYTE lpbKeyState, ...@@ -690,7 +691,13 @@ UINT WINAPI ImeToAsciiEx(UINT uVKey, UINT uScanCode, const LPBYTE lpbKeyState,
UnlockRealIMC(hIMC); UnlockRealIMC(hIMC);
TRACE("Processing Mac 0x%04x\n", vkey); TRACE("Processing Mac 0x%04x\n", vkey);
macdrv_process_text_input(uVKey, uScanCode, repeat, lpbKeyState, hIMC, &done); params.vkey = uVKey;
params.scan = uScanCode;
params.repeat = repeat;
params.key_state = lpbKeyState;
params.himc = hIMC;
params.done = &done;
MACDRV_CALL(ime_process_text_input, &params);
while (!done) while (!done)
MsgWaitForMultipleObjectsEx(0, NULL, INFINITE, QS_POSTMESSAGE | QS_SENDMESSAGE, 0); MsgWaitForMultipleObjectsEx(0, NULL, INFINITE, QS_POSTMESSAGE | QS_SENDMESSAGE, 0);
......
...@@ -1187,13 +1187,16 @@ void macdrv_hotkey_press(const macdrv_event *event) ...@@ -1187,13 +1187,16 @@ void macdrv_hotkey_press(const macdrv_event *event)
/*********************************************************************** /***********************************************************************
* macdrv_process_text_input * macdrv_process_text_input
*/ */
void macdrv_process_text_input(UINT vkey, UINT scan, UINT repeat, const BYTE *key_state, void *himc, int* done) NTSTATUS macdrv_ime_process_text_input(void *arg)
{ {
struct process_text_input_params *params = arg;
struct macdrv_thread_data *thread_data = macdrv_thread_data(); struct macdrv_thread_data *thread_data = macdrv_thread_data();
const BYTE *key_state = params->key_state;
unsigned int flags; unsigned int flags;
int keyc; int keyc;
TRACE("vkey 0x%04x scan 0x%04x repeat %u himc %p\n", vkey, scan, repeat, himc); TRACE("vkey 0x%04x scan 0x%04x repeat %u himc %p\n", params->vkey, params->scan,
params->repeat, params->himc);
flags = thread_data->last_modifiers; flags = thread_data->last_modifiers;
if (key_state[VK_SHIFT] & 0x80) if (key_state[VK_SHIFT] & 0x80)
...@@ -1215,17 +1218,19 @@ void macdrv_process_text_input(UINT vkey, UINT scan, UINT repeat, const BYTE *ke ...@@ -1215,17 +1218,19 @@ void macdrv_process_text_input(UINT vkey, UINT scan, UINT repeat, const BYTE *ke
/* Find the Mac keycode corresponding to the scan code */ /* Find the Mac keycode corresponding to the scan code */
for (keyc = 0; keyc < ARRAY_SIZE(thread_data->keyc2vkey); keyc++) for (keyc = 0; keyc < ARRAY_SIZE(thread_data->keyc2vkey); keyc++)
if (thread_data->keyc2vkey[keyc] == vkey) break; if (thread_data->keyc2vkey[keyc] == params->vkey) break;
if (keyc >= ARRAY_SIZE(thread_data->keyc2vkey)) if (keyc >= ARRAY_SIZE(thread_data->keyc2vkey))
{ {
*done = -1; *params->done = -1;
return; return 0;
} }
TRACE("flags 0x%08x keyc 0x%04x\n", flags, keyc); TRACE("flags 0x%08x keyc 0x%04x\n", flags, keyc);
macdrv_send_text_input_event(((scan & 0x8000) == 0), flags, repeat, keyc, himc, done); macdrv_send_text_input_event(((params->scan & 0x8000) == 0), flags, params->repeat, keyc,
params->himc, params->done);
return 0;
} }
......
...@@ -287,8 +287,7 @@ extern NTSTATUS macdrv_init(void *arg) DECLSPEC_HIDDEN; ...@@ -287,8 +287,7 @@ extern NTSTATUS macdrv_init(void *arg) DECLSPEC_HIDDEN;
* Mac IME driver * Mac IME driver
*/ */
extern void macdrv_process_text_input(UINT vkey, UINT scan, UINT repeat, const BYTE *key_state, extern NTSTATUS macdrv_ime_process_text_input(void *arg) DECLSPEC_HIDDEN;
void *himc, int* done) DECLSPEC_HIDDEN;
extern void macdrv_im_set_text(const macdrv_event *event) DECLSPEC_HIDDEN; extern void macdrv_im_set_text(const macdrv_event *event) DECLSPEC_HIDDEN;
extern void macdrv_sent_text_input(const macdrv_event *event) DECLSPEC_HIDDEN; extern void macdrv_sent_text_input(const macdrv_event *event) DECLSPEC_HIDDEN;
......
...@@ -607,8 +607,16 @@ BOOL macdrv_SystemParametersInfo( UINT action, UINT int_param, void *ptr_param, ...@@ -607,8 +607,16 @@ BOOL macdrv_SystemParametersInfo( UINT action, UINT int_param, void *ptr_param,
} }
static NTSTATUS macdrv_ime_using_input_method(void *arg)
{
return macdrv_using_input_method();
}
const unixlib_entry_t __wine_unix_call_funcs[] = const unixlib_entry_t __wine_unix_call_funcs[] =
{ {
macdrv_ime_process_text_input,
macdrv_ime_using_input_method,
macdrv_init, macdrv_init,
macdrv_notify_icon, macdrv_notify_icon,
}; };
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
enum macdrv_funcs enum macdrv_funcs
{ {
unix_ime_process_text_input,
unix_ime_using_input_method,
unix_init, unix_init,
unix_notify_icon, unix_notify_icon,
unix_funcs_count unix_funcs_count
...@@ -30,6 +32,17 @@ enum macdrv_funcs ...@@ -30,6 +32,17 @@ enum macdrv_funcs
extern NTSTATUS unix_call(enum macdrv_funcs code, void *params) DECLSPEC_HIDDEN; extern NTSTATUS unix_call(enum macdrv_funcs code, void *params) DECLSPEC_HIDDEN;
#define MACDRV_CALL(func, params) unix_call( unix_ ## func, params ) #define MACDRV_CALL(func, params) unix_call( unix_ ## func, params )
/* macdrv_ime_process_text_input params */
struct process_text_input_params
{
UINT vkey;
UINT scan;
UINT repeat;
const BYTE *key_state;
void *himc;
int *done;
};
/* macdrv_init params */ /* macdrv_init params */
struct localized_string struct localized_string
{ {
......
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