From 90f00c0813b8335605c81b5d5063922efe5519e3 Mon Sep 17 00:00:00 2001 From: Yuri Roubinsky Date: Mon, 3 Feb 2020 18:14:41 +0300 Subject: [PATCH] Restores correct window position after fullscreen toggling off on Linux --- platform/x11/os_x11.cpp | 7 ++++++- platform/x11/os_x11.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 8195006121f..e40aa867f88 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1433,7 +1433,11 @@ void OS_X11::set_window_fullscreen(bool p_enabled) { // Restore set_window_maximized(false); } - + if (!p_enabled) { + set_window_position(last_position_before_fs); + } else { + last_position_before_fs = get_window_position(); + } current_videomode.fullscreen = p_enabled; } @@ -3502,4 +3506,5 @@ OS_X11::OS_X11() { window_focused = true; xim_style = 0L; mouse_mode = MOUSE_MODE_VISIBLE; + last_position_before_fs = Vector2(); } diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 01e5aac3dfc..25b406743b4 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -115,6 +115,7 @@ class OS_X11 : public OS_Unix { // IME bool im_active; Vector2 im_position; + Vector2 last_position_before_fs; Size2 min_size; Size2 max_size;