Skip to content

Commit

Permalink
Merge pull request #85427 from bruvzg/ed_restore_mode
Browse files Browse the repository at this point in the history
[Editor] Save and restore previous window mode when toggling full-screen.
  • Loading branch information
akien-mga authored Nov 27, 2023
2 parents b3a0e07 + 27ca31f commit 03c251e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions editor/editor_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ class EditorNode : public Node {
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;
Expand Down

0 comments on commit 03c251e

Please sign in to comment.