aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEsteban I. Ruiz Moreno <exio4.com@gmail.com>2013-06-04 23:26:52 -0300
committerKahrl <kahrl@gmx.net>2013-06-05 21:14:14 +0200
commit7cb521725569b7eda98af40f7e4b4eb63afff633 (patch)
treeacb7380979a3cae877299d6669d14ce2de6325ba /src
parent4f6bec19bc0d838db6d1236e7815c0113bd05e81 (diff)
downloadminetest-7cb521725569b7eda98af40f7e4b4eb63afff633.tar.gz
minetest-7cb521725569b7eda98af40f7e4b4eb63afff633.tar.bz2
minetest-7cb521725569b7eda98af40f7e4b4eb63afff633.zip
Close console when it loses focus but it is still on screen
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp4
-rw-r--r--src/guiChatConsole.cpp5
-rw-r--r--src/guiChatConsole.h3
3 files changed, 12 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 22bd8c429..2d43d05b8 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1684,6 +1684,10 @@ void the_game(
{
input->clear();
}
+ if (!guienv->hasFocus(gui_chat_console) && gui_chat_console->isOpen())
+ {
+ gui_chat_console->closeConsoleAtOnce();
+ }
// Input handler step() (used by the random input generator)
input->step(dtime);
diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp
index 3dfd0090a..c1219fb80 100644
--- a/src/guiChatConsole.cpp
+++ b/src/guiChatConsole.cpp
@@ -134,6 +134,11 @@ void GUIChatConsole::openConsole(f32 height)
reformatConsole();
}
+bool GUIChatConsole::isOpen() const
+{
+ return m_open;
+}
+
bool GUIChatConsole::isOpenInhibited() const
{
return m_open_inhibited > 0;
diff --git a/src/guiChatConsole.h b/src/guiChatConsole.h
index c896aae28..5991157b2 100644
--- a/src/guiChatConsole.h
+++ b/src/guiChatConsole.h
@@ -39,6 +39,9 @@ public:
// This doesn't open immediately but initiates an animation.
// You should call isOpenInhibited() before this.
void openConsole(f32 height);
+
+ bool isOpen() const;
+
// Check if the console should not be opened at the moment
// This is to avoid reopening the console immediately after closing
bool isOpenInhibited() const;