Date:2015-04-24 18:07:10 (8 years 11 months ago)
Author:Maarten ter Huurne
Commit:cb1b26e5e67d79ca9d03e85db06ec6c2e5b3557a
Message: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.
Files: src/gmenu2x.cpp (1 diff)
src/inputmanager.cpp (1 diff)
src/inputmanager.h (1 diff)

Change Details

src/gmenu2x.cpp
636636            gotEvent = input.getButton(&button, wait);
637637        } while (wait && !gotEvent);
638638        if (gotEvent) {
639            if (button == InputManager::QUIT) {
640                break;
641            }
639642            for (auto it = layers.rbegin(); it != layers.rend(); ++it) {
640643                if ((*it)->handleButtonPress(button)) {
641644                    break;
src/inputmanager.cpp
275275            *button = REPAINT;
276276            return true;
277277
278        case SDL_QUIT:
279            *button = QUIT;
280            return true;
281
278282        default:
279283            return false;
280284    }
src/inputmanager.h
5858        ACCEPT, CANCEL,
5959        ALTLEFT, ALTRIGHT,
6060        MENU, SETTINGS,
61        REPAINT,
61        // Events that are not actually buttons:
62        // (not included in BUTTON_TYPE_SIZE)
63        REPAINT, QUIT,
6264    };
6365    #define BUTTON_TYPE_SIZE 10
6466

Archive Download the corresponding diff file



interactive