From 21a392341034169fff18db626e1c356545289af5 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Thu, 28 Nov 2019 13:41:07 +0100 Subject: Add an `OS.is_window_focused()` getter This makes it possible to know whether the window is focused at a given time, without having to track the focus state manually using `NOTIFICATION_WM_FOCUS_IN` and `NOTIFICATION_WM_FOCUS_OUT`. This partially addresses #33928. --- core/os/os.h | 1 + 1 file changed, 1 insertion(+) (limited to 'core/os') diff --git a/core/os/os.h b/core/os/os.h index 687ccaaba5..d4d8a6f415 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -217,6 +217,7 @@ public: virtual bool is_window_maximized() const { return true; } virtual void set_window_always_on_top(bool p_enabled) {} virtual bool is_window_always_on_top() const { return false; } + virtual bool is_window_focused() const { return true; } virtual void set_console_visible(bool p_enabled) {} virtual bool is_console_visible() const { return false; } virtual void request_attention() {} -- cgit v1.2.3