Merge pull request #35883 from Chaosus/fix_x11_window_restoring2

Restores correct window position after fullscreen toggling off on Linux
This commit is contained in:
Yuri Roubinsky 2020-02-03 18:28:23 +03:00 committed by GitHub
commit c4daac279b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -1433,7 +1433,11 @@ void OS_X11::set_window_fullscreen(bool p_enabled) {
// Restore // Restore
set_window_maximized(false); 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; current_videomode.fullscreen = p_enabled;
} }
@ -3502,4 +3506,5 @@ OS_X11::OS_X11() {
window_focused = true; window_focused = true;
xim_style = 0L; xim_style = 0L;
mouse_mode = MOUSE_MODE_VISIBLE; mouse_mode = MOUSE_MODE_VISIBLE;
last_position_before_fs = Vector2();
} }

View file

@ -115,6 +115,7 @@ class OS_X11 : public OS_Unix {
// IME // IME
bool im_active; bool im_active;
Vector2 im_position; Vector2 im_position;
Vector2 last_position_before_fs;
Size2 min_size; Size2 min_size;
Size2 max_size; Size2 max_size;