summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-04-09 18:17:50 +0300
committerAndrei Karas <akaras@inbox.ru>2013-04-09 18:17:50 +0300
commit4aeceabb5d4f00e2555234951a2f5db24b008265 (patch)
tree16e970611e7cc05352f18a9385b9e26c72d498d8 /src/gui/widgets
parentdd4d44a07d3a63ced0eec51c30b75887792c4a36 (diff)
downloadmv-4aeceabb5d4f00e2555234951a2f5db24b008265.tar.gz
mv-4aeceabb5d4f00e2555234951a2f5db24b008265.tar.bz2
mv-4aeceabb5d4f00e2555234951a2f5db24b008265.tar.xz
mv-4aeceabb5d4f00e2555234951a2f5db24b008265.zip
Improve perfomance in windows and popups visibility checks.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/dropshortcutcontainer.cpp3
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp2
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp4
-rw-r--r--src/gui/widgets/popup.h3
-rw-r--r--src/gui/widgets/window.cpp4
-rw-r--r--src/gui/widgets/window.h3
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;