From 36738fc9e466084a50c015873efac865853b986c Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Tue, 20 Sep 2011 16:40:54 -0400 Subject: [PATCH] Show Lion full-screen toggle if on Lion --- src/mac/tomahawkapp_mac.h | 1 + src/mac/tomahawkapp_mac.mm | 10 ++++++++++ src/tomahawkapp.cpp | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/src/mac/tomahawkapp_mac.h b/src/mac/tomahawkapp_mac.h index 86ae6702c..5741c05c2 100644 --- a/src/mac/tomahawkapp_mac.h +++ b/src/mac/tomahawkapp_mac.h @@ -43,6 +43,7 @@ void setShortcutHandler(Tomahawk::MacShortcutHandler* engine); // used for opening files with tomahawk void setApplicationHandler(PlatformInterface* handler); void checkForUpdates(); +void enableFullscreen(); }; diff --git a/src/mac/tomahawkapp_mac.mm b/src/mac/tomahawkapp_mac.mm index 9774609e5..1ab61b0e9 100644 --- a/src/mac/tomahawkapp_mac.mm +++ b/src/mac/tomahawkapp_mac.mm @@ -20,6 +20,7 @@ #include "macdelegate.h" #include "macshortcuthandler.h" +#include "tomahawkapp.h" #include "config.h" #import @@ -232,3 +233,12 @@ void Tomahawk::checkForUpdates() { [[SUUpdater sharedUpdater] checkForUpdates: NSApp]; #endif } + +void Tomahawk::enableFullscreen() +{ +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + NSView *nsview = (NSView *)APP->mainWindow()->winId(); + NSWindow *nswindow = [nsview window]; + [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; +#endif +} diff --git a/src/tomahawkapp.cpp b/src/tomahawkapp.cpp index 32a6bc7a7..2b89bda95 100644 --- a/src/tomahawkapp.cpp +++ b/src/tomahawkapp.cpp @@ -267,6 +267,11 @@ TomahawkApp::init() // check if our spotify playlist api server is up and running, and enable spotify playlist drops if so QNetworkReply* r = TomahawkUtils::nam()->get( QNetworkRequest( QUrl( SPOTIFY_PLAYLIST_API_URL "/playlist/test" ) ) ); connect( r, SIGNAL( finished() ), this, SLOT( spotifyApiCheckFinished() ) ); + +#ifdef Q_WS_MAC + // Make sure to do this after main window is inited + Tomahawk::enableFullscreen(); +#endif }