Skip to content

Commit

Permalink
Inventory: Fix picking up items via drop and pickup doubleclick (#13891)
Browse files Browse the repository at this point in the history
  • Loading branch information
Desour committed Oct 16, 2023
1 parent 5e0f142 commit 3c41195
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/gui/guiFormSpecMenu.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 3c41195

Please sign in to comment.