https://github.com/libsdl-org/Maelstrom/commit/990fa92fc021ad8997bf58b68a42e14aefb66a99
From 990fa92fc021ad8997bf58b68a42e14aefb66a99 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 9 Sep 2012 19:23:42 -0700
Subject: [PATCH] Enable text input when an editbox has focus
---
screenlib/UIElementEditbox.cpp | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/screenlib/UIElementEditbox.cpp b/screenlib/UIElementEditbox.cpp
index e098808b..635504b9 100644
--- a/screenlib/UIElementEditbox.cpp
+++ b/screenlib/UIElementEditbox.cpp
@@ -19,6 +19,7 @@
3. This notice may not be removed or altered from any source distribution.
*/
+#include "SDL_FrameBuf.h"
#include "UIElementEditbox.h"
UIElementType UIElementEditbox::s_elementType;
@@ -124,6 +125,10 @@ UIElementEditbox::HandleEvent(const SDL_Event &event)
void
UIElementEditbox::SetFocus(bool focus)
{
+ if (focus == m_focus) {
+ return;
+ }
+
m_focus = focus;
if (m_focus) {
@@ -141,6 +146,12 @@ UIElementEditbox::SetFocus(bool focus)
} else {
SetHighlight(false);
}
+
+ if (m_focus) {
+ m_screen->EnableTextInput();
+ } else {
+ m_screen->DisableTextInput();
+ }
}
void