fix: drag and drop should copy on macOS (#35963)

This commit is contained in:
Shelley Vohr 2022-10-11 09:19:59 -07:00 committed by GitHub
parent 9006f0e0c5
commit b3fd5eb258
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,7 +20,8 @@
- (NSDragOperation)draggingSession:(NSDraggingSession*)session
sourceOperationMaskForDraggingContext:(NSDraggingContext)context {
return NSDragOperationEvery;
return context == NSDraggingContextOutsideApplication ? NSDragOperationCopy
: NSDragOperationEvery;
}
@end
@ -70,7 +71,7 @@ void DragFileItems(const std::vector<base::FilePath>& files,
NSEvent* dragEvent =
[NSEvent mouseEventWithType:NSEventTypeLeftMouseDragged
location:position
modifierFlags:NSEventMaskLeftMouseDragged
modifierFlags:0
timestamp:eventTime
windowNumber:[[native_view window] windowNumber]
context:nil