2014-05-12 13:53:13 +00:00
|
|
|
#include <AppKit/NSWindow.h>
|
2014-06-17 13:47:04 +00:00
|
|
|
#include <AppKit/NSScreen.h>
|
2012-06-03 18:29:49 +00:00
|
|
|
#include "lionsupport.h"
|
|
|
|
|
|
|
|
bool LionSupport::isLion()
|
|
|
|
{
|
|
|
|
NSString *string = [NSString string];
|
|
|
|
// this selector was added only in Lion. so we can check if it's responding, we are on Lion
|
|
|
|
return [string respondsToSelector:@selector(linguisticTagsInRange:scheme:options:orthography:tokenRanges:)];
|
|
|
|
}
|
|
|
|
|
|
|
|
void LionSupport::addFullscreen(MainWindow *window)
|
|
|
|
{
|
|
|
|
#if defined(MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
|
|
|
if (isLion()) // checks if lion is running
|
|
|
|
{
|
|
|
|
NSView *nsview = (NSView *) window->winId();
|
|
|
|
NSWindow *nswindow = [nsview window];
|
|
|
|
[nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#warning No fullscreen support will be included in this build
|
|
|
|
#endif
|
|
|
|
}
|
2014-06-17 13:47:04 +00:00
|
|
|
|
|
|
|
bool LionSupport::isRetinaDisplay()
|
|
|
|
{
|
|
|
|
#if defined(MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
|
|
|
return( [ [ NSScreen mainScreen ] respondsToSelector:@selector( backingScaleFactor ) ]
|
|
|
|
&& [ [ NSScreen mainScreen ] backingScaleFactor ] > 1.5 );
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|