Draw one frame in GUI requesters before waiting for event triggers

This commit is contained in:
Dimitris Panokostas 2018-01-21 13:34:46 +01:00
parent 34865818c2
commit af6ced7111
7 changed files with 38 additions and 18 deletions

View file

@ -368,6 +368,10 @@ bool CreateFilesysHardfile()
// 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();
CreateFilesysHardfileLoop();
ExitCreateFilesysHardfile();

View file

@ -584,6 +584,10 @@ bool EditFilesysHardfile(const int unit_no)
// 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();
EditFilesysHardfileLoop();

View file

@ -389,6 +389,10 @@ bool EditFilesysVirtual(const int unit_no)
// 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();
EditFilesysVirtualLoop();

View file

@ -245,6 +245,10 @@ void InGameMessage(const char* msg)
// 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();
while (!msg_done)
{

View file

@ -7,7 +7,6 @@
#include <guisan.hpp>
#include <SDL_ttf.h>
#include <guisan/sdl.hpp>
#include <guisan/sdl/sdltruetypefont.hpp>
#endif
#include "SelectorEntry.hpp"
#include "UaeRadioButton.hpp"
@ -16,14 +15,10 @@
#include "sysconfig.h"
#include "sysdeps.h"
#include "config.h"
#include "options.h"
#include "include/memory.h"
#include "uae.h"
#include "autoconf.h"
#include "filesys.h"
#include "blkdev.h"
#include "gui.h"
#include "gui_handling.h"
enum
@ -544,7 +539,7 @@ static void AdjustDropDownControls()
cboCDFile->clearSelected();
if (changed_prefs.cdslots[0].inuse && strlen(changed_prefs.cdslots[0].name) > 0)
{
for (auto i = 0; i < lstMRUCDList.size(); ++i)
for (unsigned int i = 0; i < lstMRUCDList.size(); ++i)
{
if (lstMRUCDList[i] != changed_prefs.cdslots[0].name)
{

View file

@ -82,12 +82,12 @@ public:
void changeDir(const char* path)
{
ReadDirectory(path, &dirs, &files);
if (dirs.size() == 0)
dirs.push_back("..");
if (dirs.empty())
dirs.emplace_back("..");
FilterFiles(&files, filefilter);
}
bool isDir(int i) const
bool isDir(unsigned int i) const
{
return (i < dirs.size());
}
@ -477,6 +477,10 @@ bool SelectFile(const char* title, char* value, const char* filter[], const bool
// 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();
SelectFileLoop();
#ifdef FILE_SELECT_KEEP_POSITION

View file

@ -44,7 +44,7 @@ static gcn::ScrollArea* scrAreaFolders;
static gcn::TextField* txtCurrent;
class ButtonActionListener : public gcn::ActionListener
class FolderButtonActionListener : public gcn::ActionListener
{
public:
void action(const gcn::ActionEvent& actionEvent) override
@ -57,15 +57,15 @@ public:
}
};
static ButtonActionListener* buttonActionListener;
static FolderButtonActionListener* folderButtonActionListener;
class DirListModel : public gcn::ListModel
class SelectDirListModel : public gcn::ListModel
{
vector<string> dirs;
public:
DirListModel(const char* path)
SelectDirListModel(const char* path)
{
changeDir(path);
}
@ -90,7 +90,7 @@ public:
}
};
static DirListModel dirList(".");
static SelectDirListModel dirList(".");
static void checkfoldername(char* current)
@ -139,21 +139,21 @@ static void InitSelectFolder(const char* title)
wndSelectFolder->setCaption(title);
wndSelectFolder->setTitleBarHeight(TITLEBAR_HEIGHT);
buttonActionListener = new ButtonActionListener();
folderButtonActionListener = new FolderButtonActionListener();
cmdOK = new gcn::Button("Ok");
cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X,
DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
cmdOK->setBaseColor(gui_baseCol);
cmdOK->addActionListener(buttonActionListener);
cmdOK->addActionListener(folderButtonActionListener);
cmdCancel = new gcn::Button("Cancel");
cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH,
DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10);
cmdCancel->setBaseColor(gui_baseCol);
cmdCancel->addActionListener(buttonActionListener);
cmdCancel->addActionListener(folderButtonActionListener);
txtCurrent = new gcn::TextField();
txtCurrent->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, TEXTFIELD_HEIGHT);
@ -199,7 +199,7 @@ static void ExitSelectFolder()
delete cmdOK;
delete cmdCancel;
delete buttonActionListener;
delete folderButtonActionListener;
delete txtCurrent;
delete lstFolders;
@ -346,12 +346,17 @@ bool SelectFolder(const char* title, char* value)
{
dialogResult = false;
dialogFinished = false;
InitSelectFolder(title);
checkfoldername(value);
// 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();
SelectFolderLoop();
ExitSelectFolder();