allow negative indices in :Workspace <int>

This commit is contained in:
markt 2007-07-07 04:54:34 +00:00
parent 18cd70f749
commit b735d405f5
3 changed files with 18 additions and 7 deletions

View file

@ -1,6 +1,8 @@
(Format: Year/Month/Day)
Changes for 1.0.0:
*07/07/07:
* Allow negative numbers in :Workspace <int> command, which counts backwards
from the last one (Mark)
* Right clicking on a submenu didn't revert focus to its parent (Mark)
FbTk/Menu.cc/hh
* Pressing escape in a torn menu didn't work (Mark)

View file

@ -103,8 +103,15 @@ JumpToWorkspaceCmd::JumpToWorkspaceCmd(int workspace_num):m_workspace_num(worksp
void JumpToWorkspaceCmd::execute() {
BScreen *screen = Fluxbox::instance()->mouseScreen();
if (screen != 0)
screen->changeWorkspaceID(m_workspace_num);
if (screen != 0) {
int num = screen->numberOfWorkspaces();
int actual = m_workspace_num;
// we need an extra +1, since it's subtracted in FbCommandFactory
if (actual < 0) actual += num+1;
if (actual < 0) actual = 0;
if (actual >= num) actual = num - 1;
screen->changeWorkspaceID(actual);
}
}

View file

@ -160,13 +160,15 @@ int main(int argc, char **argv) {
}
}
if (rc_filename.empty())
rc_filename = getenv("HOME") + string("/.fluxbox/init");
FbTk::ResourceManager resource_manager(rc_filename.c_str(),false);
if (rc_filename.empty() || !resource_manager.load(rc_filename.c_str())) {
if (!resource_manager.load(rc_filename.c_str())) {
// couldn't load rc file
if (!rc_filename.empty()) {
cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "Failed trying to read rc file")<<":"<<rc_filename<<endl;
cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFileTrying, "Retrying with", "Retrying rc file loading with (the following file)")<<": "<<DEFAULT_INITFILE<<endl;
}
cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "Failed trying to read rc file")<<":"<<rc_filename<<endl;
cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFileTrying, "Retrying with", "Retrying rc file loading with (the following file)")<<": "<<DEFAULT_INITFILE<<endl;
// couldn't load default rc file, either
if (!resource_manager.load(DEFAULT_INITFILE)) {
cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "")<<": "<<DEFAULT_INITFILE<<endl;