summaryrefslogtreecommitdiff
path: root/src/nsterm.m
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-06-04 16:19:01 +0800
committerPo Lu <luangruo@yahoo.com>2022-06-04 16:19:01 +0800
commiteffbd2aeef3d6ec3d09d40ff095e072b2d9834d4 (patch)
treec1e9b43ffd0477923fc695e519833fd1748ba9b0 /src/nsterm.m
parent2ce686c049a7a35cdc3eb87626d8a94539388a35 (diff)
downloademacs-effbd2aeef3d6ec3d09d40ff095e072b2d9834d4.tar.gz
Fix file drag-and-drop on GNUstep
* src/nsselect.m (ns_decode_data_to_pasteboard): Convert URL to path names when we're using NSFilenamesPboardType. * src/nsterm.m: ([EmacsView performDragOperation:]): Handle cases where plist is a string.
Diffstat (limited to 'src/nsterm.m')
-rw-r--r--src/nsterm.m33
1 files changed, 23 insertions, 10 deletions
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)
Lisp_Object type_sym;
struct input_event ie;
- NSTRACE ("[EmacsView performDragOperation:]");
+ NSTRACE (@"[EmacsView performDragOperation:]");
source = [sender draggingSource];
@@ -8752,7 +8752,7 @@ ns_create_font_panel_buttons (id target, SEL select, SEL cancel_action)
if (!type)
return NO;
-#if NS_USE_NSPasteboardTypeFileURL != 0
+#if NS_USE_NSPasteboardTypeFileURL
else if ([type isEqualToString: NSPasteboardTypeFileURL])
{
type_sym = Qfile;
@@ -8767,18 +8767,29 @@ ns_create_font_panel_buttons (id target, SEL select, SEL cancel_action)
#else // !NS_USE_NSPasteboardTypeFileURL
else if ([type isEqualToString: NSFilenamesPboardType])
{
- NSArray *files;
+ id files;
NSEnumerator *fenum;
NSString *file;
- if (!(files = [pb propertyListForType: type]))
+ files = [pb propertyListForType: type];
+
+ if (!files)
return NO;
type_sym = Qfile;
- fenum = [files objectEnumerator];
- while ( (file = [fenum nextObject]) )
- strings = Fcons ([file lispString], strings);
+ /* On GNUstep, files might be a string. */
+
+ if ([files respondsToSelector: @selector (objectEnumerator:)])
+ {
+ fenum = [files objectEnumerator];
+
+ while ((file = [fenum nextObject]))
+ strings = Fcons ([file lispString], strings);
+ }
+ else
+ /* Then `files' is an NSString. */
+ strings = list1 ([files lispString]);
}
#endif // !NS_USE_NSPasteboardTypeFileURL
else if ([type isEqualToString: NSPasteboardTypeURL])
@@ -8795,11 +8806,12 @@ ns_create_font_panel_buttons (id target, SEL select, SEL cancel_action)
{
NSString *data;
- if (! (data = [pb stringForType: type]))
+ data = [pb stringForType: type];
+
+ if (!data)
return NO;
type_sym = Qnil;
-
strings = list1 ([data lispString]);
}
else
@@ -8807,7 +8819,8 @@ ns_create_font_panel_buttons (id target, SEL select, SEL cancel_action)
EVENT_INIT (ie);
ie.kind = DRAG_N_DROP_EVENT;
- ie.arg = Fcons (type_sym, Fcons (operations, strings));
+ ie.arg = Fcons (type_sym, Fcons (operations,
+ strings));
XSETINT (ie.x, x);
XSETINT (ie.y, y);
XSETFRAME (ie.frame_or_window, emacsframe);