summaryrefslogtreecommitdiff
path: root/src/gui/modalMenu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/modalMenu.cpp')
-rw-r--r--src/gui/modalMenu.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gui/modalMenu.cpp b/src/gui/modalMenu.cpp
index 0d3fb55f0..56a5d2cb9 100644
--- a/src/gui/modalMenu.cpp
+++ b/src/gui/modalMenu.cpp
@@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifdef HAVE_TOUCHSCREENGUI
#include "touchscreengui.h"
+#include "client/renderingengine.h"
#endif
// clang-format off
@@ -40,8 +41,8 @@ GUIModalMenu::GUIModalMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent,
m_remap_dbl_click(remap_dbl_click)
{
m_gui_scale = g_settings->getFloat("gui_scaling");
-#ifdef __ANDROID__
- float d = porting::getDisplayDensity();
+#ifdef HAVE_TOUCHSCREENGUI
+ float d = RenderingEngine::getDisplayDensity();
m_gui_scale *= 1.1 - 0.3 * d + 0.2 * d * d;
#endif
setVisible(true);
@@ -183,7 +184,7 @@ static bool isChild(gui::IGUIElement *tocheck, gui::IGUIElement *parent)
return false;
}
-#ifdef __ANDROID__
+#ifdef HAVE_TOUCHSCREENGUI
bool GUIModalMenu::simulateMouseEvent(
gui::IGUIElement *target, ETOUCH_INPUT_EVENT touch_event)
@@ -217,6 +218,8 @@ bool GUIModalMenu::simulateMouseEvent(
void GUIModalMenu::enter(gui::IGUIElement *hovered)
{
+ if (!hovered)
+ return;
sanity_check(!m_hovered);
m_hovered.grab(hovered);
SEvent gui_event{};
@@ -268,7 +271,7 @@ bool GUIModalMenu::preprocessEvent(const SEvent &event)
std::string label = wide_to_utf8(getLabelByID(hovered->getID()));
if (label.empty())
label = "text";
- message += gettext(label) + ":";
+ message += strgettext(label) + ":";
// single line text input
int type = 2;
@@ -286,7 +289,9 @@ bool GUIModalMenu::preprocessEvent(const SEvent &event)
return retval;
}
}
+#endif
+#ifdef HAVE_TOUCHSCREENGUI
if (event.EventType == EET_TOUCH_INPUT_EVENT) {
irr_ptr<GUIModalMenu> holder;
holder.grab(this); // keep this alive until return (it might be dropped downstream [?])