I just discovered that with a very simple native extension method, I can enable full screen mode for AIR Mac Desktop Applications.
This gets you the full screen icon in the top right, and it works perfectly with no changes to my code. (Obviously only works on Lion and above, since this is a Lion feature)
Enjoy.
Here's the code:
FREObject _EnableFullScreenMode(FREContext ctx, void* functionData, uint32_t argc, FREObject argv[])
{
//We should be okay to do this, even on 10.6, according to this post:
//http://www.cocoabuilder.com/archive/cocoa/311124-implementing-full-screen-for-10-7-but-app-should-also-run-on-10-6.html
//We can't use [NSApp mainWindow] - didn't appear to work
//This seems to though:
NSArray * allWindows = [NSApp windows];
if (allWindows.count > 0)
{
NSWindow *mainWindow = [allWindows objectAtIndex: 0];
NSWindowCollectionBehavior behavior = [mainWindow collectionBehavior];
behavior |= NSWindowCollectionBehaviorFullScreenPrimary;
[mainWindow setCollectionBehavior:behavior];
}
//TODO: Return a boolean instead depending on if we found the main window
return NULL;
}