diff --git a/core/src/core.cpp b/core/src/core.cpp index 9546e605..495f6826 100644 --- a/core/src/core.cpp +++ b/core/src/core.cpp @@ -145,6 +145,7 @@ int sdrpp_main(int argc, char *argv[]) { defConfig["fullWaterfallUpdate"] = false; defConfig["max"] = 0.0; defConfig["maximized"] = false; + defConfig["fullscreen"] = false; // Menu defConfig["menuElements"] = json::array(); @@ -281,6 +282,8 @@ int sdrpp_main(int argc, char *argv[]) { core::configManager.conf["moduleInstances"][_name] = newMod; } + fullScreen = core::configManager.conf["fullscreen"]; + core::configManager.release(true); if (options::opts.serverMode) { return server_main(); } @@ -298,7 +301,6 @@ int sdrpp_main(int argc, char *argv[]) { return 1; } - // Setup window glfwSetErrorCallback(glfw_error_callback); if (!glfwInit()) { @@ -424,13 +426,24 @@ int sdrpp_main(int argc, char *argv[]) { spdlog::info("Loading band plans color table"); bandplan::loadColorTable(bandColors); + bool _maximized = maximized; + int fsWidth, fsHeight, fsPosX, fsPosY; + int _winWidth, _winHeight; + glfwGetWindowSize(core::window, &_winWidth, &_winHeight); + + if (fullScreen) { + spdlog::info("Fullscreen: ON"); + fsWidth = _winWidth; + fsHeight = _winHeight; + glfwGetWindowPos(core::window, &fsPosX, &fsPosY); + const GLFWvidmode * mode = glfwGetVideoMode(glfwGetPrimaryMonitor()); + glfwSetWindowMonitor(core::window, monitor, 0, 0, mode->width, mode->height, 0); + } + gui::mainWindow.init(); spdlog::info("Ready."); - bool _maximized = maximized; - int fsWidth, fsHeight, fsPosX, fsPosY; - // Main loop while (!glfwWindowShouldClose(core::window)) { glfwPollEvents(); @@ -452,7 +465,6 @@ int sdrpp_main(int argc, char *argv[]) { core::configManager.release(true); } - int _winWidth, _winHeight; glfwGetWindowSize(core::window, &_winWidth, &_winHeight); if (ImGui::IsKeyPressed(GLFW_KEY_F11)) { @@ -464,10 +476,16 @@ int sdrpp_main(int argc, char *argv[]) { glfwGetWindowPos(core::window, &fsPosX, &fsPosY); const GLFWvidmode * mode = glfwGetVideoMode(glfwGetPrimaryMonitor()); glfwSetWindowMonitor(core::window, monitor, 0, 0, mode->width, mode->height, 0); + core::configManager.acquire(); + core::configManager.conf["fullscreen"] = true; + core::configManager.release(); } else { spdlog::info("Fullscreen: OFF"); glfwSetWindowMonitor(core::window, nullptr, fsPosX, fsPosY, fsWidth, fsHeight, 0); + core::configManager.acquire(); + core::configManager.conf["fullscreen"] = false; + core::configManager.release(); } }