Skip to content

Commit 021928b

Browse files
fix show/hide waterfall keybind not working with the Display menu hidden
1 parent 7c933d5 commit 021928b

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

core/src/gui/main_window.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,8 @@ void MainWindow::draw() {
463463
}
464464
}
465465

466+
// Process menu keybinds
467+
displaymenu::checkKeybinds();
466468

467469
// Left Column
468470
lockWaterfallControls = false;

core/src/gui/menus/display.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,24 @@ namespace displaymenu {
127127
uiScaleId = uiScales.valueId(style::uiScale);
128128
}
129129

130+
void setWaterfallShown(bool shown) {
131+
showWaterfall = shown;
132+
showWaterfall ? gui::waterfall.showWaterfall() : gui::waterfall.hideWaterfall();
133+
core::configManager.acquire();
134+
core::configManager.conf["showWaterfall"] = showWaterfall;
135+
core::configManager.release(true);
136+
}
137+
138+
void checkKeybinds() {
139+
if (ImGui::IsKeyPressed(ImGuiKey_Home, false)) {
140+
setWaterfallShown(!showWaterfall);
141+
}
142+
}
143+
130144
void draw(void* ctx) {
131145
float menuWidth = ImGui::GetContentRegionAvail().x;
132-
bool homePressed = ImGui::IsKeyPressed(ImGuiKey_Home, false);
133-
if (ImGui::Checkbox("Show Waterfall##_sdrpp", &showWaterfall) || homePressed) {
134-
if (homePressed) { showWaterfall = !showWaterfall; }
135-
showWaterfall ? gui::waterfall.showWaterfall() : gui::waterfall.hideWaterfall();
136-
core::configManager.acquire();
137-
core::configManager.conf["showWaterfall"] = showWaterfall;
138-
core::configManager.release(true);
146+
if (ImGui::Checkbox("Show Waterfall##_sdrpp", &showWaterfall)) {
147+
setWaterfallShown(showWaterfall);
139148
}
140149

141150
if (ImGui::Checkbox("Full Waterfall Update##_sdrpp", &fullWaterfallUpdate)) {

core/src/gui/menus/display.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33
namespace displaymenu {
44
void init();
5+
void checkKeybinds();
56
void draw(void* ctx);
67
}

0 commit comments

Comments
 (0)