diff --git a/HISTORY b/HISTORY index 06696427..0c5d0eee 100644 --- a/HISTORY +++ b/HISTORY @@ -10034,7 +10034,7 @@ Video Disk Recorder Revision History (suggested by Stefan Hofmann). - Added vdrrootdir and incdir to vdr.pc (thanks to Stefan Hofmann). -2025-02-12: +2025-02-17: - Removed all DEPRECATED_* code. - Fixed error checking in case the fps value can't be determined by the frame parser. @@ -10081,3 +10081,4 @@ Video Disk Recorder Revision History - Adjusted PLUGINS.html to the new API version numbering introduced in version 2.7.2. - The function cPlugin::MainThreadHook() has been deprecated and may be removed in future versions. Use proper locking instead. +- Fixed unnecessary redisplays of menus. diff --git a/menu.c b/menu.c index de13162a..0f0a0ba9 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 5.20 2025/02/05 22:12:32 kls Exp $ + * $Id: menu.c 5.21 2025/02/17 10:49:10 kls Exp $ */ #include "menu.h" @@ -4673,15 +4673,16 @@ eOSState cMenuMain::ProcessKey(eKeys Key) default: break; } } - if (!HasSubMenu() && Update(HadSubMenu)) - Display(); + bool DoDisplay = Update(); if (Key != kNone) { if (I18nCurrentLanguage() != osdLanguage) { Set(); if (!HasSubMenu()) - Display(); + DoDisplay = true; } } + if (DoDisplay) + Display(); return state; } diff --git a/osdbase.c b/osdbase.c index 9352276a..e7a9755e 100644 --- a/osdbase.c +++ b/osdbase.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osdbase.c 5.8 2025/02/13 13:58:07 kls Exp $ + * $Id: osdbase.c 5.9 2025/02/17 10:49:10 kls Exp $ */ #include "osdbase.h" @@ -78,12 +78,16 @@ void cOsdObject::Show(void) cSkinDisplayMenu *cOsdMenu::displayMenu = NULL; int cOsdMenu::displayMenuCount = 0; int cOsdMenu::osdState = 0; +cOsdMenu *cOsdMenu::topMenu = NULL; cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4) { isMenu = true; digit = 0; hasHotkeys = false; + if (!topMenu) + topMenu = this; + active = this == topMenu; displayMenuItems = 0; title = NULL; menuCategory = mcUnknown; @@ -114,6 +118,8 @@ cOsdMenu::~cOsdMenu() cStatus::MsgOsdClear(); if (!--displayMenuCount) DELETENULL(displayMenu); + if (this == topMenu) + topMenu = NULL; } void cOsdMenu::SetMenuCategory(eMenuCategory MenuCategory) @@ -126,6 +132,11 @@ void cOsdMenu::SetMenuSortMode(eMenuSortMode MenuSortMode) menuSortMode = MenuSortMode; } +void cOsdMenu::SetActive(bool Active) +{ + active = Active; +} + void cOsdMenu::SetDisplayMenu(void) { if (displayMenu) { @@ -240,6 +251,8 @@ void cOsdMenu::Display(void) subMenu->Display(); return; } + if (!active) + return; if (cOsdProvider::OsdSizeChanged(osdState)) SetDisplayMenu(); displayMenu->SetMessage(mtStatus, NULL); @@ -533,8 +546,10 @@ eOSState cOsdMenu::HotKey(eKeys Key) eOSState cOsdMenu::AddSubMenu(cOsdMenu *SubMenu) { + SetActive(false); delete subMenu; subMenu = SubMenu; + subMenu->SetActive(true); subMenu->Display(); return osContinue; // convenience return value } @@ -543,6 +558,7 @@ eOSState cOsdMenu::CloseSubMenu(bool ReDisplay) { delete subMenu; subMenu = NULL; + SetActive(true); if (ReDisplay) { RefreshCurrent(); Display(); diff --git a/osdbase.h b/osdbase.h index 6f5d71f2..a63f222b 100644 --- a/osdbase.h +++ b/osdbase.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osdbase.h 5.1 2025/02/05 22:12:32 kls Exp $ + * $Id: osdbase.h 5.2 2025/02/17 10:49:10 kls Exp $ */ #ifndef __OSDBASE_H @@ -87,6 +87,7 @@ private: static cSkinDisplayMenu *displayMenu; static int displayMenuCount; static int osdState; + static cOsdMenu *topMenu; int displayMenuItems; char *title; int cols[cSkinDisplayMenu::MaxTabs]; @@ -102,6 +103,8 @@ private: char *status; int digit; bool hasHotkeys; + bool active; + void SetActive(bool Active); void DisplayHelp(bool Force = false); void DisplayNoStatus(void); protected: