From 3c41195986a2abe648cfa411c03a150ec7c2e5c7 Mon Sep 17 00:00:00 2001 From: DS Date: Mon, 16 Oct 2023 20:46:57 +0200 Subject: [PATCH] Inventory: Fix picking up items via drop and pickup doubleclick (#13891) --- src/gui/guiFormSpecMenu.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp index 67a6d2ac83c3..a51a026696b0 100644 --- a/src/gui/guiFormSpecMenu.cpp +++ b/src/gui/guiFormSpecMenu.cpp @@ -4420,9 +4420,10 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event) } } } else if (button == BET_LEFT && (empty || matching)) { - // We don't know if the user is left-dragging or just moving - // the item, so assume that they are left-dragging, - // and wait for the next event before moving the item + // We don't know if the user is left-dragging, just moving + // the item, or doing a pickup-all via doubleclick, so assume + // that they are left-dragging, and wait for the next event + // before moving the item, or doing a pickup-all m_left_dragging = true; m_client->inhibit_inventory_revert = true; m_left_drag_stack = list_selected->getItem(m_selected_item->i); @@ -4572,6 +4573,13 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event) if (!s.isValid() || event.MouseInput.Event != EMIE_LMOUSE_DOUBLE_CLICK) break; + // Only do the pickup all thing when putting down an item. + // Doubleclick events are triggered after press-down events, so if + // m_left_dragging is true here, the user just put down an itemstack, + // but didn't yet release the button to make it happen. + if (!m_left_dragging) + break; + // Abort left-dragging m_left_dragging = false; m_client->inhibit_inventory_revert = false;