Commit ae6c5eaa authored by Eike Ziller's avatar Eike Ziller

Mac: Don't link to 10.7+ api even when compiling there.

The 'fullscreen' feature uses constants that are only available
on 10.7 or later, but when compiling on 10.6 we just defined the
constants ourselves.
With this patch we define the constants ourselves even on 10.7 and
later, to avoid linking to 10.7-only symbols when compiling on 10.7
or later, making it possible to run a Qt Creator compiled against
a 10.7 SDK also on 10.6.

Change-Id: I65236a85bdda3473fab0e424270b96880943d685
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent 2b95d81c
......@@ -36,14 +36,12 @@
#include <QSysInfo>
#include <qglobal.h>
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_6
enum {
NSWindowCollectionBehaviorFullScreenPrimary = (1 << 7)
Qtc_NSWindowCollectionBehaviorFullScreenPrimary = (1 << 7)
};
static const NSString *NSWindowDidEnterFullScreenNotification = @"NSWindowDidEnterFullScreenNotification";
static const NSString *NSWindowDidExitFullScreenNotification = @"NSWindowDidExitFullScreenNotification";
#endif
static NSString *Qtc_NSWindowDidEnterFullScreenNotification = @"NSWindowDidEnterFullScreenNotification";
static NSString *Qtc_NSWindowDidExitFullScreenNotification = @"NSWindowDidExitFullScreenNotification";
@interface WindowObserver : NSObject {
Core::Internal::MainWindow *window;
......@@ -58,7 +56,7 @@ static const NSString *NSWindowDidExitFullScreenNotification = @"NSWindowDidExit
@implementation WindowObserver
- (id)initWithMainWindow:(Core::Internal::MainWindow *)w;
- (id)initWithMainWindow:(Core::Internal::MainWindow *)w
{
if ((self = [self init])) {
window = w;
......@@ -86,11 +84,7 @@ using namespace Core::Internal;
bool MacFullScreen::supportsFullScreen()
{
#if QT_VERSION >= 0x040800
return QSysInfo::MacintoshVersion >= QSysInfo::MV_LION;
#else
return QSysInfo::MacintoshVersion >= 0x0009; /* MV_LION not defined */
#endif
}
void MacFullScreen::addFullScreen(MainWindow *window)
......@@ -98,15 +92,15 @@ void MacFullScreen::addFullScreen(MainWindow *window)
if (supportsFullScreen()) {
NSView *nsview = (NSView *) window->winId();
NSWindow *nswindow = [nsview window];
[nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
[nswindow setCollectionBehavior:Qtc_NSWindowCollectionBehaviorFullScreenPrimary];
if (observer == nil)
observer = [[WindowObserver alloc] initWithMainWindow:window];
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:observer selector:@selector(notifyDidEnterFullScreen:)
name:NSWindowDidEnterFullScreenNotification object:nswindow];
name:Qtc_NSWindowDidEnterFullScreenNotification object:nswindow];
[nc addObserver:observer selector:@selector(notifyDidExitFullScreen:)
name:NSWindowDidExitFullScreenNotification object:nswindow];
name:Qtc_NSWindowDidExitFullScreenNotification object:nswindow];
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment