From b6a691fbcbba30f69d689e0a403b6a130d92078d Mon Sep 17 00:00:00 2001 From: philmoz Date: Tue, 31 Oct 2023 10:54:04 +1100 Subject: [PATCH] fix(color): Don't display long press widget menu if no options (#4263) Co-authored-by: philmoz --- radio/src/gui/colorlcd/widget.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/radio/src/gui/colorlcd/widget.cpp b/radio/src/gui/colorlcd/widget.cpp index 19e0436fa2d..af103879b41 100644 --- a/radio/src/gui/colorlcd/widget.cpp +++ b/radio/src/gui/colorlcd/widget.cpp @@ -58,16 +58,18 @@ Widget::Widget(const WidgetFactory* factory, Window* parent, void Widget::openMenu() { - // Widgets are placed on a full screen window which is underneath the main view menu bar - // Find the parent of this so that when the popup loads it covers the main view menu - Window* w = parent->getFullScreenWindow()->getParent(); - Menu* menu = new Menu(w ? w : this); - if (fsAllowed) { - menu->addLine(STR_WIDGET_FULLSCREEN, [&]() { setFullscreen(true); }); - } - if (getOptions() && getOptions()->name) { - menu->addLine(STR_WIDGET_SETTINGS, - [=]() { new WidgetSettings(this, this); }); + if (getOptions() || fsAllowed) { + // Widgets are placed on a full screen window which is underneath the main view menu bar + // Find the parent of this so that when the popup loads it covers the main view menu + Window* w = parent->getFullScreenWindow()->getParent(); + Menu* menu = new Menu(w ? w : this); + if (fsAllowed) { + menu->addLine(STR_WIDGET_FULLSCREEN, [&]() { setFullscreen(true); }); + } + if (getOptions() && getOptions()->name) { + menu->addLine(STR_WIDGET_SETTINGS, + [=]() { new WidgetSettings(this, this); }); + } } }