|
5 | 5 | use std::ffi::{c_char, c_void}; |
6 | 6 |
|
7 | 7 | use cocoa::{ |
8 | | - appkit::{NSAlignmentOptions, NSApp, NSEvent, NSEventModifierFlags, NSEventType, NSImage}, |
| 8 | + appkit::{NSApp, NSEvent, NSEventModifierFlags, NSEventType, NSImage}, |
9 | 9 | base::{id, nil}, |
10 | 10 | foundation::{NSArray, NSData, NSPoint, NSRect, NSSize, NSUInteger}, |
11 | 11 | }; |
@@ -63,8 +63,7 @@ pub fn start_drag<W: HasRawWindowHandle, F: Fn(DragResult, CursorPosition) + Sen |
63 | 63 | // wry replaces the ns_view so we don't really use AppKitWindowHandle::ns_view |
64 | 64 | let ns_view: id = msg_send![window, contentView]; |
65 | 65 |
|
66 | | - let mouse_location: NSPoint = msg_send![window, mouseLocationOutsideOfEventStream]; |
67 | | - let current_position: NSPoint = msg_send![ns_view, backingAlignedRect: NSRect::new(mouse_location, NSSize::new(0., 0.)) options: NSAlignmentOptions::NSAlignAllEdgesOutward]; |
| 66 | + let current_position: NSPoint = msg_send![window, mouseLocationOutsideOfEventStream]; |
68 | 67 |
|
69 | 68 | let img: id = msg_send![class!(NSImage), alloc]; |
70 | 69 | let img: id = match image { |
@@ -285,7 +284,11 @@ pub fn start_drag<W: HasRawWindowHandle, F: Fn(DragResult, CursorPosition) + Sen |
285 | 284 | (*source).set_ivar("on_drop_ptr", callback_ptr as *mut _ as *mut c_void); |
286 | 285 | (*source).set_ivar( |
287 | 286 | "animate_on_cancel_or_failure", |
288 | | - !options.skip_animatation_on_cancel_or_failure, |
| 287 | + if options.skip_animatation_on_cancel_or_failure { |
| 288 | + YES |
| 289 | + } else { |
| 290 | + NO |
| 291 | + }, |
289 | 292 | ); |
290 | 293 |
|
291 | 294 | let _: () = msg_send![ns_view, beginDraggingSessionWithItems: dragging_items event: drag_event source: source]; |
|
0 commit comments