diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-01-06 11:39:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-06 11:39:18 +0100 |
commit | 845480497207839bef48997d152f00b60b6176a8 (patch) | |
tree | 8a4b65992148e55897e33c9b09c9664c2dda3e6b /platform/windows/os_windows.cpp | |
parent | 7c3543380fe9ecd3d9a2d2dd3319e1c37e06820f (diff) | |
parent | 21a392341034169fff18db626e1c356545289af5 (diff) |
Merge pull request #33967 from Calinou/add-os-is-window-focused
Add an `OS.is_window_focused()` getter
Diffstat (limited to 'platform/windows/os_windows.cpp')
-rwxr-xr-x | platform/windows/os_windows.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index cee848f270..3868d0bc63 100755 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -352,12 +352,14 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE) { main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN); + window_focused = true; alt_mem = false; control_mem = false; shift_mem = false; } else { // WM_INACTIVE input->release_pressed_events(); main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT); + window_focused = false; alt_mem = false; }; @@ -2095,6 +2097,11 @@ bool OS_Windows::is_window_always_on_top() const { return video_mode.always_on_top; } +bool OS_Windows::is_window_focused() const { + + return window_focused; +} + void OS_Windows::set_console_visible(bool p_enabled) { if (console_visible == p_enabled) return; @@ -3372,6 +3379,7 @@ OS_Windows::OS_Windows(HINSTANCE _hInstance) { meta_mem = false; minimized = false; was_maximized = false; + window_focused = true; console_visible = IsWindowVisible(GetConsoleWindow()); //Note: Functions for pen input, available on Windows 8+ |