Skip to content

Commit 7cb5217

Browse files
EXio4kahrl
authored andcommittedJun 5, 2013
Close console when it loses focus but it is still on screen
1 parent 4f6bec1 commit 7cb5217

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed
 

‎src/game.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -1684,6 +1684,10 @@ void the_game(
16841684
{
16851685
input->clear();
16861686
}
1687+
if (!guienv->hasFocus(gui_chat_console) && gui_chat_console->isOpen())
1688+
{
1689+
gui_chat_console->closeConsoleAtOnce();
1690+
}
16871691

16881692
// Input handler step() (used by the random input generator)
16891693
input->step(dtime);

‎src/guiChatConsole.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ void GUIChatConsole::openConsole(f32 height)
134134
reformatConsole();
135135
}
136136

137+
bool GUIChatConsole::isOpen() const
138+
{
139+
return m_open;
140+
}
141+
137142
bool GUIChatConsole::isOpenInhibited() const
138143
{
139144
return m_open_inhibited > 0;

‎src/guiChatConsole.h

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ class GUIChatConsole : public gui::IGUIElement
3939
// This doesn't open immediately but initiates an animation.
4040
// You should call isOpenInhibited() before this.
4141
void openConsole(f32 height);
42+
43+
bool isOpen() const;
44+
4245
// Check if the console should not be opened at the moment
4346
// This is to avoid reopening the console immediately after closing
4447
bool isOpenInhibited() const;

0 commit comments

Comments
 (0)