From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winemac.drv/event.c | 11 +++++++++++ dlls/winemac.drv/ime.c | 10 ---------- dlls/winemac.drv/macdrv.h | 1 - 3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/dlls/winemac.drv/event.c b/dlls/winemac.drv/event.c index 45ceb09c094..9e53bef981a 100644 --- a/dlls/winemac.drv/event.c +++ b/dlls/winemac.drv/event.c @@ -26,6 +26,7 @@ #include "winuser.h"
WINE_DEFAULT_DEBUG_CHANNEL(event); +WINE_DECLARE_DEBUG_CHANNEL(imm);
/* return the name of an Mac event */ @@ -140,6 +141,16 @@ static macdrv_event_mask get_event_mask(DWORD mask) }
+/*********************************************************************** + * macdrv_sent_text_input + */ +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; +} + + /*********************************************************************** * macdrv_query_event * diff --git a/dlls/winemac.drv/ime.c b/dlls/winemac.drv/ime.c index d1d2002fc47..00d4d9f1852 100644 --- a/dlls/winemac.drv/ime.c +++ b/dlls/winemac.drv/ime.c @@ -1451,16 +1451,6 @@ void macdrv_im_set_text(const macdrv_event *event) IME_NotifyComplete(himc); }
-/*********************************************************************** - * macdrv_sent_text_input - */ -void macdrv_sent_text_input(const macdrv_event *event) -{ - TRACE("handled: %s\n", event->sent_text_input.handled ? "TRUE" : "FALSE"); - *event->sent_text_input.done = event->sent_text_input.handled ? 1 : -1; -} - - /************************************************************************** * query_ime_char_rect */ diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 2ea6cd638c3..95ed36ff7e0 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -290,7 +290,6 @@ extern NTSTATUS macdrv_init(void *arg) DECLSPEC_HIDDEN; extern NTSTATUS macdrv_ime_process_text_input(void *arg) 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 BOOL query_ime_char_rect(macdrv_query* query) DECLSPEC_HIDDEN;
/* unixlib interface */
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winemac.drv/dllmain.c | 17 +++++++++++++- dlls/winemac.drv/event.c | 28 +++++++++++++++++++++++ dlls/winemac.drv/ime.c | 42 ++++++++++++---------------------- dlls/winemac.drv/macdrv.h | 5 +++- dlls/winemac.drv/macdrv_main.c | 8 +++++++ dlls/winemac.drv/unixlib.h | 19 +++++++++++++++ 6 files changed, 89 insertions(+), 30 deletions(-)
diff --git a/dlls/winemac.drv/dllmain.c b/dlls/winemac.drv/dllmain.c index 23a1e6e2218..27eda4d2ac8 100644 --- a/dlls/winemac.drv/dllmain.c +++ b/dlls/winemac.drv/dllmain.c @@ -26,9 +26,19 @@
HMODULE macdrv_module = 0;
+typedef NTSTATUS (WINAPI *kernel_callback)(void *params, ULONG size); +static const kernel_callback kernel_callbacks[] = +{ + macdrv_ime_set_text, +}; + +C_ASSERT(NtUserDriverCallbackFirst + ARRAYSIZE(kernel_callbacks) == client_func_last); + + static BOOL process_attach(void) { struct init_params params; + void **callback_table;
struct localized_string *str; struct localized_string strings[] = { @@ -53,7 +63,12 @@ static BOOL process_attach(void) str->len = LoadStringW(macdrv_module, str->id, (WCHAR *)&str->str, 0); params.strings = strings;
- return !MACDRV_CALL(init, ¶ms); + if (MACDRV_CALL(init, ¶ms)) return FALSE; + + callback_table = NtCurrentTeb()->Peb->KernelCallbackTable; + memcpy( callback_table + NtUserDriverCallbackFirst, kernel_callbacks, sizeof(kernel_callbacks) ); + + return TRUE; }
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) diff --git a/dlls/winemac.drv/event.c b/dlls/winemac.drv/event.c index 9e53bef981a..68b66d610fe 100644 --- a/dlls/winemac.drv/event.c +++ b/dlls/winemac.drv/event.c @@ -141,6 +141,34 @@ static macdrv_event_mask get_event_mask(DWORD mask) }
+/*********************************************************************** + * macdrv_im_set_text + */ +static void macdrv_im_set_text(const macdrv_event *event) +{ + HWND hwnd = macdrv_get_window_hwnd(event->window); + struct ime_set_text_params *params; + CFIndex length = 0, size; + + TRACE_(imm)("win %p/%p himc %p text %s complete %u\n", hwnd, event->window, event->im_set_text.data, + debugstr_cf(event->im_set_text.text), event->im_set_text.complete); + + if (event->im_set_text.text) + length = CFStringGetLength(event->im_set_text.text); + + size = offsetof(struct ime_set_text_params, text[length]); + if (!(params = malloc(size))) return; + params->hwnd = hwnd; + params->data = event->im_set_text.data; + params->cursor_pos = event->im_set_text.cursor_pos; + params->complete = event->im_set_text.complete; + + if (length) + CFStringGetCharacters(event->im_set_text.text, CFRangeMake(0, length), params->text); + + macdrv_client_func(client_func_ime_set_text, params, size); +} + /*********************************************************************** * macdrv_sent_text_input */ diff --git a/dlls/winemac.drv/ime.c b/dlls/winemac.drv/ime.c index 00d4d9f1852..2cf3aefb79d 100644 --- a/dlls/winemac.drv/ime.c +++ b/dlls/winemac.drv/ime.c @@ -1395,38 +1395,25 @@ BOOL WINAPI ImeInquire(LPIMEINFO lpIMEInfo, LPWSTR lpszUIClass, LPCWSTR lpszOpti /* Interfaces to other parts of the Mac driver */
/*********************************************************************** - * macdrv_im_set_text + * macdrv_ime_set_text */ -void macdrv_im_set_text(const macdrv_event *event) +NTSTATUS WINAPI macdrv_ime_set_text(void *arg, ULONG size) { - HWND hwnd = macdrv_get_window_hwnd(event->window); - void *himc = event->im_set_text.data; - - TRACE("win %p/%p himc %p text %s complete %u\n", hwnd, event->window, himc, - debugstr_cf(event->im_set_text.text), event->im_set_text.complete); + struct ime_set_text_params *params = arg; + ULONG length = (size - offsetof(struct ime_set_text_params, text)) / sizeof(WCHAR); + void *himc = params->data;
if (!himc) himc = RealIMC(FROM_MACDRV);
- if (event->im_set_text.text) + if (length) { - CFIndex length = CFStringGetLength(event->im_set_text.text); - const UniChar *chars = CFStringGetCharactersPtr(event->im_set_text.text); - UniChar *buffer = NULL; - - if (!chars) - { - buffer = HeapAlloc(GetProcessHeap(), 0, length * sizeof(*buffer)); - CFStringGetCharacters(event->im_set_text.text, CFRangeMake(0, length), buffer); - chars = buffer; - } - if (himc) - IME_SetCompositionString(himc, SCS_SETSTR, chars, length * sizeof(*chars), - event->im_set_text.cursor_pos, !event->im_set_text.complete); + IME_SetCompositionString(himc, SCS_SETSTR, params->text, length * sizeof(WCHAR), + params->cursor_pos, !params->complete); else { INPUT input; - CFIndex i; + unsigned int i;
input.type = INPUT_KEYBOARD; input.ki.wVk = 0; @@ -1435,20 +1422,19 @@ void macdrv_im_set_text(const macdrv_event *event)
for (i = 0; i < length; i++) { - input.ki.wScan = chars[i]; + input.ki.wScan = params->text[i]; input.ki.dwFlags = KEYEVENTF_UNICODE; - __wine_send_input(hwnd, &input, NULL); + __wine_send_input(params->hwnd, &input, NULL);
input.ki.dwFlags = KEYEVENTF_UNICODE | KEYEVENTF_KEYUP; - __wine_send_input(hwnd, &input, NULL); + __wine_send_input(params->hwnd, &input, NULL); } } - - HeapFree(GetProcessHeap(), 0, buffer); }
- if (event->im_set_text.complete) + if (params->complete) IME_NotifyComplete(himc); + return 0; }
/************************************************************************** diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 95ed36ff7e0..c9fcf1dbf4b 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -289,13 +289,16 @@ extern NTSTATUS macdrv_init(void *arg) DECLSPEC_HIDDEN;
extern NTSTATUS macdrv_ime_process_text_input(void *arg) DECLSPEC_HIDDEN;
-extern void macdrv_im_set_text(const macdrv_event *event) DECLSPEC_HIDDEN; +extern NTSTATUS WINAPI macdrv_ime_set_text(void *params, ULONG size) DECLSPEC_HIDDEN; extern BOOL query_ime_char_rect(macdrv_query* query) DECLSPEC_HIDDEN;
/* unixlib interface */
extern NTSTATUS macdrv_notify_icon(void *arg) DECLSPEC_HIDDEN;
+extern NTSTATUS macdrv_client_func(enum macdrv_client_funcs func, const void *params, + ULONG size) DECLSPEC_HIDDEN; + /* user helpers */
static inline LRESULT send_message(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c index 4a183747796..bf06d96b407 100644 --- a/dlls/winemac.drv/macdrv_main.c +++ b/dlls/winemac.drv/macdrv_main.c @@ -607,6 +607,14 @@ BOOL macdrv_SystemParametersInfo( UINT action, UINT int_param, void *ptr_param, }
+NTSTATUS macdrv_client_func(enum macdrv_client_funcs id, const void *params, ULONG size) +{ + /* FIXME: use KeUserModeCallback instead */ + NTSTATUS (WINAPI *func)(const void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id]; + return func(params, size); +} + + static NTSTATUS macdrv_ime_using_input_method(void *arg) { return macdrv_using_input_method(); diff --git a/dlls/winemac.drv/unixlib.h b/dlls/winemac.drv/unixlib.h index dc1b314c8cb..20447f1f3b9 100644 --- a/dlls/winemac.drv/unixlib.h +++ b/dlls/winemac.drv/unixlib.h @@ -62,3 +62,22 @@ struct notify_icon_params DWORD msg; struct _NOTIFYICONDATAW *data; }; + +/* driver client callbacks exposed with KernelCallbackTable interface */ +enum macdrv_client_funcs +{ + client_func_ime_set_text = NtUserDriverCallbackFirst, + client_func_last +}; + +/* macdrv_ime_set_text params */ +struct ime_set_text_params +{ + HWND hwnd; + void *data; + UINT32 cursor_pos; + UINT32 complete; + WCHAR text[1]; +}; + +C_ASSERT(client_func_last <= NtUserDriverCallbackLast + 1);
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winemac.drv/dllmain.c | 1 + dlls/winemac.drv/event.c | 32 +++++++++++++++++++++++ dlls/winemac.drv/ime.c | 52 ++++++++++++++++++-------------------- dlls/winemac.drv/macdrv.h | 2 +- dlls/winemac.drv/unixlib.h | 21 ++++++++++++++- 5 files changed, 78 insertions(+), 30 deletions(-)
diff --git a/dlls/winemac.drv/dllmain.c b/dlls/winemac.drv/dllmain.c index 27eda4d2ac8..d38e7cf9164 100644 --- a/dlls/winemac.drv/dllmain.c +++ b/dlls/winemac.drv/dllmain.c @@ -29,6 +29,7 @@ HMODULE macdrv_module = 0; typedef NTSTATUS (WINAPI *kernel_callback)(void *params, ULONG size); static const kernel_callback kernel_callbacks[] = { + macdrv_ime_query_char_rect, macdrv_ime_set_text, };
diff --git a/dlls/winemac.drv/event.c b/dlls/winemac.drv/event.c index 68b66d610fe..43cd3f85bcd 100644 --- a/dlls/winemac.drv/event.c +++ b/dlls/winemac.drv/event.c @@ -179,6 +179,38 @@ static void macdrv_sent_text_input(const macdrv_event *event) }
+/************************************************************************** + * query_ime_char_rect + */ +BOOL query_ime_char_rect(macdrv_query* query) +{ + HWND hwnd = macdrv_get_window_hwnd(query->window); + void *himc = query->ime_char_rect.data; + CFRange *range = &query->ime_char_rect.range; + CGRect *rect = &query->ime_char_rect.rect; + struct ime_query_char_rect_result result = {0}; + struct ime_query_char_rect_params params; + BOOL ret; + + TRACE_(imm)("win %p/%p himc %p range %ld-%ld\n", hwnd, query->window, himc, range->location, + range->length); + + params.hwnd = hwnd; + params.data = himc; + params.result = &result; + params.location = range->location; + params.length = range->length; + ret = macdrv_client_func(client_func_ime_query_char_rect, ¶ms, sizeof(params)); + *range = CFRangeMake(result.location, result.length); + *rect = cgrect_from_rect(result.rect); + + TRACE_(imm)(" -> %s range %ld-%ld rect %s\n", ret ? "TRUE" : "FALSE", range->location, + range->length, wine_dbgstr_cgrect(*rect)); + + return ret; +} + + /*********************************************************************** * macdrv_query_event * diff --git a/dlls/winemac.drv/ime.c b/dlls/winemac.drv/ime.c index 2cf3aefb79d..251c22d5005 100644 --- a/dlls/winemac.drv/ime.c +++ b/dlls/winemac.drv/ime.c @@ -1438,43 +1438,42 @@ NTSTATUS WINAPI macdrv_ime_set_text(void *arg, ULONG size) }
/************************************************************************** - * query_ime_char_rect + * macdrv_ime_query_char_rect */ -BOOL query_ime_char_rect(macdrv_query* query) +NTSTATUS WINAPI macdrv_ime_query_char_rect(void *arg, ULONG size) { - HWND hwnd = macdrv_get_window_hwnd(query->window); - void *himc = query->ime_char_rect.data; - CFRange* range = &query->ime_char_rect.range; - CGRect* rect = &query->ime_char_rect.rect; + struct ime_query_char_rect_params *params = arg; + struct ime_query_char_rect_result *result = params->result; + void *himc = params->data; IMECHARPOSITION charpos; BOOL ret = FALSE;
- TRACE("win %p/%p himc %p range %ld-%ld\n", hwnd, query->window, himc, range->location, - range->length); + result->location = params->location; + result->length = params->length;
if (!himc) himc = RealIMC(FROM_MACDRV);
charpos.dwSize = sizeof(charpos); - charpos.dwCharPos = range->location; + charpos.dwCharPos = params->location; if (ImmRequestMessageW(himc, IMR_QUERYCHARPOSITION, (ULONG_PTR)&charpos)) { int i;
- *rect = CGRectMake(charpos.pt.x, charpos.pt.y, 0, charpos.cLineHeight); + SetRect(&result->rect, charpos.pt.x, charpos.pt.y, 0, charpos.pt.y + charpos.cLineHeight);
/* iterate over rest of length to extend rect */ - for (i = 1; i < range->length; i++) + for (i = 1; i < params->length; i++) { charpos.dwSize = sizeof(charpos); - charpos.dwCharPos = range->location + i; + charpos.dwCharPos = params->location + i; if (!ImmRequestMessageW(himc, IMR_QUERYCHARPOSITION, (ULONG_PTR)&charpos) || - charpos.pt.y != rect->origin.y) + charpos.pt.y != result->rect.top) { - range->length = i; + result->length = i; break; }
- rect->size.width = charpos.pt.x - rect->origin.x; + result->rect.right = charpos.pt.x; }
ret = TRUE; @@ -1501,15 +1500,15 @@ BOOL query_ime_char_rect(macdrv_query* query) if (private->textfont) oldfont = SelectObject(dc, private->textfont);
- if (range->location > compstr->dwCompStrLen) - range->location = compstr->dwCompStrLen; - if (range->location + range->length > compstr->dwCompStrLen) - range->length = compstr->dwCompStrLen - range->location; + if (result->location > compstr->dwCompStrLen) + result->location = compstr->dwCompStrLen; + if (result->location + result->length > compstr->dwCompStrLen) + result->length = compstr->dwCompStrLen - result->location;
- GetTextExtentPoint32W(dc, str, range->location, &size); + GetTextExtentPoint32W(dc, str, result->location, &size); charpos.rcDocument.left = size.cx; charpos.rcDocument.top = 0; - GetTextExtentPoint32W(dc, str, range->location + range->length, &size); + GetTextExtentPoint32W(dc, str, result->location + result->length, &size); charpos.rcDocument.right = size.cx; charpos.rcDocument.bottom = size.cy;
@@ -1518,7 +1517,7 @@ BOOL query_ime_char_rect(macdrv_query* query)
LPtoDP(dc, (POINT*)&charpos.rcDocument, 2); MapWindowPoints(private->hwndDefault, 0, (POINT*)&charpos.rcDocument, 2); - *rect = cgrect_from_rect(charpos.rcDocument); + result->rect = charpos.rcDocument; ret = TRUE;
if (oldfont) @@ -1540,16 +1539,13 @@ BOOL query_ime_char_rect(macdrv_query* query) if (GetGUIThreadInfo(0, >i)) { MapWindowPoints(gti.hwndCaret, 0, (POINT*)>i.rcCaret, 2); - *rect = cgrect_from_rect(gti.rcCaret); + result->rect = gti.rcCaret; ret = TRUE; } }
- if (ret && range->length && !rect->size.width) - rect->size.width = 1; - - TRACE(" -> %s range %ld-%ld rect %s\n", ret ? "TRUE" : "FALSE", range->location, - range->length, wine_dbgstr_cgrect(*rect)); + if (ret && result->length && result->rect.left == result->rect.right) + result->rect.right++;
return ret; } diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index c9fcf1dbf4b..de8384d5437 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -290,7 +290,7 @@ extern NTSTATUS macdrv_init(void *arg) DECLSPEC_HIDDEN; extern NTSTATUS macdrv_ime_process_text_input(void *arg) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI macdrv_ime_set_text(void *params, ULONG size) DECLSPEC_HIDDEN; -extern BOOL query_ime_char_rect(macdrv_query* query) DECLSPEC_HIDDEN; +extern NTSTATUS WINAPI macdrv_ime_query_char_rect(void *params, ULONG size) DECLSPEC_HIDDEN;
/* unixlib interface */
diff --git a/dlls/winemac.drv/unixlib.h b/dlls/winemac.drv/unixlib.h index 20447f1f3b9..dd03cd4de95 100644 --- a/dlls/winemac.drv/unixlib.h +++ b/dlls/winemac.drv/unixlib.h @@ -66,10 +66,29 @@ struct notify_icon_params /* driver client callbacks exposed with KernelCallbackTable interface */ enum macdrv_client_funcs { - client_func_ime_set_text = NtUserDriverCallbackFirst, + client_func_ime_query_char_rect = NtUserDriverCallbackFirst, + client_func_ime_set_text, client_func_last };
+/* macdrv_ime_query_char_rect result */ +struct ime_query_char_rect_result +{ + RECT rect; + UINT32 location; + UINT32 length; +}; + +/* macdrv_ime_query_char_rect params */ +struct ime_query_char_rect_params +{ + HWND hwnd; + void *data; + UINT32 location; + UINT32 length; + struct ime_query_char_rect_result *result; /* FIXME: Use NtCallbackReturn instead */ +}; + /* macdrv_ime_set_text params */ struct ime_set_text_params {
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winemac.drv/ime.c | 2 +- dlls/winemac.drv/macdrv.h | 3 +-- dlls/winemac.drv/macdrv_main.c | 8 ++++++++ dlls/winemac.drv/unixlib.h | 1 + 4 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/dlls/winemac.drv/ime.c b/dlls/winemac.drv/ime.c index 251c22d5005..756e880c5a3 100644 --- a/dlls/winemac.drv/ime.c +++ b/dlls/winemac.drv/ime.c @@ -853,7 +853,7 @@ BOOL WINAPI NotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
TRACE("NI_COMPOSITIONSTR: CPS_CANCEL\n");
- macdrv_clear_ime_text(); + MACDRV_CALL(ime_clear, NULL); if (lpIMC->hCompStr) ImmDestroyIMCC(lpIMC->hCompStr);
diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index de8384d5437..e125bb03b4d 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -287,13 +287,12 @@ extern NTSTATUS macdrv_init(void *arg) DECLSPEC_HIDDEN; * Mac IME driver */
-extern NTSTATUS macdrv_ime_process_text_input(void *arg) DECLSPEC_HIDDEN; - extern NTSTATUS WINAPI macdrv_ime_set_text(void *params, ULONG size) DECLSPEC_HIDDEN; extern NTSTATUS WINAPI macdrv_ime_query_char_rect(void *params, ULONG size) DECLSPEC_HIDDEN;
/* unixlib interface */
+extern NTSTATUS macdrv_ime_process_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, diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c index bf06d96b407..4ef9060ea4b 100644 --- a/dlls/winemac.drv/macdrv_main.c +++ b/dlls/winemac.drv/macdrv_main.c @@ -615,6 +615,13 @@ NTSTATUS macdrv_client_func(enum macdrv_client_funcs id, const void *params, ULO }
+static NTSTATUS macdrv_ime_clear(void *arg) +{ + macdrv_clear_ime_text(); + return 0; +} + + static NTSTATUS macdrv_ime_using_input_method(void *arg) { return macdrv_using_input_method(); @@ -623,6 +630,7 @@ static NTSTATUS macdrv_ime_using_input_method(void *arg)
const unixlib_entry_t __wine_unix_call_funcs[] = { + macdrv_ime_clear, macdrv_ime_process_text_input, macdrv_ime_using_input_method, macdrv_init, diff --git a/dlls/winemac.drv/unixlib.h b/dlls/winemac.drv/unixlib.h index dd03cd4de95..d0950e63c3c 100644 --- a/dlls/winemac.drv/unixlib.h +++ b/dlls/winemac.drv/unixlib.h @@ -21,6 +21,7 @@
enum macdrv_funcs { + unix_ime_clear, unix_ime_process_text_input, unix_ime_using_input_method, unix_init,
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winemac.drv/dllmain.c | 1 + dlls/winemac.drv/dragdrop.c | 9 +++++---- dlls/winemac.drv/event.c | 11 +++++++++++ dlls/winemac.drv/macdrv.h | 3 ++- dlls/winemac.drv/unixlib.h | 9 ++++++++- 5 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/dlls/winemac.drv/dllmain.c b/dlls/winemac.drv/dllmain.c index d38e7cf9164..493062521ad 100644 --- a/dlls/winemac.drv/dllmain.c +++ b/dlls/winemac.drv/dllmain.c @@ -29,6 +29,7 @@ HMODULE macdrv_module = 0; typedef NTSTATUS (WINAPI *kernel_callback)(void *params, ULONG size); static const kernel_callback kernel_callbacks[] = { + macdrv_dnd_query_exited, macdrv_ime_query_char_rect, macdrv_ime_set_text, }; diff --git a/dlls/winemac.drv/dragdrop.c b/dlls/winemac.drv/dragdrop.c index a07b66ac14a..d5de2abb37a 100644 --- a/dlls/winemac.drv/dragdrop.c +++ b/dlls/winemac.drv/dragdrop.c @@ -482,14 +482,15 @@ BOOL query_drag_drop(macdrv_query* query)
/************************************************************************** - * query_drag_exited + * macdrv_dnd_query_exited */ -BOOL query_drag_exited(macdrv_query* query) +NTSTATUS WINAPI macdrv_dnd_query_exited(void *arg, ULONG size) { - HWND hwnd = macdrv_get_window_hwnd(query->window); + struct dnd_query_exited_params *params = arg; + HWND hwnd = params->hwnd; IDropTarget *droptarget;
- TRACE("win %p/%p\n", hwnd, query->window); + TRACE("win %p\n", hwnd);
droptarget = get_droptarget_pointer(last_droptarget_hwnd); if (droptarget) diff --git a/dlls/winemac.drv/event.c b/dlls/winemac.drv/event.c index 43cd3f85bcd..361709010c9 100644 --- a/dlls/winemac.drv/event.c +++ b/dlls/winemac.drv/event.c @@ -179,6 +179,17 @@ static void macdrv_sent_text_input(const macdrv_event *event) }
+/************************************************************************** + * query_drag_exited + */ +static BOOL query_drag_exited(macdrv_query *query) +{ + struct dnd_query_exited_params params; + params.hwnd = macdrv_get_window_hwnd(query->window); + return macdrv_client_func(client_func_dnd_query_exited, ¶ms, sizeof(params)); +} + + /************************************************************************** * query_ime_char_rect */ diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index e125bb03b4d..c0f2811c5f5 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -261,7 +261,6 @@ extern BOOL macdrv_pasteboard_has_format(CFTypeRef pasteboard, UINT desired_form extern UINT* macdrv_get_pasteboard_formats(CFTypeRef pasteboard, UINT* num_formats) DECLSPEC_HIDDEN;
extern BOOL query_drag_operation(macdrv_query* query) DECLSPEC_HIDDEN; -extern BOOL query_drag_exited(macdrv_query* query) DECLSPEC_HIDDEN; extern BOOL query_drag_drop(macdrv_query* query) DECLSPEC_HIDDEN;
extern struct opengl_funcs *macdrv_wine_get_wgl_driver(UINT version) DECLSPEC_HIDDEN; @@ -298,6 +297,8 @@ extern NTSTATUS macdrv_notify_icon(void *arg) DECLSPEC_HIDDEN; extern NTSTATUS macdrv_client_func(enum macdrv_client_funcs func, const void *params, ULONG size) DECLSPEC_HIDDEN;
+extern NTSTATUS WINAPI macdrv_dnd_query_exited(void *arg, ULONG size) DECLSPEC_HIDDEN; + /* user helpers */
static inline LRESULT send_message(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) diff --git a/dlls/winemac.drv/unixlib.h b/dlls/winemac.drv/unixlib.h index d0950e63c3c..067f46c8f5d 100644 --- a/dlls/winemac.drv/unixlib.h +++ b/dlls/winemac.drv/unixlib.h @@ -67,11 +67,18 @@ struct notify_icon_params /* driver client callbacks exposed with KernelCallbackTable interface */ enum macdrv_client_funcs { - client_func_ime_query_char_rect = NtUserDriverCallbackFirst, + client_func_dnd_query_exited = NtUserDriverCallbackFirst, + client_func_ime_query_char_rect, client_func_ime_set_text, client_func_last };
+/* macdrv_dnd_query_exited params */ +struct dnd_query_exited_params +{ + HWND hwnd; +}; + /* macdrv_ime_query_char_rect result */ struct ime_query_char_rect_result {
From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winemac.drv/clipboard.c | 2 +- dlls/winemac.drv/dragdrop.c | 40 ++++++++++++++++++++++++++++++++++++ dlls/winemac.drv/macdrv.h | 1 - 3 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/dlls/winemac.drv/clipboard.c b/dlls/winemac.drv/clipboard.c index 16eff401a98..16c44ddfde6 100644 --- a/dlls/winemac.drv/clipboard.c +++ b/dlls/winemac.drv/clipboard.c @@ -210,7 +210,7 @@ static unsigned int nb_current_mac_formats; /************************************************************************** * debugstr_format */ -const char *debugstr_format(UINT id) +static const char *debugstr_format(UINT id) { WCHAR buffer[256];
diff --git a/dlls/winemac.drv/dragdrop.c b/dlls/winemac.drv/dragdrop.c index d5de2abb37a..19a5c4794b5 100644 --- a/dlls/winemac.drv/dragdrop.c +++ b/dlls/winemac.drv/dragdrop.c @@ -46,6 +46,46 @@ typedef struct } DragDropDataObject;
+/************************************************************************** + * debugstr_format + */ +static const char *debugstr_format(UINT id) +{ + WCHAR buffer[256]; + + if (GetClipboardFormatNameW(id, buffer, 256)) + return wine_dbg_sprintf("0x%04x %s", id, debugstr_w(buffer)); + + switch (id) + { +#define BUILTIN(id) case id: return #id; + BUILTIN(CF_TEXT) + BUILTIN(CF_BITMAP) + BUILTIN(CF_METAFILEPICT) + BUILTIN(CF_SYLK) + BUILTIN(CF_DIF) + BUILTIN(CF_TIFF) + BUILTIN(CF_OEMTEXT) + BUILTIN(CF_DIB) + BUILTIN(CF_PALETTE) + BUILTIN(CF_PENDATA) + BUILTIN(CF_RIFF) + BUILTIN(CF_WAVE) + BUILTIN(CF_UNICODETEXT) + BUILTIN(CF_ENHMETAFILE) + BUILTIN(CF_HDROP) + BUILTIN(CF_LOCALE) + BUILTIN(CF_DIBV5) + BUILTIN(CF_OWNERDISPLAY) + BUILTIN(CF_DSPTEXT) + BUILTIN(CF_DSPBITMAP) + BUILTIN(CF_DSPMETAFILEPICT) + BUILTIN(CF_DSPENHMETAFILE) +#undef BUILTIN + default: return wine_dbg_sprintf("0x%04x", id); + } +} + static inline DragDropDataObject *impl_from_IDataObject(IDataObject *iface) { return CONTAINING_RECORD(iface, DragDropDataObject, IDataObject_iface); diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index c0f2811c5f5..401ebab3bcc 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -255,7 +255,6 @@ extern void macdrv_displays_changed(const macdrv_event *event) DECLSPEC_HIDDEN; extern void macdrv_UpdateClipboard(void) DECLSPEC_HIDDEN; extern BOOL query_pasteboard_data(HWND hwnd, CFStringRef type) DECLSPEC_HIDDEN; extern void macdrv_lost_pasteboard_ownership(HWND hwnd) DECLSPEC_HIDDEN; -extern const char *debugstr_format(UINT id) DECLSPEC_HIDDEN; extern HANDLE macdrv_get_pasteboard_data(CFTypeRef pasteboard, UINT desired_format) DECLSPEC_HIDDEN; extern BOOL macdrv_pasteboard_has_format(CFTypeRef pasteboard, UINT desired_format) DECLSPEC_HIDDEN; extern UINT* macdrv_get_pasteboard_formats(CFTypeRef pasteboard, UINT* num_formats) DECLSPEC_HIDDEN;
This merge request was approved by Huw Davies.