emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: src/nsterm.m: fix window tabbing on macOS


From: Paul W. Rankin
Subject: Re: src/nsterm.m: fix window tabbing on macOS
Date: Sun, 16 May 2021 19:16:54 +1000
User-agent: Purely Mail via Roundcube/1.4.10

On 2021-05-14 07:05, Alan Third wrote:
On Thu, May 13, 2021 at 03:46:54PM +1000, Paul W. Rankin via Emacs
development discussions. wrote:
On 2021-05-13 07:23, Alan Third wrote:
You're right and I can't find another macOS app with a tab bar that behaves
the way Emacs.app does, so I gotta assume there is something somewhere
overriding the Cocoa window manager behaviour. But I'm really only qualified to guess; I looked through nsterm.m and changed a few suspected BOOL values and recompiled a few times but nothing had an effect on the hidden tab bar.

Relatedly, tool-bar-mode is in the same boat; hidden in full screen, but
probably shouldn't be.

Search in nsterm.m for "autohide", there are a couple of places where
hiding various bits and bobs is done, all related to fullscreen
afaict.

I'm not on a Mac just now or I'd try removing them all to see what it
does.

Looks like you're on the money!

I've attached two patches: 0001 is to remove the explicit setting of NSWindowTabbingModeDisallowed; 0002 allows visibility of the toolbar and tab bar in fullscreen (screenshot attached), but reliably causes a segmentation fault with the following steps:

1. System Preferences > Dock > Prefer tabs... [Always]
2. $ emacs -Q
3. M-x toggle-frame-full
4. M-x make-frame
5. M-x delete-frame

Attached crash.log.

Interestingly, calling delete-other-frames does not trigger a crash and when in windowed (non-fullscreen) a crash is only triggered with the following:

1. System Preferences > Dock > Prefer tabs... [Always]
2. $ emacs -Q
3. M-x make-frame
4. M-x make-frame
5. click close background tab
6. wait for animation to finish
7. click close foreground tab

As I said, I suspect this change could be contentious, so we may want
to provide a variable to enable or disable it.

> If you just remove it completely does it do anything different from
> your patch?

It appears that removing the code has the same effect as
NSWindowTabbingModeAutomatic. I like minimalism so happy to just remove it.

👍

Let's view these as two separate but related changes, one to remove the explicit setting of NSWindowTabbingModeDisallowed (patch 0001), the other to fix the code that's preventing toolbar visibility when in fullscreen (WIP patch 0002). I think the former is easy and not contentious, whereas the latter -- obviously once it's not crashing -- may be another story.

There are three positions someone could take:

1. wants tabs in all macOS apps including Emacs.app
2. does not want tabs in any macOS apps including Emacs.app
3. wants tabs in all other macOS except for Emacs.app

Anyone in categories 1 and 2 will be covered by the option in System Preferences. Given that all I think we're doing here is removing old barrier code to have Emacs function with an OS's native window manager, anyone in the third category would be putting the onus on themselves to write code for additional functionality.

Attachment: 0001-src-nsterm.m-fix-window-tabbing-on-macOS.patch
Description: Text Data

Attachment: 0002-WIP-src-nsterm.m-allow-toolbar-visibility-in-fullscr.patch
Description: Text Data

Attachment: crash.log
Description: Text document

Attachment: ns-fullscreen-with-toolbar.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]