OS X 10.10: Space items in NSToolbar cause unsatisfiable constraints in full-screen mode
| Originator: | kastansn | ||
| Number: | rdar://17589204 | Date Originated: | 2014-07-08 |
| Status: | Closed | Resolved: | |
| Product: | OS X SDK | Product Version: | 10.10 |
| Classification: | UI/Usability | Reproducible: | Always |
Summary:
Entering full-screen mode with a window that has attached a standard NSToolbar with at least one space item (NSToolbarSpaceItemIdentifier) yields an "unsatisfiable constraints" error.
The problem occurs as soon as a toolbar contains a space item and as long as the window contains at least one other NSControl. It didn't occur in earlier versions of OS X.
The offending constraints are created automatically by App Kit, thus the bug is not caused by custom constraints created by the user.
Steps to Reproduce:
Please examine the attached demo project or create one by yourself:
1. In Terminal.app, set user defaults so that ambiguous constraints are made visible:
defaults write NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints -bool YES
2. Open a new „Cocoa Application“ project in Xcode, set language to Objective-C and don’t use Storyboards
3. In MainMenu.xib, set the main window’s Full Screen capability from „Unsupported“ to „Primary window“
4. Drag a standard NSToolBar from the IB palette into the main window
5. Customize this toolbar by double clicking it: Add a „Space“ item between the first two toolbar items, i.e. between „Colors“ and „Fonts“
6. Drag a NSButton item (or any other control) from the IB palette into the main window and place it somewhere below the toolbar
7. Build and run the application
8. Enter full screen mode and notify that there is a visual warning about constraints that cannot be satisfied simultaneously. Clicking those constraints identifies them in the console log.
Expected Results:
The window should go full screen without yielding constraints errors as it did in OS X versions before 10.10.
Actual Results:
The window goes full screen but simultaneously issues warnings about constraints that cannot be satisfied simultaneously in the console log:
08.07.14 10:46:00,405 demo[5100]: Unable to simultaneously satisfy constraints:
(
"<NSAutoresizingMaskLayoutConstraint:0x6080000838e0 h=--& v=--& V:[NSToolbarItemViewer:0x10010d650(5)]>",
"<NSAutoresizingMaskLayoutConstraint:0x6080000836b0 h=--& v=-&- V:|-(10)-[_NSToolbarSpace:0x608000141080] (Names: '|':NSToolbarItemViewer:0x10010d650 )>",
"<NSAutoresizingMaskLayoutConstraint:0x608000083660 h=--& v=-&- V:[_NSToolbarSpace:0x608000141080]-(11)-| (Names: '|':NSToolbarItemViewer:0x10010d650 )>"
)
Will attempt to recover by breaking constraint
<NSAutoresizingMaskLayoutConstraint:0x6080000836b0 h=--& v=-&- V:|-(10)-[_NSToolbarSpace:0x608000141080] (Names: '|':NSToolbarItemViewer:0x10010d650 )>
Version:
Xcode 6.0 DP 3 (6A254o)
OS X 10.10 DP 3 (14A283o)
Configuration:
The problem seems to be caused by space items in the toolbar. As long as there are no space items all constraints are satisfied. Also, there needs to be at least one additional NSControl on the window besides the NSToolbar in order to trigger the bug.
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!