1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Support both mouse and touch input in GUIs in a single binary (#14146)

This commit is contained in:
grorp 2023-12-27 22:37:36 +01:00 committed by GitHub
parent 4f1dbb127a
commit 32e492837c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 95 additions and 83 deletions

View file

@ -1052,14 +1052,10 @@ void GUIHyperText::checkHover(s32 X, s32 Y)
}
}
#ifndef HAVE_TOUCHSCREENGUI
if (m_drawer.m_hovertag)
RenderingEngine::get_raw_device()->getCursorControl()->setActiveIcon(
gui::ECI_HAND);
else
RenderingEngine::get_raw_device()->getCursorControl()->setActiveIcon(
gui::ECI_NORMAL);
#endif
ICursorControl *cursor_control = RenderingEngine::get_raw_device()->getCursorControl();
if (cursor_control)
cursor_control->setActiveIcon(m_drawer.m_hovertag ? gui::ECI_HAND : gui::ECI_NORMAL);
}
bool GUIHyperText::OnEvent(const SEvent &event)
@ -1075,12 +1071,11 @@ bool GUIHyperText::OnEvent(const SEvent &event)
if (event.EventType == EET_GUI_EVENT &&
event.GUIEvent.EventType == EGET_ELEMENT_LEFT) {
m_drawer.m_hovertag = nullptr;
#ifndef HAVE_TOUCHSCREENGUI
gui::ICursorControl *cursor_control =
RenderingEngine::get_raw_device()->getCursorControl();
if (cursor_control->isVisible())
ICursorControl *cursor_control = RenderingEngine::get_raw_device()->getCursorControl();
if (cursor_control && cursor_control->isVisible())
cursor_control->setActiveIcon(gui::ECI_NORMAL);
#endif
}
if (event.EventType == EET_MOUSE_INPUT_EVENT) {