summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authorJonathan G Rennison <j.g.rennison@gmail.com>2019-11-04 18:10:09 +0000
committerCharles Pigott <charlespigott@googlemail.com>2019-11-10 17:58:42 +0000
commit1dba06656d5dda3f8efc6a3dc2a8596428e17df5 (patch)
tree7381ea7bc20ea3b68096dd8452ee6347922dca7f /src/window.cpp
parent81f159434d9d5421ec188dc7844b6d82dc6aa3e3 (diff)
downloadopenttd-1dba06656d5dda3f8efc6a3dc2a8596428e17df5.tar.xz
Codechange: Add utility function for whether the focused window is a console
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/window.cpp b/src/window.cpp
index c25751fbb..c6a221af0 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -467,6 +467,15 @@ bool EditBoxInGlobalFocus()
}
/**
+ * Check if a console is focused.
+ * @return returns true if the focused window is a console, else false
+ */
+bool FocusedWindowIsConsole()
+{
+ return _focused_window && _focused_window->window_class == WC_CONSOLE;
+}
+
+/**
* Makes no widget on this window have focus. The function however doesn't change which window has focus.
*/
void Window::UnfocusFocusedWidget()