diff --git a/core/src/gui/main_window.cpp b/core/src/gui/main_window.cpp index 8c90ebd6..8ed95324 100644 --- a/core/src/gui/main_window.cpp +++ b/core/src/gui/main_window.cpp @@ -463,6 +463,8 @@ void MainWindow::draw() { } } + // Process menu keybinds + displaymenu::checkKeybinds(); // Left Column lockWaterfallControls = false; diff --git a/core/src/gui/menus/display.cpp b/core/src/gui/menus/display.cpp index 2f9f1b7e..59649ed1 100644 --- a/core/src/gui/menus/display.cpp +++ b/core/src/gui/menus/display.cpp @@ -127,15 +127,24 @@ namespace displaymenu { uiScaleId = uiScales.valueId(style::uiScale); } + void setWaterfallShown(bool shown) { + showWaterfall = shown; + showWaterfall ? gui::waterfall.showWaterfall() : gui::waterfall.hideWaterfall(); + core::configManager.acquire(); + core::configManager.conf["showWaterfall"] = showWaterfall; + core::configManager.release(true); + } + + void checkKeybinds() { + if (ImGui::IsKeyPressed(ImGuiKey_Home, false)) { + setWaterfallShown(!showWaterfall); + } + } + void draw(void* ctx) { float menuWidth = ImGui::GetContentRegionAvail().x; - bool homePressed = ImGui::IsKeyPressed(ImGuiKey_Home, false); - if (ImGui::Checkbox("Show Waterfall##_sdrpp", &showWaterfall) || homePressed) { - if (homePressed) { showWaterfall = !showWaterfall; } - showWaterfall ? gui::waterfall.showWaterfall() : gui::waterfall.hideWaterfall(); - core::configManager.acquire(); - core::configManager.conf["showWaterfall"] = showWaterfall; - core::configManager.release(true); + if (ImGui::Checkbox("Show Waterfall##_sdrpp", &showWaterfall)) { + setWaterfallShown(showWaterfall); } if (ImGui::Checkbox("Full Waterfall Update##_sdrpp", &fullWaterfallUpdate)) { diff --git a/core/src/gui/menus/display.h b/core/src/gui/menus/display.h index f0a97d18..68e18002 100644 --- a/core/src/gui/menus/display.h +++ b/core/src/gui/menus/display.h @@ -2,5 +2,6 @@ namespace displaymenu { void init(); + void checkKeybinds(); void draw(void* ctx); } \ No newline at end of file