diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 2821abd5ce..872d675184 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -398,11 +398,24 @@ CFrame::~CFrame() bool CFrame::RendererIsFullscreen() { + bool fullscreen = false; + if (Core::GetState() == Core::CORE_RUN || Core::GetState() == Core::CORE_PAUSE) { - return m_RenderFrame->IsFullScreen(); + fullscreen = m_RenderFrame->IsFullScreen(); } - return false; + +#if defined(__APPLE__) + if (m_RenderFrame != NULL) + { + NSView *view = (NSView *) m_RenderFrame->GetHandle(); + NSWindow *window = [view window]; + + fullscreen = (([window styleMask] & NSFullScreenWindowMask) == NSFullScreenWindowMask); + } +#endif + + return fullscreen; } void CFrame::OnQuit(wxCommandEvent& WXUNUSED (event)) @@ -979,7 +992,18 @@ void CFrame::DoFullscreen(bool bF) { ToggleDisplayMode(bF); +#if defined(__APPLE__) + NSView *view = (NSView *) m_RenderFrame->GetHandle(); + NSWindow *window = [view window]; + + if (bF != RendererIsFullscreen()) + { + [window toggleFullScreen:nil]; + } +#else m_RenderFrame->ShowFullScreen(bF, wxFULLSCREEN_ALL); +#endif + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain) { if (bF) diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 45a0eb1ad4..7a7f7de431 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -29,6 +29,10 @@ #include #include +#ifdef __APPLE__ +#include +#endif + #include "CDUtils.h" #include "Debugger/CodeWindow.h" #include "LogWindow.h" diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 634bcc4d32..7626e1b62e 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -798,9 +798,6 @@ void CFrame::ToggleDisplayMode(bool bFullscreen) #elif defined(HAVE_XRANDR) && HAVE_XRANDR m_XRRConfig->ToggleDisplayMode(bFullscreen); #elif defined __APPLE__ - NSView* view = (NSView *)m_RenderFrame->GetHandle(); - [[view window] toggleFullScreen:[view window]]; - if(bFullscreen) CGDisplayHideCursor(CGMainDisplayID()); else @@ -867,6 +864,13 @@ void CFrame::StartGame(const std::string& filename) m_RenderFrame->Show(); } +#if defined(__APPLE__) + NSView *view = (NSView *) m_RenderFrame->GetHandle(); + NSWindow *window = [view window]; + + [window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; +#endif + wxBeginBusyCursor(); DoFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen); @@ -1022,10 +1026,22 @@ void CFrame::DoStop() m_RenderParent->SetCursor(wxNullCursor); DoFullscreen(false); if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain) + { m_RenderFrame->Destroy(); + } else + { +#if defined(__APPLE__) + // Disable the full screen button when not in a game. + NSView *view = (NSView *) m_RenderFrame->GetHandle(); + NSWindow *window = [view window]; + + [window setCollectionBehavior:NSWindowCollectionBehaviorDefault]; +#endif + // Make sure the window is not longer set to stay on top m_RenderFrame->SetWindowStyle(m_RenderFrame->GetWindowStyle() & ~wxSTAY_ON_TOP); + } m_RenderParent = NULL; // Clean framerate indications from the status bar. diff --git a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp index 0687340e4d..c0acedcebb 100644 --- a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp @@ -253,6 +253,8 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con wxFlexGridSizer* const szr_display = new wxFlexGridSizer(2, 5, 5); { + +#if !defined(__APPLE__) // display resolution { wxArrayString res_list = GetListOfResolutions(); @@ -274,6 +276,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con choice_display_resolution->Disable(); } } +#endif // aspect-ratio {