From d6b2b1e368caadcde16cd9d871297a97234cd44e Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Fri, 29 Sep 2017 20:37:37 +0200 Subject: [PATCH] CMenuWidget: fix "left" key for menuchoosers where the "decrement menu function" got lost by the last "simplify code and add missing break" commit. The implicit fallthrough actually was used to execute the "left" function. Reorganize the code so that it works even without the implicit fallthrough. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/ab3434e27867e2fe958d016bec0334ac60719a58 Author: Stefan Seyfried Date: 2017-09-29 (Fri, 29 Sep 2017) ------------------ This commit was generated by Migit --- src/gui/widget/menue.cpp | 67 ++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 37 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 2a516a62a..07aaed0e6 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -928,46 +928,39 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) break; } case (CRCInput::RC_left): - { - if(hasItem() && selected > -1 && (int)items.size() > selected) { - CMenuItem* itemX = items[selected]; - if (!itemX->isMenueOptionChooser()) { - if (g_settings.menu_left_exit) - msg = CRCInput::RC_timeout; - break; - } - } - } case (CRCInput::RC_right): case (CRCInput::RC_ok): - { - if(hasItem() && selected > -1 && (int)items.size() > selected) { - //exec this item... - CMenuItem* item = items[selected]; - if (!item->isSelectable()) - break; - item->msg = msg; - fader.StopFade(); - int rv = item->exec( this ); - switch ( rv ) { - case menu_return::RETURN_EXIT_ALL: - retval = menu_return::RETURN_EXIT_ALL; - /* fall through */ - case menu_return::RETURN_EXIT: - msg = CRCInput::RC_timeout; - break; - case menu_return::RETURN_REPAINT: - case menu_return::RETURN_EXIT_REPAINT: - if (fade && washidden) - fader.StartFadeIn(); - checkHints(); - pos = selected; - paint(); - break; - } - } else + if (hasItem() && selected > -1 && (int)items.size() > selected) { + //exec this item... + CMenuItem* item = items[selected]; + if (msg == CRCInput::RC_left && g_settings.menu_left_exit && + !item->isMenueOptionChooser()) { msg = CRCInput::RC_timeout; - } + break; + } + if (!item->isSelectable()) + break; + item->msg = msg; + fader.StopFade(); + int rv = item->exec( this ); + switch ( rv ) { + case menu_return::RETURN_EXIT_ALL: + retval = menu_return::RETURN_EXIT_ALL; + /* fall through */ + case menu_return::RETURN_EXIT: + msg = CRCInput::RC_timeout; + break; + case menu_return::RETURN_REPAINT: + case menu_return::RETURN_EXIT_REPAINT: + if (fade && washidden) + fader.StartFadeIn(); + checkHints(); + pos = selected; + paint(); + break; + } + } else + msg = CRCInput::RC_timeout; break; case (CRCInput::RC_home):