summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/dropshortcutcontainer.cpp16
-rw-r--r--src/gui/widgets/itemcontainer.cpp3
2 files changed, 18 insertions, 1 deletions
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp
index fcd708bdc..aa4e1d829 100644
--- a/src/gui/widgets/dropshortcutcontainer.cpp
+++ b/src/gui/widgets/dropshortcutcontainer.cpp
@@ -207,7 +207,20 @@ void DropShortcutContainer::mousePressed(gcn::MouseEvent &event)
if (event.getButton() == gcn::MouseEvent::LEFT)
{
- mItemClicked = true;
+ if (dropShortcut->getItem(index) > 0)
+ {
+ mItemClicked = true;
+ }
+ else
+ {
+ Item *const selected = dragDrop.getSelected();
+ if (selected)
+ {
+ dropShortcut->setItems(index, selected->getId(),
+ selected->getColor());
+ dragDrop.deselect();
+ }
+ }
}
else if (event.getButton() == gcn::MouseEvent::RIGHT)
{
@@ -246,6 +259,7 @@ void DropShortcutContainer::mouseReleased(gcn::MouseEvent &event)
{
dropShortcut->setItems(index, item->getId(), item->getColor());
dragDrop.clear();
+ dragDrop.deselect();
}
}
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index f591af19c..eb353f5cf 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -401,11 +401,13 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event)
if (mSelectedIndex == index && mClicks != 2)
{
dragDrop.dragItem(item, DragDropSource::DRAGDROP_SOURCE_INVENTORY);
+ dragDrop.select(item);
mSelectionStatus = SEL_DESELECTING;
}
else if (item && item->getId())
{
dragDrop.dragItem(item, DragDropSource::DRAGDROP_SOURCE_INVENTORY);
+ dragDrop.select(item);
setSelectedIndex(index);
mSelectionStatus = SEL_SELECTING;
@@ -420,6 +422,7 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event)
}
else
{
+ dragDrop.deselect();
selectNone();
}
}