diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/nsselect.m | 10 | ||||
| -rw-r--r-- | src/nsterm.m | 33 |
2 files changed, 32 insertions, 11 deletions
diff --git a/src/nsselect.m b/src/nsselect.m index a719eef4e86..6831090aa20 100644 --- a/src/nsselect.m +++ b/src/nsselect.m | |||
| @@ -565,6 +565,9 @@ ns_decode_data_to_pasteboard (Lisp_Object type, Lisp_Object data, | |||
| 565 | NSMutableArray *temp; | 565 | NSMutableArray *temp; |
| 566 | Lisp_Object tem; | 566 | Lisp_Object tem; |
| 567 | specpdl_ref count; | 567 | specpdl_ref count; |
| 568 | #if !NS_USE_NSPasteboardTypeFileURL | ||
| 569 | NSURL *url; | ||
| 570 | #endif | ||
| 568 | 571 | ||
| 569 | types = [pasteboard types]; | 572 | types = [pasteboard types]; |
| 570 | count = SPECPDL_INDEX (); | 573 | count = SPECPDL_INDEX (); |
| @@ -602,7 +605,12 @@ ns_decode_data_to_pasteboard (Lisp_Object type, Lisp_Object data, | |||
| 602 | [pasteboard setString: [NSString stringWithLispString: data] | 605 | [pasteboard setString: [NSString stringWithLispString: data] |
| 603 | forType: NSPasteboardTypeFileURL]; | 606 | forType: NSPasteboardTypeFileURL]; |
| 604 | #else | 607 | #else |
| 605 | [pasteboard setString: [NSString stringWithLispString: data] | 608 | url = [NSURL URLWithString: [NSString stringWithLispString: data]]; |
| 609 | |||
| 610 | if (!url) | ||
| 611 | signal_error ("Invalid file URL", data); | ||
| 612 | |||
| 613 | [pasteboard setString: [url path] | ||
| 606 | forType: NSFilenamesPboardType]; | 614 | forType: NSFilenamesPboardType]; |
| 607 | #endif | 615 | #endif |
| 608 | } | 616 | } |
diff --git a/src/nsterm.m b/src/nsterm.m index 04475bbba05..4663ac85d84 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -8724,7 +8724,7 @@ ns_create_font_panel_buttons (id target, SEL select, SEL cancel_action) | |||
| 8724 | Lisp_Object type_sym; | 8724 | Lisp_Object type_sym; |
| 8725 | struct input_event ie; | 8725 | struct input_event ie; |
| 8726 | 8726 | ||
| 8727 | NSTRACE ("[EmacsView performDragOperation:]"); | 8727 | NSTRACE (@"[EmacsView performDragOperation:]"); |
| 8728 | 8728 | ||
| 8729 | source = [sender draggingSource]; | 8729 | source = [sender draggingSource]; |
| 8730 | 8730 | ||
| @@ -8752,7 +8752,7 @@ ns_create_font_panel_buttons (id target, SEL select, SEL cancel_action) | |||
| 8752 | 8752 | ||
| 8753 | if (!type) | 8753 | if (!type) |
| 8754 | return NO; | 8754 | return NO; |
| 8755 | #if NS_USE_NSPasteboardTypeFileURL != 0 | 8755 | #if NS_USE_NSPasteboardTypeFileURL |
| 8756 | else if ([type isEqualToString: NSPasteboardTypeFileURL]) | 8756 | else if ([type isEqualToString: NSPasteboardTypeFileURL]) |
| 8757 | { | 8757 | { |
| 8758 | type_sym = Qfile; | 8758 | type_sym = Qfile; |
| @@ -8767,18 +8767,29 @@ ns_create_font_panel_buttons (id target, SEL select, SEL cancel_action) | |||
| 8767 | #else // !NS_USE_NSPasteboardTypeFileURL | 8767 | #else // !NS_USE_NSPasteboardTypeFileURL |
| 8768 | else if ([type isEqualToString: NSFilenamesPboardType]) | 8768 | else if ([type isEqualToString: NSFilenamesPboardType]) |
| 8769 | { | 8769 | { |
| 8770 | NSArray *files; | 8770 | id files; |
| 8771 | NSEnumerator *fenum; | 8771 | NSEnumerator *fenum; |
| 8772 | NSString *file; | 8772 | NSString *file; |
| 8773 | 8773 | ||
| 8774 | if (!(files = [pb propertyListForType: type])) | 8774 | files = [pb propertyListForType: type]; |
| 8775 | |||
| 8776 | if (!files) | ||
| 8775 | return NO; | 8777 | return NO; |
| 8776 | 8778 | ||
| 8777 | type_sym = Qfile; | 8779 | type_sym = Qfile; |
| 8778 | 8780 | ||
| 8779 | fenum = [files objectEnumerator]; | 8781 | /* On GNUstep, files might be a string. */ |
| 8780 | while ( (file = [fenum nextObject]) ) | 8782 | |
| 8781 | strings = Fcons ([file lispString], strings); | 8783 | if ([files respondsToSelector: @selector (objectEnumerator:)]) |
| 8784 | { | ||
| 8785 | fenum = [files objectEnumerator]; | ||
| 8786 | |||
| 8787 | while ((file = [fenum nextObject])) | ||
| 8788 | strings = Fcons ([file lispString], strings); | ||
| 8789 | } | ||
| 8790 | else | ||
| 8791 | /* Then `files' is an NSString. */ | ||
| 8792 | strings = list1 ([files lispString]); | ||
| 8782 | } | 8793 | } |
| 8783 | #endif // !NS_USE_NSPasteboardTypeFileURL | 8794 | #endif // !NS_USE_NSPasteboardTypeFileURL |
| 8784 | else if ([type isEqualToString: NSPasteboardTypeURL]) | 8795 | else if ([type isEqualToString: NSPasteboardTypeURL]) |
| @@ -8795,11 +8806,12 @@ ns_create_font_panel_buttons (id target, SEL select, SEL cancel_action) | |||
| 8795 | { | 8806 | { |
| 8796 | NSString *data; | 8807 | NSString *data; |
| 8797 | 8808 | ||
| 8798 | if (! (data = [pb stringForType: type])) | 8809 | data = [pb stringForType: type]; |
| 8810 | |||
| 8811 | if (!data) | ||
| 8799 | return NO; | 8812 | return NO; |
| 8800 | 8813 | ||
| 8801 | type_sym = Qnil; | 8814 | type_sym = Qnil; |
| 8802 | |||
| 8803 | strings = list1 ([data lispString]); | 8815 | strings = list1 ([data lispString]); |
| 8804 | } | 8816 | } |
| 8805 | else | 8817 | else |
| @@ -8807,7 +8819,8 @@ ns_create_font_panel_buttons (id target, SEL select, SEL cancel_action) | |||
| 8807 | 8819 | ||
| 8808 | EVENT_INIT (ie); | 8820 | EVENT_INIT (ie); |
| 8809 | ie.kind = DRAG_N_DROP_EVENT; | 8821 | ie.kind = DRAG_N_DROP_EVENT; |
| 8810 | ie.arg = Fcons (type_sym, Fcons (operations, strings)); | 8822 | ie.arg = Fcons (type_sym, Fcons (operations, |
| 8823 | strings)); | ||
| 8811 | XSETINT (ie.x, x); | 8824 | XSETINT (ie.x, x); |
| 8812 | XSETINT (ie.y, y); | 8825 | XSETINT (ie.y, y); |
| 8813 | XSETFRAME (ie.frame_or_window, emacsframe); | 8826 | XSETFRAME (ie.frame_or_window, emacsframe); |