diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 32da37ad273..b2a65063a76 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -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(); diff --git a/editor/editor_node.h b/editor/editor_node.h index 9c97166456e..a50ea5c69ea 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -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;