mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-12-26 21:43:20 +02:00
Fixed bug with launch screen and double buffering
LinkApp::drawRun() assumes the layers below are already painted when it is called, but this was not the case. With single buffering, the previous frame was still there so it still looked good, but with double buffering the buffer typically contains an outdated screen. Long term I think the launch should happen at the outermost scope, so all destructors get a chance to run. This commit is a small step in that direction, by exiting the main loop before launching.
This commit is contained in:
parent
8d38decc82
commit
965340a39c
@ -194,6 +194,7 @@ void GMenu2X::initCPULimits() {
|
||||
#endif
|
||||
|
||||
GMenu2X::GMenu2X()
|
||||
: appToLaunch(nullptr)
|
||||
{
|
||||
usbnet = samba = inet = web = false;
|
||||
useSelectionPng = false;
|
||||
@ -589,8 +590,9 @@ void GMenu2X::main() {
|
||||
if (!fileExists(CARD_ROOT))
|
||||
CARD_ROOT = "";
|
||||
|
||||
bool quit = false;
|
||||
while (!quit) {
|
||||
appToLaunch = nullptr;
|
||||
|
||||
while (true) {
|
||||
// Remove dismissed layers from the stack.
|
||||
for (auto it = layers.begin(); it != layers.end(); ) {
|
||||
if ((*it)->getStatus() == Layer::Status::DISMISSED) {
|
||||
@ -610,6 +612,9 @@ void GMenu2X::main() {
|
||||
for (auto layer : layers) {
|
||||
layer->paint(*s);
|
||||
}
|
||||
if (appToLaunch) {
|
||||
break;
|
||||
}
|
||||
s->flip();
|
||||
|
||||
// Handle touchscreen events.
|
||||
@ -639,6 +644,11 @@ void GMenu2X::main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (appToLaunch) {
|
||||
appToLaunch->drawRun();
|
||||
appToLaunch->launch(fileToLaunch);
|
||||
}
|
||||
}
|
||||
|
||||
void GMenu2X::explorer() {
|
||||
@ -662,6 +672,11 @@ void GMenu2X::explorer() {
|
||||
}
|
||||
}
|
||||
|
||||
void GMenu2X::queueLaunch(LinkApp *app, const std::string &file) {
|
||||
appToLaunch = app;
|
||||
fileToLaunch = file;
|
||||
}
|
||||
|
||||
void GMenu2X::showHelpPopup() {
|
||||
layers.push_back(make_shared<HelpPopup>(*this));
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ class Font;
|
||||
class HelpPopup;
|
||||
class IconButton;
|
||||
class Layer;
|
||||
class LinkApp;
|
||||
class MediaMonitor;
|
||||
class Menu;
|
||||
class Surface;
|
||||
@ -72,6 +73,9 @@ private:
|
||||
std::shared_ptr<Menu> menu;
|
||||
MediaMonitor *monitor;
|
||||
|
||||
LinkApp *appToLaunch;
|
||||
std::string fileToLaunch;
|
||||
|
||||
std::vector<std::shared_ptr<Layer>> layers;
|
||||
|
||||
/*!
|
||||
@ -184,6 +188,12 @@ public:
|
||||
|
||||
void setInputSpeed();
|
||||
|
||||
/**
|
||||
* Requests that the given application be launched.
|
||||
* The launch won't happen immediately; it will happen after control
|
||||
* returns to the main loop.
|
||||
*/
|
||||
void queueLaunch(LinkApp *app, const std::string &file);
|
||||
void saveSelection();
|
||||
void writeConfig();
|
||||
void writeSkinConfig();
|
||||
|
@ -372,7 +372,7 @@ void LinkApp::start() {
|
||||
if (!selectordir.empty())
|
||||
selector();
|
||||
else
|
||||
launch();
|
||||
gmenu2x->queueLaunch(this, "");
|
||||
}
|
||||
|
||||
void LinkApp::showManual() {
|
||||
@ -547,13 +547,11 @@ void LinkApp::selector(int startSelection, const string &selectorDir) {
|
||||
selectordir = selectedDir;
|
||||
}
|
||||
gmenu2x->writeTmp(selection, selectedDir);
|
||||
launch(selectedDir + sel.getFile());
|
||||
gmenu2x->queueLaunch(this, selectedDir + sel.getFile());
|
||||
}
|
||||
}
|
||||
|
||||
void LinkApp::launch(const string &selectedFile) {
|
||||
drawRun();
|
||||
|
||||
save();
|
||||
|
||||
if (isOpk()) {
|
||||
|
@ -41,7 +41,6 @@ private:
|
||||
int iclock;
|
||||
std::string exec, params, workdir, manual, selectordir, selectorfilter, selectorscreens;
|
||||
bool selectorbrowser, editable;
|
||||
void drawRun();
|
||||
|
||||
std::string aliasfile;
|
||||
std::string file;
|
||||
@ -53,7 +52,6 @@ private:
|
||||
#endif
|
||||
|
||||
void start();
|
||||
void launch(const std::string &selectedFile = "");
|
||||
|
||||
protected:
|
||||
virtual const std::string &searchIcon();
|
||||
@ -107,6 +105,9 @@ public:
|
||||
|
||||
const std::string &getFile() { return file; }
|
||||
void renameFile(const std::string &name);
|
||||
|
||||
void drawRun();
|
||||
void launch(const std::string &selectedFile);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user