https://github.com/libsdl-org/Maelstrom/commit/f7fc925ab7e32bda26c641bad8666981a1f5b9fb
From f7fc925ab7e32bda26c641bad8666981a1f5b9fb Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 29 Oct 2011 01:45:32 -0400
Subject: [PATCH] You can press escape to cancel dialogs
---
UIDialog.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/UIDialog.cpp b/UIDialog.cpp
index ddeb7e0b..80c8dca2 100644
--- a/UIDialog.cpp
+++ b/UIDialog.cpp
@@ -1,5 +1,6 @@
#include "screenlib/SDL_FrameBuf.h"
+#include "screenlib/UIManager.h"
#include "UIDialog.h"
@@ -110,6 +111,11 @@ UIDialog::HandleEvent(const SDL_Event &event)
UIPanel::HandleEvent(event);
if (event.type != SDL_QUIT) {
+ /* Press escape to cancel out of dialogs */
+ if (event.type == SDL_KEYUP &&
+ event.key.keysym.sym == SDLK_ESCAPE) {
+ GetUI()->HidePanel(GetUI()->GetCurrentPanel());
+ }
return true;
}
return false;