aboutsummaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorDS <vorunbekannt75@web.de>2022-10-21 17:11:41 +0200
committerGitHub <noreply@github.com>2022-10-21 17:11:41 +0200
commit7153cb8a0bd6a0d405e2d84975812164233be4f6 (patch)
treeed9aca93153bdd84392be670674bb96d19f98cf5 /src/gui
parent9f0d88407d9dadb1a8cf8c03131eda034f2f19e1 (diff)
downloadminetest-7153cb8a0bd6a0d405e2d84975812164233be4f6.tar.xz
Fix formspec focus (#12795)
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/guiFormSpecMenu.cpp2
-rw-r--r--src/gui/guiFormSpecMenu.h15
2 files changed, 9 insertions, 8 deletions
diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp
index 846b657d7..b85ee57c4 100644
--- a/src/gui/guiFormSpecMenu.cpp
+++ b/src/gui/guiFormSpecMenu.cpp
@@ -3046,7 +3046,7 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
}
} else {
// Don't keep old focus value
- m_focused_element.clear();
+ m_focused_element = nullopt;
}
// Remove children
diff --git a/src/gui/guiFormSpecMenu.h b/src/gui/guiFormSpecMenu.h
index c01ff817b..d745eab80 100644
--- a/src/gui/guiFormSpecMenu.h
+++ b/src/gui/guiFormSpecMenu.h
@@ -32,6 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "guiTable.h"
#include "network/networkprotocol.h"
#include "client/joystick_controller.h"
+#include "util/Optional.h"
#include "util/string.h"
#include "util/enriched_string.h"
#include "StyleSpec.h"
@@ -352,13 +353,13 @@ protected:
video::SColor m_default_tooltip_color;
private:
- IFormSource *m_form_src;
- TextDest *m_text_dst;
- std::string m_last_formname;
- u16 m_formspec_version = 1;
- std::string m_focused_element = "";
- JoystickController *m_joystick;
- bool m_show_debug = false;
+ IFormSource *m_form_src;
+ TextDest *m_text_dst;
+ std::string m_last_formname;
+ u16 m_formspec_version = 1;
+ Optional<std::string> m_focused_element = nullopt;
+ JoystickController *m_joystick;
+ bool m_show_debug = false;
struct parserData {
bool explicit_size;