Fixed unnecessary redisplays of menus

This commit is contained in:
Klaus Schmidinger 2025-02-17 10:49:10 +01:00
parent 3045995bbc
commit d3dcbbd4f2
4 changed files with 28 additions and 7 deletions

View File

@ -10034,7 +10034,7 @@ Video Disk Recorder Revision History
(suggested by Stefan Hofmann). (suggested by Stefan Hofmann).
- Added vdrrootdir and incdir to vdr.pc (thanks to Stefan Hofmann). - Added vdrrootdir and incdir to vdr.pc (thanks to Stefan Hofmann).
2025-02-12: 2025-02-17:
- Removed all DEPRECATED_* code. - Removed all DEPRECATED_* code.
- Fixed error checking in case the fps value can't be determined by the frame parser. - 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. - 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 - The function cPlugin::MainThreadHook() has been deprecated and may be removed in future
versions. Use proper locking instead. versions. Use proper locking instead.
- Fixed unnecessary redisplays of menus.

11
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "menu.h"
@ -4673,15 +4673,16 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
default: break; default: break;
} }
} }
if (!HasSubMenu() && Update(HadSubMenu)) bool DoDisplay = Update();
Display();
if (Key != kNone) { if (Key != kNone) {
if (I18nCurrentLanguage() != osdLanguage) { if (I18nCurrentLanguage() != osdLanguage) {
Set(); Set();
if (!HasSubMenu()) if (!HasSubMenu())
DoDisplay = true;
}
}
if (DoDisplay)
Display(); Display();
}
}
return state; return state;
} }

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "osdbase.h"
@ -78,12 +78,16 @@ void cOsdObject::Show(void)
cSkinDisplayMenu *cOsdMenu::displayMenu = NULL; cSkinDisplayMenu *cOsdMenu::displayMenu = NULL;
int cOsdMenu::displayMenuCount = 0; int cOsdMenu::displayMenuCount = 0;
int cOsdMenu::osdState = 0; int cOsdMenu::osdState = 0;
cOsdMenu *cOsdMenu::topMenu = NULL;
cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4) cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4)
{ {
isMenu = true; isMenu = true;
digit = 0; digit = 0;
hasHotkeys = false; hasHotkeys = false;
if (!topMenu)
topMenu = this;
active = this == topMenu;
displayMenuItems = 0; displayMenuItems = 0;
title = NULL; title = NULL;
menuCategory = mcUnknown; menuCategory = mcUnknown;
@ -114,6 +118,8 @@ cOsdMenu::~cOsdMenu()
cStatus::MsgOsdClear(); cStatus::MsgOsdClear();
if (!--displayMenuCount) if (!--displayMenuCount)
DELETENULL(displayMenu); DELETENULL(displayMenu);
if (this == topMenu)
topMenu = NULL;
} }
void cOsdMenu::SetMenuCategory(eMenuCategory MenuCategory) void cOsdMenu::SetMenuCategory(eMenuCategory MenuCategory)
@ -126,6 +132,11 @@ void cOsdMenu::SetMenuSortMode(eMenuSortMode MenuSortMode)
menuSortMode = MenuSortMode; menuSortMode = MenuSortMode;
} }
void cOsdMenu::SetActive(bool Active)
{
active = Active;
}
void cOsdMenu::SetDisplayMenu(void) void cOsdMenu::SetDisplayMenu(void)
{ {
if (displayMenu) { if (displayMenu) {
@ -240,6 +251,8 @@ void cOsdMenu::Display(void)
subMenu->Display(); subMenu->Display();
return; return;
} }
if (!active)
return;
if (cOsdProvider::OsdSizeChanged(osdState)) if (cOsdProvider::OsdSizeChanged(osdState))
SetDisplayMenu(); SetDisplayMenu();
displayMenu->SetMessage(mtStatus, NULL); displayMenu->SetMessage(mtStatus, NULL);
@ -533,8 +546,10 @@ eOSState cOsdMenu::HotKey(eKeys Key)
eOSState cOsdMenu::AddSubMenu(cOsdMenu *SubMenu) eOSState cOsdMenu::AddSubMenu(cOsdMenu *SubMenu)
{ {
SetActive(false);
delete subMenu; delete subMenu;
subMenu = SubMenu; subMenu = SubMenu;
subMenu->SetActive(true);
subMenu->Display(); subMenu->Display();
return osContinue; // convenience return value return osContinue; // convenience return value
} }
@ -543,6 +558,7 @@ eOSState cOsdMenu::CloseSubMenu(bool ReDisplay)
{ {
delete subMenu; delete subMenu;
subMenu = NULL; subMenu = NULL;
SetActive(true);
if (ReDisplay) { if (ReDisplay) {
RefreshCurrent(); RefreshCurrent();
Display(); Display();

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __OSDBASE_H
@ -87,6 +87,7 @@ private:
static cSkinDisplayMenu *displayMenu; static cSkinDisplayMenu *displayMenu;
static int displayMenuCount; static int displayMenuCount;
static int osdState; static int osdState;
static cOsdMenu *topMenu;
int displayMenuItems; int displayMenuItems;
char *title; char *title;
int cols[cSkinDisplayMenu::MaxTabs]; int cols[cSkinDisplayMenu::MaxTabs];
@ -102,6 +103,8 @@ private:
char *status; char *status;
int digit; int digit;
bool hasHotkeys; bool hasHotkeys;
bool active;
void SetActive(bool Active);
void DisplayHelp(bool Force = false); void DisplayHelp(bool Force = false);
void DisplayNoStatus(void); void DisplayNoStatus(void);
protected: protected: