From 33c8aa660fcd89cbddb352d28e0debf9d24bccf2 Mon Sep 17 00:00:00 2001 From: Francesca Plebani Date: Thu, 27 Dec 2018 14:22:00 -0500 Subject: [PATCH] macOS: Correct `prepareForDragOperation:` signature (#741) --- CHANGELOG.md | 1 + src/platform/macos/window.rs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce5b4dd4..d8e39de5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - On Wayland, DPI calculation is handled by smithay-client-toolkit. - On X11, `WindowBuilder::with_min_dimensions` and `WindowBuilder::with_max_dimensions` now correctly account for DPI. - Added support for generating dummy `DeviceId`s and `WindowId`s to better support unit testing. +- On macOS, fixed unsoundness in drag-and-drop that could result in drops being rejected. # Version 0.18.0 (2018-11-07) diff --git a/src/platform/macos/window.rs b/src/platform/macos/window.rs index d344f126..a3a9db01 100644 --- a/src/platform/macos/window.rs +++ b/src/platform/macos/window.rs @@ -330,7 +330,9 @@ impl WindowDelegate { } /// Invoked when the image is released - extern fn prepare_for_drag_operation(_: &Object, _: Sel, _: id) {} + extern fn prepare_for_drag_operation(_: &Object, _: Sel, _: id) -> BOOL { + YES + } /// Invoked after the released image has been removed from the screen extern fn perform_drag_operation(this: &Object, _: Sel, sender: id) -> BOOL { @@ -465,7 +467,7 @@ impl WindowDelegate { decl.add_method(sel!(draggingEntered:), dragging_entered as extern fn(&Object, Sel, id) -> BOOL); decl.add_method(sel!(prepareForDragOperation:), - prepare_for_drag_operation as extern fn(&Object, Sel, id)); + prepare_for_drag_operation as extern fn(&Object, Sel, id) -> BOOL); decl.add_method(sel!(performDragOperation:), perform_drag_operation as extern fn(&Object, Sel, id) -> BOOL); decl.add_method(sel!(concludeDragOperation:),