diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-04-09 18:17:50 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-04-09 18:17:50 +0300 |
commit | 4aeceabb5d4f00e2555234951a2f5db24b008265 (patch) | |
tree | 16e970611e7cc05352f18a9385b9e26c72d498d8 /src/gui/widgets | |
parent | dd4d44a07d3a63ced0eec51c30b75887792c4a36 (diff) | |
download | plus-4aeceabb5d4f00e2555234951a2f5db24b008265.tar.gz plus-4aeceabb5d4f00e2555234951a2f5db24b008265.tar.bz2 plus-4aeceabb5d4f00e2555234951a2f5db24b008265.tar.xz plus-4aeceabb5d4f00e2555234951a2f5db24b008265.zip |
Improve perfomance in windows and popups visibility checks.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/dropshortcutcontainer.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/itemlinkhandler.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/itemshortcutcontainer.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/popup.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/window.h | 3 |
6 files changed, 13 insertions, 6 deletions
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index 9fb20b041..bc6b3d878 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -222,7 +222,8 @@ void DropShortcutContainer::mousePressed(gcn::MouseEvent &event) if (event.getButton() == gcn::MouseEvent::LEFT) { // Stores the selected item if theirs one. - if (dropShortcut->isItemSelected() && inventoryWindow->isVisible()) + if (dropShortcut->isItemSelected() + && inventoryWindow->isWindowVisible()) { dropShortcut->setItem(index); dropShortcut->setItemSelected(-1); diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp index e708eb507..e2999c8ad 100644 --- a/src/gui/widgets/itemlinkhandler.cpp +++ b/src/gui/widgets/itemlinkhandler.cpp @@ -117,7 +117,7 @@ void ItemLinkHandler::handleLink(const std::string &link, //+++ need add color to links? mItemPopup->setItem(itemInfo, 1, true); - if (mItemPopup->isVisible()) + if (mItemPopup->isPopupVisible()) { mItemPopup->setVisible(false); } diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 12bc52f74..560374271 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -306,8 +306,8 @@ void ItemShortcutContainer::mousePressed(gcn::MouseEvent &event) { // Stores the selected item if theirs one. if (selShortcut->isItemSelected() && inventoryWindow && - (inventoryWindow->isVisible() || selShortcut->getSelectedItem() - >= SPELL_MIN_ID)) + (inventoryWindow->isWindowVisible() + || selShortcut->getSelectedItem() >= SPELL_MIN_ID)) { selShortcut->setItem(index); selShortcut->setItemSelected(-1); diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h index 23bce3d5f..57772f642 100644 --- a/src/gui/widgets/popup.h +++ b/src/gui/widgets/popup.h @@ -168,6 +168,9 @@ class Popup : public Container, public gcn::MouseListener, void widgetMoved(const gcn::Event &event) override; + bool isPopupVisible() const + { return mVisible; } + protected: int mPadding; /**< Holds the padding of the popup. */ Skin *mSkin; /**< Skin in use by this popup */ diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 63c5b6629..7d80464d9 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -558,7 +558,7 @@ void Window::setVisible(bool visible) void Window::setVisible(bool visible, bool forceSticky) { - if (visible == isVisible()) + if (visible == isWindowVisible()) return; // Nothing to do // Check if the window is off screen... @@ -886,7 +886,7 @@ void Window::saveWindowState() config.setValue(mWindowName + "WinY", mDimension.y); if (mSaveVisible) - config.setValue(mWindowName + "Visible", isVisible()); + config.setValue(mWindowName + "Visible", isWindowVisible()); if (mStickyButton) config.setValue(mWindowName + "Sticky", isSticky()); diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 02f58d2a8..bf9bd935f 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -414,6 +414,9 @@ class Window : public gcn::Window, void enableVisibleSound(bool b) { mPlayVisibleSound = b; } + bool isWindowVisible() const A_WARN_UNUSED + { return mVisible; } + protected: bool canMove() const A_WARN_UNUSED; |