mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-01-12 11:17:11 +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["fullWaterfallUpdate"] = false;
|
||||||
defConfig["max"] = 0.0;
|
defConfig["max"] = 0.0;
|
||||||
defConfig["maximized"] = false;
|
defConfig["maximized"] = false;
|
||||||
|
defConfig["fullscreen"] = false;
|
||||||
|
|
||||||
// Menu
|
// Menu
|
||||||
defConfig["menuElements"] = json::array();
|
defConfig["menuElements"] = json::array();
|
||||||
@ -281,6 +282,8 @@ int sdrpp_main(int argc, char *argv[]) {
|
|||||||
core::configManager.conf["moduleInstances"][_name] = newMod;
|
core::configManager.conf["moduleInstances"][_name] = newMod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fullScreen = core::configManager.conf["fullscreen"];
|
||||||
|
|
||||||
core::configManager.release(true);
|
core::configManager.release(true);
|
||||||
|
|
||||||
if (options::opts.serverMode) { return server_main(); }
|
if (options::opts.serverMode) { return server_main(); }
|
||||||
@ -298,7 +301,6 @@ int sdrpp_main(int argc, char *argv[]) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Setup window
|
// Setup window
|
||||||
glfwSetErrorCallback(glfw_error_callback);
|
glfwSetErrorCallback(glfw_error_callback);
|
||||||
if (!glfwInit()) {
|
if (!glfwInit()) {
|
||||||
@ -424,13 +426,24 @@ int sdrpp_main(int argc, char *argv[]) {
|
|||||||
spdlog::info("Loading band plans color table");
|
spdlog::info("Loading band plans color table");
|
||||||
bandplan::loadColorTable(bandColors);
|
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();
|
gui::mainWindow.init();
|
||||||
|
|
||||||
spdlog::info("Ready.");
|
spdlog::info("Ready.");
|
||||||
|
|
||||||
bool _maximized = maximized;
|
|
||||||
int fsWidth, fsHeight, fsPosX, fsPosY;
|
|
||||||
|
|
||||||
// Main loop
|
// Main loop
|
||||||
while (!glfwWindowShouldClose(core::window)) {
|
while (!glfwWindowShouldClose(core::window)) {
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
@ -452,7 +465,6 @@ int sdrpp_main(int argc, char *argv[]) {
|
|||||||
core::configManager.release(true);
|
core::configManager.release(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int _winWidth, _winHeight;
|
|
||||||
glfwGetWindowSize(core::window, &_winWidth, &_winHeight);
|
glfwGetWindowSize(core::window, &_winWidth, &_winHeight);
|
||||||
|
|
||||||
if (ImGui::IsKeyPressed(GLFW_KEY_F11)) {
|
if (ImGui::IsKeyPressed(GLFW_KEY_F11)) {
|
||||||
@ -464,10 +476,16 @@ int sdrpp_main(int argc, char *argv[]) {
|
|||||||
glfwGetWindowPos(core::window, &fsPosX, &fsPosY);
|
glfwGetWindowPos(core::window, &fsPosX, &fsPosY);
|
||||||
const GLFWvidmode * mode = glfwGetVideoMode(glfwGetPrimaryMonitor());
|
const GLFWvidmode * mode = glfwGetVideoMode(glfwGetPrimaryMonitor());
|
||||||
glfwSetWindowMonitor(core::window, monitor, 0, 0, mode->width, mode->height, 0);
|
glfwSetWindowMonitor(core::window, monitor, 0, 0, mode->width, mode->height, 0);
|
||||||
|
core::configManager.acquire();
|
||||||
|
core::configManager.conf["fullscreen"] = true;
|
||||||
|
core::configManager.release();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
spdlog::info("Fullscreen: OFF");
|
spdlog::info("Fullscreen: OFF");
|
||||||
glfwSetWindowMonitor(core::window, nullptr, fsPosX, fsPosY, fsWidth, fsHeight, 0);
|
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