unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 33035@debbugs.gnu.org, Philipp Stephani <p.stephani2@gmail.com>,
	Alan Third <alan@idiocy.org>
Subject: bug#33035: 27.0.50; Deprecated macOS functions
Date: Sun, 10 Jan 2021 14:25:28 +0100	[thread overview]
Message-ID: <1AE9CD2F-44C2-45DE-96CD-ED585E70E8DC@acm.org> (raw)
In-Reply-To: <m2a7nhg8vm.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 144 bytes --]

Not sure if this is the right way to go about it, but it does silence the remaining warnings about NSFilenamesPboardType.
Tested on Mojave.


[-- Attachment #2: ns-pboard-warning.diff --]
[-- Type: application/octet-stream, Size: 1708 bytes --]

diff --git a/src/nsterm.m b/src/nsterm.m
index 2defb9e2ee..2ca3f6f3ff 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -5602,7 +5602,7 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes.
   ns_drag_types = [[NSArray arrayWithObjects:
                             NSPasteboardTypeString,
                             NSPasteboardTypeTabularText,
-                            NSFilenamesPboardType,
+                            NSPasteboardTypeFileURL,
                             NSPasteboardTypeURL, nil] retain];
 
   /* If fullscreen is in init/default-frame-alist, focus isn't set
@@ -8533,23 +8533,17 @@ -(BOOL)performDragOperation: (id <NSDraggingInfo>) sender
     {
       return NO;
     }
-  /* FIXME: NSFilenamesPboardType is deprecated in 10.14, but the
-     NSURL method can only handle one file at a time.  Stick with the
-     existing code at the moment.  */
-  else if ([type isEqualToString: NSFilenamesPboardType])
+  else if ([type isEqualToString: NSPasteboardTypeFileURL])
     {
-      NSArray *files;
-      NSEnumerator *fenum;
-      NSString *file;
-
-      if (!(files = [pb propertyListForType: type]))
-        return NO;
-
       type_sym = Qfile;
 
-      fenum = [files objectEnumerator];
-      while ( (file = [fenum nextObject]) )
-        strings = Fcons ([file lispString], strings);
+      NSArray *a = [pb readObjectsForClasses: @[[NSURL self]]
+                                     options: nil];
+      NSEnumerator *ae = [a objectEnumerator];
+      NSURL *u;
+      while ((u = [ae nextObject])) {
+        strings = Fcons ([[u path] lispString], strings);
+      }
     }
   else if ([type isEqualToString: NSPasteboardTypeURL])
     {

  parent reply	other threads:[~2021-01-10 13:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-13 15:32 bug#33035: 27.0.50; Deprecated macOS functions Philipp
2020-08-16 17:45 ` Lars Ingebrigtsen
2021-01-10 13:25 ` Mattias Engdegård [this message]
2021-01-10 15:43   ` Alan Third
2021-01-10 16:22     ` Alan Third
2021-01-10 16:53       ` Mattias Engdegård
2021-01-18 12:03         ` Mattias Engdegård
2021-01-18 20:58           ` Alan Third
2021-01-10 16:22     ` Mattias Engdegård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1AE9CD2F-44C2-45DE-96CD-ED585E70E8DC@acm.org \
    --to=mattiase@acm.org \
    --cc=33035@debbugs.gnu.org \
    --cc=alan@idiocy.org \
    --cc=larsi@gnus.org \
    --cc=p.stephani2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).