summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game.cpp11
-rw-r--r--src/gui/viewport.cpp5
-rw-r--r--src/gui/viewport.h2
3 files changed, 16 insertions, 2 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 0082040dc..259317545 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -754,8 +754,15 @@ void Game::handleInput()
case KeyboardConfig::KEY_QUIT:
if (!chatWindow->isInputFocused())
{
- quitDialog = new QuitDialog(&quitDialog);
- quitDialog->requestMoveToTop();
+ if (viewport && viewport->isPopupMenuVisible())
+ {
+ viewport->closePopupMenu();
+ }
+ else
+ {
+ quitDialog = new QuitDialog(&quitDialog);
+ quitDialog->requestMoveToTop();
+ }
return;
}
break;
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 79e536c2f..ba8414699 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -819,3 +819,8 @@ void Viewport::moveCamera(int dx, int dy)
mCameraRelativeX += dx;
mCameraRelativeY += dy;
}
+
+bool Viewport::isPopupMenuVisible()
+{
+ return mPopupMenu ? mPopupMenu->isVisible() : false;
+}
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index 6657b98f3..d6ee54834 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -254,6 +254,8 @@ class Viewport : public WindowContainer, public gcn::MouseListener,
int getCameraRelativeY()
{ return mCameraRelativeY; }
+ bool isPopupMenuVisible();
+
protected:
friend class ActorSpriteManager;