unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* macOS fullscreen crashes
@ 2018-11-30 11:04 Alan Third
  2018-12-01 11:21 ` Charles A. Roelli
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Third @ 2018-11-30 11:04 UTC (permalink / raw)
  To: emacs-devel

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

We still occasionally receive bug reports about crashes on macOS
10.12+ caused by macOS turning fullscreen windows into ‘tabbed’
windows. I’ve also seen it discussed in a few places round the web.

We currently have a compile‐time check to include code that fixes this
on 10.12+, and it can be over‐ridden if Emacs is being built on an
older version of macOS but is expected to run on 10.12+, however it is
clearly not doing the job.

I propose for Emacs 26.2 (and the master branch) that we remove the
compile‐time check and just use a run‐time check. This will result in
a compiler warning on macOS 10.11 and below, but will prevent crashes
everywhere.

Any thoughts?

Patch attached.
-- 
Alan Third

[-- Attachment #2: 0001-Remove-macOS-version-checks-for-tabbed-frames-bug-33.patch --]
[-- Type: text/plain, Size: 1525 bytes --]

From 4df81ee31f0f2cf9ca4f906d753cf7dd134cf64d Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Fri, 30 Nov 2018 10:50:44 +0000
Subject: [PATCH] Remove macOS version checks for tabbed frames (bug#33118)

* src/nsterm.m ([EmacsView initFrameFromEmacs:]) [NS_IMPL_COCOA]:
Remove compile-time version checks.
---
 src/nsterm.m | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index 948dd1da2e..7a751b3868 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7397,14 +7397,16 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f
   [NSApp registerServicesMenuSendTypes: ns_send_types
                            returnTypes: [NSArray array]];
 
+#if defined (NS_IMPL_COCOA)
   /* 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_MAX_ALLOWED >= 101200
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
+     Currently it only happens by accident and is buggy anyway.
+
+     This will cause a build warning on older versions of macOS, but
+     limiting it to just 10.12+ has resulted in a number of crash
+     reports where Emacs was built on an older version of macOS than
+     it's being used on.  */
   if ([win respondsToSelector: @selector(setTabbingMode:)])
-#endif
     [win setTabbingMode: NSWindowTabbingModeDisallowed];
 #endif
 
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: macOS fullscreen crashes
  2018-11-30 11:04 macOS fullscreen crashes Alan Third
@ 2018-12-01 11:21 ` Charles A. Roelli
  2018-12-01 13:18   ` Alan Third
  0 siblings, 1 reply; 9+ messages in thread
From: Charles A. Roelli @ 2018-12-01 11:21 UTC (permalink / raw)
  To: Alan Third; +Cc: emacs-devel

> Date: Fri, 30 Nov 2018 11:04:58 +0000
> From: Alan Third <alan@idiocy.org>
> 
> We still occasionally receive bug reports about crashes on macOS
> 10.12+ caused by macOS turning fullscreen windows into ‘tabbed’
> windows. I’ve also seen it discussed in a few places round the web.
> 
> We currently have a compile‐time check to include code that fixes this
> on 10.12+, and it can be over‐ridden if Emacs is being built on an
> older version of macOS but is expected to run on 10.12+, however it is
> clearly not doing the job.

Do you know why?  It sounds like people are using builds made on an
older macOS without setting MAC_OS_X_VERSION_MIN_REQUIRED and
MAC_OS_X_VERSION_MAX_ALLOWED appropriately.  Maybe we should call out
in NEWS (in branch emacs-26, that is) and/or nextstep/README how
exactly to do this.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: macOS fullscreen crashes
  2018-12-01 11:21 ` Charles A. Roelli
@ 2018-12-01 13:18   ` Alan Third
  2018-12-01 14:45     ` Charles A. Roelli
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Third @ 2018-12-01 13:18 UTC (permalink / raw)
  To: Charles A. Roelli; +Cc: emacs-devel

On Sat, Dec 01, 2018 at 12:21:13PM +0100, Charles A. Roelli wrote:
> > Date: Fri, 30 Nov 2018 11:04:58 +0000
> > From: Alan Third <alan@idiocy.org>
> > 
> > We still occasionally receive bug reports about crashes on macOS
> > 10.12+ caused by macOS turning fullscreen windows into ‘tabbed’
> > windows. I’ve also seen it discussed in a few places round the web.
> > 
> > We currently have a compile‐time check to include code that fixes this
> > on 10.12+, and it can be over‐ridden if Emacs is being built on an
> > older version of macOS but is expected to run on 10.12+, however it is
> > clearly not doing the job.
> 
> Do you know why?  It sounds like people are using builds made on an
> older macOS without setting MAC_OS_X_VERSION_MIN_REQUIRED and
> MAC_OS_X_VERSION_MAX_ALLOWED appropriately.  Maybe we should call out
> in NEWS (in branch emacs-26, that is) and/or nextstep/README how
> exactly to do this.

