1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-16 11:19:18 +01:00

Enable fullscreen support for OS X 10.7+

Fixes issue #2329
(cherry picked from commit a1361dfa7e)
This commit is contained in:
John Maguire 2012-10-09 14:56:17 +02:00
parent 94b1e10621
commit 8ddc5064dc
3 changed files with 20 additions and 0 deletions

View File

@ -5,6 +5,7 @@
class MacGlobalShortcutBackend;
class QObject;
class QWidget;
class PlatformInterface {
public:
@ -28,6 +29,7 @@ QString GetApplicationSupportPath();
QString GetMusicDirectory();
bool MigrateLegacyConfigFiles();
void EnableFullScreen(const QWidget& main_window);
} // namespace mac

View File

@ -52,11 +52,13 @@
#import <Sparkle/SUUpdater.h>
#endif
#include <QApplication>
#include <QCoreApplication>
#include <QDir>
#include <QEvent>
#include <QFile>
#include <QSettings>
#include <QWidget>
#include <QtDebug>
@ -472,4 +474,17 @@ void DumpDictionary(CFDictionaryRef dict) {
NSLog(@"%@", d);
}
// NSWindowCollectionBehaviorFullScreenPrimary
static const NSUInteger kFullScreenPrimary = 1 << 7;
void EnableFullScreen(const QWidget& main_window) {
if (QSysInfo::MacintoshVersion == QSysInfo::MV_SNOWLEOPARD) {
return; // Unsupported on 10.6
}
NSView* view = reinterpret_cast<NSView*>(main_window.winId());
NSWindow* window = [view window];
[window setCollectionBehavior: kFullScreenPrimary];
}
} // namespace mac

View File

@ -424,6 +424,9 @@ int main(int argc, char *argv[]) {
// Window
MainWindow w(&app, tray_icon.get(), &osd);
#ifdef Q_OS_DARWIN
mac::EnableFullScreen(w);
#endif // Q_OS_DARWIN
#ifdef HAVE_GIO
ScanGIOModulePath();
#endif