mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-24 19:53:44 +02:00
Quit GMenu2X when window is closed in main screen
This helps when testing on PC. I didn't bother to implement the same functionality for all dialog event loops, since that would be a lot of extra work and not necessary for the scenario that I need it for: clean exit when running under Valgrind.
This commit is contained in:
parent
ef6d378c5e
commit
cb1b26e5e6
@ -636,6 +636,9 @@ void GMenu2X::mainLoop() {
|
||||
gotEvent = input.getButton(&button, wait);
|
||||
} while (wait && !gotEvent);
|
||||
if (gotEvent) {
|
||||
if (button == InputManager::QUIT) {
|
||||
break;
|
||||
}
|
||||
for (auto it = layers.rbegin(); it != layers.rend(); ++it) {
|
||||
if ((*it)->handleButtonPress(button)) {
|
||||
break;
|
||||
|
@ -275,6 +275,10 @@ bool InputManager::getButton(Button *button, bool wait) {
|
||||
*button = REPAINT;
|
||||
return true;
|
||||
|
||||
case SDL_QUIT:
|
||||
*button = QUIT;
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -58,7 +58,9 @@ public:
|
||||
ACCEPT, CANCEL,
|
||||
ALTLEFT, ALTRIGHT,
|
||||
MENU, SETTINGS,
|
||||
REPAINT,
|
||||
// Events that are not actually buttons:
|
||||
// (not included in BUTTON_TYPE_SIZE)
|
||||
REPAINT, QUIT,
|
||||
};
|
||||
#define BUTTON_TYPE_SIZE 10
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user