From b5aa38dc56462596bce958d1c45f841d031899d8 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Mon, 13 Mar 2017 09:20:31 +0100 Subject: [PATCH] CMenuWidget::calcSize: Recalculation of min_width ... ... for adjustment to the osd resolution Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/30db40da1afebe1c3a4f5748d864bb1a043b2946 Author: Michael Liebmann Date: 2017-03-13 (Mon, 13 Mar 2017) ------------------ This commit was generated by Migit --- src/gui/widget/menue.cpp | 8 ++++++++ src/gui/widget/menue.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 3ccd2905c..9511e5239 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -600,6 +600,7 @@ void CMenuWidget::Init(const std::string &NameString, const std::string &Icon, c selected = (widget_index == NO_WIDGET_ID ? preselected : mglobal->v_selected[widget_index]); //dimension + mwidth_save = mwidth; min_width = 0; width = 0; /* is set in paint() */ if (mwidth > 100){ @@ -1096,6 +1097,13 @@ void CMenuWidget::checkHints() void CMenuWidget::calcSize() { + // recalc min_width + min_width = 0; + int mwidth = std::min(mwidth_save, 100); + min_width = frameBuffer->getScreenWidth(true) * mwidth / 100; + if (min_width > (int)frameBuffer->getScreenWidth()) + min_width = frameBuffer->getScreenWidth(); + width = min_width; int wi, hi; diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index bf784e3cb..6a174ea18 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -513,6 +513,7 @@ class CMenuWidget : public CMenuTarget, public CComponentsSignals std::string iconfile; int min_width; + int mwidth_save; int width; int height; int hheight; // header