From 309ed5ef28ffe6abbc6d53d4f46981bd385a735d Mon Sep 17 00:00:00 2001 From: Ralph Sennhauser Date: Sat, 11 Jul 2026 12:30:18 +0200 Subject: [PATCH] Add fullscreen support to Atlas Add a fullscreen toggle to the View menu and with a global hotkey, reusing the default one from the main game. Unlike the current implementation this one doesn't need the game canvas to be focused and also works on GTK. Signed-off-by: Ralph Sennhauser --- .../AtlasUI/ScenarioEditor/ScenarioEditor.cpp | 17 +++++++---------- .../AtlasUI/ScenarioEditor/ScenarioEditor.h | 1 + 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp b/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp index c0cbb52a2c..4a23e8e210 100644 --- a/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp @@ -202,16 +202,6 @@ private: return; } - // Alt+enter toggles fullscreen - if (evt.GetKeyCode() == WXK_RETURN && wxGetKeyState(WXK_ALT)) - { - if (m_ScenarioEditor.IsFullScreen()) - m_ScenarioEditor.ShowFullScreen(false); - else - m_ScenarioEditor.ShowFullScreen(true, wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION); - return; - } - if (evt.GetKeyCode() == 'c') { POST_MESSAGE(CameraReset, ()); @@ -520,6 +510,8 @@ ScenarioEditor::ScenarioEditor(wxWindow* parent) menuView->AppendCheckItem(ID_Wireframe, _("&Wireframe")); menuView->AppendCheckItem(ID_SmoothFramerate, _("Smooth framerate")); menuView->AppendCheckItem(ID_BirdsEyeView, _("&Birds Eye View\tCtrl+B")); + auto* fullscreenItem = menuView->AppendCheckItem(wxID_ANY, _("&Fullscreen\tAlt+Enter")); + this->Bind(wxEVT_MENU, [this, fullscreenItem](auto&){ SetFullscreen(fullscreenItem->IsChecked()); }); menuView->Append(ID_CameraReset, _("&Reset camera")); } @@ -1006,6 +998,11 @@ void ScenarioEditor::OnBirdsEyeView(wxCommandEvent& event) POST_MESSAGE(SetBirdsEyeView, (event.IsChecked())); } +void ScenarioEditor::SetFullscreen(const bool enabled) +{ + ShowFullScreen(enabled, wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION); +} + void ScenarioEditor::OnDumpState(wxCommandEvent& event) { wxDateTime time = wxDateTime::Now(); diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.h b/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.h index 98856f9c43..64a17d7e7e 100644 --- a/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.h +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.h @@ -62,6 +62,7 @@ public: void OnWireframe(wxCommandEvent& event); void OnSmoothFramerate(wxCommandEvent& event); void OnBirdsEyeView(wxCommandEvent& event); + void SetFullscreen(const bool enabled); void OnCameraReset(wxCommandEvent& event); void OnMessageTrace(wxCommandEvent& event);