On Aug 21, 2016, at 6:36 AM, Andreas Falkenhahn <andr...@falkenhahn.com> wrote:
> 
> There seems to be some conflicting behaviour in OS X versions concerning what
> happens when combining NSBorderlessWindowMask and NSResizableWindowMask:
> 
> - on my 10.6 system, setting NSResizableWindowMask seems to override 
> NSBorderlessWindowMask
>  and make the window a bordered one even though NSBorderlessWindowMask was set
> 
> - on my 10.11 system, however, both styles can be combined and indeed give me
>  a resizable borderless window
> 
> This behaviour seems to be undocumented. Shouldn't this be documented here?
> https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/#//apple_ref/doc/constant_group/Window_Style_Masks
>  
> 
> I'd especially be interested in the OS X version that introduced this change.
> I only have 10.6 and 10.11 so the new behaviour must have been introduced
> in any versions between 10.7 and 10.11. But since it's undocumented, I don't
> know :/

You should routinely read the release notes as a critical part of the 
documentation.  In particular, this is addressed in the AppKit release notes 
for 10.7 
<https://developer.apple.com/library/mac/releasenotes/AppKit/RN-AppKitOlderNotes/#X10_7Notes>
 (scroll down to "NSResizableWindowMask and window title bars"):

"Prior to 10.7, passing NSResizableWindowMask to NSWindow init methods would 
create the window with a titlebar, as if you had passed NSTitledWindowMask. In 
10.7, this is no longer true: passing NSResizableWindowMask without 
NSTitledWindowMask will create a resizable window with no titlebar. For 
compatibility, this change only affects applications compiled on 10.7 or later, 
and only affects windows loaded from nibs that were saved on 10.7.

"For maximum compatibility, you should of course specify NSTitledWindowMask 
whenever you want a window to have a titlebar."


> I still need to support 10.6 so I wrote some custom code to handle resizing of
> borderless windows. This wasn't particularly difficult. However, of course
> I'd like to use the new OS-provided functionality in case the user is running
> the version that introduced this new feature. But this doesn't seem to be 
> possible
> because all apps compiled on 10.6 seem to fall back to the old behaviour on
> 10.11, i.e. even if I set NSResizableWindowMask and NSBorderlessWindowMask
> I will still get the old behaviour on 10.11 if the app was compiled on 10.6.
> I will only get the new behaviour if the app was compiled on 10.11.
> 
> So here are my two questions:
> 
> 1) Is there any way around this? Can I compile my app on 10.6 and still access
> the new functionality?

You will need to build against the 10.7 SDK or later and, as noted above, 
re-save any window NIBs on 10.7 or later.  You can't build against an SDK 
that's newer than the OS you're building on, so you won't be able to do this on 
your 10.6 system but there's no reason you couldn't do it on your 10.11 system. 
 You can set the deployment target to 10.6 to maintain the ability to deploy to 
10.6.  You'll have to be careful to either not use any post-10.6 APIs or to do 
so only after checking at runtime that they're actually available on the 
current OS.

Also, be sure to read all the relevant release notes to learn what other 
behaviors may change due to the change of SDK.


> 2) Which OS X version introduced this new feature? Is it documented anywhere?

Answered above.

Regards,
Ken


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to