1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-23 09:19:41 +01:00

* Added Tomahawk::toggleFullscreen on OSX.

This commit is contained in:
Christian Muehlhaeuser 2013-01-16 13:15:46 +01:00
parent dffd614c38
commit 18ebcc1156
2 changed files with 21 additions and 0 deletions

View File

@ -46,6 +46,7 @@ void setApplicationHandler(PlatformInterface* handler);
void checkForUpdates();
// Pass in a QObject with slots "fullScreenEntered() and fullScreenExited() in order to be notified
void toggleFullscreen();
void enableFullscreen( QObject* notifier );
};

View File

@ -250,6 +250,26 @@ void Tomahawk::checkForUpdates() {
#define LION_FULLSCREEN_EXIT_NOTIFICATION_VALUE @"NSWindowDidExitFullScreenNotification"
#endif
void Tomahawk::toggleFullscreen()
{
if ( QSysInfo::MacintoshVersion != QSysInfo::MV_SNOWLEOPARD &&
QSysInfo::MacintoshVersion != QSysInfo::MV_LEOPARD )
{
qDebug() << "Toggling 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() )
{
if ( qobject_cast< TomahawkWindow* >( w ) )
{
NSView *nsview = (NSView *)w->winId();
NSWindow *nswindow = [nsview window];
[nswindow toggleFullScreen: nil];
}
}
}
}
void Tomahawk::enableFullscreen( QObject* receiver )
{
// We don't support anything below leopard, so if it's not [snow] leopard it must be lion