From 0810d7db5e87d9541daabac98a4b8b2d0f431b69 Mon Sep 17 00:00:00 2001 From: Soeren Beye Date: Wed, 27 Feb 2013 09:44:49 +0100 Subject: Workspace switching on the toolbar via the mouse buttons --- doc/asciidoc/fluxbox.txt | 6 ++++-- src/ToolFactory.cc | 10 +++++++--- src/Toolbar.cc | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/doc/asciidoc/fluxbox.txt b/doc/asciidoc/fluxbox.txt index 8fc0bd1..7848f03 100644 --- a/doc/asciidoc/fluxbox.txt +++ b/doc/asciidoc/fluxbox.txt @@ -557,7 +557,9 @@ The possible tools are: The Systemtray can hold applications that are made to use it. *WorkspaceName*::: - This displays the name of the current workspace. + This displays the name of the current workspace. Also, one is able to switch + to the workspace left of the current one with a left click and to the + workspace right of the current one with a right click. *PrevWorkspace*::: This displays an arrow that allows one to switch to the workspace left of @@ -577,7 +579,7 @@ The possible tools are: Other aspects of the toolbar can be configured in two ways: through the toolbar menu, which is accessible in the Configuration part of the RootMenu or with a -right click on the edge the toolbar, or by editing the init file (see the +middle click on the edge the toolbar, or by editing the init file (see the *RESOURCES* section for more information about that). Toolbar Menu diff --git a/src/ToolFactory.cc b/src/ToolFactory.cc index 5da2777..4034313 100644 --- a/src/ToolFactory.cc +++ b/src/ToolFactory.cc @@ -75,6 +75,8 @@ ToolFactory::ToolFactory(BScreen &screen):m_screen(screen), ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow &parent, Toolbar &tbar) { ToolbarItem * item = 0; + FbTk::CommandParser& cp = FbTk::CommandParser::instance(); + unsigned int button_size = 24; if (tbar.theme()->buttonSize() > 0) button_size = tbar.theme()->buttonSize(); @@ -83,8 +85,10 @@ ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow & WorkspaceNameTool *witem = new WorkspaceNameTool(parent, *m_workspace_theme, screen()); using namespace FbTk; - RefCount > showmenu(new ShowMenuAboveToolbar(tbar)); - witem->button().setOnClick(showmenu); + RefCount< Command > leftCommand(cp.parse("prevworkspace")); + RefCount< Command > rightCommand(cp.parse("nextworkspace")); + witem->button().setOnClick(leftCommand); + witem->button().setOnClick(rightCommand, 3); item = witem; } else if (name == "iconbar") { item = new IconbarTool(parent, m_iconbar_theme, m_focused_iconbar_theme, m_unfocused_iconbar_theme, screen(), tbar.menu()); @@ -101,7 +105,7 @@ ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow & cmd_str += " (workspace=[current])"; } - FbTk::RefCount > cmd(FbTk::CommandParser::instance().parse(cmd_str)); + FbTk::RefCount > cmd(cp.parse(cmd_str)); if (cmd == 0) // we need a command return 0; diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 5f4cc80..c43a419 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -517,7 +517,7 @@ void Toolbar::buttonPressEvent(XButtonEvent &be) { if (be.button == 1) raise(); - if (be.button != 3) + if (be.button != 2) return; screen() -- cgit v0.11.2