all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Philipp <p.stephani2@gmail.com>
Cc: 29643@debbugs.gnu.org
Subject: bug#29643: [PATCH] Silence macOS 10.13 deprecation notices (Bug#29643)
Date: Sun, 10 Dec 2017 20:27:37 +0000	[thread overview]
Message-ID: <20171210202737.GA78649@breton.holly.idiocy.org> (raw)
In-Reply-To: <m2609eado0.fsf@gmail.com>

* src/nsfns.m (Fx_display_backing_store):
(Fx_display_save_under): Don't use NSBackingStoreRetained or
NSBackingStoreNonretained on macOS 10.13+.
* src/nsselect.m (symbol_to_nsstring):
(ns_string_to_symbol):
(nxatoms_of_nsselect): Replace NSGeneralPboard with
NSPasteboardNameGeneral.
* src/nsterm.h: #define NSPasteboardNameGeneral to NSGeneralPboard on
GNUstep and macOS < 10.13.
* src/nsterm.m (EmacsView::resetCursorRects):
(EmacsScroller::resetCursorRects): Don't use setOnMouseEntered on
macOS 10.13+.
---
 src/nsfns.m    |  4 ++++
 src/nsselect.m |  8 ++++----
 src/nsterm.h   |  5 +++++
 src/nsterm.m   | 17 +++++++++++++++--
 4 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/src/nsfns.m b/src/nsfns.m
index 8172268167..064b476fb4 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1896,10 +1896,12 @@ and GNUstep implementations ("distributor-specific release
     {
     case NSBackingStoreBuffered:
       return intern ("buffered");
+#if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MIN_REQUIRED < 101300
     case NSBackingStoreRetained:
       return intern ("retained");
     case NSBackingStoreNonretained:
       return intern ("non-retained");
+#endif
     default:
       error ("Strange value for backingType parameter of frame");
     }
@@ -1953,9 +1955,11 @@ and GNUstep implementations ("distributor-specific release
     case NSBackingStoreBuffered:
       return Qt;
 
+#if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MIN_REQUIRED < 101300
     case NSBackingStoreRetained:
     case NSBackingStoreNonretained:
       return Qnil;
+#endif
 
     default:
       error ("Strange value for backingType parameter of frame");
diff --git a/src/nsselect.m b/src/nsselect.m
index 067c7788e8..d1ce9437a7 100644
--- a/src/nsselect.m
+++ b/src/nsselect.m
@@ -36,7 +36,7 @@ Updated by Christian Limpach (chris@nice.ch)
 
 static Lisp_Object Vselection_alist;
 
-/* NSGeneralPboard is pretty much analogous to X11 CLIPBOARD */
+/* NSPasteboardNameGeneral is pretty much analogous to X11 CLIPBOARD */
 static NSString *NXPrimaryPboard;
 static NSString *NXSecondaryPboard;
 
@@ -54,7 +54,7 @@ Updated by Christian Limpach (chris@nice.ch)
 symbol_to_nsstring (Lisp_Object sym)
 {
   CHECK_SYMBOL (sym);
-  if (EQ (sym, QCLIPBOARD))   return NSGeneralPboard;
+  if (EQ (sym, QCLIPBOARD))   return NSPasteboardNameGeneral;
   if (EQ (sym, QPRIMARY))     return NXPrimaryPboard;
   if (EQ (sym, QSECONDARY))   return NXSecondaryPboard;
   if (EQ (sym, QTEXT))        return NSStringPboardType;
@@ -70,7 +70,7 @@ Updated by Christian Limpach (chris@nice.ch)
 static Lisp_Object
 ns_string_to_symbol (NSString *t)
 {
-  if ([t isEqualToString: NSGeneralPboard])
+  if ([t isEqualToString: NSPasteboardNameGeneral])
     return QCLIPBOARD;
   if ([t isEqualToString: NXPrimaryPboard])
     return QPRIMARY;
@@ -469,7 +469,7 @@ Updated by Christian Limpach (chris@nice.ch)
   pasteboard_changecount
     = [[NSMutableDictionary
 	 dictionaryWithObjectsAndKeys:
-	     [NSNumber numberWithLong:0], NSGeneralPboard,
+	     [NSNumber numberWithLong:0], NSPasteboardNameGeneral,
 	     [NSNumber numberWithLong:0], NXPrimaryPboard,
 	     [NSNumber numberWithLong:0], NXSecondaryPboard,
 	     [NSNumber numberWithLong:0], NSStringPboardType,
diff --git a/src/nsterm.h b/src/nsterm.h
index c81bf5fb63..e669c95931 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -1322,5 +1322,10 @@ enum NSWindowTabbingMode
     NSWindowTabbingModePreferred,
     NSWindowTabbingModeDisallowed
   };
+#endif /* !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_12)  */
+
+#if !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_13)
+/* Deprecated in macOS 10.13.  */
+#define NSPasteboardNameGeneral NSGeneralPboard
 #endif
 #endif	/* HAVE_NS */
diff --git a/src/nsterm.m b/src/nsterm.m
index 50e06c94d4..07ac8f978f 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -6016,7 +6016,13 @@ - (void)resetCursorRects
 
   if (!NSIsEmptyRect (visible))
     [self addCursorRect: visible cursor: currentCursor];
-  [currentCursor setOnMouseEntered: YES];
+
+#if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MIN_REQUIRED < 101300
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101300
+  if ([currentCursor respondsToSelector: @selector(setOnMouseEntered)])
+#endif
+    [currentCursor setOnMouseEntered: YES];
+#endif
 }
 
 
@@ -8746,7 +8752,14 @@ - (void)resetCursorRects
 
   if (!NSIsEmptyRect (visible))
     [self addCursorRect: visible cursor: [NSCursor arrowCursor]];
-  [[NSCursor arrowCursor] setOnMouseEntered: YES];
+
+#if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MIN_REQUIRED < 101300
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101300
+  if ([[NSCursor arrowCursor] respondsToSelector:
+                                @selector(setOnMouseEntered)])
+#endif
+    [[NSCursor arrowCursor] setOnMouseEntered: YES];
+#endif
 }
 
 
-- 

Hi Philipp, can you please check whether this patch silences the
deprecation notices?

I’m still on 10.12, so I can’t check myself.

-- 
Alan Third





  reply	other threads:[~2017-12-10 20:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-10 13:57 bug#29643: 27.0.50; Deprecation warnings on macOS High Sierra Philipp
2017-12-10 20:27 ` Alan Third [this message]
2017-12-16 18:13   ` bug#29643: [PATCH] Silence macOS 10.13 deprecation notices (Bug#29643) Philipp Stephani
2017-12-17  0:08     ` Alan Third

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

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

  git send-email \
    --in-reply-to=20171210202737.GA78649@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=29643@debbugs.gnu.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.