From: Alan Third <alan@idiocy.org>
To: "Charles A. Roelli" <charles@aurox.ch>
Cc: Paul Michael Reilly <pmr@pajato.com>,
Jean-Christophe Helary <jean.christophe.helary@gmail.com>,
Anders Lindgren <andlind@gmail.com>,
Emacs-Devel devel <emacs-devel@gnu.org>
Subject: Re: Mac OS Sierra tab feature breaks C-x 5 2
Date: Tue, 18 Jul 2017 23:16:29 +0100 [thread overview]
Message-ID: <20170718221629.GA55506@breton.holly.idiocy.org> (raw)
In-Reply-To: <e6be1e89-14a9-da0a-7d15-3f29dd37e91f@aurox.ch>
[-- Attachment #1: Type: text/plain, Size: 408 bytes --]
On Tue, Jul 18, 2017 at 08:33:05PM +0200, Charles A. Roelli wrote:
> It does seem to be gcc:
>
> (snippet from output of 'make V=1' when compiling src/nsterm.m):
> gcc -std=gnu99 -c -Demacs -I. -I. -I../lib -I../lib -D_REENTRANT -I
> [...] -MMD -MF deps/nsterm.d -MP -O0 -g3 nsterm.m
Can you check whether the attached patch results in a compilation
warning from nsterm.m for you, please?
--
Alan Third
[-- Attachment #2: 0001-Use-a-run-time-check-for-macOS-Sierra-tabbing-suppor.patch --]
[-- Type: text/plain, Size: 3081 bytes --]
From dd73f985107937ee1c593f0878bdd5b01178af1c Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Thu, 6 Jul 2017 23:10:49 +0100
Subject: [PATCH] Use a run-time check for macOS Sierra tabbing support
* src/nsterm.m (initFrameFromEmacs) [NS_IMPL_COCOA]: Switch from
compile-time check to run-time.
* src/nsterm.h (NSWindowTabbingMode): Define in pre-Sierra macOS.
(NS_SILENCE_MISSING_METHOD_WARNING_BEGIN,
NS_SILENCE_MISSING_METHOD_WARNING_BEGIN_END): Add #defines for
silencing known missing method warnings.
---
src/nsterm.h | 33 +++++++++++++++++++++++++++++++++
src/nsterm.m | 8 +++++---
2 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/src/nsterm.h b/src/nsterm.h
index 0f1b36db7b..c5b4b17eed 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -1317,6 +1317,39 @@ extern char gnustep_base_version[]; /* version tracking */
#ifdef __OBJC__
typedef NSUInteger NSWindowStyleMask;
#endif
+
+/* Window tabbing mode enums are new too. */
+enum NSWindowTabbingMode
+ {
+ NSWindowTabbingModeAutomatic,
+ NSWindowTabbingModePreferred,
+ NSWindowTabbingModeDisallowed
+ };
+#endif
+
+/* Surround code with the following macros to silence a missing method
+ * warning from the compiler. This is useful when testing whether a
+ * method is available on an object, and then calling it if so.
+ *
+ * if ([obj respondsToSelector: @selector(methodName)])
+ * [obj methodName];
+ *
+ * Where obj doesn't have a selector methodName, the compiler will
+ * issue a warning. Sometimes we want to build against libraries
+ * where we don't know if the method exists, for example when a new
+ * version of Cocoa adds or removes a method.
+ */
+#if defined (__GNUC__) && !defined (__clang__)
+/* gcc doesn't seem to have any way to silence this warning. */
+#define NS_SILENCE_MISSING_METHOD_WARNING_BEGIN
+#define NS_SILENCE_MISSING_METHOD_WARNING_BEGIN_END
+
+#elif defined (__clang__)
+#define NS_SILENCE_MISSING_METHOD_WARNING_BEGIN \
+ _Pragma ("clang diagnostic push") \
+ _Pragma ("clang diagnostic ignored \"-Wobjc-method-access\"")
+#define NS_SILENCE_MISSING_METHOD_WARNING_BEGIN_END \
+ _Pragma ("clang diagnostic pop")
#endif
#endif /* HAVE_NS */
diff --git a/src/nsterm.m b/src/nsterm.m
index a3c7031331..e1ce05b978 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7091,9 +7091,11 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f
/* macOS Sierra automatically enables tabbed windows. We can't
allow this to be enabled until it's available on a Free system.
Currently it only happens by accident and is buggy anyway. */
-#if defined (NS_IMPL_COCOA) && \
- MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
- [win setTabbingMode: NSWindowTabbingModeDisallowed];
+#ifdef NS_IMPL_COCOA
+ NS_SILENCE_MISSING_METHOD_WARNING_BEGIN
+ if ([win respondsToSelector: @selector(setTabbingMode:)])
+ [win setTabbingMode: NSWindowTabbingModeDisallowed];
+ NS_SILENCE_MISSING_METHOD_WARNING_BEGIN_END
#endif
ns_window_num++;
--
2.12.0
next prev parent reply other threads:[~2017-07-18 22:16 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-06 11:29 Mac OS Sierra tab feature breaks C-x 5 2 Paul Michael Reilly
2017-07-06 12:14 ` Jean-Christophe Helary
2017-07-06 12:46 ` Sebastian Christ
2017-07-06 12:53 ` Alan Third
2017-07-06 14:35 ` Alan Third
2017-07-06 15:05 ` Jean-Christophe Helary
2017-07-06 17:42 ` Alan Third
2017-07-06 22:16 ` Alan Third
2017-07-10 19:17 ` Anders Lindgren
2017-07-10 19:52 ` Alan Third
2017-07-10 20:22 ` Anders Lindgren
2017-07-12 18:23 ` Alan Third
2017-07-12 21:20 ` Anders Lindgren
2017-07-13 20:22 ` Alan Third
2017-07-16 18:43 ` Anders Lindgren
2017-07-16 23:01 ` Alan Third
2017-07-17 20:09 ` Charles A. Roelli
2017-07-18 6:06 ` Anders Lindgren
2017-07-18 18:33 ` Charles A. Roelli
2017-07-18 22:16 ` Alan Third [this message]
2017-07-19 4:57 ` Charles A. Roelli
2017-07-21 20:31 ` Anders Lindgren
2017-07-22 11:22 ` Alan Third
2017-07-23 12:17 ` NS runtime feature detection (was: Mac OS Sierra tab feature breaks C-x 5 2) Alan Third
2017-07-24 19:02 ` NS runtime feature detection Charles A. Roelli
2017-07-24 20:45 ` Alan Third
2017-07-23 22:35 ` Mac OS Sierra tab feature breaks C-x 5 2 Tim Cross
-- strict thread matches above, loose matches on Subject: below --
2017-07-06 17:24 Matthew Bauer
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=20170718221629.GA55506@breton.holly.idiocy.org \
--to=alan@idiocy.org \
--cc=andlind@gmail.com \
--cc=charles@aurox.ch \
--cc=emacs-devel@gnu.org \
--cc=jean.christophe.helary@gmail.com \
--cc=pmr@pajato.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).