diff options
author | fluxgen <fluxgen> | 2004-01-11 16:08:57 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2004-01-11 16:08:57 (GMT) |
commit | be2f29dee6e33ce53a1e6a243273d977dfcb4595 (patch) | |
tree | 35ee5bbc9be7667233936d7e65315334069cc99e | |
parent | 978b72ca6fee7eed2085107110ff3ac613b44a04 (diff) | |
download | fluxbox-be2f29dee6e33ce53a1e6a243273d977dfcb4595.zip fluxbox-be2f29dee6e33ce53a1e6a243273d977dfcb4595.tar.bz2 |
hide menus on click
-rw-r--r-- | src/IconButton.cc | 27 | ||||
-rw-r--r-- | src/Toolbar.cc | 6 |
2 files changed, 23 insertions, 10 deletions
diff --git a/src/IconButton.cc b/src/IconButton.cc index 6c5e3e4..5733e2c 100644 --- a/src/IconButton.cc +++ b/src/IconButton.cc | |||
@@ -1,5 +1,5 @@ | |||
1 | // IconButton.cc | 1 | // IconButton.cc |
2 | // Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) | 2 | // Copyright (c) 2003 - 2004 Henrik Kinnunen (fluxgen at users.sourceforge.net) |
3 | // and Simon Bowden (rathnor at users.sourceforge.net) | 3 | // and Simon Bowden (rathnor at users.sourceforge.net) |
4 | // | 4 | // |
5 | // Permission is hereby granted, free of charge, to any person obtaining a | 5 | // Permission is hereby granted, free of charge, to any person obtaining a |
@@ -20,18 +20,23 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: IconButton.cc,v 1.13 2003/11/27 14:27:48 fluxgen Exp $ | 23 | // $Id: IconButton.cc,v 1.14 2004/01/11 16:08:07 fluxgen Exp $ |
24 | 24 | ||
25 | #include "IconButton.hh" | 25 | #include "IconButton.hh" |
26 | 26 | ||
27 | #include "FbTk/App.hh" | ||
28 | #include "FbTk/EventManager.hh" | ||
29 | 27 | ||
30 | #include "fluxbox.hh" | 28 | #include "fluxbox.hh" |
31 | #include "Screen.hh" | 29 | #include "Screen.hh" |
32 | #include "Window.hh" | 30 | #include "Window.hh" |
33 | #include "WinClient.hh" | 31 | #include "WinClient.hh" |
34 | #include "SimpleCommand.hh" | 32 | |
33 | #include "FbTk/SimpleCommand.hh" | ||
34 | #include "FbTk/App.hh" | ||
35 | #include "FbTk/EventManager.hh" | ||
36 | #include "FbTk/MacroCommand.hh" | ||
37 | #include "FbTk/Command.hh" | ||
38 | #include "FbTk/RefCount.hh" | ||
39 | |||
35 | 40 | ||
36 | #ifdef HAVE_CONFIG_H | 41 | #ifdef HAVE_CONFIG_H |
37 | #include "config.h" | 42 | #include "config.h" |
@@ -48,6 +53,7 @@ class ShowMenu: public FbTk::Command { | |||
48 | public: | 53 | public: |
49 | explicit ShowMenu(FluxboxWindow &win):m_win(win) { } | 54 | explicit ShowMenu(FluxboxWindow &win):m_win(win) { } |
50 | void execute() { | 55 | void execute() { |
56 | m_win.screen().hideMenus(); | ||
51 | // get last button pos | 57 | // get last button pos |
52 | const XEvent &event = Fluxbox::instance()->lastEvent(); | 58 | const XEvent &event = Fluxbox::instance()->lastEvent(); |
53 | int x = event.xbutton.x_root - (m_win.menu().width() / 2); | 59 | int x = event.xbutton.x_root - (m_win.menu().width() / 2); |
@@ -70,9 +76,14 @@ IconButton::IconButton(const FbTk::FbWindow &parent, const FbTk::Font &font, | |||
70 | m_use_pixmap(true) { | 76 | m_use_pixmap(true) { |
71 | 77 | ||
72 | FbTk::RefCount<FbTk::Command> focus(new FbTk::SimpleCommand<FluxboxWindow>(m_win, &FluxboxWindow::raiseAndFocus)); | 78 | FbTk::RefCount<FbTk::Command> focus(new FbTk::SimpleCommand<FluxboxWindow>(m_win, &FluxboxWindow::raiseAndFocus)); |
73 | FbTk::RefCount<FbTk::Command> menu(new ::ShowMenu(m_win)); | 79 | FbTk::RefCount<FbTk::Command> hidemenus(new FbTk::SimpleCommand<BScreen>(win.screen(), &BScreen::hideMenus)); |
74 | setOnClick(focus, 1); | 80 | FbTk::MacroCommand *focus_macro = new FbTk::MacroCommand(); |
75 | setOnClick(menu, 3); | 81 | focus_macro->add(hidemenus); |
82 | focus_macro->add(focus); | ||
83 | FbTk::RefCount<FbTk::Command> focus_cmd(focus_macro); | ||
84 | FbTk::RefCount<FbTk::Command> menu_cmd(new ::ShowMenu(m_win)); | ||
85 | setOnClick(focus_cmd, 1); | ||
86 | setOnClick(menu_cmd, 3); | ||
76 | m_win.hintSig().attach(this); | 87 | m_win.hintSig().attach(this); |
77 | 88 | ||
78 | FbTk::EventManager::instance()->add(*this, m_icon_window); | 89 | FbTk::EventManager::instance()->add(*this, m_icon_window); |
diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 732be39..e804aed 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc | |||
@@ -1,5 +1,5 @@ | |||
1 | // Toolbar.cc for Fluxbox | 1 | // Toolbar.cc for Fluxbox |
2 | // Copyright (c) 2002 - 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) | 2 | // Copyright (c) 2002 - 2004 Henrik Kinnunen (fluxgen at users.sourceforge.net) |
3 | // | 3 | // |
4 | // Toolbar.cc for Blackbox - an X11 Window manager | 4 | // Toolbar.cc for Blackbox - an X11 Window manager |
5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes at tcac.net) | 5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes at tcac.net) |
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Toolbar.cc,v 1.134 2003/12/20 19:05:42 fluxgen Exp $ | 25 | // $Id: Toolbar.cc,v 1.135 2004/01/11 16:08:57 fluxgen Exp $ |
26 | 26 | ||
27 | #include "Toolbar.hh" | 27 | #include "Toolbar.hh" |
28 | 28 | ||
@@ -471,6 +471,8 @@ void Toolbar::buttonPressEvent(XButtonEvent &be) { | |||
471 | if (be.button != 3) | 471 | if (be.button != 3) |
472 | return; | 472 | return; |
473 | 473 | ||
474 | screen().hideMenus(); | ||
475 | |||
474 | if (! menu().isVisible()) { | 476 | if (! menu().isVisible()) { |
475 | int x, y; | 477 | int x, y; |
476 | 478 | ||