mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-11-06 18:57:39 +01:00
Saved fullscreen state in the config
This commit is contained in:
parent
894700cbab
commit
a938324886
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user