GS window: try to fix ESC on fullscreen sometimes not exiting correctly

This tries to emulate LilyPad's "Safe fullscreen exit on escape" hack, and
hopefully also makes this LilyPad hack redundant, such that it would fix the
issue also with other input plugins.
This commit is contained in:
Avi Halachmi (:avih) 2015-10-06 19:09:45 +03:00
parent 4522418890
commit 9c1688a39a
3 changed files with 15 additions and 4 deletions

View File

@ -441,12 +441,12 @@ void GSFrame::OnCloseWindow(wxCloseEvent& evt)
Hide(); // and don't close it.
}
bool GSFrame::ShowFullScreen(bool show)
bool GSFrame::ShowFullScreen(bool show, bool updateConfig)
{
/*if( show != IsFullScreen() )
Console.WriteLn( Color_StrongMagenta, "(gsFrame) Switching to %s mode...", show ? "Fullscreen" : "Windowed" );*/
if( g_Conf->GSWindow.IsFullscreen != show )
if (updateConfig && g_Conf->GSWindow.IsFullscreen != show)
{
g_Conf->GSWindow.IsFullscreen = show;
wxGetApp().PostIdleMethod( AppSaveSettings );

View File

@ -103,7 +103,7 @@ public:
bool Show( bool shown=true );
wxStaticText* GetLabel_OutputDisabled() const;
bool ShowFullScreen(bool show);
bool ShowFullScreen(bool show, bool updateConfig = true);
protected:
void OnCloseWindow( wxCloseEvent& evt );

View File

@ -281,9 +281,20 @@ namespace Implementations
void Sys_Suspend()
{
GSFrame* gsframe = wxGetApp().GetGsFramePtr();
if (gsframe) {
// On some cases, probably due to driver bugs, if we don't exit fullscreen then
// the content stays on screen. Try to prevent that by first exiting fullscreen,
// but don't update the internal PCSX2 state/config, and PCSX2 will restore
// fullscreen correctly when emulation resumes according to its state/config.
// This is similar to what LilyPad's "Safe fullscreen exit on escape" hack does,
// and thus hopefully makes LilyPad's hack redundant.
gsframe->ShowFullScreen(false, false);
}
CoreThread.Suspend();
GSFrame* gsframe = wxGetApp().GetGsFramePtr();
gsframe = wxGetApp().GetGsFramePtr(); // just in case suspend removes this window
if (gsframe && !wxGetApp().HasGUI() && g_Conf->GSWindow.CloseOnEsc) {
// When we run with --nogui, PCSX2 only knows to exit when the gs window closes.
// However, by default suspend just hides the gs window, so PCSX2 will not exit