From 680128f286d990549ea99eadbb4a6094f65cc461 Mon Sep 17 00:00:00 2001
From: rathnor <rathnor>
Date: Sun, 29 Aug 2004 14:53:23 +0000
Subject: fix wrapping upwards in menu

---
 ChangeLog        |  2 ++
 src/FbTk/Menu.cc | 10 +++-------
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 81b70ce..1c221e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
 (Format: Year/Month/Day)
 Changes for 0.9.10:
 *04/08/29:
+  * Fix cycling using keys in menus (didn't wrap upwards) (Simon)
+    FbTk/Menu.cc
   * Fix rendering bug when revisiting >1 column menus (Simon)
     FbTk/Menu.cc
   * Fix crash when extramenus not attached to windowmenu (Simon)
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index b4ae45a..7e89016 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -22,7 +22,7 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 // DEALINGS IN THE SOFTWARE.
 
-// $Id: Menu.cc,v 1.76 2004/08/29 14:37:52 rathnor Exp $
+// $Id: Menu.cc,v 1.77 2004/08/29 14:53:23 rathnor Exp $
 
 //use GNU extensions
 #ifndef	 _GNU_SOURCE
@@ -300,11 +300,9 @@ void Menu::nextItem() {
     }
 
     // restore old in case we changed which_press
-    which_press = old_which_press;
+    which_press = old_which_press + 1;
     if (!validIndex(which_press))
         which_press = 0;
-    else
-        which_press++;
 
 
     if (menuitems[which_press] == 0) {
@@ -340,12 +338,10 @@ void Menu::prevItem() {
                  true); // transp
     }
     // restore old in case we changed which_press
-    which_press = old_which_press;
+    which_press = old_which_press - 1;
 
     if (!validIndex(which_press))
         which_press = menuitems.size() - 1;
-    else if (which_press - 1 >= 0)
-        which_press--;
 
     if (menuitems[which_press] == 0) {
         m_active_index = -1;
-- 
cgit v0.11.2