all repos — fluxbox @ 63a5065d5e58e18e8f20fd53a6438413f1a5d42d

custom fork of the fluxbox windowmanager

WorkspaceNameDialogCmd, CommandDialogCmd and changes in SetWorkspaceNameCmd
fluxgen fluxgen
commit

63a5065d5e58e18e8f20fd53a6438413f1a5d42d

parent

fbceff651a4e93638e7d44ab6a35ee3622793ff4

2 files changed, 60 insertions(+), 6 deletions(-)

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

@@ -19,14 +19,16 @@ // 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: FbCommands.cc,v 1.19 2003/12/19 00:47:30 fluxgen Exp $ +// $Id: FbCommands.cc,v 1.20 2003/12/19 03:56:51 fluxgen Exp $ #include "FbCommands.hh" #include "fluxbox.hh" -#include "FbTk/Theme.hh" #include "Screen.hh" -#include "Menu.hh" -#include "SetWorkspaceName.hh" +#include "CommandDialog.hh" +#include "Workspace.hh" + +#include "FbTk/Theme.hh" +#include "FbTk/Menu.hh" #include <sys/types.h> #include <unistd.h>

@@ -163,13 +165,51 @@ screen->getWorkspacemenu().grabInputFocus();

} + + +SetWorkspaceNameCmd::SetWorkspaceNameCmd(const std::string &name, int spaceid): + m_name(name), m_workspace(spaceid) { } + void SetWorkspaceNameCmd::execute() { + BScreen *screen = Fluxbox::instance()->mouseScreen(); + if (screen == 0) { + screen = Fluxbox::instance()->keyScreen(); + if (screen == 0) { + cerr<<"Screen == 0!"<<endl; + return; + } + } + + if (m_workspace < 0) { + screen->currentWorkspace()->setName(m_name); + } else { + Workspace *space = screen->getWorkspace(m_workspace); + if (space == 0) + return; + space->setName(m_name); + } + + screen->updateWorkspaceNamesAtom(); + Fluxbox::instance()->save_rc(); +} + +void WorkspaceNameDialogCmd::execute() { BScreen *screen = Fluxbox::instance()->mouseScreen(); if (screen == 0) return; - SetWorkspaceName *win = new SetWorkspaceName(*screen); + CommandDialog *win = new CommandDialog(*screen, "Set Workspace Name:", "SetWorkspaceName "); + win->setText(screen->currentWorkspace()->name()); + win->show(); +} + +void CommandDialogCmd::execute() { + BScreen *screen = Fluxbox::instance()->mouseScreen(); + if (screen == 0) + return; + + FbTk::FbWindow *win = new CommandDialog(*screen, "Fluxbox Command"); win->show(); }
M src/FbCommands.hhsrc/FbCommands.hh

@@ -19,7 +19,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: FbCommands.hh,v 1.14 2003/12/16 23:35:00 fluxgen Exp $ +// $Id: FbCommands.hh,v 1.15 2003/12/19 03:56:51 fluxgen Exp $ // \file contains basic commands to restart, reconfigure, execute command and exit fluxbox

@@ -94,6 +94,20 @@ void execute();

}; class SetWorkspaceNameCmd: public FbTk::Command { +public: + SetWorkspaceNameCmd(const std::string &name, int spaceid = -1); + void execute(); +private: + std::string m_name; + int m_workspace; +}; + +class WorkspaceNameDialogCmd: public FbTk::Command { +public: + void execute(); +}; + +class CommandDialogCmd: public FbTk::Command { public: void execute(); };