Inventory: Fix picking up items via drop and pickup doubleclick (#13891)

This commit is contained in:
DS 2023-10-16 20:46:57 +02:00 committed by GitHub
parent 5e0f14266d
commit 3c41195986
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;