Index: src/FbTk/Menu.cc =================================================================== RCS file: /cvsroot/fluxbox/fluxbox/src/FbTk/Menu.cc,v retrieving revision 1.71 diff -a -b -B -p -u -r1.71 Menu.cc --- src/FbTk/Menu.cc 14 Jul 2004 18:30:37 -0000 1.71 +++ src/FbTk/Menu.cc 3 Aug 2004 15:27:23 -0000 @@ -36,6 +36,7 @@ #endif //HAVE_CONFIG_H #include "MenuItem.hh" +#include "MenuSeparator.hh" #include "ImageControl.hh" #include "MenuTheme.hh" #include "App.hh" @@ -51,6 +52,7 @@ #include #include #include +#include using namespace std; @@ -309,6 +314,11 @@ void Menu::nextItem() { return; } + if (!isItemSelectable(which_press)) { + nextItem(); + return; + } + m_active_index = which_press; drawItem(which_press, @@ -344,6 +354,11 @@ void Menu::prevItem() { return; } + if (!isItemSelectable(which_press)) { + prevItem(); + return; + } + m_active_index = which_press; drawItem(which_press, @@ -1038,6 +1054,18 @@ bool Menu::isItemEnabled(unsigned int in return item->isEnabled(); } +bool Menu::isItemSelectable(unsigned int index) const { + + if (index >= menuitems.size()) return false; + + const MenuItem *item = find(index); + if (!item) + return false; + + return (typeid(*item) != typeid(FbTk::MenuSeparator)); +} + + void Menu::handleEvent(XEvent &event) { if (event.type == FocusOut) { if (s_focused == this) @@ -1189,6 +1219,7 @@ void Menu::motionNotifyEvent(XMotionEven !item->submenu()->isTorn()) { // setup hide timer for submenu item->submenu()->startHide(); + which_sub = -1; } } @@ -1231,7 +1262,7 @@ void Menu::motionNotifyEvent(XMotionEven } - } else { + } else if (isItemSelectable(w)){ // else normal menu item // draw highlighted m_submenu_timer.stop(); Index: src/FbTk/Menu.hh =================================================================== RCS file: /cvsroot/fluxbox/fluxbox/src/FbTk/Menu.hh,v retrieving revision 1.37 diff -a -b -B -p -u -r1.37 Menu.hh --- src/FbTk/Menu.hh 27 Jun 2004 13:51:24 -0000 1.37 +++ src/FbTk/Menu.hh 3 Aug 2004 15:27:24 -0000 @@ -151,6 +151,7 @@ public: bool hasSubmenu(unsigned int index) const; bool isItemSelected(unsigned int index) const; bool isItemEnabled(unsigned int index) const; + bool isItemSelectable(unsigned int index) const; inline const MenuTheme &theme() const { return m_theme; } inline unsigned char alpha() const { return theme().alpha(); } inline static Menu *focused() { return s_focused; }