Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

detach view while showing a Save/Load dialog, to avoid event leakage

fixes #1547
  • Loading branch information...
commit 166665ad344969ffa94535749cf3cbcdb69b212a 1 parent 644b90e
@johnbartholomew johnbartholomew authored
Showing with 7 additions and 2 deletions.
  1. +7 −0 src/GameLoaderSaver.cpp
  2. +0 −2  src/GameMenuView.cpp
View
7 src/GameLoaderSaver.cpp
@@ -14,6 +14,10 @@ GameLoaderSaver::GameLoaderSaver(FileSelectorWidget::Type type, const std::strin
void GameLoaderSaver::DialogMainLoop()
{
+ // detach previous view to avoid event leakage
+ View *previousView = Pi::GetView();
+ Pi::SetView(0);
+
Gui::Fixed *background = new Gui::Fixed(float(Gui::Screen::GetWidth()), float(Gui::Screen::GetHeight()));
background->SetTransparency(false);
background->SetBgColor(0,0,0,1.0);
@@ -40,6 +44,9 @@ void GameLoaderSaver::DialogMainLoop()
Gui::Screen::RemoveBaseWidget(background);
delete background;
+
+ // restore previous view
+ Pi::SetView(previousView);
}
void GameLoaderSaver::OnClickLoad(std::string filename)
View
2  src/GameMenuView.cpp
@@ -634,10 +634,8 @@ void GameMenuView::OpenSaveDialog()
Pi::cpan->MsgLog()->Message("", Lang::CANT_SAVE_IN_HYPERSPACE);
return;
}
- HideAll();
GameSaver saver(Pi::game);
saver.DialogMainLoop();
- ShowAll();
const std::string filename = saver.GetFilename();
if (!filename.empty())
Pi::cpan->MsgLog()->Message("", Lang::GAME_SAVED_TO+filename);
Please sign in to comment.
Something went wrong with that request. Please try again.