Merge pull request #85427 from bruvzg/ed_restore_mode

[Editor] Save and restore previous window mode when toggling full-screen.
This commit is contained in:
Rémi Verschelde 2023-11-27 19:42:38 +01:00 committed by GitHub
commit 03c251e659
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -2943,8 +2943,13 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
feature_profile_manager->popup_centered_clamped(Size2(900, 800) * EDSCALE, 0.8);
} break;
case SETTINGS_TOGGLE_FULLSCREEN: {
DisplayServer::get_singleton()->window_set_mode(DisplayServer::get_singleton()->window_get_mode() == DisplayServer::WINDOW_MODE_FULLSCREEN ? DisplayServer::WINDOW_MODE_WINDOWED : DisplayServer::WINDOW_MODE_FULLSCREEN);
DisplayServer::WindowMode mode = DisplayServer::get_singleton()->window_get_mode();
if (mode == DisplayServer::WINDOW_MODE_FULLSCREEN || mode == DisplayServer::WINDOW_MODE_EXCLUSIVE_FULLSCREEN) {
DisplayServer::get_singleton()->window_set_mode(prev_mode);
} else {
prev_mode = mode;
DisplayServer::get_singleton()->window_set_mode(DisplayServer::WINDOW_MODE_FULLSCREEN);
}
} break;
case EDITOR_SCREENSHOT: {
screenshot_timer->start();

View file

@ -332,6 +332,7 @@ private:
bool exiting = false;
bool dimmed = false;
DisplayServer::WindowMode prev_mode = DisplayServer::WINDOW_MODE_MAXIMIZED;
int old_split_ofs = 0;
VSplitContainer *top_split = nullptr;
HBoxContainer *bottom_hb = nullptr;