Yes, you’re right, we should probably try education first.

BTW, it looks like there are two different sets of macros for this,
there are the ones we’re using, and newer ones defined in
Availability.h that have two underscores at the start. It looks like
the newer ones are a bit neater. If you use

    -mmacosx-version-min=10.x

it disables a great many deprecation warnings that you get if you just
set MAC_OS_X_VERSION_MIN_REQUIRED like we do.

I don’t think we should be changing anything at the moment, and I
don’t know if those macros are available on macOS 10.6 so they may not
be much use to us, but it is nice how it makes the compiler output a
lot quieter.

So, anyway, perhaps we want to put something like this in
nextstep/INSTALL:

Targeting different macOS versions
----------------------------------

The Emacs build process automatically enables or disables macOS
features according to the version of macOS it is being built on. It is
possible to over-ride this automatic configuration if you are
targeting a different version of macOS, or wish to build one
executable that is able to enable or disable features at run-time.

To build a version compatible with an older version of macOS use this
flag:

  -DMAC_OS_X_VERSION_MIN_REQUIRED=x

and to build for a newer version of macOS:

  -DMAC_OS_X_VERSION_MAX_ALLOWED=x

For example, to enable run-time checks for features available between
macOS 10.6, and 10.12 inclusive:

  ./configure --with-ns CFLAGS="-DMAC_OS_X_VERSION_MIN_REQUIRED=1060 \
    -DMAC_OS_X_VERSION_MAX_ALLOWED=101200 -g3 -O2"

The macOS version numbers are formatted as 10x0 for macOS up to 10.10,
and 10xx00 for macOS 10.10 and above. A full list is available in
/usr/include/AvailabilityMacros.h.
-- 
Alan Third



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: macOS fullscreen crashes
  2018-12-01 13:18   ` Alan Third
@ 2018-12-01 14:45     ` Charles A. Roelli
  2018-12-01 16:09       ` Alan Third
  0 siblings, 1 reply; 9+ messages in thread
From: Charles A. Roelli @ 2018-12-01 14:45 UTC (permalink / raw)
  To: Alan Third; +Cc: emacs-devel

> Date: Sat, 1 Dec 2018 13:18:51 +0000
> From: Alan Third <alan@idiocy.org>
>
> BTW, it looks like there are two different sets of macros for this,
> there are the ones we’re using, and newer ones defined in
> Availability.h that have two underscores at the start. It looks like
> the newer ones are a bit neater. If you use
> 
>     -mmacosx-version-min=10.x
> 
> it disables a great many deprecation warnings that you get if you just
> set MAC_OS_X_VERSION_MIN_REQUIRED like we do.
> 
> I don’t think we should be changing anything at the moment, and I
> don’t know if those macros are available on macOS 10.6 so they may not
> be much use to us, but it is nice how it makes the compiler output a
> lot quieter.

__MAC_OS_X_VERSION_MIN_REQUIRED and __MAC_OS_X_VERSION_MAX_ALLOWED are
available in 10.6 (and the use of, e.g. -mmacosx-version-min=10.x, is
recommended in Availability.h).  But it's unlikely that FSF GCC would
support the "-mmacosx-version-min" flag, so we may not be able to use
it.
 
> So, anyway, perhaps we want to put something like this in
> nextstep/INSTALL:
> 
> Targeting different macOS versions
> ----------------------------------
> 
> The Emacs build process automatically enables or disables macOS
> features according to the version of macOS it is being built on. It is
> possible to over-ride this automatic configuration if you are
> targeting a different version of macOS, or wish to build one
> executable that is able to enable or disable features at run-time.
> 
> To build a version compatible with an older version of macOS use this
> flag:
> 
>   -DMAC_OS_X_VERSION_MIN_REQUIRED=x
> 
> and to build for a newer version of macOS:
> 
>   -DMAC_OS_X_VERSION_MAX_ALLOWED=x
> 
> For example, to enable run-time checks for features available between
> macOS 10.6, and 10.12 inclusive:
> 
>   ./configure --with-ns CFLAGS="-DMAC_OS_X_VERSION_MIN_REQUIRED=1060 \
>     -DMAC_OS_X_VERSION_MAX_ALLOWED=101200 -g3 -O2"
> 
> The macOS version numbers are formatted as 10x0 for macOS up to 10.10,
> and 10xx00 for macOS 10.10 and above. A full list is available in
> /usr/include/AvailabilityMacros.h.

Thanks, this looks good.  We should also mention in NEWS that this is
a change in build behavior from previous Emacs versions (and that this
change was originally made in Emacs 26.1 but not mentioned in its NEWS).



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: macOS fullscreen crashes
  2018-12-01 14:45     ` Charles A. Roelli
