fix(color): Don't display long press widget menu if no options (#4263)

Co-authored-by: philmoz <phil.a.mitchell@gmail.com>
This commit is contained in:
philmoz
2023-10-31 09:54:04 +10:00
committed by GitHub
co-authored by philmoz
parent f6b119bd24
commit b6a691fbcb
+12 -10
View File
@@ -58,16 +58,18 @@ Widget::Widget(const WidgetFactory* factory, Window* parent,
void Widget::openMenu() void Widget::openMenu()
{ {
// Widgets are placed on a full screen window which is underneath the main view menu bar if (getOptions() || fsAllowed) {
// Find the parent of this so that when the popup loads it covers the main view menu // Widgets are placed on a full screen window which is underneath the main view menu bar
Window* w = parent->getFullScreenWindow()->getParent(); // Find the parent of this so that when the popup loads it covers the main view menu
Menu* menu = new Menu(w ? w : this); Window* w = parent->getFullScreenWindow()->getParent();
if (fsAllowed) { Menu* menu = new Menu(w ? w : this);
menu->addLine(STR_WIDGET_FULLSCREEN, [&]() { setFullscreen(true); }); if (fsAllowed) {
} menu->addLine(STR_WIDGET_FULLSCREEN, [&]() { setFullscreen(true); });
if (getOptions() && getOptions()->name) { }
menu->addLine(STR_WIDGET_SETTINGS, if (getOptions() && getOptions()->name) {
[=]() { new WidgetSettings(this, this); }); menu->addLine(STR_WIDGET_SETTINGS,
[=]() { new WidgetSettings(this, this); });
}
} }
} }