indragiek / INAppStoreWindow

NSWindow subclass with a highly customizable title bar and traffic lights
BSD 2-Clause "Simplified" License
1.06k stars 162 forks source link

Window widgets are positioned incorrectly in document-based application when showing sheets #200

Open wadeco opened 9 years ago

wadeco commented 9 years ago

When using INAppStoreWindow in a document based application on 10.11 the window theme widgets are positioned incorrectly briefly when showing a sheet. I tracked down the cause of the issue and unfortunately the only place to hook into NSWindow to correct the behavior is in -(void)_updateCollectionBehavior. So the fix I have in place looks like this:

-(void)_updateCollectionBehavior { [super _updateCollectionBehavior]; [self _layoutTrafficLightsAndContent]; }

Of course, the problem here is that the method is private and therefore may cause problems with App Store applications.

wadeco commented 9 years ago

This issue does bring up a common problem with INAppStoreWindow; that being the wack-a-mole style fixes when Apple decides to add yet another way of adjusting the widget positions. I have thought this could be done cleaner within INAppStoreWindow and an idea I had was to simply observe the frame changes on the close/zoom/minimize buttons using the NSViewFrameDidChangeNotification. From within the notification handler, you'd then unregister / move the buttons / re-register for notifications. This would require a bit of work to refactor the existing implementation, but I feel like it might less error prone as AppKit moves forward.

indragiek commented 8 years ago

@wadeco That's a good idea. I'll keep this open to track progress in making that fix. I can look into it when I have some time, or I'm also happy to review a PR that implements it.