@ 2018-12-01 16:09       ` Alan Third
  2018-12-01 16:50         ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Third @ 2018-12-01 16:09 UTC (permalink / raw)
  To: Charles A. Roelli; +Cc: emacs-devel

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

On Sat, Dec 01, 2018 at 03:45:57PM +0100, Charles A. Roelli wrote:
> > Date: Sat, 1 Dec 2018 13:18:51 +0000
> > From: Alan Third <alan@idiocy.org>
> >
> > BTW, it looks like there are two different sets of macros for this,
> > there are the ones we’re using, and newer ones defined in
> > Availability.h that have two underscores at the start. It looks like
> > the newer ones are a bit neater. If you use
> > 
> >     -mmacosx-version-min=10.x
> > 
> > it disables a great many deprecation warnings that you get if you just
> > set MAC_OS_X_VERSION_MIN_REQUIRED like we do.
> > 
> > I don’t think we should be changing anything at the moment, and I
> > don’t know if those macros are available on macOS 10.6 so they may not
> > be much use to us, but it is nice how it makes the compiler output a
> > lot quieter.
> 
> __MAC_OS_X_VERSION_MIN_REQUIRED and __MAC_OS_X_VERSION_MAX_ALLOWED are
> available in 10.6 (and the use of, e.g. -mmacosx-version-min=10.x, is
> recommended in Availability.h).  But it's unlikely that FSF GCC would
> support the "-mmacosx-version-min" flag, so we may not be able to use
> it.

Good to know. Doessetting __MAC_OS_X_VERSION_MIN_REQUIRED directly
work just as well?

> Thanks, this looks good.  We should also mention in NEWS that this is
> a change in build behavior from previous Emacs versions (and that this
> change was originally made in Emacs 26.1 but not mentioned in its NEWS).

I’m not sure that there’s any reason to mention that it was available
in 26.1 but undocumented. Is that standard practice?

Anyway, patch attached.
-- 
Alan Third

[-- Attachment #2: 0001-Add-notes-about-cross-compiling-macOS-versions.patch --]
[-- Type: text/plain, Size: 2023 bytes --]

From 532abecb72f12c83c2b2f129fbc5f56387f5895c Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Sat, 1 Dec 2018 13:36:58 +0000
Subject: [PATCH] ; Add notes about cross-compiling macOS versions

---
 etc/NEWS         |  3 +++
 nextstep/INSTALL | 29 +++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index 399508cacc..103dbf127e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -178,6 +178,9 @@ optional argument to do so.
 \f
 * Changes in Emacs 26.2 on Non-Free Operating Systems
 
+** macOS features can now be detected at at run-time as well as at
+build-time.  See nextstep/INSTALL for details.
+
 \f
 * Installation Changes in Emacs 26.1
 
diff --git a/nextstep/INSTALL b/nextstep/INSTALL
index 64f8f8fcf7..726a897c37 100644
--- a/nextstep/INSTALL
+++ b/nextstep/INSTALL
@@ -45,6 +45,35 @@ files will be installed under whatever 'prefix' is set to (defaults to
 require 'sudo' for "make install").
 
 
+Targeting different macOS versions
+----------------------------------
+
+The Emacs build process automatically enables or disables macOS
+features according to the version of macOS it is being built on.  It
+is possible to override this automatic configuration if you are
+targeting a different version of macOS, or wish to build one
+executable that is able to enable or disable features at run-time.
+
+To build a version compatible with an older version of macOS use this
+flag:
+
+  -DMAC_OS_X_VERSION_MIN_REQUIRED=x
+
+and to build for a newer version of macOS:
+
+  -DMAC_OS_X_VERSION_MAX_ALLOWED=x
+
+For example, to enable run-time checks for features available between
+macOS 10.6, and 10.12 inclusive:
+
+  ./configure --with-ns CFLAGS="-DMAC_OS_X_VERSION_MIN_REQUIRED=1060 \
+    -DMAC_OS_X_VERSION_MAX_ALLOWED=101200 -g3 -O2"
+
+The macOS version numbers are formatted as 10x0 for macOS up to 10.10,
+and 10xx00 for macOS 10.10 and above.  A full list is provided in
+/usr/include/AvailabilityMacros.h.
+
+
 Installation
 ------------
 
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: macOS fullscreen crashes
  2018-12-01 16:09       ` Alan Third
