summaryrefslogtreecommitdiff
path: root/src/guiChatConsole.cpp
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2016-02-27 15:51:09 -0500
committerShadowNinja <shadowninja@minetest.net>2016-03-02 23:23:31 -0500
commit3edb7575a1ccca631994c0f5515b770b7a3e20d2 (patch)
tree7298aa5ac133e57594febab7ac26227f5ec1646b /src/guiChatConsole.cpp
parenteffa24737d6997dc40508533635accca3ed099e9 (diff)
downloadminetest-3edb7575a1ccca631994c0f5515b770b7a3e20d2.tar.gz
minetest-3edb7575a1ccca631994c0f5515b770b7a3e20d2.tar.bz2
minetest-3edb7575a1ccca631994c0f5515b770b7a3e20d2.zip
Unlock cursor when opening console
Diffstat (limited to 'src/guiChatConsole.cpp')
-rw-r--r--src/guiChatConsole.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp
index 4c0039e5e..4a084a8e5 100644
--- a/src/guiChatConsole.cpp
+++ b/src/guiChatConsole.cpp
@@ -46,12 +46,14 @@ GUIChatConsole::GUIChatConsole(
gui::IGUIElement* parent,
s32 id,
ChatBackend* backend,
- Client* client
+ Client* client,
+ IMenuManager* menumgr
):
IGUIElement(gui::EGUIET_ELEMENT, env, parent, id,
core::rect<s32>(0,0,100,100)),
m_chat_backend(backend),
m_client(client),
+ m_menumgr(menumgr),
m_screensize(v2u32(0,0)),
m_animate_time_old(0),
m_open(false),
@@ -120,6 +122,8 @@ void GUIChatConsole::openConsole(f32 height)
m_desired_height_fraction = height;
m_desired_height = height * m_screensize.Y;
reformatConsole();
+ Environment->setFocus(this);
+ m_menumgr->createdMenu(this);
}
bool GUIChatConsole::isOpen() const
@@ -135,11 +139,13 @@ bool GUIChatConsole::isOpenInhibited() const
void GUIChatConsole::closeConsole()
{
m_open = false;
+ Environment->removeFocus(this);
+ m_menumgr->deletingMenu(this);
}
void GUIChatConsole::closeConsoleAtOnce()
{
- m_open = false;
+ closeConsole();
m_height = 0;
recalculateConsolePosition();
}
@@ -399,7 +405,6 @@ bool GUIChatConsole::OnEvent(const SEvent& event)
if(KeyPress(event.KeyInput) == getKeySetting("keymap_console"))
{
closeConsole();
- Environment->removeFocus(this);
// inhibit open so the_game doesn't reopen immediately
m_open_inhibited = 50;
@@ -409,7 +414,6 @@ bool GUIChatConsole::OnEvent(const SEvent& event)
else if(event.KeyInput.Key == KEY_ESCAPE)
{
closeConsoleAtOnce();
- Environment->removeFocus(this);
m_close_on_enter = false;
// inhibit open so the_game doesn't reopen immediately
m_open_inhibited = 1; // so the ESCAPE button doesn't open the "pause menu"
@@ -432,7 +436,6 @@ bool GUIChatConsole::OnEvent(const SEvent& event)
m_client->typeChatMessage(text);
if (m_close_on_enter) {
closeConsoleAtOnce();
- Environment->removeFocus(this);
m_close_on_enter = false;
}
return true;