diff options
Diffstat (limited to 'platform/x11')
-rw-r--r-- | platform/x11/os_x11.cpp | 8 | ||||
-rw-r--r-- | platform/x11/os_x11.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index b9cfd6f386..2f0d49e6dd 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1684,6 +1684,10 @@ bool OS_X11::is_window_always_on_top() const { return current_videomode.always_on_top; } +bool OS_X11::is_window_focused() const { + return window_focused; +} + void OS_X11::set_borderless_window(bool p_borderless) { if (get_borderless_window() == p_borderless) @@ -2276,6 +2280,8 @@ void OS_X11::process_xevents() { minimized = false; window_has_focus = true; main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN); + window_focused = true; + if (mouse_mode_grab) { // Show and update the cursor if confined and the window regained focus. if (mouse_mode == MOUSE_MODE_CONFINED) @@ -2303,6 +2309,7 @@ void OS_X11::process_xevents() { window_has_focus = false; input->release_pressed_events(); main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT); + window_focused = false; if (mouse_mode_grab) { //dear X11, I try, I really try, but you never work, you do whathever you want. @@ -3497,6 +3504,7 @@ OS_X11::OS_X11() { xi.last_relative_time = 0; layered_window = false; minimized = false; + window_focused = true; xim_style = 0L; mouse_mode = MOUSE_MODE_VISIBLE; } diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 35c55aab54..01e5aac3df 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -195,6 +195,7 @@ class OS_X11 : public OS_Unix { int video_driver_index; bool maximized; + bool window_focused; //void set_wm_border(bool p_enabled); void set_wm_fullscreen(bool p_enabled); void set_wm_above(bool p_enabled); @@ -284,6 +285,7 @@ public: virtual bool is_window_maximized() const; virtual void set_window_always_on_top(bool p_enabled); virtual bool is_window_always_on_top() const; + virtual bool is_window_focused() const; virtual void request_attention(); virtual void set_borderless_window(bool p_borderless); |