all repos — fluxbox @ 7b4d57f275fb7fbc7521fd3efad57f6fd07bb248

custom fork of the fluxbox windowmanager

fixed menu move bug and made separator not selectable, patch from Mathias Gumz
fluxgen fluxgen
commit

7b4d57f275fb7fbc7521fd3efad57f6fd07bb248

parent

582fe36cea0d20298d67222a720fe8be014a78bf

2 files changed, 29 insertions(+), 3 deletions(-)

jump to
M src/FbTk/Menu.ccsrc/FbTk/Menu.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Menu.cc,v 1.71 2004/07/14 18:30:37 fluxgen Exp $ +// $Id: Menu.cc,v 1.72 2004/08/03 21:25:51 fluxgen Exp $ //use GNU extensions #ifndef _GNU_SOURCE

@@ -36,6 +36,7 @@ #include "config.h"

#endif //HAVE_CONFIG_H #include "MenuItem.hh" +#include "MenuSeparator.hh" #include "ImageControl.hh" #include "MenuTheme.hh" #include "App.hh"

@@ -51,6 +52,7 @@ #include <cstdio>

#include <cstdlib> #include <cstring> #include <iostream> +#include <typeinfo> using namespace std;

@@ -309,6 +311,11 @@ m_active_index = -1;

return; } + if (!isItemSelectable(which_press)) { + nextItem(); + return; + } + m_active_index = which_press; drawItem(which_press,

@@ -341,6 +348,11 @@ which_press--;

if (menuitems[which_press] == 0) { m_active_index = -1; + return; + } + + if (!isItemSelectable(which_press)) { + prevItem(); return; }

@@ -1038,6 +1050,18 @@

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 +1213,7 @@ if (item->submenu()->isVisible() &&

!item->submenu()->isTorn()) { // setup hide timer for submenu item->submenu()->startHide(); + which_sub = -1; } }

@@ -1231,7 +1256,7 @@ m_submenu_timer.start();

} - } else { + } else if (isItemSelectable(w)){ // else normal menu item // draw highlighted m_submenu_timer.stop();
M src/FbTk/Menu.hhsrc/FbTk/Menu.hh

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Menu.hh,v 1.37 2004/06/27 13:51:24 fluxgen Exp $ +// $Id: Menu.hh,v 1.38 2004/08/03 21:25:51 fluxgen Exp $ #ifndef FBTK_MENU_HH #define FBTK_MENU_HH

@@ -151,6 +151,7 @@ inline int currentSubmenu() const { return which_sub; }

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; }