From 9c6495b69566e88b5655f6aa596c8f290d755b13 Mon Sep 17 00:00:00 2001 From: Deve Date: Wed, 17 May 2023 00:26:18 +0200 Subject: [PATCH] Add a fix for inventory that can't be open in some cases The forceUpdateHoveredElement() forces GUI Environment to drop previously grabbed elements that are not hovered anymore. --- src/gui/modalMenu.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gui/modalMenu.cpp b/src/gui/modalMenu.cpp index 4894e8c3c..7b3c81819 100644 --- a/src/gui/modalMenu.cpp +++ b/src/gui/modalMenu.cpp @@ -109,7 +109,17 @@ void GUIModalMenu::quitMenu() // This removes Environment's grab on us Environment->removeFocus(this); m_menumgr->deletingMenu(this); + this->grab(); this->remove(); + +#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR >= 9 + // Force update hovered elements, so that GUI Environment drops previously + // grabbed elements that are not hovered anymore + Environment->forceUpdateHoveredElement(); +#endif + + this->drop(); + #ifdef HAVE_TOUCHSCREENGUI if (g_touchscreengui && g_touchscreengui->isActive() && m_touchscreen_visible) g_touchscreengui->show();