From 3edb7575a1ccca631994c0f5515b770b7a3e20d2 Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Sat, 27 Feb 2016 15:51:09 -0500 Subject: Unlock cursor when opening console --- src/guiChatConsole.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/guiChatConsole.cpp') 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(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; -- cgit v1.2.3