From 7f8fd01cdd56b322c19e58c19d483fb32fb05cb5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 3 Jul 2013 16:00:30 +0300 Subject: fix drag and drop inside some windows. --- src/gui/outfitwindow.cpp | 17 +++++++++++------ src/gui/widgets/dropshortcutcontainer.cpp | 17 +++++++++++------ src/gui/widgets/itemshortcutcontainer.cpp | 2 ++ src/gui/widgets/spellshortcutcontainer.cpp | 2 ++ 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp index d14abd701..a95d6fe2f 100644 --- a/src/gui/outfitwindow.cpp +++ b/src/gui/outfitwindow.cpp @@ -471,13 +471,18 @@ void OutfitWindow::mouseReleased(gcn::MouseEvent &event) } mMoved = false; event.consume(); - if (!dragDrop.isEmpty() && dragDrop.getSource() - == DRAGDROP_SOURCE_INVENTORY) + if (!dragDrop.isEmpty()) { - mItems[mCurrentOutfit][index] = dragDrop.getItem(); - mItemColors[mCurrentOutfit][index] = dragDrop.getItemColor(); - dragDrop.clear(); - dragDrop.deselect(); + DragDropSource src = dragDrop.getSource(); + if (src == DRAGDROP_SOURCE_INVENTORY + || src == DRAGDROP_SOURCE_OUTFIT + || src == DRAGDROP_SOURCE_DROP) + { + mItems[mCurrentOutfit][index] = dragDrop.getItem(); + mItemColors[mCurrentOutfit][index] = dragDrop.getItemColor(); + dragDrop.clear(); + dragDrop.deselect(); + } } if (mItemClicked) mItemClicked = false; diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index 8078347f7..f74db990b 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -252,13 +252,18 @@ void DropShortcutContainer::mouseReleased(gcn::MouseEvent &event) dragDrop.clear(); return; } - if (!dragDrop.isEmpty() && dragDrop.getSource() - == DRAGDROP_SOURCE_INVENTORY) + if (!dragDrop.isEmpty()) { - dropShortcut->setItems(index, dragDrop.getItem(), - dragDrop.getItemColor()); - dragDrop.clear(); - dragDrop.deselect(); + DragDropSource src = dragDrop.getSource(); + if (src == DRAGDROP_SOURCE_INVENTORY + || src == DRAGDROP_SOURCE_OUTFIT + || src == DRAGDROP_SOURCE_DROP) + { + dropShortcut->setItems(index, dragDrop.getItem(), + dragDrop.getItemColor()); + dragDrop.clear(); + dragDrop.deselect(); + } } mItemClicked = false; diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index ec0776f36..517c783a0 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -386,6 +386,8 @@ void ItemShortcutContainer::mouseReleased(gcn::MouseEvent &event) selShortcut->setItem(index, dragDrop.getItem(), dragDrop.getItemColor()); } + dragDrop.clear(); + dragDrop.deselect(); } mItemClicked = false; diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index dad7f5dcf..436f0c583 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -245,6 +245,8 @@ void SpellShortcutContainer::mouseReleased(gcn::MouseEvent &event) { spellManager->swap(idx + index, idx + oldIndex); spellManager->save(); + dragDrop.clear(); + dragDrop.deselect(); } } } -- cgit v1.2.3-70-g09d2