1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 15:59:42 +01:00

Runtime check for lion instead of compile-time

This commit is contained in:
Leo Franchi 2011-10-20 14:31:41 -04:00
parent f24a25b370
commit 428dbe8f0e

View File

@ -234,19 +234,23 @@ void Tomahawk::checkForUpdates() {
void Tomahawk::enableFullscreen()
{
#ifdef LION
qDebug() << "Enabling Lion Full-screeen";
// Can't include tomahawkapp.h in a .mm file, pulls in infosystem.h which uses
// the objc keyword 'id'
foreach( QWidget* w, QApplication::topLevelWidgets() )
// We don't support anything below leopard, so if it's not [snow] leopard it must be lion
// Can't check for lion as Qt 4.7 doesn't have the enum val, not checking for Unknown as it will be lion
// on 4.8
if ( QSysInfo::MacintoshVersion != QSysInfo::MV_SNOWLEOPARD &&
QSysInfo::MacintoshVersion != QSysInfo::MV_LEOPARD )
{
if ( qobject_cast< TomahawkWindow* >( w ) )
qDebug() << "Enabling Lion Full-screeen";
// Can't include tomahawkapp.h in a .mm file, pulls in infosystem.h which uses
// the objc keyword 'id'
foreach( QWidget* w, QApplication::topLevelWidgets() )
{
NSView *nsview = (NSView *)w->winId();
NSWindow *nswindow = [nsview window];
[nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
if ( qobject_cast< TomahawkWindow* >( w ) )
{
NSView *nsview = (NSView *)w->winId();
NSWindow *nswindow = [nsview window];
[nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
}
}
}
#endif
}