all repos — fluxbox @ 8890bfe94688fdcc7c22f99a6725f6030a98a71f

custom fork of the fluxbox windowmanager

using left to close submenu and right to open it
fluxgen fluxgen
commit

8890bfe94688fdcc7c22f99a6725f6030a98a71f

parent

b4aba1ff12e455cb5fb6f76dee93f405bfe5738e

1 files changed, 31 insertions(+), 63 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.26 2003/07/03 12:23:28 fluxgen Exp $ +// $Id: Menu.cc,v 1.27 2003/07/03 12:47:22 fluxgen Exp $ //use GNU extensions #ifndef _GNU_SOURCE

@@ -320,11 +320,6 @@ drawSubmenu(which_press);

else drawItem(which_press, true, true, true); -#ifdef DEBUG - cerr<<__FILE__<<"("<<__FUNCTION__<<")"<<endl; - cerr<<"which_press = "<<which_press<<endl; -#endif // DEBUG - } void Menu::prevItem() {

@@ -354,11 +349,33 @@ else

drawItem(which_press, true, true, true); } -#ifdef DEBUG - cerr<<__FILE__<<"("<<__FUNCTION__<<")"<<endl; - cerr<<"which_press = "<<which_press<<endl; -#endif // DEBUG +} + +void Menu::enterSubmenu() { + if (which_press < 0 || which_press >= menuitems.size()) + return; + + Menu *submenu = menuitems[which_press]->submenu(); + if (submenu == 0) + return; + submenu->grabInputFocus(); + submenu->which_press = -1; // so we land on 0 after nextItem() + submenu->nextItem(); +} + +void Menu::enterParent() { + if (which_press < 0 || which_press >= menuitems.size() || parent() == 0) + return; + + Menu *submenu = menuitems[which_press]->submenu(); + if (submenu) + submenu->menu.window.hide(); + + drawItem(which_press, false, true, true); + which_press = -1; // dont select any in this + // return focus to parent but keep this window open + parent()->grabInputFocus(); } void Menu::disableTitle() {

@@ -1259,33 +1276,6 @@ drawSubmenu(which_sub);

} } -void Menu::enterSubmenu() { - if (which_press < 0 || which_press >= menuitems.size()) - return; - - Menu *submenu = menuitems[which_press]->submenu(); - if (submenu == 0) - return; - - submenu->grabInputFocus(); - submenu->which_press = -1; // so we land on 0 after nextItem() - submenu->nextItem(); -} - -void Menu::enterParent() { - if (which_press < 0 || which_press >= menuitems.size() || parent() == 0) - return; - - Menu *submenu = menuitems[which_press]->submenu(); - if (submenu) - submenu->menu.window.hide(); - - drawItem(which_press, false, true, true); - which_press = -1; // dont select any in this - // return focus to parent but keep this window open - parent()->grabInputFocus(); -} - void Menu::keyPressEvent(XKeyEvent &event) { KeySym ks; char keychar[1];

@@ -1303,33 +1293,11 @@ break;

case XK_Down: nextItem(); break; - case XK_Left: // enter submenu or leave this menu and enter parent - // if we have a submenu we should determine if - // we should open it or close this and enter parent depending on which - // side the parent is. - // if parent on the left -> enter parent - // if parent on the right -> enter submenu of this item - if (which_press >= 0 && which_press < menuitems.size()) { - Menu *submenu = menuitems[which_press]->submenu(); - if (parent() && parent()->x() < x()) // parent on the left - enterParent(); - else if (submenu) // else parent on the right and submenu on the left - enterSubmenu(); - } + case XK_Left: // enter parent if we have one + enterParent(); break; - case XK_Right: // enter submenu or leave this menu and enter parent - // if we have a submenu we should determine if - // we should open it or close this and enter parent depending on which - // side the parent is. - // if parent on the left -> enter submenu of this item - // parent on the right -> leave this menu and enter parent - if (which_press >= 0 && which_press < menuitems.size()) { - Menu *submenu = menuitems[which_press]->submenu(); - if (parent() && parent()->x() > x()) // parent on the right - enterParent(); - else if (submenu) // else parent on the left and submenu on the right - enterSubmenu(); - } + case XK_Right: // enter submenu if we have one + enterSubmenu(); break; case XK_Escape: // close menu hide();