Let the Renderer decide when to exit fullscreen.

This ensures the transition from/to exclusive mode happens while the RenderFrame is fullscreen.

This prevents fullscreen loops and relieves us of having to restore the window size after we exit fullscreen.
This commit is contained in:
Jules Blok 2014-07-16 15:53:33 +02:00
parent cd94ff1966
commit 36ea1890c8
8 changed files with 40 additions and 5 deletions

View file

@ -31,6 +31,7 @@ void Host_Message(int Id);
void Host_NotifyMapLoaded();
void Host_RefreshDSPDebuggerWindow();
void Host_RequestRenderWindowSize(int width, int height);
void Host_RequestFullscreen(bool fullscreen);
void Host_SetStartupDebuggingParameters();
void Host_SetWiiMoteConnectionState(int _State);
void Host_ShowJitResults(unsigned int address);

View file

@ -640,6 +640,11 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
}
break;
case IDM_FULLSCREENREQUEST:
if (m_RenderFrame != nullptr)
m_RenderFrame->ShowFullScreen(event.GetInt() == 0 ? false : true);
break;
case WM_USER_CREATE:
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
m_RenderParent->SetCursor(wxCURSOR_BLANK);
@ -1185,7 +1190,18 @@ void CFrame::DoFullscreen(bool bF)
[window toggleFullScreen:nil];
}
#else
m_RenderFrame->ShowFullScreen(bF, wxFULLSCREEN_ALL);
if (bF)
{
m_RenderFrame->ShowFullScreen(true, wxFULLSCREEN_ALL);
}
else if (!g_ActiveConfig.backend_info.bSupportsExclusiveFullscreen ||
SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain ||
g_ActiveConfig.bForceBorderlessFullscreen)
{
// Exiting exclusive fullscreen should be done from a Renderer callback.
// Therefore we don't exit fullscreen from here if we support exclusive mode.
m_RenderFrame->ShowFullScreen(false, wxFULLSCREEN_ALL);
}
#endif
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)

View file

@ -256,6 +256,7 @@ enum
IDM_WINDOWSIZEREQUEST,
IDM_STOPPED,
IDM_HOST_MESSAGE,
IDM_FULLSCREENREQUEST,
IDM_MPANEL, ID_STATUSBAR,

View file

@ -627,6 +627,13 @@ void Host_RequestRenderWindowSize(int width, int height)
main_frame->GetEventHandler()->AddPendingEvent(event);
}
void Host_RequestFullscreen(bool fullscreen)
{
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_FULLSCREENREQUEST);
event.SetInt(fullscreen ? 1 : 0);
main_frame->GetEventHandler()->AddPendingEvent(event);
}
void Host_SetStartupDebuggingParameters()
{
SCoreStartupParameter& StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter;

View file

@ -94,6 +94,9 @@ void Host_GetRenderWindowSize(int& x, int& y, int& width, int& height)
}
void Host_RequestRenderWindowSize(int width, int height) {}
void Host_RequestFullscreen(bool fullscreen) {}
void Host_SetStartupDebuggingParameters()
{
}

View file

@ -88,6 +88,9 @@ void Host_GetRenderWindowSize(int& x, int& y, int& width, int& height)
}
void Host_RequestRenderWindowSize(int width, int height) {}
void Host_RequestFullscreen(bool fullscreen) {}
void Host_SetStartupDebuggingParameters()
{
SCoreStartupParameter& StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter;

View file

@ -440,9 +440,6 @@ void Reset()
// release all back buffer references
SAFE_RELEASE(backbuf);
// apply fullscreen state
D3D::swapchain->SetFullscreenState(g_ActiveConfig.bFullscreen, nullptr);
// resize swapchain buffers
RECT client;
GetClientRect(hWnd, &client);

View file

@ -975,11 +975,18 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl
s_LastAA != g_ActiveConfig.iMultisampleMode)
{
s_LastAA = g_ActiveConfig.iMultisampleMode;
s_last_fullscreen_mode = fullscreen;
PixelShaderCache::InvalidateMSAAShaders();
if (windowResized || fullscreen_changed)
{
// apply fullscreen state
if (fullscreen_changed)
{
s_last_fullscreen_mode = fullscreen;
D3D::swapchain->SetFullscreenState(fullscreen, nullptr);
Host_RequestFullscreen(fullscreen);
}
// TODO: Aren't we still holding a reference to the back buffer right now?
D3D::Reset();
SAFE_RELEASE(s_screenshot_texture);