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 | 32 +++++++++++----------------- dlls/winemac.drv/event.c | 42 ++++++++++++++++++++++++++++++++++++- dlls/winemac.drv/macdrv.h | 2 +- dlls/winemac.drv/unixlib.h | 13 +++++++++++- 5 files changed, 67 insertions(+), 23 deletions(-)
diff --git a/dlls/winemac.drv/dllmain.c b/dlls/winemac.drv/dllmain.c index 493062521ad..69bc02e46c2 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_drop, 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 19a5c4794b5..a57caab423b 100644 --- a/dlls/winemac.drv/dragdrop.c +++ b/dlls/winemac.drv/dragdrop.c @@ -427,40 +427,32 @@ static IDropTarget* get_droptarget_pointer(HWND hwnd)
/************************************************************************** - * query_drag_drop + * macdrv_dnd_query_drop */ -BOOL query_drag_drop(macdrv_query* query) +NTSTATUS WINAPI macdrv_dnd_query_drop(void *arg, ULONG size) { + struct dnd_query_drop_params *params = arg; + IDropTarget *droptarget; BOOL ret = FALSE; - HWND hwnd = macdrv_get_window_hwnd(query->window); - struct macdrv_win_data *data = get_win_data(hwnd); POINT pt; - IDropTarget *droptarget; - - TRACE("win %p/%p x,y %d,%d op 0x%08x pasteboard %p\n", hwnd, query->window, - query->drag_drop.x, query->drag_drop.y, query->drag_drop.op, query->drag_drop.pasteboard);
- if (!data) - { - WARN("no win_data for win %p/%p\n", hwnd, query->window); - return FALSE; - } + TRACE("win %p x,y %d,%d effect %x pasteboard %s\n", params->hwnd, params->x, params->y, + params->effect, wine_dbgstr_longlong(params->handle));
- pt.x = query->drag_drop.x + data->whole_rect.left; - pt.y = query->drag_drop.y + data->whole_rect.top; - release_win_data(data); + pt.x = params->x; + pt.y = params->y;
droptarget = get_droptarget_pointer(last_droptarget_hwnd); if (droptarget) { HRESULT hr; POINTL pointl; - DWORD effect = drag_operations_to_dropeffects(query->drag_drop.op); + DWORD effect = params->effect;
if (!active_data_object) { WARN("shouldn't happen: no active IDataObject\n"); - active_data_object = create_data_object_for_pasteboard(query->drag_drop.pasteboard); + active_data_object = create_data_object_for_pasteboard((void *)(UINT_PTR)params->handle); }
pointl.x = pt.x; @@ -484,12 +476,12 @@ BOOL query_drag_drop(macdrv_query* query) } else { - hwnd = WindowFromPoint(pt); + HWND hwnd = WindowFromPoint(pt); while (hwnd && !(GetWindowLongW(hwnd, GWL_EXSTYLE) & WS_EX_ACCEPTFILES)) hwnd = GetParent(hwnd); if (hwnd) { - HDROP hdrop = macdrv_get_pasteboard_data(query->drag_drop.pasteboard, CF_HDROP); + HDROP hdrop = macdrv_get_pasteboard_data((void *)(UINT_PTR)params->handle, CF_HDROP); DROPFILES *dropfiles = GlobalLock(hdrop); if (dropfiles) { diff --git a/dlls/winemac.drv/event.c b/dlls/winemac.drv/event.c index aed8f94076a..8432218d8d1 100644 --- a/dlls/winemac.drv/event.c +++ b/dlls/winemac.drv/event.c @@ -23,7 +23,7 @@ #include "config.h"
#include "macdrv.h" -#include "winuser.h" +#include "oleidl.h"
WINE_DEFAULT_DEBUG_CHANNEL(event); WINE_DECLARE_DEBUG_CHANNEL(imm); @@ -179,6 +179,46 @@ static void macdrv_sent_text_input(const macdrv_event *event) }
+/************************************************************************** + * drag_operations_to_dropeffects + */ +static DWORD drag_operations_to_dropeffects(uint32_t ops) +{ + DWORD effects = 0; + if (ops & (DRAG_OP_COPY | DRAG_OP_GENERIC)) + effects |= DROPEFFECT_COPY; + if (ops & DRAG_OP_MOVE) + effects |= DROPEFFECT_MOVE; + if (ops & (DRAG_OP_LINK | DRAG_OP_GENERIC)) + effects |= DROPEFFECT_LINK; + return effects; +} + + +/************************************************************************** + * query_drag_drop + */ +static BOOL query_drag_drop(macdrv_query *query) +{ + HWND hwnd = macdrv_get_window_hwnd(query->window); + struct macdrv_win_data *data = get_win_data(hwnd); + struct dnd_query_drop_params params; + + if (!data) + { + WARN("no win_data for win %p/%p\n", hwnd, query->window); + return FALSE; + } + + params.hwnd = hwnd; + params.effect = drag_operations_to_dropeffects(query->drag_drop.op); + params.x = query->drag_drop.x + data->whole_rect.left; + params.y = query->drag_drop.y + data->whole_rect.top; + params.handle = (UINT_PTR)query->drag_drop.pasteboard; + release_win_data(data); + return macdrv_client_func(client_func_dnd_query_drop, ¶ms, sizeof(params)); +} + /************************************************************************** * query_drag_exited */ diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 401ebab3bcc..a0ae0225423 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -260,7 +260,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_drop(macdrv_query* query) DECLSPEC_HIDDEN;
extern struct opengl_funcs *macdrv_wine_get_wgl_driver(UINT version) DECLSPEC_HIDDEN; extern const struct vulkan_funcs *macdrv_wine_get_vulkan_driver(UINT version) DECLSPEC_HIDDEN; @@ -296,6 +295,7 @@ 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_drop(void *arg, ULONG size) DECLSPEC_HIDDEN; extern NTSTATUS WINAPI macdrv_dnd_query_exited(void *arg, ULONG size) DECLSPEC_HIDDEN;
/* user helpers */ diff --git a/dlls/winemac.drv/unixlib.h b/dlls/winemac.drv/unixlib.h index 067f46c8f5d..a858b29baaa 100644 --- a/dlls/winemac.drv/unixlib.h +++ b/dlls/winemac.drv/unixlib.h @@ -67,12 +67,23 @@ struct notify_icon_params /* driver client callbacks exposed with KernelCallbackTable interface */ enum macdrv_client_funcs { - client_func_dnd_query_exited = NtUserDriverCallbackFirst, + client_func_dnd_query_drop = NtUserDriverCallbackFirst, + client_func_dnd_query_exited, client_func_ime_query_char_rect, client_func_ime_set_text, client_func_last };
+/* macdrv_dnd_query_drop params */ +struct dnd_query_drop_params +{ + HWND hwnd; + UINT32 effect; + INT32 x; + INT32 y; + UINT64 handle; +}; + /* macdrv_dnd_query_exited params */ struct dnd_query_exited_params {