Window restoration imposes tab bar even if window tabbing disabled

Originator:jalkut
Number:rdar://28578742 Date Originated:01-Oct-2016 01:29 PM
Status:Open Resolved:
Product:macOS Product Version:
Classification: Reproducible:
 
Summary:
An app that has explicitly disabled window tabbing by setting:

NSWindow.allowsAutomaticWindowTabbing = NO;

Will nonetheless have window tabbing imposed on a document window that is restored by default document restoration.

Steps to Reproduce:
1. Open attached sample project.
2. Build and run.
3. Create a new  document if needed.
4. Select View -> Show Tab Bar
5. Quit, leaving the document open
6. Uncomment the line of code in AppDelegate.m that sets the NSWindow.allowsAutomaticWindowTabbing property to NO
7. Build and run the app.

Expected Results:
The window should not be allowed to show tabbing UI. 

Actual Results:
The window shows window tabbing UI even though it has been explicitly forbidden.

Version:
10.12 (16A323) 

Notes:
I think it must be because the window restoration happens so early in launch, that the setting to allowsAutomaticWindowTabbing is too late to catch the creation of the restored document window. Setting the NSWindow property in main.m does prevent the UI from being shown.

The problem is made worse by the fact that with tabbing disabled, there is no menu item to hide the window tabbing bar. It could put a user in a predicament where, if an app previously allowed window tabbing but then disabled it, they will always be cursed with window tabbing on restored documents, and never have any way of turning it off.

Perhaps when the window NSWindow.allowsAutomaticWindowTabbing is set to NO, any open windows that have tabbing enabled should have it immediately set to disabled?
 

Configuration:


Attachments:
'WindowTabbingBug.zip' was successfully uploaded.

The gist of WindowTabbingBug.zip is that in the project's AppDelegate.m, the following method is implemented:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {

	// 1. Run the app once and turn on the tab bar using "View" -> "Show Tab Bar"
	// 2. Quit the app with the document window open
	// 3. Uncomment the following line.
	// 4. Rebuild and run the app

	//NSWindow.allowsAutomaticWindowTabbing = NO;
}

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!