From 54e79c8c98a092c2da7f7febad28c2557354fc98 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 31 Jan 2015 16:26:34 +0100 Subject: [PATCH] Use mouse pressed event for pin button instead of mouse click --- apps/openmw/mwgui/windowpinnablebase.cpp | 9 ++++++--- apps/openmw/mwgui/windowpinnablebase.hpp | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwgui/windowpinnablebase.cpp b/apps/openmw/mwgui/windowpinnablebase.cpp index 7307ece2d..a6984b5a4 100644 --- a/apps/openmw/mwgui/windowpinnablebase.cpp +++ b/apps/openmw/mwgui/windowpinnablebase.cpp @@ -12,7 +12,7 @@ namespace MWGui ExposedWindow* window = mMainWidget->castType(); mPinButton = window->getSkinWidget ("Button"); - mPinButton->eventMouseButtonClick += MyGUI::newDelegate(this, &WindowPinnableBase::onPinButtonClicked); + mPinButton->eventMouseButtonPressed += MyGUI::newDelegate(this, &WindowPinnableBase::onPinButtonPressed); MyGUI::Button* button = NULL; MyGUI::VectorWidgetPtr widgets = window->getSkinWidgetsByName("Action"); @@ -26,8 +26,11 @@ namespace MWGui button->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &WindowPinnableBase::onDoubleClick); } - void WindowPinnableBase::onPinButtonClicked(MyGUI::Widget* _sender) + void WindowPinnableBase::onPinButtonPressed(MyGUI::Widget* _sender, int left, int top, MyGUI::MouseButton id) { + if (id != MyGUI::MouseButton::Left) + return; + mPinned = !mPinned; if (mPinned) @@ -46,7 +49,7 @@ namespace MWGui void WindowPinnableBase::setPinned(bool pinned) { if (pinned != mPinned) - onPinButtonClicked(mPinButton); + onPinButtonPressed(mPinButton, 0, 0, MyGUI::MouseButton::Left); } void WindowPinnableBase::setPinButtonVisible(bool visible) diff --git a/apps/openmw/mwgui/windowpinnablebase.hpp b/apps/openmw/mwgui/windowpinnablebase.hpp index 8b7bbefaf..c085bebf2 100644 --- a/apps/openmw/mwgui/windowpinnablebase.hpp +++ b/apps/openmw/mwgui/windowpinnablebase.hpp @@ -16,7 +16,7 @@ namespace MWGui void setPinButtonVisible(bool visible); private: - void onPinButtonClicked(MyGUI::Widget* _sender); + void onPinButtonPressed(MyGUI::Widget* _sender, int left, int top, MyGUI::MouseButton id); void onDoubleClick(MyGUI::Widget* _sender); protected: