Skip to content
Permalink
Browse files

GUIInventoryList: fix dropping items when clicking outside of formspe…

…c window (#9422)
  • Loading branch information
Desour committed Feb 26, 2020
1 parent 244121b commit 0c08f948d7014e66d5a79d7584c03164af2edd93
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/gui/guiInventoryList.cpp
@@ -176,7 +176,14 @@ bool GUIInventoryList::OnEvent(const SEvent &event)
Environment->getRootGUIElement()->getElementFromPoint(
core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y));

bool ret = hovered && hovered->OnEvent(event);
// if the player clicks outside of the formspec window, hovered is not
// m_fs_menu, but some other weird element (with ID -1). we do however need
// hovered to be m_fs_menu as item dropping when clicking outside of the
// formspec window is handled in its OnEvent callback
if (!hovered || hovered->getID() == -1)
hovered = m_fs_menu;

bool ret = hovered->OnEvent(event);

IsVisible = was_visible;

0 comments on commit 0c08f94

Please sign in to comment.
You can’t perform that action at this time.