summaryrefslogtreecommitdiff
path: root/platform/x11/os_x11.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/x11/os_x11.cpp')
-rw-r--r--platform/x11/os_x11.cpp8
1 files changed, 8 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;
}