@ 2018-12-01 16:50         ` Eli Zaretskii
  2018-12-01 17:13           ` Alan Third
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2018-12-01 16:50 UTC (permalink / raw)
  To: Alan Third; +Cc: charles, emacs-devel

> Date: Sat, 1 Dec 2018 16:09:43 +0000
> From: Alan Third <alan@idiocy.org>
> Cc: emacs-devel@gnu.org
> 
> I’m not sure that there’s any reason to mention that it was available
> in 26.1 but undocumented. Is that standard practice?

Yes.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: macOS fullscreen crashes
  2018-12-01 16:50         ` Eli Zaretskii
@ 2018-12-01 17:13           ` Alan Third
  2018-12-01 17:46             ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Third @ 2018-12-01 17:13 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: charles, emacs-devel

On Sat, Dec 01, 2018 at 06:50:07PM +0200, Eli Zaretskii wrote:
> > Date: Sat, 1 Dec 2018 16:09:43 +0000
> > From: Alan Third <alan@idiocy.org>
> > Cc: emacs-devel@gnu.org
> > 
> > I’m not sure that there’s any reason to mention that it was available
> > in 26.1 but undocumented. Is that standard practice?
> 
> Yes.

OK, after reading the news file more thoroughly I’ve updated it to this:

** macOS features can now be detected at run-time as well as at
build-time. See nextstep/INSTALL for details. (This change was
actually made in Emacs 26.1, but was undocumented and not called out
in its NEWS.)

-- 
Alan Third



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: macOS fullscreen crashes
  2018-12-01 17:13           ` Alan Third
@ 2018-12-01 17:46             ` Eli Zaretskii
  2018-12-01 19:02               ` Alan Third
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2018-12-01 17:46 UTC (permalink / raw)
  To: Alan Third; +Cc: charles, emacs-devel

> Date: Sat, 1 Dec 2018 17:13:36 +0000
> From: Alan Third <alan@idiocy.org>
> Cc: charles@aurox.ch, emacs-devel@gnu.org
> 
> ** macOS features can now be detected at run-time as well as at
> build-time. See nextstep/INSTALL for details. (This change was
> actually made in Emacs 26.1, but was undocumented and not called out
> in its NEWS.)

This is fine, but please leave 2 spaces between sentences.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: macOS fullscreen crashes
  2018-12-01 17:46             ` Eli Zaretskii
@ 2018-12-01 19:02               ` Alan Third
  0 siblings, 0 replies; 9+ messages in thread
From: Alan Third @ 2018-12-01 19:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: charles, emacs-devel

On Sat, Dec 01, 2018 at 07:46:16PM +0200, Eli Zaretskii wrote:
> > Date: Sat, 1 Dec 2018 17:13:36 +0000
> > From: Alan Third <alan@idiocy.org>
> > Cc: charles@aurox.ch, emacs-devel@gnu.org
> > 
> > ** macOS features can now be detected at run-time as well as at
> > build-time. See nextstep/INSTALL for details. (This change was
> > actually made in Emacs 26.1, but was undocumented and not called out
> > in its NEWS.)
> 
> This is fine, but please leave 2 spaces between sentences.

Pushed to emacs-26. Thanks.
-- 
Alan Third



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-12-01 19:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-30 11:04 macOS fullscreen crashes Alan Third
2018-12-01 11:21 ` Charles A. Roelli
2018-12-01 13:18   ` Alan Third
2018-12-01 14:45     ` Charles A. Roelli
2018-12-01 16:09       ` Alan Third
2018-12-01 16:50         ` Eli Zaretskii
2018-12-01 17:13           ` Alan Third
2018-12-01 17:46             ` Eli Zaretskii
2018-12-01 19:02               ` Alan Third

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).