Re: Implementing Full Screen for 10.7 but app should also run on 10.6
On Nov 16, 2011, at 3:08 AM, Stefan Werner wrote: > > On 14.11.2011, at 19:20, Quincey Morris wrote: > >> Don't follow the advice to define >> NSWindowCollectionBehaviorFullScreenPrimary yourself. It's really, really >> dangerous to replicate a fragment of one SDK in a build against an earlier >> SDK. What if the value changes in a later 10.7.x SDK, or if the value is >> invalidated in some way you can't foresee? > > If that value changed in a later SDK, it would break binary compatibility. > While I strongly suggest against replicating SDK code in your own code for > the reason you're giving, it does not apply in this case. > > Any application compiled today will have a constant number in place of > NSWindowCollectionBehaviorFullScreenPrimary. If the OS at some point changes > the meaning of that number, it will break all applications compiled before > that date. Not necessarily. There are a number of places where the frameworks check to see what SDK you link against to determine what behavior you get, just so that old apps (which are then linked against older SDKs) continue to work as they did, but new/fixed behavior is exhibited when linked against current SDKs. So it could happen that, when X+1 is released, anything that links against X gets the old interpretation of a flag (first implemented in version X), but if you link against X+1 you get the new one. And if you actually link against X-1 (and manually add that flag from the X SDK) who knows what you'll get. Unlikely, but I wouldn't be surprised if this sort of thing hasn't bitten somebody at some point... (though probably with things like side effects of methods, and not different interpretations of constant flags) Glenn Andreas gandr...@gandreas.com The most merciful thing in the world ... is the inability of the human mind to correlate all its contents - HPL ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Implementing Full Screen for 10.7 but app should also run on 10.6
On 14.11.2011, at 19:20, Quincey Morris wrote: > Don't follow the advice to define NSWindowCollectionBehaviorFullScreenPrimary > yourself. It's really, really dangerous to replicate a fragment of one SDK in > a build against an earlier SDK. What if the value changes in a later 10.7.x > SDK, or if the value is invalidated in some way you can't foresee? If that value changed in a later SDK, it would break binary compatibility. While I strongly suggest against replicating SDK code in your own code for the reason you're giving, it does not apply in this case. Any application compiled today will have a constant number in place of NSWindowCollectionBehaviorFullScreenPrimary. If the OS at some point changes the meaning of that number, it will break all applications compiled before that date. > There's only one safe way to use features from a later SDK: use the later SDK > as your base SDK, and set your deployment target to the earlier system > version, adding run-time checks to ensure that you don't use the later SDK's > features on an earlier system. That is a practice I consider just as dangerous. It is very easy to end up using APIs that are newer than your minimum supported version and forgetting to add the run-time check. Mac OS will allow you to run that application on lower OS versions, but at best it will not behave as intended, but it is also quite likely to crash. -Stefan___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Implementing Full Screen for 10.7 but app should also run on 10.6
On Nov 16, 2011, at 01:08 , Stefan Werner wrote: > Any application compiled today will have a constant number in place of > NSWindowCollectionBehaviorFullScreenPrimary. If the OS at some point changes > the meaning of that number, it will break all applications compiled before > that date. Yes, I do (and did) understand this point. However, it is not (for example) impossible that a later OS version may expect a different constant, and either check the executable for being linked against certain SDK versions, or treat the "old" value in some kind of compatibility mode. Under such scenarios, a change of constant value could be accommodated. Of course, this sort of thing would be unlikely in such a simplistic case as a single constant value, but the underlying point remains valid. It's just not safe to define your own SDK (or even fragment of an SDK). Of course, developers do it; that doesn't make it safe. > That is a practice I consider just as dangerous. It is very easy to end up > using APIs that are newer than your minimum supported version and forgetting > to add the run-time check. Mac OS will allow you to run that application on > lower OS versions, but at best it will not behave as intended, but it is also > quite likely to crash. Yes, it's easy to make a mistake, and there's no compile-time safety net, as I already acknowledged. Nevertheless, this is the technically correct way to do it. ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Implementing Full Screen for 10.7 but app should also run on 10.6
On Nov 14, 2011, at 4:55 PM, Graham Cox wrote: > If you are using Xcode 4.x, you can just flag the "supports fullscreen" in IB > and it just works. You get a warning that the feature isn't supported on 10.6 > or earlier when the nib is compiled, but it's OK - earlier systems just > ignore that flag. On 10.7 it is honoured. Other aspects of fullscreen > behaviour are handled by delegate methods, which can exist on any system > version, but will never be called on < 10.7 It just works! Thanks, - Koen.___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Implementing Full Screen for 10.7 but app should also run on 10.6
On 15/11/2011, at 2:15 AM, Koen van der Drift wrote: > Another window size question, just putting it ina another thread. > > I'd like my application to use the full screen feature on 10.7, but > the app should also run on 10.6 I tried adding > NSWindowCollectionBehaviorFullScreenPrimary for my main window, but > got an error since I am building agains 10.6 SDK. > > How do I make this work (if possible)? If you are using Xcode 4.x, you can just flag the "supports fullscreen" in IB and it just works. You get a warning that the feature isn't supported on 10.6 or earlier when the nib is compiled, but it's OK - earlier systems just ignore that flag. On 10.7 it is honoured. Other aspects of fullscreen behaviour are handled by delegate methods, which can exist on any system version, but will never be called on < 10.7 --Graham ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Implementing Full Screen for 10.7 but app should also run on 10.6
On Mon, Nov 14, 2011 at 1:39 PM, Gideon King wrote: > They have not bumped the appkit version number in 10.6 (see NSApplication.h), > and in previous releases, the number was just bumped by a decimal, so the > floor() call handles that. As far as I am aware, this comparison should be > correct. Yeah, leave it to me to miss the floor() call. Sorry for the noise. --Kyle Sluder ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Implementing Full Screen for 10.7 but app should also run on 10.6
On Nov 14, 2011, at 11:16 AM, Kyle Sluder wrote: > On Nov 14, 2011, at 7:30 AM, Gideon King wrote: > >> if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) { >> > > This comparison is incorrect. The AppKit version number almost always gets > bumped on an OS point release. This comparison will succeed on 10.6.1 and > higher. > > Does Apple not ship symbols for the current AppKit version in the SDK—in > other words, is there an NSAppKitVersionNumber10_7 in the 10.7 SDK? It does not. The 10.7 SDK only includes up to NSAppKitVersionNumber10_6. The only way to check this using NSAppKitVersionNumber is to use floor, as he did (or to use another method, such as Gestalt). Charles___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Implementing Full Screen for 10.7 but app should also run on 10.6
They have not bumped the appkit version number in 10.6 (see NSApplication.h), and in previous releases, the number was just bumped by a decimal, so the floor() call handles that. As far as I am aware, this comparison should be correct. e.g. #define NSAppKitVersionNumber10_5 949 #define NSAppKitVersionNumber10_5_2 949.27 #define NSAppKitVersionNumber10_5_3 949.33 #define NSAppKitVersionNumber10_6 1038 Regards Gideon On 15/11/2011, at 3:16 AM, Kyle Sluder wrote: > On Nov 14, 2011, at 7:30 AM, Gideon King wrote: > >> if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) { >> > > This comparison is incorrect. The AppKit version number almost always gets > bumped on an OS point release. This comparison will succeed on 10.6.1 and > higher. > > Does Apple not ship symbols for the current AppKit version in the SDK—in > other words, is there an NSAppKitVersionNumber10_7 in the 10.7 SDK? > > --Kyle Sluder ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Implementing Full Screen for 10.7 but app should also run on 10.6
On Mon, Nov 14, 2011 at 1:20 PM, Quincey Morris wrote: > On Nov 14, 2011, at 07:15 , Koen van der Drift wrote: > > I'd like my application to use the full screen feature on 10.7, but > the app should also run on 10.6 I tried adding > NSWindowCollectionBehaviorFullScreenPrimary for my main window, but > got an error since I am building agains 10.6 SDK. > > How do I make this work (if possible)? > > Don't follow the advice to > define NSWindowCollectionBehaviorFullScreenPrimary yourself. It's really, > really dangerous to replicate a fragment of one SDK in a build against an > earlier SDK. What if the value changes in a later 10.7.x SDK, or if the > value is invalidated in some way you can't foresee? > There's only one safe way to use features from a later SDK: use the later > SDK as your base SDK, and set your deployment target to the earlier system > version, adding run-time checks to ensure that you don't use the later SDK's > features on an earlier system. > Unfortunately -- this is a known deficiency -- when you do that, you lose > the ability to detect (at compile time) features of the later SDK that are > used without the correct run-time checks. > Thanks for all the suggestions, I'm going to give it a try later today. - Koen. ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Implementing Full Screen for 10.7 but app should also run on 10.6
On Nov 14, 2011, at 07:15 , Koen van der Drift wrote: > I'd like my application to use the full screen feature on 10.7, but > the app should also run on 10.6 I tried adding > NSWindowCollectionBehaviorFullScreenPrimary for my main window, but > got an error since I am building agains 10.6 SDK. > > How do I make this work (if possible)? Don't follow the advice to define NSWindowCollectionBehaviorFullScreenPrimary yourself. It's really, really dangerous to replicate a fragment of one SDK in a build against an earlier SDK. What if the value changes in a later 10.7.x SDK, or if the value is invalidated in some way you can't foresee? There's only one safe way to use features from a later SDK: use the later SDK as your base SDK, and set your deployment target to the earlier system version, adding run-time checks to ensure that you don't use the later SDK's features on an earlier system. Unfortunately -- this is a known deficiency -- when you do that, you lose the ability to detect (at compile time) features of the later SDK that are used without the correct run-time checks. ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Implementing Full Screen for 10.7 but app should also run on 10.6
On Nov 14, 2011, at 7:15 AM, Koen van der Drift wrote: > I'd like my application to use the full screen feature on 10.7, but > the app should also run on 10.6 I tried adding > NSWindowCollectionBehaviorFullScreenPrimary for my main window, but > got an error since I am building agains 10.6 SDK. I believe you are supposed to build with the SDK for the *highest* system version your app will run on; in this case 10.7. Then you’ll have access to the declarations you need. (Just set the “deployment version” to 10.6 so Xcode will know not to depend on 10.7.) —Jens smime.p7s Description: S/MIME cryptographic signature ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Implementing Full Screen for 10.7 but app should also run on 10.6
On Nov 14, 2011, at 7:30 AM, Gideon King wrote: >if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) { > This comparison is incorrect. The AppKit version number almost always gets bumped on an OS point release. This comparison will succeed on 10.6.1 and higher. Does Apple not ship symbols for the current AppKit version in the SDK—in other words, is there an NSAppKitVersionNumber10_7 in the 10.7 SDK? --Kyle Sluder___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Implementing Full Screen for 10.7 but app should also run on 10.6
You could do something like this: #ifndef NSAppKitVersionNumber10_6 #define NSAppKitVersionNumber10_6 1038 #endif #ifndef NSWindowCollectionBehaviorFullScreenPrimary #define NSWindowCollectionBehaviorFullScreenPrimary 1 << 7 #endif if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) { [[self window] setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; } HTH Gideon On 15/11/2011, at 1:15 AM, Koen van der Drift wrote: > Another window size question, just putting it ina another thread. > > I'd like my application to use the full screen feature on 10.7, but > the app should also run on 10.6 I tried adding > NSWindowCollectionBehaviorFullScreenPrimary for my main window, but > got an error since I am building agains 10.6 SDK. > > How do I make this work (if possible)? > > Thanks, > > - Koen. > ___ ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Implementing Full Screen for 10.7 but app should also run on 10.6
Do something like this. - (void)prepareWindowCollectionBehavior { if (MySystemVersion_10_07_OrLater()) { #ifdef MAC_OS_X_VERSION_10_7 NSWindowCollectionBehavior behavior = [_window collectionBehavior]; behavior = behavior | NSWindowCollectionBehaviorFullScreenPrimary; [_window setCollectionBehavior:behavior]; #endif } } --Richard On Nov 14, 2011, at 8:15 AM, Koen van der Drift wrote: > I'd like my application to use the full screen feature on 10.7, but > the app should also run on 10.6 ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Implementing Full Screen for 10.7 but app should also run on 10.6
Another window size question, just putting it ina another thread. I'd like my application to use the full screen feature on 10.7, but the app should also run on 10.6 I tried adding NSWindowCollectionBehaviorFullScreenPrimary for my main window, but got an error since I am building agains 10.6 SDK. How do I make this work (if possible)? Thanks, - Koen. ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com