aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoeren Beye <soeren at soerenbeye dot de>2013-02-27 08:44:49 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2013-02-27 08:46:47 (GMT)
commit0810d7db5e87d9541daabac98a4b8b2d0f431b69 (patch)
treead26bb6f246de352422c6b1c3bc55588aeca920e
parentec7fe513c8ca241836fab4632fc56faedd0f1863 (diff)
downloadfluxbox-0810d7db5e87d9541daabac98a4b8b2d0f431b69.zip
fluxbox-0810d7db5e87d9541daabac98a4b8b2d0f431b69.tar.bz2
Workspace switching on the toolbar via the mouse buttons
-rw-r--r--doc/asciidoc/fluxbox.txt6
-rw-r--r--src/ToolFactory.cc10
-rw-r--r--src/Toolbar.cc2
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:
557 The Systemtray can hold applications that are made to use it. 557 The Systemtray can hold applications that are made to use it.
558 558
559*WorkspaceName*::: 559*WorkspaceName*:::
560 This displays the name of the current workspace. 560 This displays the name of the current workspace. Also, one is able to switch
561 to the workspace left of the current one with a left click and to the
562 workspace right of the current one with a right click.
561 563
562*PrevWorkspace*::: 564*PrevWorkspace*:::
563 This displays an arrow that allows one to switch to the workspace left of 565 This displays an arrow that allows one to switch to the workspace left of
@@ -577,7 +579,7 @@ The possible tools are:
577 579
578Other aspects of the toolbar can be configured in two ways: through the toolbar 580Other aspects of the toolbar can be configured in two ways: through the toolbar
579menu, which is accessible in the Configuration part of the RootMenu or with a 581menu, which is accessible in the Configuration part of the RootMenu or with a
580right click on the edge the toolbar, or by editing the init file (see the 582middle click on the edge the toolbar, or by editing the init file (see the
581*RESOURCES* section for more information about that). 583*RESOURCES* section for more information about that).
582 584
583Toolbar Menu 585Toolbar 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),
75ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow &parent, Toolbar &tbar) { 75ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow &parent, Toolbar &tbar) {
76 ToolbarItem * item = 0; 76 ToolbarItem * item = 0;
77 77
78 FbTk::CommandParser<void>& cp = FbTk::CommandParser<void>::instance();
79
78 unsigned int button_size = 24; 80 unsigned int button_size = 24;
79 if (tbar.theme()->buttonSize() > 0) 81 if (tbar.theme()->buttonSize() > 0)
80 button_size = tbar.theme()->buttonSize(); 82 button_size = tbar.theme()->buttonSize();
@@ -83,8 +85,10 @@ ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow &
83 WorkspaceNameTool *witem = new WorkspaceNameTool(parent, 85 WorkspaceNameTool *witem = new WorkspaceNameTool(parent,
84 *m_workspace_theme, screen()); 86 *m_workspace_theme, screen());
85 using namespace FbTk; 87 using namespace FbTk;
86 RefCount<Command<void> > showmenu(new ShowMenuAboveToolbar(tbar)); 88 RefCount< Command<void> > leftCommand(cp.parse("prevworkspace"));
87 witem->button().setOnClick(showmenu); 89 RefCount< Command<void> > rightCommand(cp.parse("nextworkspace"));
90 witem->button().setOnClick(leftCommand);
91 witem->button().setOnClick(rightCommand, 3);
88 item = witem; 92 item = witem;
89 } else if (name == "iconbar") { 93 } else if (name == "iconbar") {
90 item = new IconbarTool(parent, m_iconbar_theme, m_focused_iconbar_theme, m_unfocused_iconbar_theme, screen(), tbar.menu()); 94 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 &
101 cmd_str += " (workspace=[current])"; 105 cmd_str += " (workspace=[current])";
102 } 106 }
103 107
104 FbTk::RefCount<FbTk::Command<void> > cmd(FbTk::CommandParser<void>::instance().parse(cmd_str)); 108 FbTk::RefCount<FbTk::Command<void> > cmd(cp.parse(cmd_str));
105 if (cmd == 0) // we need a command 109 if (cmd == 0) // we need a command
106 return 0; 110 return 0;
107 111
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) {
517 517
518 if (be.button == 1) 518 if (be.button == 1)
519 raise(); 519 raise();
520 if (be.button != 3) 520 if (be.button != 2)
521 return; 521 return;
522 522
523 screen() 523 screen()