summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-03-21 17:32:27 +0300
committerAndrei Karas <akaras@inbox.ru>2014-03-21 18:51:45 +0300
commit3ed0b5f6edce152fa2eca9c84d64cbeec8ac0173 (patch)
tree8791e88608a737b0cb56997743a1404f982eecc8
parent1dd71a1f8489b35d1c989fb0477122224d981853 (diff)
downloadmanaplus-3ed0b5f6edce152fa2eca9c84d64cbeec8ac0173.tar.gz
manaplus-3ed0b5f6edce152fa2eca9c84d64cbeec8ac0173.tar.bz2
manaplus-3ed0b5f6edce152fa2eca9c84d64cbeec8ac0173.tar.xz
manaplus-3ed0b5f6edce152fa2eca9c84d64cbeec8ac0173.zip
Add consume calls into mouse press / click handlers.
-rw-r--r--src/gui/widgets/avatarlistbox.cpp1
-rw-r--r--src/gui/widgets/characterdisplay.cpp1
-rw-r--r--src/gui/widgets/checkbox.cpp3
-rw-r--r--src/gui/widgets/dropdown.cpp1
-rw-r--r--src/gui/widgets/dropshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/emotepage.cpp1
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp1
-rw-r--r--src/gui/widgets/guitable.cpp1
-rw-r--r--src/gui/widgets/itemcontainer.cpp1
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/listbox.cpp2
-rw-r--r--src/gui/widgets/popuplist.cpp1
-rw-r--r--src/gui/widgets/radiobutton.cpp1
-rw-r--r--src/gui/widgets/scrollarea.cpp9
-rw-r--r--src/gui/widgets/slider.cpp1
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/tabbedarea.cpp1
-rw-r--r--src/gui/widgets/textbox.cpp1
-rw-r--r--src/gui/widgets/textfield.cpp1
-rw-r--r--src/gui/widgets/window.cpp4
-rw-r--r--src/gui/windowmenu.cpp6
-rw-r--r--src/gui/windows/chatwindow.cpp1
-rw-r--r--src/gui/windows/equipmentwindow.cpp2
-rw-r--r--src/gui/windows/ministatuswindow.cpp1
-rw-r--r--src/gui/windows/npcdialog.cpp1
-rw-r--r--src/gui/windows/serverdialog.cpp12
-rw-r--r--src/gui/windows/skilldialog.cpp1
27 files changed, 55 insertions, 6 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index 01126f8ac..5ce74bfca 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -332,6 +332,7 @@ void AvatarListBox::mousePressed(MouseEvent &event)
if (!ava)
return;
+ event.consume();
const unsigned int eventButton = event.getButton();
if (eventButton == MouseEvent::LEFT)
{
diff --git a/src/gui/widgets/characterdisplay.cpp b/src/gui/widgets/characterdisplay.cpp
index 7bfc938de..db2f2e2de 100644
--- a/src/gui/widgets/characterdisplay.cpp
+++ b/src/gui/widgets/characterdisplay.cpp
@@ -145,6 +145,7 @@ void CharacterDisplay::mouseMoved(MouseEvent &event A_UNUSED)
void CharacterDisplay::mousePressed(MouseEvent &event)
{
+ event.consume();
if (event.getClickCount() == 2)
distributeActionEvent();
}
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index 3816fe436..0cba673b5 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -256,7 +256,10 @@ void CheckBox::adjustSize()
void CheckBox::mouseClicked(MouseEvent& mouseEvent)
{
if (mouseEvent.getButton() == MouseEvent::LEFT)
+ {
toggleSelected();
+ mouseEvent.consume();
+ }
}
void CheckBox::mouseDragged(MouseEvent& mouseEvent)
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 7173e04b4..a4580f596 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -356,6 +356,7 @@ void DropDown::hideDrop(bool event)
void DropDown::mousePressed(MouseEvent& mouseEvent)
{
+ mouseEvent.consume();
// If we have a mouse press on the widget.
if (mouseEvent.getButton() == MouseEvent::LEFT
&& !mDroppedDown && mouseEvent.getSource() == this)
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp
index c8e4bc2d9..d85bcccf4 100644
--- a/src/gui/widgets/dropshortcutcontainer.cpp
+++ b/src/gui/widgets/dropshortcutcontainer.cpp
@@ -206,6 +206,8 @@ void DropShortcutContainer::mousePressed(MouseEvent &event)
if (index == -1)
return;
+ event.consume();
+
const int eventButton = event.getButton();
if (eventButton == MouseEvent::LEFT)
{
diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp
index 9000c147b..ebf504f54 100644
--- a/src/gui/widgets/emotepage.cpp
+++ b/src/gui/widgets/emotepage.cpp
@@ -119,6 +119,7 @@ void EmotePage::draw(Graphics *graphics)
void EmotePage::mousePressed(MouseEvent &mouseEvent)
{
mSelectedIndex = getIndexFromGrid(mouseEvent.getX(), mouseEvent.getY());
+ mouseEvent.consume();
distributeActionEvent();
}
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index 296f21126..c731e86d8 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -163,6 +163,7 @@ void EmoteShortcutContainer::mousePressed(MouseEvent &event)
if (index == -1)
return;
+ event.consume();
// Stores the selected emote if there is one.
if (emoteShortcut->isEmoteSelected())
{
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index c7964d3c6..08da80322 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -480,6 +480,7 @@ void GuiTable::mousePressed(MouseEvent& mouseEvent)
{
mSelectedColumn = column;
mSelectedRow = row;
+ mouseEvent.consume();
}
distributeActionEvent();
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 3fba41750..1c6cf9ec3 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -403,6 +403,7 @@ void ItemContainer::mousePressed(MouseEvent &event)
if (button == MouseEvent::LEFT || button == MouseEvent::RIGHT)
{
+ event.consume();
const int index = getSlotIndex(event.getX(), event.getY());
if (index == Inventory::NO_SLOT_INDEX)
return;
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index b9dc3bec8..33ae1890d 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -334,6 +334,7 @@ void ItemShortcutContainer::mousePressed(MouseEvent &event)
if (event.getButton() == MouseEvent::LEFT)
{
+ event.consume();
// Stores the selected item if theirs one.
if (selShortcut->isItemSelected() && inventoryWindow &&
(inventoryWindow->isWindowVisible()
@@ -352,6 +353,7 @@ void ItemShortcutContainer::mousePressed(MouseEvent &event)
}
else if (event.getButton() == MouseEvent::RIGHT)
{
+ event.consume();
if (viewport && selShortcut)
{
viewport->showItemPopup(selShortcut->getItem(index),
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index f2a23253e..27cc29ed1 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -275,6 +275,8 @@ void ListBox::mouseWheelMovedDown(MouseEvent &mouseEvent A_UNUSED)
void ListBox::mousePressed(MouseEvent &event)
{
mPressedIndex = getSelectionByMouse(event.getY());
+ if (mPressedIndex != -1)
+ event.consume();
}
void ListBox::mouseReleased(MouseEvent &event)
diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp
index 2636dac38..c657cdde5 100644
--- a/src/gui/widgets/popuplist.cpp
+++ b/src/gui/widgets/popuplist.cpp
@@ -133,6 +133,7 @@ void PopupList::mousePressed(MouseEvent& mouseEvent)
{
mPressedIndex = mListBox->getSelectionByMouse(
mouseEvent.getY() + mPadding);
+ mouseEvent.consume();
}
void PopupList::mouseReleased(MouseEvent& mouseEvent)
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index 8abac91cf..e83e9229a 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -276,6 +276,7 @@ void RadioButton::mouseClicked(MouseEvent& mouseEvent)
if (mouseEvent.getButton() == MouseEvent::LEFT)
{
setSelected(true);
+ mouseEvent.consume();
distributeActionEvent();
}
}
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index 571297ace..4aeef8efb 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -739,24 +739,28 @@ void ScrollArea::mousePressed(MouseEvent& event)
setVerticalScrollAmount(mVScroll
- mUpButtonScrollAmount);
mUpButtonPressed = true;
+ event.consume();
}
else if (getDownButtonDimension().isPointInRect(x, y))
{
setVerticalScrollAmount(mVScroll
+ mDownButtonScrollAmount);
mDownButtonPressed = true;
+ event.consume();
}
else if (getLeftButtonDimension().isPointInRect(x, y))
{
setHorizontalScrollAmount(mHScroll
- mLeftButtonScrollAmount);
mLeftButtonPressed = true;
+ event.consume();
}
else if (getRightButtonDimension().isPointInRect(x, y))
{
setHorizontalScrollAmount(mHScroll
+ mRightButtonScrollAmount);
mRightButtonPressed = true;
+ event.consume();
}
else if (getVerticalMarkerDimension().isPointInRect(x, y))
{
@@ -764,6 +768,7 @@ void ScrollArea::mousePressed(MouseEvent& event)
mIsVerticalMarkerDragged = true;
mVerticalMarkerDragOffset = y - getVerticalMarkerDimension().y;
+ event.consume();
}
else if (getVerticalBarDimension().isPointInRect(x, y))
{
@@ -777,13 +782,14 @@ void ScrollArea::mousePressed(MouseEvent& event)
setVerticalScrollAmount(mVScroll
+ static_cast<int>(getChildrenArea().height * 0.95));
}
+ event.consume();
}
else if (getHorizontalMarkerDimension().isPointInRect(x, y))
{
mIsHorizontalMarkerDragged = true;
mIsVerticalMarkerDragged = false;
-
mHorizontalMarkerDragOffset = x - getHorizontalMarkerDimension().x;
+ event.consume();
}
else if (getHorizontalBarDimension().isPointInRect(x, y))
{
@@ -797,6 +803,7 @@ void ScrollArea::mousePressed(MouseEvent& event)
setHorizontalScrollAmount(mHScroll
+ static_cast<int>(getChildrenArea().width * 0.95));
}
+ event.consume();
}
if (event.getButton() == MouseEvent::LEFT)
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index 6de889249..e7f046422 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -362,6 +362,7 @@ void Slider::mousePressed(MouseEvent &mouseEvent)
if (mouseEvent.getButton() == MouseEvent::LEFT
&& x >= 0 && x <= width && y >= 0 && y <= height)
{
+ mouseEvent.consume();
if (mOrientation == HORIZONTAL)
setValue(markerPositionToValue(x - mMarkerLength / 2));
else
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index ed92b62e1..add394a64 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -189,6 +189,7 @@ void SpellShortcutContainer::mousePressed(MouseEvent &event)
const int itemId = getItemByIndex(index);
if (itemId > 0)
mSpellClicked = true;
+ event.consume();
}
else if (eventButton == MouseEvent::RIGHT)
{
@@ -198,6 +199,7 @@ void SpellShortcutContainer::mousePressed(MouseEvent &event)
if (!spellShortcut || !spellManager)
return;
+ event.consume();
const int itemId = getItemByIndex(index);
spellManager->invoke(itemId);
}
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index 445f17982..554bdfc66 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -379,6 +379,7 @@ void TabbedArea::mousePressed(MouseEvent &mouseEvent)
if (tab)
{
+ mouseEvent.consume();
setSelectedTab(tab);
requestFocus();
}
diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp
index 5008da6ea..50e423de8 100644
--- a/src/gui/widgets/textbox.cpp
+++ b/src/gui/widgets/textbox.cpp
@@ -590,6 +590,7 @@ void TextBox::mousePressed(MouseEvent& mouseEvent)
if (!height)
return;
+ mouseEvent.consume();
mCaretRow = mouseEvent.getY() / height;
const int sz = static_cast<int>(mTextRows.size());
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 98a308e37..b822996a4 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -699,6 +699,7 @@ void TextField::mousePressed(MouseEvent &mouseEvent)
if (!client->isKeyboardVisible())
inputManager.executeAction(Input::KEY_SHOW_KEYBOARD);
#endif
+ mouseEvent.consume();
if (mouseEvent.getButton() == MouseEvent::RIGHT)
{
if (viewport)
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index dda03a438..8d457e599 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -724,6 +724,7 @@ void Window::mousePressed(MouseEvent &event)
{
mouseResize = 0;
mMoved = 0;
+ event.consume();
close();
return;
}
@@ -735,11 +736,14 @@ void Window::mousePressed(MouseEvent &event)
mouseResize = 0;
mMoved = 0;
mRedraw = true;
+ event.consume();
return;
}
// Handle window resizing
mouseResize = getResizeHandles(event) & resizeMask;
+ if (mouseResize != 0)
+ event.consume();
if (canMove())
mMoved = !mouseResize;
else
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 616afa46d..868455de5 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -239,8 +239,12 @@ void WindowMenu::mousePressed(MouseEvent &event)
if (!viewport)
return;
- if (!mSmallWindow && event.getButton() == MouseEvent::RIGHT)
+ if (event.getButton() == MouseEvent::RIGHT)
{
+ if (mSmallWindow)
+ return;
+
+ event.consume();
Button *const btn = dynamic_cast<Button*>(event.getSource());
if (!btn)
return;
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 5698973f3..c6e4182d8 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -732,6 +732,7 @@ void ChatWindow::mousePressed(MouseEvent &event)
Tab *const tab = mChatTabs->getSelectedTab();
if (tab)
{
+ event.consume();
if (inputManager.isActionActive(static_cast<int>(
Input::KEY_CHAT_MOD)))
{
diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp
index 3799015e5..b8b693fc1 100644
--- a/src/gui/windows/equipmentwindow.cpp
+++ b/src/gui/windows/equipmentwindow.cpp
@@ -332,6 +332,7 @@ void EquipmentWindow::mousePressed(MouseEvent& mouseEvent)
inBox = true;
if (item)
{
+ mouseEvent.consume();
setSelected(i);
dragDrop.dragItem(item, DRAGDROP_SOURCE_EQUIPMENT);
return;
@@ -355,6 +356,7 @@ void EquipmentWindow::mousePressed(MouseEvent& mouseEvent)
const int my = y + getY();
if (viewport)
{
+ mouseEvent.consume();
if (mForing)
viewport->showUndressPopup(mx, my, mBeing, item);
else
diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp
index 939bfb619..216d33f42 100644
--- a/src/gui/windows/ministatuswindow.cpp
+++ b/src/gui/windows/ministatuswindow.cpp
@@ -443,6 +443,7 @@ void MiniStatusWindow::mousePressed(MouseEvent &event)
event.getSource());
if (!bar)
return;
+ event.consume();
if (viewport)
{
viewport->showPopup(getX() + event.getX(),
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index 17454b6ab..17ff9a8c1 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -969,6 +969,7 @@ void NpcDialog::mousePressed(MouseEvent &event)
if (event.getButton() == MouseEvent::RIGHT
&& event.getSource() == mTextBox)
{
+ event.consume();
if (viewport)
viewport->showNpcDialogPopup(mNpcId);
}
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp
index 112d1588d..5b0b557dc 100644
--- a/src/gui/windows/serverdialog.cpp
+++ b/src/gui/windows/serverdialog.cpp
@@ -452,11 +452,15 @@ void ServerDialog::valueChanged(const SelectionEvent &)
void ServerDialog::mouseClicked(MouseEvent &mouseEvent)
{
- if (mouseEvent.getClickCount() == 2 &&
- mouseEvent.getSource() == mServersList)
+ if (mouseEvent.getButton() == MouseEvent::LEFT)
{
- action(ActionEvent(mConnectButton,
- mConnectButton->getActionEventId()));
+ mouseEvent.consume();
+ if (mouseEvent.getClickCount() == 2 &&
+ mouseEvent.getSource() == mServersList)
+ {
+ action(ActionEvent(mConnectButton,
+ mConnectButton->getActionEventId()));
+ }
}
}
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index 21cc009bc..ebad47b98 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -215,6 +215,7 @@ class SkillListBox final : public ListBox
const SkillInfo *const skill = getSkillByEvent(event);
if (!skill)
return;
+ event.consume();
mSkillClicked = true;
}
}