From 6d61173bca9e3df1e152f792bbc0f216be8b6931 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Tue, 20 Sep 2011 18:16:38 -0400 Subject: [PATCH] Avoid tomahawkapp.h in .mm files --- src/mac/tomahawkapp_mac.h | 4 ++-- src/mac/tomahawkapp_mac.mm | 26 +++++++++++++++----------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/mac/tomahawkapp_mac.h b/src/mac/tomahawkapp_mac.h index 5741c05c2..e0957177f 100644 --- a/src/mac/tomahawkapp_mac.h +++ b/src/mac/tomahawkapp_mac.h @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - === - * - * Copyright 2010-2011, Christian Muehlhaeuser + * + * Copyright 2010-2011, Leo Franchi * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/mac/tomahawkapp_mac.mm b/src/mac/tomahawkapp_mac.mm index 4f559d693..2178ae37b 100644 --- a/src/mac/tomahawkapp_mac.mm +++ b/src/mac/tomahawkapp_mac.mm @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - === * - * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2010-2011, Leo Franchi * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +21,7 @@ #include "macdelegate.h" #include "macshortcuthandler.h" #include "config.h" +#include "tomahawkwindow.h" #include "AvailabilityMacros.h" @@ -41,14 +42,8 @@ #import #endif -#if defined(MAC_OS_X_VERSION_10_7) -#include "tomahawkapp.h" -#endif - #include - -// Capture global media keys on Mac (Cocoa only!) -// See: http://www.rogueamoeba.com/utm/2007/09/29/apple-keyboard-media-key-event-handling/ +#include @interface MacApplication :NSApplication { AppDelegate* delegate_; @@ -243,8 +238,17 @@ void Tomahawk::enableFullscreen() { #if defined(MAC_OS_X_VERSION_10_7) qDebug() << "Enabling Lion Full-screeen"; - NSView *nsview = (NSView *)APP->mainWindow()->winId(); - NSWindow *nswindow = [nsview window]; - [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; + // 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 setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; + } + } + #endif }