1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 11:20:22 +02:00

Attempt to make sizegrip fix work from 10.6 builds

This commit is contained in:
Leo Franchi
2012-06-05 09:17:56 +01:00
parent c001acffee
commit 338a39fe5b

View File

@@ -166,14 +166,14 @@
NSAppleEventManager *em = [NSAppleEventManager sharedAppleEventManager]; NSAppleEventManager *em = [NSAppleEventManager sharedAppleEventManager];
[em [em
setEventHandler:self setEventHandler:self
andSelector:@selector(getUrl:withReplyEvent:) andSelector:@selector(getUrl:withReplyEvent:)
forEventClass:kInternetEventClass forEventClass:kInternetEventClass
andEventID:kAEGetURL]; andEventID:kAEGetURL];
[em [em
setEventHandler:self setEventHandler:self
andSelector:@selector(getUrl:withReplyEvent:) andSelector:@selector(getUrl:withReplyEvent:)
forEventClass:'WWW!' forEventClass:'WWW!'
andEventID:'OURL']; andEventID:'OURL'];
NSString *bundleID = [[NSBundle mainBundle] bundleIdentifier]; NSString *bundleID = [[NSBundle mainBundle] bundleIdentifier];
OSStatus httpResult = LSSetDefaultHandlerForURLScheme((CFStringRef)@"tomahawk", (CFStringRef)bundleID); OSStatus httpResult = LSSetDefaultHandlerForURLScheme((CFStringRef)@"tomahawk", (CFStringRef)bundleID);
@@ -253,8 +253,10 @@ void Tomahawk::checkForUpdates() {
#ifdef LION #ifdef LION
#define SET_LION_FULLSCREEN NSWindowCollectionBehaviorFullScreenPrimary #define SET_LION_FULLSCREEN NSWindowCollectionBehaviorFullScreenPrimary
#define LION_FULLSCREEN_NOTIFICATION_VALUE NSWindowWillEnterFullScreenNotification
#else #else
#define SET_LION_FULLSCREEN (NSUInteger)(1 << 7) // Defined as NSWindowCollectionBehaviorFullScreenPrimary in lion's NSWindow.h #define SET_LION_FULLSCREEN (NSUInteger)(1 << 7) // Defined as NSWindowCollectionBehaviorFullScreenPrimary in lion's NSWindow.h
#define LION_FULLSCREEN_NOTIFICATION_VALUE @"NSWindowWillEnterFullScreenNotification"
#endif #endif
void Tomahawk::enableFullscreen( QObject* receiver ) void Tomahawk::enableFullscreen( QObject* receiver )
@@ -276,25 +278,23 @@ void Tomahawk::enableFullscreen( QObject* receiver )
NSWindow *nswindow = [nsview window]; NSWindow *nswindow = [nsview window];
[nswindow setCollectionBehavior:SET_LION_FULLSCREEN]; [nswindow setCollectionBehavior:SET_LION_FULLSCREEN];
#ifdef LION
if ( !receiver ) if ( !receiver )
continue; continue;
[[NSNotificationCenter defaultCenter] addObserverForName:NSWindowWillEnterFullScreenNotification [[NSNotificationCenter defaultCenter] addObserverForName:LION_FULLSCREEN_NOTIFICATION_VALUE
object:nswindow object:nswindow
queue:nil queue:nil
usingBlock:^(NSNotification * note) { usingBlock:^(NSNotification * note) {
NSLog(@"Became Full Screen!"); NSLog(@"Became Full Screen!");
QMetaObject::invokeMethod( receiver, "fullScreenEntered", Qt::DirectConnection ); QMetaObject::invokeMethod( receiver, "fullScreenEntered", Qt::DirectConnection );
}]; }];
[[NSNotificationCenter defaultCenter] addObserverForName:NSWindowDidExitFullScreenNotification [[NSNotificationCenter defaultCenter] addObserverForName:LION_FULLSCREEN_NOTIFICATION_VALUE
object:nswindow object:nswindow
queue:nil queue:nil
usingBlock:^(NSNotification * note) { usingBlock:^(NSNotification * note) {
NSLog(@"Left Full Screen!"); NSLog(@"Left Full Screen!");
QMetaObject::invokeMethod( receiver, "fullScreenExited", Qt::DirectConnection ); QMetaObject::invokeMethod( receiver, "fullScreenExited", Qt::DirectConnection );
}]; }];
#endif
} }
} }
} }