all repos — fluxbox @ be2f29dee6e33ce53a1e6a243273d977dfcb4595

custom fork of the fluxbox windowmanager

hide menus on click
fluxgen fluxgen
commit

be2f29dee6e33ce53a1e6a243273d977dfcb4595

parent

978b72ca6fee7eed2085107110ff3ac613b44a04

2 files changed, 23 insertions(+), 10 deletions(-)

jump to
M src/IconButton.ccsrc/IconButton.cc

@@ -1,5 +1,5 @@

// IconButton.cc -// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) +// Copyright (c) 2003 - 2004 Henrik Kinnunen (fluxgen at users.sourceforge.net) // and Simon Bowden (rathnor at users.sourceforge.net) // // Permission is hereby granted, free of charge, to any person obtaining a

@@ -20,18 +20,23 @@ // 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: IconButton.cc,v 1.13 2003/11/27 14:27:48 fluxgen Exp $ +// $Id: IconButton.cc,v 1.14 2004/01/11 16:08:07 fluxgen Exp $ #include "IconButton.hh" -#include "FbTk/App.hh" -#include "FbTk/EventManager.hh" #include "fluxbox.hh" #include "Screen.hh" #include "Window.hh" #include "WinClient.hh" -#include "SimpleCommand.hh" + +#include "FbTk/SimpleCommand.hh" +#include "FbTk/App.hh" +#include "FbTk/EventManager.hh" +#include "FbTk/MacroCommand.hh" +#include "FbTk/Command.hh" +#include "FbTk/RefCount.hh" + #ifdef HAVE_CONFIG_H #include "config.h"

@@ -48,6 +53,7 @@ class ShowMenu: public FbTk::Command {

public: explicit ShowMenu(FluxboxWindow &win):m_win(win) { } void execute() { + m_win.screen().hideMenus(); // get last button pos const XEvent &event = Fluxbox::instance()->lastEvent(); int x = event.xbutton.x_root - (m_win.menu().width() / 2);

@@ -70,9 +76,14 @@ ExposureMask | ButtonPressMask | ButtonReleaseMask),

m_use_pixmap(true) { FbTk::RefCount<FbTk::Command> focus(new FbTk::SimpleCommand<FluxboxWindow>(m_win, &FluxboxWindow::raiseAndFocus)); - FbTk::RefCount<FbTk::Command> menu(new ::ShowMenu(m_win)); - setOnClick(focus, 1); - setOnClick(menu, 3); + FbTk::RefCount<FbTk::Command> hidemenus(new FbTk::SimpleCommand<BScreen>(win.screen(), &BScreen::hideMenus)); + FbTk::MacroCommand *focus_macro = new FbTk::MacroCommand(); + focus_macro->add(hidemenus); + focus_macro->add(focus); + FbTk::RefCount<FbTk::Command> focus_cmd(focus_macro); + FbTk::RefCount<FbTk::Command> menu_cmd(new ::ShowMenu(m_win)); + setOnClick(focus_cmd, 1); + setOnClick(menu_cmd, 3); m_win.hintSig().attach(this); FbTk::EventManager::instance()->add(*this, m_icon_window);
M src/Toolbar.ccsrc/Toolbar.cc

@@ -1,5 +1,5 @@

// Toolbar.cc for Fluxbox -// Copyright (c) 2002 - 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) +// Copyright (c) 2002 - 2004 Henrik Kinnunen (fluxgen at users.sourceforge.net) // // Toolbar.cc for Blackbox - an X11 Window manager // Copyright (c) 1997 - 2000 Brad Hughes (bhughes at tcac.net)

@@ -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: Toolbar.cc,v 1.134 2003/12/20 19:05:42 fluxgen Exp $ +// $Id: Toolbar.cc,v 1.135 2004/01/11 16:08:57 fluxgen Exp $ #include "Toolbar.hh"

@@ -470,6 +470,8 @@

void Toolbar::buttonPressEvent(XButtonEvent &be) { if (be.button != 3) return; + + screen().hideMenus(); if (! menu().isVisible()) { int x, y;