https://github.com/libsdl-org/Maelstrom/commit/de214447a59c9d6b1f57490e3769f29080298f73
From de214447a59c9d6b1f57490e3769f29080298f73 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 29 Oct 2011 01:45:59 -0400
Subject: [PATCH] You can hit return to activate default buttons.
---
UIDialogButton.cpp | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/UIDialogButton.cpp b/UIDialogButton.cpp
index f3663b0f..1f2f9d0c 100644
--- a/UIDialogButton.cpp
+++ b/UIDialogButton.cpp
@@ -37,23 +37,12 @@ UIDialogButton::Load(rapidxml::xml_node<> *node, const UITemplates *templates)
return false;
}
- attr = node->first_attribute("default", 0, false);
- if (attr) {
- const char *value = attr->value();
-
- if (*value == '1' || *value == 't' || *value == 'T') {
- m_default = true;
- }
+ LoadBool(node, "default", m_default);
+ if (m_default) {
+ m_hotkey = SDLK_RETURN;
}
- attr = node->first_attribute("closeDialog", 0, false);
- if (attr) {
- const char *value = attr->value();
-
- if (*value == '1' || *value == 't' || *value == 'T') {
- m_closeDialog = true;
- }
- }
+ LoadBool(node, "closeDialog", m_closeDialog);
attr = node->first_attribute("text", 0, false);
if (attr) {