forked from qt-creator/qt-creator
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: Erik Verbruggen <erik.verbruggen@digia.com> Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
This commit is contained in:
@@ -36,14 +36,12 @@
|
|||||||
#include <QSysInfo>
|
#include <QSysInfo>
|
||||||
#include <qglobal.h>
|
#include <qglobal.h>
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_6
|
|
||||||
enum {
|
enum {
|
||||||
NSWindowCollectionBehaviorFullScreenPrimary = (1 << 7)
|
Qtc_NSWindowCollectionBehaviorFullScreenPrimary = (1 << 7)
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NSString *NSWindowDidEnterFullScreenNotification = @"NSWindowDidEnterFullScreenNotification";
|
static NSString *Qtc_NSWindowDidEnterFullScreenNotification = @"NSWindowDidEnterFullScreenNotification";
|
||||||
static const NSString *NSWindowDidExitFullScreenNotification = @"NSWindowDidExitFullScreenNotification";
|
static NSString *Qtc_NSWindowDidExitFullScreenNotification = @"NSWindowDidExitFullScreenNotification";
|
||||||
#endif
|
|
||||||
|
|
||||||
@interface WindowObserver : NSObject {
|
@interface WindowObserver : NSObject {
|
||||||
Core::Internal::MainWindow *window;
|
Core::Internal::MainWindow *window;
|
||||||
@@ -58,7 +56,7 @@ static const NSString *NSWindowDidExitFullScreenNotification = @"NSWindowDidExit
|
|||||||
|
|
||||||
@implementation WindowObserver
|
@implementation WindowObserver
|
||||||
|
|
||||||
- (id)initWithMainWindow:(Core::Internal::MainWindow *)w;
|
- (id)initWithMainWindow:(Core::Internal::MainWindow *)w
|
||||||
{
|
{
|
||||||
if ((self = [self init])) {
|
if ((self = [self init])) {
|
||||||
window = w;
|
window = w;
|
||||||
@@ -86,11 +84,7 @@ using namespace Core::Internal;
|
|||||||
|
|
||||||
bool MacFullScreen::supportsFullScreen()
|
bool MacFullScreen::supportsFullScreen()
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x040800
|
|
||||||
return QSysInfo::MacintoshVersion >= QSysInfo::MV_LION;
|
return QSysInfo::MacintoshVersion >= QSysInfo::MV_LION;
|
||||||
#else
|
|
||||||
return QSysInfo::MacintoshVersion >= 0x0009; /* MV_LION not defined */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacFullScreen::addFullScreen(MainWindow *window)
|
void MacFullScreen::addFullScreen(MainWindow *window)
|
||||||
@@ -98,15 +92,15 @@ void MacFullScreen::addFullScreen(MainWindow *window)
|
|||||||
if (supportsFullScreen()) {
|
if (supportsFullScreen()) {
|
||||||
NSView *nsview = (NSView *) window->winId();
|
NSView *nsview = (NSView *) window->winId();
|
||||||
NSWindow *nswindow = [nsview window];
|
NSWindow *nswindow = [nsview window];
|
||||||
[nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
[nswindow setCollectionBehavior:Qtc_NSWindowCollectionBehaviorFullScreenPrimary];
|
||||||
|
|
||||||
if (observer == nil)
|
if (observer == nil)
|
||||||
observer = [[WindowObserver alloc] initWithMainWindow:window];
|
observer = [[WindowObserver alloc] initWithMainWindow:window];
|
||||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||||
[nc addObserver:observer selector:@selector(notifyDidEnterFullScreen:)
|
[nc addObserver:observer selector:@selector(notifyDidEnterFullScreen:)
|
||||||
name:NSWindowDidEnterFullScreenNotification object:nswindow];
|
name:Qtc_NSWindowDidEnterFullScreenNotification object:nswindow];
|
||||||
[nc addObserver:observer selector:@selector(notifyDidExitFullScreen:)
|
[nc addObserver:observer selector:@selector(notifyDidExitFullScreen:)
|
||||||
name:NSWindowDidExitFullScreenNotification object:nswindow];
|
name:Qtc_NSWindowDidExitFullScreenNotification object:nswindow];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user