Skip to content

Commit 0c08f94

Browse files
authoredFeb 26, 2020
GUIInventoryList: fix dropping items when clicking outside of formspec window (#9422)
1 parent 244121b commit 0c08f94

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed
 

Diff for: ‎src/gui/guiInventoryList.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,14 @@ bool GUIInventoryList::OnEvent(const SEvent &event)
176176
Environment->getRootGUIElement()->getElementFromPoint(
177177
core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y));
178178

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

181188
IsVisible = was_visible;
182189

0 commit comments

Comments
 (0)
Please sign in to comment.