From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winemac.drv/cocoa_event.m | 8 +++--- dlls/winemac.drv/cocoa_window.m | 19 +++++++-------- dlls/winemac.drv/event.c | 43 ++++++++++++++++----------------- dlls/winemac.drv/macdrv_cocoa.h | 15 +++--------- 4 files changed, 37 insertions(+), 48 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_event.m b/dlls/winemac.drv/cocoa_event.m index 11dd9c3c784..8fad083f6e5 100644 --- a/dlls/winemac.drv/cocoa_event.m +++ b/dlls/winemac.drv/cocoa_event.m @@ -720,11 +720,9 @@ void macdrv_release_query(macdrv_query *query) { switch (query->type) { - case QUERY_DRAG_OPERATION: - if (query->drag_operation.pasteboard) - CFRelease(query->drag_operation.pasteboard); - break; - case QUERY_DRAG_DROP: + case QUERY_DRAG_DROP_LEAVE: + case QUERY_DRAG_DROP_DRAG: + case QUERY_DRAG_DROP_DROP: if (query->drag_drop.pasteboard) CFRelease(query->drag_drop.pasteboard); break; diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index 6545e7908b3..1682c612de8 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -3265,7 +3265,7 @@ - (void) draggingExited:(id <NSDraggingInfo>)sender // has to be processed in a similar manner as the other drag-and-drop // queries in order to maintain the proper order of operations. macdrv_query* query = macdrv_create_query(); - query->type = QUERY_DRAG_EXITED; + query->type = QUERY_DRAG_DROP_LEAVE; query->window = (macdrv_window)[self retain];
[self.queue query:query timeout:0.1]; @@ -3280,16 +3280,15 @@ - (NSDragOperation) draggingUpdated:(id <NSDraggingInfo>)sender NSPasteboard* pb = [sender draggingPasteboard];
macdrv_query* query = macdrv_create_query(); - query->type = QUERY_DRAG_OPERATION; + query->type = QUERY_DRAG_DROP_DRAG; query->window = (macdrv_window)[self retain]; - query->drag_operation.x = floor(cgpt.x); - query->drag_operation.y = floor(cgpt.y); - query->drag_operation.offered_ops = [sender draggingSourceOperationMask]; - query->drag_operation.accepted_op = NSDragOperationNone; - query->drag_operation.pasteboard = (CFTypeRef)[pb retain]; + query->drag_drop.x = floor(cgpt.x); + query->drag_drop.y = floor(cgpt.y); + query->drag_drop.ops = [sender draggingSourceOperationMask]; + query->drag_drop.pasteboard = (CFTypeRef)[pb retain];
[self.queue query:query timeout:3]; - ret = query->status ? query->drag_operation.accepted_op : NSDragOperationNone; + ret = query->status ? query->drag_drop.ops : NSDragOperationNone; macdrv_release_query(query);
return ret; @@ -3303,11 +3302,11 @@ - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender NSPasteboard* pb = [sender draggingPasteboard];
macdrv_query* query = macdrv_create_query(); - query->type = QUERY_DRAG_DROP; + query->type = QUERY_DRAG_DROP_DROP; query->window = (macdrv_window)[self retain]; query->drag_drop.x = floor(cgpt.x); query->drag_drop.y = floor(cgpt.y); - query->drag_drop.op = [sender draggingSourceOperationMask]; + query->drag_drop.ops = [sender draggingSourceOperationMask]; query->drag_drop.pasteboard = (CFTypeRef)[pb retain];
[self.queue query:query timeout:3 * 60 flags:WineQueryProcessEvents]; diff --git a/dlls/winemac.drv/event.c b/dlls/winemac.drv/event.c index 4f80f59692e..cd5fee519bb 100644 --- a/dlls/winemac.drv/event.c +++ b/dlls/winemac.drv/event.c @@ -223,9 +223,9 @@ static uint32_t dropeffect_to_drag_operation(DWORD effect, uint32_t ops)
/************************************************************************** - * query_drag_drop + * query_drag_drop_drop */ -static BOOL query_drag_drop(macdrv_query *query) +static BOOL query_drag_drop_drop(macdrv_query *query) { HWND hwnd = macdrv_get_window_hwnd(query->window); struct macdrv_win_data *data = get_win_data(hwnd); @@ -240,7 +240,7 @@ static BOOL query_drag_drop(macdrv_query *query) }
params.hwnd = HandleToUlong(hwnd); - params.effect = drag_operations_to_dropeffects(query->drag_drop.op); + params.effect = drag_operations_to_dropeffects(query->drag_drop.ops); params.x = query->drag_drop.x + data->rects.visible.left; params.y = query->drag_drop.y + data->rects.visible.top; params.handle = (UINT_PTR)query->drag_drop.pasteboard; @@ -251,9 +251,9 @@ static BOOL query_drag_drop(macdrv_query *query) }
/************************************************************************** - * query_drag_exited + * query_drag_drop_leave */ -static BOOL query_drag_exited(macdrv_query *query) +static BOOL query_drag_drop_leave(macdrv_query *query) { struct dnd_query_exited_params params = {.dispatch = {.callback = dnd_query_exited_callback}}; void *ret_ptr; @@ -267,9 +267,9 @@ static BOOL query_drag_exited(macdrv_query *query)
/************************************************************************** - * query_drag_operation + * query_drag_drop_drag */ -static BOOL query_drag_operation(macdrv_query *query) +static BOOL query_drag_drop_drag(macdrv_query *query) { struct dnd_query_drag_params params = {.dispatch = {.callback = dnd_query_drag_callback}}; HWND hwnd = macdrv_get_window_hwnd(query->window); @@ -285,10 +285,10 @@ static BOOL query_drag_operation(macdrv_query *query) }
params.hwnd = HandleToUlong(hwnd); - params.effect = drag_operations_to_dropeffects(query->drag_operation.offered_ops); - params.x = query->drag_operation.x + data->rects.visible.left; - params.y = query->drag_operation.y + data->rects.visible.top; - params.handle = (UINT_PTR)query->drag_operation.pasteboard; + params.effect = drag_operations_to_dropeffects(query->drag_drop.ops); + params.x = query->drag_drop.x + data->rects.visible.left; + params.y = query->drag_drop.y + data->rects.visible.top; + params.handle = (UINT_PTR)query->drag_drop.pasteboard; release_win_data(data);
if (KeUserDispatchCallback(¶ms.dispatch, sizeof(params), &ret_ptr, &ret_len)) @@ -296,8 +296,7 @@ static BOOL query_drag_operation(macdrv_query *query) effect = *(DWORD *)ret_ptr; if (!effect) return FALSE;
- query->drag_operation.accepted_op = dropeffect_to_drag_operation(effect, - query->drag_operation.offered_ops); + query->drag_drop.ops = dropeffect_to_drag_operation(effect, query->drag_drop.ops); return TRUE; }
@@ -360,17 +359,17 @@ static void macdrv_query_event(HWND hwnd, const macdrv_event *event)
switch (query->type) { - case QUERY_DRAG_DROP: - TRACE("QUERY_DRAG_DROP\n"); - success = query_drag_drop(query); + case QUERY_DRAG_DROP_LEAVE: + TRACE("QUERY_DRAG_DROP_LEAVE\n"); + success = query_drag_drop_leave(query); break; - case QUERY_DRAG_EXITED: - TRACE("QUERY_DRAG_EXITED\n"); - success = query_drag_exited(query); + case QUERY_DRAG_DROP_DRAG: + TRACE("QUERY_DRAG_DROP_DRAG\n"); + success = query_drag_drop_drag(query); break; - case QUERY_DRAG_OPERATION: - TRACE("QUERY_DRAG_OPERATION\n"); - success = query_drag_operation(query); + case QUERY_DRAG_DROP_DROP: + TRACE("QUERY_DRAG_DROP_DROP\n"); + success = query_drag_drop_drop(query); break; case QUERY_IME_CHAR_RECT: TRACE("QUERY_IME_CHAR_RECT\n"); diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h index 94821eef6bf..1c9266d4564 100644 --- a/dlls/winemac.drv/macdrv_cocoa.h +++ b/dlls/winemac.drv/macdrv_cocoa.h @@ -440,9 +440,9 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display, } macdrv_event;
enum { - QUERY_DRAG_DROP, - QUERY_DRAG_EXITED, - QUERY_DRAG_OPERATION, + QUERY_DRAG_DROP_LEAVE, + QUERY_DRAG_DROP_DRAG, + QUERY_DRAG_DROP_DROP, QUERY_IME_CHAR_RECT, QUERY_PASTEBOARD_DATA, QUERY_RESIZE_SIZE, @@ -461,16 +461,9 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display, struct { int x; int y; - uint32_t op; + uint32_t ops; CFTypeRef pasteboard; } drag_drop; - struct { - int x; - int y; - uint32_t offered_ops; - uint32_t accepted_op; - CFTypeRef pasteboard; - } drag_operation; struct { void *himc; CFRange range;
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winemac.drv/clipboard.c | 46 +++++++++++++++++++++++++++++++++ dlls/winemac.drv/cocoa_event.m | 1 + dlls/winemac.drv/cocoa_window.m | 10 +++++++ dlls/winemac.drv/event.c | 19 ++++++++++++++ dlls/winemac.drv/macdrv.h | 2 ++ dlls/winemac.drv/macdrv_cocoa.h | 1 + 6 files changed, 79 insertions(+)
diff --git a/dlls/winemac.drv/clipboard.c b/dlls/winemac.drv/clipboard.c index 5a1065cf7c4..7e4e7dd30df 100644 --- a/dlls/winemac.drv/clipboard.c +++ b/dlls/winemac.drv/clipboard.c @@ -1130,6 +1130,52 @@ static CFDataRef export_unicodetext_to_utf16(void *data, size_t size) return ret; }
+struct format_entry *get_format_entries(CFTypeRef pasteboard, UINT *entries_size) +{ + struct format_entry *entries = NULL; + CFStringRef type; + CFArrayRef types; + size_t size = 0; + CFIndex i; + char *tmp; + + TRACE("pasteboard %p\n", pasteboard); + + types = macdrv_copy_pasteboard_types(pasteboard); + if (!types) return NULL; + + for (i = 0; i < CFArrayGetCount(types); i++) + { + WINE_CLIPFORMAT *format; + size_t import_size; + CFDataRef data; + void *import; + + type = CFArrayGetValueAtIndex(types, i); + if (!(format = format_for_type(type))) continue; + + data = macdrv_copy_pasteboard_data(pasteboard, type); + import = format->import_func(data, &import_size); + + if ((tmp = realloc(entries, size + sizeof(*entries) + import_size))) + { + struct format_entry *entry = (struct format_entry *)(tmp + size); + entry->format = format->format_id; + entry->size = import_size; + memcpy(entry->data, import, import_size); + + entries = (struct format_entry *)tmp; + size += sizeof(*entry) + import_size; + } + + free(import); + } + + CFRelease(types); + + *entries_size = size; + return entries; +}
/************************************************************************** * macdrv_dnd_get_data diff --git a/dlls/winemac.drv/cocoa_event.m b/dlls/winemac.drv/cocoa_event.m index 8fad083f6e5..336de1c9047 100644 --- a/dlls/winemac.drv/cocoa_event.m +++ b/dlls/winemac.drv/cocoa_event.m @@ -720,6 +720,7 @@ void macdrv_release_query(macdrv_query *query) { switch (query->type) { + case QUERY_DRAG_DROP_ENTER: case QUERY_DRAG_DROP_LEAVE: case QUERY_DRAG_DROP_DRAG: case QUERY_DRAG_DROP_DROP: diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index 1682c612de8..435a3d9162f 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -3256,6 +3256,16 @@ - (void) pasteboardChangedOwner:(NSPasteboard*)sender */ - (NSDragOperation) draggingEntered:(id <NSDraggingInfo>)sender { + macdrv_query* query = macdrv_create_query(); + NSPasteboard* pb = [sender draggingPasteboard]; + + query->type = QUERY_DRAG_DROP_ENTER; + query->window = (macdrv_window)[self retain]; + query->drag_drop.pasteboard = (CFTypeRef)[pb retain]; + + [self.queue query:query timeout:0.1]; + macdrv_release_query(query); + return [self draggingUpdated:sender]; }
diff --git a/dlls/winemac.drv/event.c b/dlls/winemac.drv/event.c index cd5fee519bb..f5ebd1675b9 100644 --- a/dlls/winemac.drv/event.c +++ b/dlls/winemac.drv/event.c @@ -250,6 +250,21 @@ static BOOL query_drag_drop_drop(macdrv_query *query) return *(BOOL *)ret_ptr; }
+/************************************************************************** + * query_drag_drop_enter + */ +static BOOL query_drag_drop_enter(macdrv_query *query) +{ + CFTypeRef pasteboard = query->drag_drop.pasteboard; + struct format_entry *entries; + UINT entries_size; + + if (!(entries = get_format_entries(pasteboard, &entries_size))) return FALSE; + free(entries); + + return TRUE; +} + /************************************************************************** * query_drag_drop_leave */ @@ -359,6 +374,10 @@ static void macdrv_query_event(HWND hwnd, const macdrv_event *event)
switch (query->type) { + case QUERY_DRAG_DROP_ENTER: + TRACE("QUERY_DRAG_DROP_ENTER\n"); + success = query_drag_drop_enter(query); + break; case QUERY_DRAG_DROP_LEAVE: TRACE("QUERY_DRAG_DROP_LEAVE\n"); success = query_drag_drop_leave(query); diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 76c9be9519f..8053ff434ca 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -261,6 +261,8 @@ extern CGImageRef create_cgimage_from_icon_bitmaps(HDC hdc, HANDLE icon, HBITMAP extern void check_retina_status(void); extern void init_user_driver(void);
+extern struct format_entry *get_format_entries(CFTypeRef pasteboard, UINT *entries_size); + /* unixlib interface */
extern NTSTATUS macdrv_dnd_get_data(void *arg); diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h index 1c9266d4564..20d82b9bef8 100644 --- a/dlls/winemac.drv/macdrv_cocoa.h +++ b/dlls/winemac.drv/macdrv_cocoa.h @@ -440,6 +440,7 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display, } macdrv_event;
enum { + QUERY_DRAG_DROP_ENTER, QUERY_DRAG_DROP_LEAVE, QUERY_DRAG_DROP_DRAG, QUERY_DRAG_DROP_DROP,
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winemac.drv/Makefile.in | 1 - dlls/winemac.drv/clipboard.c | 196 ---------- dlls/winemac.drv/cocoa_window.m | 4 - dlls/winemac.drv/dllmain.c | 3 - dlls/winemac.drv/dragdrop.c | 648 -------------------------------- dlls/winemac.drv/event.c | 45 +-- dlls/winemac.drv/macdrv.h | 11 - dlls/winemac.drv/macdrv_main.c | 40 -- dlls/winemac.drv/unixlib.h | 53 --- 9 files changed, 13 insertions(+), 988 deletions(-) delete mode 100644 dlls/winemac.drv/dragdrop.c
diff --git a/dlls/winemac.drv/Makefile.in b/dlls/winemac.drv/Makefile.in index e3e71c5f4cc..a9ce7249eb3 100644 --- a/dlls/winemac.drv/Makefile.in +++ b/dlls/winemac.drv/Makefile.in @@ -27,7 +27,6 @@ SOURCES = \ cocoa_window.m \ display.c \ dllmain.c \ - dragdrop.c \ event.c \ gdi.c \ image.c \ diff --git a/dlls/winemac.drv/clipboard.c b/dlls/winemac.drv/clipboard.c index 7e4e7dd30df..12af4de5e6d 100644 --- a/dlls/winemac.drv/clipboard.c +++ b/dlls/winemac.drv/clipboard.c @@ -251,12 +251,6 @@ static const char *debugstr_format(UINT id) }
-static CFTypeRef pasteboard_from_handle(UINT64 handle) -{ - return (CFTypeRef)(UINT_PTR)handle; -} - - /************************************************************************** * insert_clipboard_format */ @@ -1177,129 +1171,6 @@ struct format_entry *get_format_entries(CFTypeRef pasteboard, UINT *entries_size return entries; }
-/************************************************************************** - * macdrv_dnd_get_data - */ -NTSTATUS macdrv_dnd_get_data(void *arg) -{ - struct dnd_get_data_params *params = arg; - CFTypeRef pasteboard = pasteboard_from_handle(params->handle); - CFArrayRef types; - CFIndex count; - CFIndex i; - CFStringRef type, best_type; - WINE_CLIPFORMAT* best_format = NULL; - unsigned int status = STATUS_SUCCESS; - - TRACE("pasteboard %p, desired_format %s\n", pasteboard, debugstr_format(params->format)); - - types = macdrv_copy_pasteboard_types(pasteboard); - if (!types) - { - WARN("Failed to copy pasteboard types\n"); - return STATUS_NO_MEMORY; - } - - count = CFArrayGetCount(types); - TRACE("got %ld types\n", count); - - for (i = 0; (!best_format || best_format->synthesized) && i < count; i++) - { - WINE_CLIPFORMAT* format; - - type = CFArrayGetValueAtIndex(types, i); - - if ((format = format_for_type(type))) - { - TRACE("for type %s got format %p/%s\n", debugstr_cf(type), format, debugstr_format(format->format_id)); - - if (format->format_id == params->format) - { - /* The best format is the matching one which is not synthesized. Failing that, - the best format is the first matching synthesized format. */ - if (!format->synthesized || !best_format) - { - best_type = type; - best_format = format; - } - } - } - } - - if (best_format) - { - CFDataRef pasteboard_data = macdrv_copy_pasteboard_data(pasteboard, best_type); - - TRACE("got pasteboard data for type %s: %s\n", debugstr_cf(best_type), debugstr_cf(pasteboard_data)); - - if (pasteboard_data) - { - size_t size; - void *import = best_format->import_func(pasteboard_data, &size); - if (import) - { - if (size > params->size) status = STATUS_BUFFER_OVERFLOW; - else memcpy(params->data, import, size); - params->size = size; - free(import); - } - CFRelease(pasteboard_data); - } - } - - CFRelease(types); - TRACE(" -> %#x\n", status); - return status; -} - - -/************************************************************************** - * macdrv_pasteboard_has_format - */ -NTSTATUS macdrv_dnd_have_format(void *arg) -{ - struct dnd_have_format_params *params = arg; - CFTypeRef pasteboard = pasteboard_from_handle(params->handle); - CFArrayRef types; - int count; - UINT i; - BOOL found = FALSE; - - TRACE("pasteboard %p, desired_format %s\n", pasteboard, debugstr_format(params->format)); - - types = macdrv_copy_pasteboard_types(pasteboard); - if (!types) - { - WARN("Failed to copy pasteboard types\n"); - return FALSE; - } - - count = CFArrayGetCount(types); - TRACE("got %d types\n", count); - - for (i = 0; i < count; i++) - { - CFStringRef type = CFArrayGetValueAtIndex(types, i); - WINE_CLIPFORMAT* format = format_for_type(type); - - if (format) - { - TRACE("for type %s got format %s\n", debugstr_cf(type), debugstr_format(format->format_id)); - - if (format->format_id == params->format) - { - found = TRUE; - break; - } - } - } - - CFRelease(types); - TRACE(" -> %d\n", found); - return found; -} - - /************************************************************************** * get_formats_for_pasteboard_types */ @@ -1398,51 +1269,6 @@ static WINE_CLIPFORMAT** get_formats_for_pasteboard_types(CFArrayRef types, UINT }
-/************************************************************************** - * get_formats_for_pasteboard - */ -static WINE_CLIPFORMAT** get_formats_for_pasteboard(CFTypeRef pasteboard, UINT *num_formats) -{ - CFArrayRef types; - WINE_CLIPFORMAT** formats; - - TRACE("pasteboard %s\n", debugstr_cf(pasteboard)); - - types = macdrv_copy_pasteboard_types(pasteboard); - if (!types) - { - WARN("Failed to copy pasteboard types\n"); - return NULL; - } - - formats = get_formats_for_pasteboard_types(types, num_formats); - CFRelease(types); - return formats; -} - - -/************************************************************************** - * macdrv_dnd_get_formats - */ -NTSTATUS macdrv_dnd_get_formats(void *arg) -{ - struct dnd_get_formats_params *params = arg; - CFTypeRef pasteboard = pasteboard_from_handle(params->handle); - WINE_CLIPFORMAT** formats; - UINT count, i; - - formats = get_formats_for_pasteboard(pasteboard, &count); - if (!formats) - return 0; - count = min(count, ARRAYSIZE(params->formats)); - - for (i = 0; i < count; i++) - params->formats[i] = formats[i]->format_id; - - return count; -} - - /************************************************************************** * register_win32_formats * @@ -1793,25 +1619,3 @@ void macdrv_lost_pasteboard_ownership(HWND hwnd) if (!macdrv_is_pasteboard_owner(clipboard_cocoa_window)) grab_win32_clipboard(); } - - -/************************************************************************** - * macdrv_dnd_release - */ -NTSTATUS macdrv_dnd_release(void *arg) -{ - UINT64 handle = *(UINT64 *)arg; - CFRelease(pasteboard_from_handle(handle)); - return 0; -} - - -/************************************************************************** - * macdrv_dnd_retain - */ -NTSTATUS macdrv_dnd_retain(void *arg) -{ - UINT64 handle = *(UINT64 *)arg; - CFRetain(pasteboard_from_handle(handle)); - return 0; -} diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index 435a3d9162f..ce8b571fa23 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -3287,7 +3287,6 @@ - (NSDragOperation) draggingUpdated:(id <NSDraggingInfo>)sender NSDragOperation ret; NSPoint pt = [[self contentView] convertPoint:[sender draggingLocation] fromView:nil]; CGPoint cgpt = cgpoint_win_from_mac(NSPointToCGPoint(pt)); - NSPasteboard* pb = [sender draggingPasteboard];
macdrv_query* query = macdrv_create_query(); query->type = QUERY_DRAG_DROP_DRAG; @@ -3295,7 +3294,6 @@ - (NSDragOperation) draggingUpdated:(id <NSDraggingInfo>)sender query->drag_drop.x = floor(cgpt.x); query->drag_drop.y = floor(cgpt.y); query->drag_drop.ops = [sender draggingSourceOperationMask]; - query->drag_drop.pasteboard = (CFTypeRef)[pb retain];
[self.queue query:query timeout:3]; ret = query->status ? query->drag_drop.ops : NSDragOperationNone; @@ -3309,7 +3307,6 @@ - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender BOOL ret; NSPoint pt = [[self contentView] convertPoint:[sender draggingLocation] fromView:nil]; CGPoint cgpt = cgpoint_win_from_mac(NSPointToCGPoint(pt)); - NSPasteboard* pb = [sender draggingPasteboard];
macdrv_query* query = macdrv_create_query(); query->type = QUERY_DRAG_DROP_DROP; @@ -3317,7 +3314,6 @@ - (BOOL) performDragOperation:(id <NSDraggingInfo>)sender query->drag_drop.x = floor(cgpt.x); query->drag_drop.y = floor(cgpt.y); query->drag_drop.ops = [sender draggingSourceOperationMask]; - query->drag_drop.pasteboard = (CFTypeRef)[pb retain];
[self.queue query:query timeout:3 * 60 flags:WineQueryProcessEvents]; ret = query->status; diff --git a/dlls/winemac.drv/dllmain.c b/dlls/winemac.drv/dllmain.c index 7c582f772cc..706a55e5dc8 100644 --- a/dlls/winemac.drv/dllmain.c +++ b/dlls/winemac.drv/dllmain.c @@ -399,9 +399,6 @@ static BOOL process_attach(void) params.strings = strings; params.app_icon_callback = (UINT_PTR)macdrv_app_icon; params.app_quit_request_callback = (UINT_PTR)macdrv_app_quit_request; - params.dnd_query_drag_callback = (UINT_PTR)macdrv_dnd_query_drag; - params.dnd_query_drop_callback = (UINT_PTR)macdrv_dnd_query_drop; - params.dnd_query_exited_callback = (UINT_PTR)macdrv_dnd_query_exited;
if (MACDRV_CALL(init, ¶ms)) return FALSE;
diff --git a/dlls/winemac.drv/dragdrop.c b/dlls/winemac.drv/dragdrop.c deleted file mode 100644 index a75641afd32..00000000000 --- a/dlls/winemac.drv/dragdrop.c +++ /dev/null @@ -1,648 +0,0 @@ -/* - * MACDRV Drag and drop code - * - * Copyright 2003 Ulrich Czekalla - * Copyright 2007 Damjan Jovanovic - * Copyright 2013 Ken Thomases for CodeWeavers Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "ntstatus.h" -#define WIN32_NO_STATUS -#include "macdrv_dll.h" - -#define COBJMACROS -#include "objidl.h" -#include "shellapi.h" -#include "shlobj.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(dragdrop); - - -static IDataObject *active_data_object; -static HWND last_droptarget_hwnd; - - -typedef struct -{ - IDataObject IDataObject_iface; - LONG ref; - UINT64 pasteboard; -} 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); -} - - -static HANDLE get_pasteboard_data(UINT64 pasteboard, UINT desired_format) -{ - struct dnd_get_data_params params = { .handle = pasteboard, .format = desired_format, .size = 2048 }; - HANDLE handle; - NTSTATUS status; - - for (;;) - { - if (!(handle = GlobalAlloc(GMEM_FIXED, params.size))) return 0; - params.data = GlobalLock(handle); - status = MACDRV_CALL(dnd_get_data, ¶ms); - GlobalUnlock(handle); - if (!status) return GlobalReAlloc(handle, params.size, GMEM_MOVEABLE); - GlobalFree(handle); - if (status != STATUS_BUFFER_OVERFLOW) return 0; - } -} - -static HRESULT WINAPI dddo_QueryInterface(IDataObject* iface, REFIID riid, LPVOID *ppvObj) -{ - DragDropDataObject *This = impl_from_IDataObject(iface); - - TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppvObj); - - if (IsEqualIID(riid, &IID_IUnknown) || (IsEqualIID(riid, &IID_IDataObject))) - { - *ppvObj = iface; - IDataObject_AddRef(iface); - return S_OK; - } - - *ppvObj = NULL; - return E_NOINTERFACE; -} - - -static ULONG WINAPI dddo_AddRef(IDataObject* iface) -{ - DragDropDataObject *This = impl_from_IDataObject(iface); - ULONG refCount = InterlockedIncrement(&This->ref); - - TRACE("(%p)->(count=%lu)\n", This, refCount - 1); - - return refCount; -} - - -static ULONG WINAPI dddo_Release(IDataObject* iface) -{ - DragDropDataObject *This = impl_from_IDataObject(iface); - ULONG refCount = InterlockedDecrement(&This->ref); - - TRACE("(%p)->(count=%lu)\n", This, refCount + 1); - if (refCount) - return refCount; - - TRACE("-- destroying DragDropDataObject (%p)\n", This); - MACDRV_CALL(dnd_release, &This->pasteboard); - HeapFree(GetProcessHeap(), 0, This); - return 0; -} - - -static HRESULT WINAPI dddo_GetData(IDataObject* iface, FORMATETC* formatEtc, STGMEDIUM* medium) -{ - DragDropDataObject *This = impl_from_IDataObject(iface); - HRESULT hr; - - TRACE("This %p formatEtc %s\n", This, debugstr_format(formatEtc->cfFormat)); - - hr = IDataObject_QueryGetData(iface, formatEtc); - if (SUCCEEDED(hr)) - { - medium->tymed = TYMED_HGLOBAL; - medium->hGlobal = get_pasteboard_data(This->pasteboard, formatEtc->cfFormat); - medium->pUnkForRelease = NULL; - hr = medium->hGlobal ? S_OK : E_OUTOFMEMORY; - } - - return hr; -} - - -static HRESULT WINAPI dddo_GetDataHere(IDataObject* iface, FORMATETC* formatEtc, - STGMEDIUM* medium) -{ - FIXME("iface %p formatEtc %p medium %p; stub\n", iface, formatEtc, medium); - return DATA_E_FORMATETC; -} - - -static HRESULT WINAPI dddo_QueryGetData(IDataObject* iface, FORMATETC* formatEtc) -{ - DragDropDataObject *This = impl_from_IDataObject(iface); - struct dnd_have_format_params params; - HRESULT hr = DV_E_FORMATETC; - - TRACE("This %p formatEtc %p={.tymed=0x%lx, .dwAspect=%ld, .cfFormat=%s}\n", - This, formatEtc, formatEtc->tymed, formatEtc->dwAspect, - debugstr_format(formatEtc->cfFormat)); - - if (formatEtc->tymed && !(formatEtc->tymed & TYMED_HGLOBAL)) - { - FIXME("only HGLOBAL medium types supported right now\n"); - return DV_E_TYMED; - } - if (formatEtc->dwAspect != DVASPECT_CONTENT) - { - FIXME("only the content aspect is supported right now\n"); - return E_NOTIMPL; - } - - params.handle = This->pasteboard; - params.format = formatEtc->cfFormat; - if (MACDRV_CALL(dnd_have_format, ¶ms)) - hr = S_OK; - - TRACE(" -> 0x%lx\n", hr); - return hr; -} - - -static HRESULT WINAPI dddo_GetConicalFormatEtc(IDataObject* iface, FORMATETC* formatEtc, - FORMATETC* formatEtcOut) -{ - DragDropDataObject *This = impl_from_IDataObject(iface); - - TRACE("This %p formatEtc %p={.tymed=0x%lx, .dwAspect=%ld, .cfFormat=%s}\n", - This, formatEtc, formatEtc->tymed, formatEtc->dwAspect, - debugstr_format(formatEtc->cfFormat)); - - *formatEtcOut = *formatEtc; - formatEtcOut->ptd = NULL; - return DATA_S_SAMEFORMATETC; -} - - -static HRESULT WINAPI dddo_SetData(IDataObject* iface, FORMATETC* formatEtc, - STGMEDIUM* medium, BOOL fRelease) -{ - DragDropDataObject *This = impl_from_IDataObject(iface); - - TRACE("This %p formatEtc %p={.tymed=0x%lx, .dwAspect=%ld, .cfFormat=%s} medium %p fRelease %d\n", - This, formatEtc, formatEtc->tymed, formatEtc->dwAspect, - debugstr_format(formatEtc->cfFormat), medium, fRelease); - - return E_NOTIMPL; -} - - -static HRESULT WINAPI dddo_EnumFormatEtc(IDataObject* iface, DWORD direction, - IEnumFORMATETC** enumFormatEtc) -{ - DragDropDataObject *This = impl_from_IDataObject(iface); - struct dnd_get_formats_params params; - UINT count; - HRESULT hr; - - TRACE("This %p direction %lu enumFormatEtc %p\n", This, direction, enumFormatEtc); - - if (direction != DATADIR_GET) - { - WARN("only the get direction is implemented\n"); - return E_NOTIMPL; - } - - params.handle = This->pasteboard; - count = MACDRV_CALL(dnd_get_formats, ¶ms); - if (count) - { - FORMATETC *formatEtcs = HeapAlloc(GetProcessHeap(), 0, count * sizeof(FORMATETC)); - if (formatEtcs) - { - INT i; - - for (i = 0; i < count; i++) - { - formatEtcs[i].cfFormat = params.formats[i]; - formatEtcs[i].ptd = NULL; - formatEtcs[i].dwAspect = DVASPECT_CONTENT; - formatEtcs[i].lindex = -1; - formatEtcs[i].tymed = TYMED_HGLOBAL; - } - - hr = SHCreateStdEnumFmtEtc(count, formatEtcs, enumFormatEtc); - HeapFree(GetProcessHeap(), 0, formatEtcs); - } - else - hr = E_OUTOFMEMORY; - } - else - hr = SHCreateStdEnumFmtEtc(0, NULL, enumFormatEtc); - - TRACE(" -> 0x%lx\n", hr); - return hr; -} - - -static HRESULT WINAPI dddo_DAdvise(IDataObject* iface, FORMATETC* formatEtc, DWORD advf, - IAdviseSink* pAdvSink, DWORD* pdwConnection) -{ - FIXME("(%p, %p, %lu, %p, %p): stub\n", iface, formatEtc, advf, - pAdvSink, pdwConnection); - return OLE_E_ADVISENOTSUPPORTED; -} - - -static HRESULT WINAPI dddo_DUnadvise(IDataObject* iface, DWORD dwConnection) -{ - FIXME("(%p, %lu): stub\n", iface, dwConnection); - return OLE_E_ADVISENOTSUPPORTED; -} - - -static HRESULT WINAPI dddo_EnumDAdvise(IDataObject* iface, IEnumSTATDATA** pEnumAdvise) -{ - FIXME("(%p, %p): stub\n", iface, pEnumAdvise); - return OLE_E_ADVISENOTSUPPORTED; -} - - -static const IDataObjectVtbl dovt = -{ - dddo_QueryInterface, - dddo_AddRef, - dddo_Release, - dddo_GetData, - dddo_GetDataHere, - dddo_QueryGetData, - dddo_GetConicalFormatEtc, - dddo_SetData, - dddo_EnumFormatEtc, - dddo_DAdvise, - dddo_DUnadvise, - dddo_EnumDAdvise -}; - - -static IDataObject *create_data_object_for_pasteboard(UINT64 pasteboard) -{ - DragDropDataObject *dddo; - - dddo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*dddo)); - if (!dddo) - return NULL; - - dddo->ref = 1; - dddo->IDataObject_iface.lpVtbl = &dovt; - dddo->pasteboard = pasteboard; - MACDRV_CALL(dnd_retain, &dddo->pasteboard); - - return &dddo->IDataObject_iface; -} - - -/* Based on functions in dlls/ole32/ole2.c */ -static HANDLE get_droptarget_local_handle(HWND hwnd) -{ - static const WCHAR prop_marshalleddroptarget[] = - {'W','i','n','e','M','a','r','s','h','a','l','l','e','d','D','r','o','p','T','a','r','g','e','t',0}; - HANDLE handle; - HANDLE local_handle = 0; - - handle = GetPropW(hwnd, prop_marshalleddroptarget); - if (handle) - { - DWORD pid; - HANDLE process; - - GetWindowThreadProcessId(hwnd, &pid); - process = OpenProcess(PROCESS_DUP_HANDLE, FALSE, pid); - if (process) - { - DuplicateHandle(process, handle, GetCurrentProcess(), &local_handle, 0, FALSE, DUPLICATE_SAME_ACCESS); - CloseHandle(process); - } - } - return local_handle; -} - - -static HRESULT create_stream_from_map(HANDLE map, IStream **stream) -{ - HRESULT hr = E_OUTOFMEMORY; - HGLOBAL hmem; - void *data; - MEMORY_BASIC_INFORMATION info; - - data = MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0); - if(!data) return hr; - - VirtualQuery(data, &info, sizeof(info)); - TRACE("size %d\n", (int)info.RegionSize); - - hmem = GlobalAlloc(GMEM_MOVEABLE, info.RegionSize); - if(hmem) - { - memcpy(GlobalLock(hmem), data, info.RegionSize); - GlobalUnlock(hmem); - hr = CreateStreamOnHGlobal(hmem, TRUE, stream); - } - UnmapViewOfFile(data); - return hr; -} - - -static IDropTarget* get_droptarget_pointer(HWND hwnd) -{ - IDropTarget *droptarget = NULL; - HANDLE map; - IStream *stream; - - map = get_droptarget_local_handle(hwnd); - if(!map) return NULL; - - if(SUCCEEDED(create_stream_from_map(map, &stream))) - { - CoUnmarshalInterface(stream, &IID_IDropTarget, (void**)&droptarget); - IStream_Release(stream); - } - CloseHandle(map); - return droptarget; -} - - -/************************************************************************** - * macdrv_dnd_query_drop - */ -NTSTATUS WINAPI macdrv_dnd_query_drop(void *arg, ULONG size) -{ - struct dnd_query_drop_params *params = arg; - IDropTarget *droptarget; - BOOL ret = FALSE; - POINT pt; - - TRACE("win %x x,y %d,%d effect %x pasteboard %s\n", params->hwnd, params->x, params->y, - params->effect, wine_dbgstr_longlong(params->handle)); - - pt.x = params->x; - pt.y = params->y; - - droptarget = get_droptarget_pointer(last_droptarget_hwnd); - if (droptarget) - { - HRESULT hr; - POINTL pointl; - DWORD effect = params->effect; - - if (!active_data_object) - { - WARN("shouldn't happen: no active IDataObject\n"); - active_data_object = create_data_object_for_pasteboard(params->handle); - } - - pointl.x = pt.x; - pointl.y = pt.y; - TRACE("Drop hwnd %p droptarget %p pointl (%ld,%ld) effect 0x%08lx\n", last_droptarget_hwnd, - droptarget, pointl.x, pointl.y, effect); - hr = IDropTarget_Drop(droptarget, active_data_object, MK_LBUTTON, pointl, &effect); - if (SUCCEEDED(hr)) - { - if (effect != DROPEFFECT_NONE) - { - TRACE("drop succeeded\n"); - ret = TRUE; - } - else - TRACE("the application refused the drop\n"); - } - else - WARN("drop failed, error 0x%08lx\n", hr); - IDropTarget_Release(droptarget); - } - else - { - HWND hwnd = WindowFromPoint(pt); - while (hwnd && !(GetWindowLongW(hwnd, GWL_EXSTYLE) & WS_EX_ACCEPTFILES)) - hwnd = GetParent(hwnd); - if (hwnd) - { - HDROP hdrop = get_pasteboard_data(params->handle, CF_HDROP); - DROPFILES *dropfiles = GlobalLock(hdrop); - if (dropfiles) - { - RECT rect; - dropfiles->pt.x = pt.x; - dropfiles->pt.y = pt.y; - dropfiles->fNC = !(ScreenToClient(hwnd, &dropfiles->pt) && - GetClientRect(hwnd, &rect) && - PtInRect(&rect, dropfiles->pt)); - - TRACE("sending WM_DROPFILES: hwnd %p nc %d pt %s %s\n", hwnd, - dropfiles->fNC, wine_dbgstr_point(&dropfiles->pt), - debugstr_w((WCHAR*)((char*)dropfiles + dropfiles->pFiles))); - - GlobalUnlock(hdrop); - - ret = PostMessageW(hwnd, WM_DROPFILES, (WPARAM)hdrop, 0L); - /* hdrop is owned by the message and freed when the recipient calls DragFinish(). */ - } - - if (!ret) GlobalFree(hdrop); - } - } - - if (active_data_object) IDataObject_Release(active_data_object); - active_data_object = NULL; - last_droptarget_hwnd = NULL; - return NtCallbackReturn( &ret, sizeof(ret), STATUS_SUCCESS ); -} - - -/************************************************************************** - * macdrv_dnd_query_exited - */ -NTSTATUS WINAPI macdrv_dnd_query_exited(void *arg, ULONG size) -{ - struct dnd_query_exited_params *params = arg; - HWND hwnd = UlongToHandle(params->hwnd); - IDropTarget *droptarget; - BOOL ret = TRUE; - - TRACE("win %p\n", hwnd); - - droptarget = get_droptarget_pointer(last_droptarget_hwnd); - if (droptarget) - { - HRESULT hr; - - TRACE("DragLeave hwnd %p droptarget %p\n", last_droptarget_hwnd, droptarget); - hr = IDropTarget_DragLeave(droptarget); - if (FAILED(hr)) - WARN("IDropTarget_DragLeave failed, error 0x%08lx\n", hr); - IDropTarget_Release(droptarget); - } - - if (active_data_object) IDataObject_Release(active_data_object); - active_data_object = NULL; - last_droptarget_hwnd = NULL; - return NtCallbackReturn( &ret, sizeof(ret), STATUS_SUCCESS ); -} - - -/************************************************************************** - * query_drag_operation - */ -NTSTATUS WINAPI macdrv_dnd_query_drag(void *arg, ULONG size) -{ - struct dnd_query_drag_params *params = arg; - HWND hwnd = UlongToHandle(params->hwnd); - BOOL ret = FALSE; - POINT pt; - DWORD effect; - IDropTarget *droptarget; - HRESULT hr; - - TRACE("win %p x,y %d,%d effect %x pasteboard %s\n", hwnd, params->x, params->y, - params->effect, wine_dbgstr_longlong(params->handle)); - - pt.x = params->x; - pt.y = params->y; - effect = params->effect; - - /* Instead of the top-level window we got in the query, start with the deepest - child under the cursor. Travel up the hierarchy looking for a window that - has an associated IDropTarget. */ - hwnd = WindowFromPoint(pt); - do - { - droptarget = get_droptarget_pointer(hwnd); - } while (!droptarget && (hwnd = GetParent(hwnd))); - - if (last_droptarget_hwnd != hwnd) - { - if (last_droptarget_hwnd) - { - IDropTarget *old_droptarget = get_droptarget_pointer(last_droptarget_hwnd); - if (old_droptarget) - { - TRACE("DragLeave hwnd %p droptarget %p\n", last_droptarget_hwnd, old_droptarget); - hr = IDropTarget_DragLeave(old_droptarget); - if (FAILED(hr)) - WARN("IDropTarget_DragLeave failed, error 0x%08lx\n", hr); - IDropTarget_Release(old_droptarget); - } - } - - last_droptarget_hwnd = hwnd; - - if (droptarget) - { - POINTL pointl = { pt.x, pt.y }; - - if (!active_data_object) - active_data_object = create_data_object_for_pasteboard(params->handle); - - TRACE("DragEnter hwnd %p droptarget %p\n", hwnd, droptarget); - hr = IDropTarget_DragEnter(droptarget, active_data_object, MK_LBUTTON, - pointl, &effect); - if (SUCCEEDED(hr)) - { - TRACE(" effect %ld\n", effect); - ret = TRUE; - } - else - WARN("IDropTarget_DragEnter failed, error 0x%08lx\n", hr); - IDropTarget_Release(droptarget); - } - } - else if (droptarget) - { - POINTL pointl = { pt.x, pt.y }; - - TRACE("DragOver hwnd %p droptarget %p\n", hwnd, droptarget); - hr = IDropTarget_DragOver(droptarget, MK_LBUTTON, pointl, &effect); - if (SUCCEEDED(hr)) - { - TRACE(" effect %ld\n", effect); - ret = TRUE; - } - else - WARN("IDropTarget_DragOver failed, error 0x%08lx\n", hr); - IDropTarget_Release(droptarget); - } - - if (!ret) - { - hwnd = WindowFromPoint(pt); - while (hwnd && !(GetWindowLongW(hwnd, GWL_EXSTYLE) & WS_EX_ACCEPTFILES)) - hwnd = GetParent(hwnd); - if (hwnd) - { - FORMATETC formatEtc; - - if (!active_data_object) - active_data_object = create_data_object_for_pasteboard(params->handle); - - formatEtc.cfFormat = CF_HDROP; - formatEtc.ptd = NULL; - formatEtc.dwAspect = DVASPECT_CONTENT; - formatEtc.lindex = -1; - formatEtc.tymed = TYMED_HGLOBAL; - if (SUCCEEDED(IDataObject_QueryGetData(active_data_object, &formatEtc))) - { - TRACE("WS_EX_ACCEPTFILES hwnd %p\n", hwnd); - effect = DROPEFFECT_COPY | DROPEFFECT_LINK; - ret = TRUE; - } - } - } - - TRACE(" -> %s\n", ret ? "TRUE" : "FALSE"); - if (!ret) effect = 0; - return NtCallbackReturn( &effect, sizeof(effect), STATUS_SUCCESS ); -} diff --git a/dlls/winemac.drv/event.c b/dlls/winemac.drv/event.c index f5ebd1675b9..20a791ac48a 100644 --- a/dlls/winemac.drv/event.c +++ b/dlls/winemac.drv/event.c @@ -228,26 +228,18 @@ static uint32_t dropeffect_to_drag_operation(DWORD effect, uint32_t ops) static BOOL query_drag_drop_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 = {.dispatch = {.callback = dnd_query_drop_callback}}; - void *ret_ptr; - ULONG ret_len; + struct macdrv_win_data *data;
- if (!data) + if (!(data = get_win_data(hwnd))) { WARN("no win_data for win %p/%p\n", hwnd, query->window); return FALSE; }
- params.hwnd = HandleToUlong(hwnd); - params.effect = drag_operations_to_dropeffects(query->drag_drop.ops); - params.x = query->drag_drop.x + data->rects.visible.left; - params.y = query->drag_drop.y + data->rects.visible.top; - params.handle = (UINT_PTR)query->drag_drop.pasteboard; release_win_data(data); - if (KeUserDispatchCallback(¶ms.dispatch, sizeof(params), &ret_ptr, &ret_len)) - return FALSE; - return *(BOOL *)ret_ptr; + + NtUserMessageCall(hwnd, WINE_DRAG_DROP_DROP, 0, 0, NULL, NtUserDragDropCall, FALSE); + return TRUE; }
/************************************************************************** @@ -260,6 +252,7 @@ static BOOL query_drag_drop_enter(macdrv_query *query) UINT entries_size;
if (!(entries = get_format_entries(pasteboard, &entries_size))) return FALSE; + NtUserMessageCall(0, WINE_DRAG_DROP_ENTER, entries_size, (LPARAM)entries, NULL, NtUserDragDropCall, FALSE); free(entries);
return TRUE; @@ -270,14 +263,8 @@ static BOOL query_drag_drop_enter(macdrv_query *query) */ static BOOL query_drag_drop_leave(macdrv_query *query) { - struct dnd_query_exited_params params = {.dispatch = {.callback = dnd_query_exited_callback}}; - void *ret_ptr; - ULONG ret_len; - - params.hwnd = HandleToUlong(macdrv_get_window_hwnd(query->window)); - if (KeUserDispatchCallback(¶ms.dispatch, sizeof(params), &ret_ptr, &ret_len)) - return FALSE; - return *(BOOL *)ret_ptr; + NtUserMessageCall(0, WINE_DRAG_DROP_LEAVE, 0, 0, NULL, NtUserDragDropCall, FALSE); + return TRUE; }
@@ -286,12 +273,10 @@ static BOOL query_drag_drop_leave(macdrv_query *query) */ static BOOL query_drag_drop_drag(macdrv_query *query) { - struct dnd_query_drag_params params = {.dispatch = {.callback = dnd_query_drag_callback}}; HWND hwnd = macdrv_get_window_hwnd(query->window); struct macdrv_win_data *data = get_win_data(hwnd); - void *ret_ptr; - ULONG ret_len; DWORD effect; + POINT point;
if (!data) { @@ -299,16 +284,12 @@ static BOOL query_drag_drop_drag(macdrv_query *query) return FALSE; }
- params.hwnd = HandleToUlong(hwnd); - params.effect = drag_operations_to_dropeffects(query->drag_drop.ops); - params.x = query->drag_drop.x + data->rects.visible.left; - params.y = query->drag_drop.y + data->rects.visible.top; - params.handle = (UINT_PTR)query->drag_drop.pasteboard; + effect = drag_operations_to_dropeffects(query->drag_drop.ops); + point.x = query->drag_drop.x + data->rects.visible.left; + point.y = query->drag_drop.y + data->rects.visible.top; release_win_data(data);
- if (KeUserDispatchCallback(¶ms.dispatch, sizeof(params), &ret_ptr, &ret_len)) - return FALSE; - effect = *(DWORD *)ret_ptr; + effect = NtUserMessageCall(hwnd, WINE_DRAG_DROP_DRAG, MAKELONG(point.x, point.y), effect, NULL, NtUserDragDropCall, FALSE); if (!effect) return FALSE;
query->drag_drop.ops = dropeffect_to_drag_operation(effect, query->drag_drop.ops); diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 8053ff434ca..79c7545d883 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -46,9 +46,6 @@
extern UINT64 app_icon_callback; extern UINT64 app_quit_request_callback; -extern UINT64 dnd_query_drag_callback; -extern UINT64 dnd_query_drop_callback; -extern UINT64 dnd_query_exited_callback;
extern const char* debugstr_cf(CFTypeRef t);
@@ -263,14 +260,6 @@ extern CGImageRef create_cgimage_from_icon_bitmaps(HDC hdc, HANDLE icon, HBITMAP
extern struct format_entry *get_format_entries(CFTypeRef pasteboard, UINT *entries_size);
-/* unixlib interface */ - -extern NTSTATUS macdrv_dnd_get_data(void *arg); -extern NTSTATUS macdrv_dnd_get_formats(void *arg); -extern NTSTATUS macdrv_dnd_have_format(void *arg); -extern NTSTATUS macdrv_dnd_release(void *arg); -extern NTSTATUS macdrv_dnd_retain(void *arg); - /* 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 d26ac73b6b5..24f6ac973df 100644 --- a/dlls/winemac.drv/macdrv_main.c +++ b/dlls/winemac.drv/macdrv_main.c @@ -62,9 +62,6 @@ int enable_app_nap = FALSE;
UINT64 app_icon_callback = 0; UINT64 app_quit_request_callback = 0; -UINT64 dnd_query_drag_callback = 0; -UINT64 dnd_query_drop_callback = 0; -UINT64 dnd_query_exited_callback = 0;
CFDictionaryRef localized_strings;
@@ -438,9 +435,6 @@ static NTSTATUS macdrv_init(void *arg)
app_icon_callback = params->app_icon_callback; app_quit_request_callback = params->app_quit_request_callback; - dnd_query_drag_callback = params->dnd_query_drag_callback; - dnd_query_drop_callback = params->dnd_query_drop_callback; - dnd_query_exited_callback = params->dnd_query_exited_callback;
status = SessionGetInfo(callerSecuritySession, NULL, &attributes); if (status != noErr || !(attributes & sessionHasGraphicAccess)) @@ -615,11 +609,6 @@ static NTSTATUS macdrv_quit_result(void *arg)
const unixlib_entry_t __wine_unix_call_funcs[] = { - macdrv_dnd_get_data, - macdrv_dnd_get_formats, - macdrv_dnd_have_format, - macdrv_dnd_release, - macdrv_dnd_retain, macdrv_init, macdrv_quit_result, }; @@ -628,24 +617,6 @@ C_ASSERT( ARRAYSIZE(__wine_unix_call_funcs) == unix_funcs_count );
#ifdef _WIN64
-static NTSTATUS wow64_dnd_get_data(void *arg) -{ - struct - { - UINT64 handle; - UINT format; - ULONG size; - ULONG data; - } *params32 = arg; - struct dnd_get_data_params params; - - params.handle = params32->handle; - params.format = params32->format; - params.size = params32->size; - params.data = UlongToPtr(params32->data); - return macdrv_dnd_get_data(¶ms); -} - static NTSTATUS wow64_init(void *arg) { struct @@ -653,28 +624,17 @@ static NTSTATUS wow64_init(void *arg) ULONG strings; UINT64 app_icon_callback; UINT64 app_quit_request_callback; - UINT64 dnd_query_drag_callback; - UINT64 dnd_query_drop_callback; - UINT64 dnd_query_exited_callback; } *params32 = arg; struct init_params params;
params.strings = UlongToPtr(params32->strings); params.app_icon_callback = params32->app_icon_callback; params.app_quit_request_callback = params32->app_quit_request_callback; - params.dnd_query_drag_callback = params32->dnd_query_drag_callback; - params.dnd_query_drop_callback = params32->dnd_query_drop_callback; - params.dnd_query_exited_callback = params32->dnd_query_exited_callback; return macdrv_init(¶ms); }
const unixlib_entry_t __wine_unix_call_wow64_funcs[] = { - wow64_dnd_get_data, - macdrv_dnd_get_formats, - macdrv_dnd_have_format, - macdrv_dnd_release, - macdrv_dnd_retain, wow64_init, macdrv_quit_result, }; diff --git a/dlls/winemac.drv/unixlib.h b/dlls/winemac.drv/unixlib.h index 4f5616ca388..d39b3ea5b83 100644 --- a/dlls/winemac.drv/unixlib.h +++ b/dlls/winemac.drv/unixlib.h @@ -21,11 +21,6 @@
enum macdrv_funcs { - unix_dnd_get_data, - unix_dnd_get_formats, - unix_dnd_have_format, - unix_dnd_release, - unix_dnd_retain, unix_init, unix_quit_result, unix_funcs_count @@ -33,29 +28,6 @@
#define MACDRV_CALL(func, params) WINE_UNIX_CALL(unix_ ## func, params)
-/* macdrv_dnd_get_data params */ -struct dnd_get_data_params -{ - UINT64 handle; - UINT format; - size_t size; - void *data; -}; - -/* macdrv_dnd_get_formats params */ -struct dnd_get_formats_params -{ - UINT64 handle; - UINT formats[64]; -}; - -/* macdrv_dnd_have_format params */ -struct dnd_have_format_params -{ - UINT64 handle; - UINT format; -}; - /* macdrv_init params */ struct localized_string { @@ -69,9 +41,6 @@ struct localized_string *strings; UINT64 app_icon_callback; UINT64 app_quit_request_callback; - UINT64 dnd_query_drag_callback; - UINT64 dnd_query_drop_callback; - UINT64 dnd_query_exited_callback; };
/* macdrv_quit_result params */ @@ -97,28 +66,6 @@ UINT flags; };
-/* macdrv_dnd_query_drag params */ -struct dnd_query_drag_params -{ - struct dispatch_callback_params dispatch; - UINT32 hwnd; - UINT32 effect; - INT32 x; - INT32 y; - UINT64 handle; -}; - -/* macdrv_dnd_query_drop params */ -struct dnd_query_drop_params -{ - struct dispatch_callback_params dispatch; - UINT32 hwnd; - UINT32 effect; - INT32 x; - INT32 y; - UINT64 handle; -}; - /* macdrv_dnd_query_exited params */ struct dnd_query_exited_params {