all repos — fluxbox @ 53b73110331803cadcbb66b775cf3037f3512b8a

custom fork of the fluxbox windowmanager

on click iconify if focused else raise and focus
fluxgen fluxgen
commit

53b73110331803cadcbb66b775cf3037f3512b8a

parent

c2ba488919ab2c2bd4fe97f8bd8678602aeca41b

1 files changed, 18 insertions(+), 3 deletions(-)

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

@@ -20,7 +20,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: IconButton.cc,v 1.15 2004/01/13 12:27:51 fluxgen Exp $ +// $Id: IconButton.cc,v 1.16 2004/01/16 09:32:44 fluxgen Exp $ #include "IconButton.hh"

@@ -65,8 +65,24 @@ private:

FluxboxWindow &m_win; }; +class FocusCommand: public FbTk::Command { +public: + explicit FocusCommand(FluxboxWindow &win):m_win(win) { } + void execute() { + if(m_win.isIconic() || !m_win.isFocused()) + m_win.raiseAndFocus(); + else + m_win.iconify(); + } +private: + FluxboxWindow &m_win; +}; + + } // end anonymous namespace + + IconButton::IconButton(const FbTk::FbWindow &parent, const FbTk::Font &font, FluxboxWindow &win): FbTk::TextButton(parent, font, win.winClient().title()),

@@ -75,7 +91,6 @@ m_icon_window(*this, 1, 1, 1, 1,

ExposureMask | ButtonPressMask | ButtonReleaseMask), m_use_pixmap(true) { - FbTk::RefCount<FbTk::Command> focus(new FbTk::SimpleCommand<FluxboxWindow>(m_win, &FluxboxWindow::raiseAndFocus)); FbTk::RefCount<FbTk::Command> hidemenus(new FbTk::SimpleCommand<BScreen>(win.screen(), &BScreen::hideMenus)); //!! TODO: There're some issues with MacroCommand when // this object dies when the last macrocommand is executed (focused cmd)

@@ -83,7 +98,7 @@ // In iconbar mode Icons

// FbTk::MacroCommand *focus_macro = new FbTk::MacroCommand(); // focus_macro->add(hidemenus); // focus_macro->add(focus); - FbTk::RefCount<FbTk::Command> focus_cmd(focus); + FbTk::RefCount<FbTk::Command> focus_cmd(new ::FocusCommand(m_win)); FbTk::RefCount<FbTk::Command> menu_cmd(new ::ShowMenu(m_win)); setOnClick(focus_cmd, 1); setOnClick(menu_cmd, 3);