Fixed #217: ShowMessage and ShowHelp would not get drawn on-screen until an event was triggered

This commit is contained in:
Dimitris Panokostas 2018-01-22 21:38:11 +01:00
parent daa4817f0d
commit 27b563ee8d
2 changed files with 42 additions and 6 deletions

View file

@ -226,6 +226,17 @@ void ShowHelp(const char* title, const vector<string>& text)
wndShowHelp->setCaption(title); wndShowHelp->setCaption(title);
cmdOK->setCaption("Ok"); cmdOK->setCaption("Ok");
// Now we let the Gui object perform its logic.
uae_gui->logic();
// Now we let the Gui object draw itself.
uae_gui->draw();
#ifdef USE_SDL2
SDL_UpdateTexture(gui_texture, nullptr, gui_screen->pixels, gui_screen->pitch);
#endif
UpdateGuiScreen();
ShowHelpLoop(); ShowHelpLoop();
ExitShowHelp(); ExitShowHelp();
} }

View file

@ -183,11 +183,13 @@ static void ShowMessageLoop()
{ {
FocusBugWorkaround(wndShowMessage); FocusBugWorkaround(wndShowMessage);
int gotEvent = 0;
while (!dialogFinished) while (!dialogFinished)
{ {
SDL_Event event; SDL_Event event;
while (SDL_PollEvent(&event)) while (SDL_PollEvent(&event))
{ {
gotEvent = 1;
if (event.type == SDL_KEYDOWN) if (event.type == SDL_KEYDOWN)
{ {
switch (event.key.keysym.sym) switch (event.key.keysym.sym)
@ -251,13 +253,17 @@ static void ShowMessageLoop()
gui_input->pushInput(event); gui_input->pushInput(event);
#endif #endif
} }
if (gotEvent)
// Now we let the Gui object perform its logic. {
uae_gui->logic(); // Now we let the Gui object perform its logic.
// Now we let the Gui object draw itself. uae_gui->logic();
uae_gui->draw(); // Now we let the Gui object draw itself.
uae_gui->draw();
#ifdef USE_SDL2
SDL_UpdateTexture(gui_texture, nullptr, gui_screen->pixels, gui_screen->pitch);
#endif
}
// Finally we update the screen. // Finally we update the screen.
UpdateGuiScreen(); UpdateGuiScreen();
} }
} }
@ -281,7 +287,17 @@ bool ShowMessage(const char* title, const char* line1, const char* line2, const
cmdOK->setPosition(cmdCancel->getX(), cmdCancel->getY()); cmdOK->setPosition(cmdCancel->getX(), cmdCancel->getY());
} }
cmdOK->setEnabled(true); cmdOK->setEnabled(true);
// Prepare the screen once
uae_gui->logic();
uae_gui->draw();
#ifdef USE_SDL2
SDL_UpdateTexture(gui_texture, nullptr, gui_screen->pixels, gui_screen->pitch);
#endif
UpdateGuiScreen();
ShowMessageLoop(); ShowMessageLoop();
ExitShowMessage(); ExitShowMessage();
return dialogResult; return dialogResult;
@ -298,7 +314,16 @@ const char* ShowMessageForInput(const char* title, const char* line1, const char
cmdOK->setVisible(false); cmdOK->setVisible(false);
cmdCancel->setCaption(button1); cmdCancel->setCaption(button1);
// Prepare the screen once
uae_gui->logic();
uae_gui->draw();
#ifdef USE_SDL2
SDL_UpdateTexture(gui_texture, nullptr, gui_screen->pixels, gui_screen->pitch);
#endif
UpdateGuiScreen();
ShowMessageWaitInputLoop(); ShowMessageWaitInputLoop();
ExitShowMessage(); ExitShowMessage();
return dialogControlPressed; return dialogControlPressed;