diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Screen.cc | 15 | ||||
-rw-r--r-- | src/Screen.hh | 1 | ||||
-rw-r--r-- | src/WorkspaceCmd.cc | 10 |
3 files changed, 18 insertions, 8 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index c24250a..17d8c23 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -194,6 +194,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm, | |||
194 | m_layermanager(num_layers), | 194 | m_layermanager(num_layers), |
195 | root_colormap_installed(false), | 195 | root_colormap_installed(false), |
196 | m_current_workspace(0), | 196 | m_current_workspace(0), |
197 | m_former_workspace(0), | ||
197 | m_focused_windowtheme(new FbWinFrameTheme(scrn, ".focus", ".Focus")), | 198 | m_focused_windowtheme(new FbWinFrameTheme(scrn, ".focus", ".Focus")), |
198 | m_unfocused_windowtheme(new FbWinFrameTheme(scrn, ".unfocus", ".Unfocus")), | 199 | m_unfocused_windowtheme(new FbWinFrameTheme(scrn, ".unfocus", ".Unfocus")), |
199 | // the order of windowtheme and winbutton theme is important | 200 | // the order of windowtheme and winbutton theme is important |
@@ -919,6 +920,8 @@ int BScreen::removeLastWorkspace() { | |||
919 | 920 | ||
920 | if (m_current_workspace->workspaceID() == wkspc->workspaceID()) | 921 | if (m_current_workspace->workspaceID() == wkspc->workspaceID()) |
921 | changeWorkspaceID(m_current_workspace->workspaceID() - 1); | 922 | changeWorkspaceID(m_current_workspace->workspaceID() - 1); |
923 | if (m_former_workspace && m_former_workspace->workspaceID() == wkspc->workspaceID()) | ||
924 | m_former_workspace = 0; | ||
922 | 925 | ||
923 | wkspc->removeAll(wkspc->workspaceID()-1); | 926 | wkspc->removeAll(wkspc->workspaceID()-1); |
924 | 927 | ||
@@ -950,6 +953,8 @@ void BScreen::changeWorkspaceID(unsigned int id, bool revert) { | |||
950 | id == m_current_workspace->workspaceID()) | 953 | id == m_current_workspace->workspaceID()) |
951 | return; | 954 | return; |
952 | 955 | ||
956 | m_former_workspace = m_current_workspace; | ||
957 | |||
953 | /* Ignore all EnterNotify events until the pointer actually moves */ | 958 | /* Ignore all EnterNotify events until the pointer actually moves */ |
954 | this->focusControl().ignoreAtPointer(); | 959 | this->focusControl().ignoreAtPointer(); |
955 | 960 | ||
@@ -1524,14 +1529,20 @@ void BScreen::setLayer(FbTk::LayerItem &item, int layernum) { | |||
1524 | Goes to the workspace "right" of the current | 1529 | Goes to the workspace "right" of the current |
1525 | */ | 1530 | */ |
1526 | void BScreen::nextWorkspace(int delta) { | 1531 | void BScreen::nextWorkspace(int delta) { |
1527 | changeWorkspaceID( (currentWorkspaceID() + delta) % numberOfWorkspaces()); | 1532 | if (delta) |
1533 | changeWorkspaceID( (currentWorkspaceID() + delta) % numberOfWorkspaces()); | ||
1534 | else if (m_former_workspace) | ||
1535 | changeWorkspaceID(m_former_workspace->workspaceID()); | ||
1528 | } | 1536 | } |
1529 | 1537 | ||
1530 | /** | 1538 | /** |
1531 | Goes to the workspace "left" of the current | 1539 | Goes to the workspace "left" of the current |
1532 | */ | 1540 | */ |
1533 | void BScreen::prevWorkspace(int delta) { | 1541 | void BScreen::prevWorkspace(int delta) { |
1534 | changeWorkspaceID( (static_cast<signed>(numberOfWorkspaces()) + currentWorkspaceID() - (delta % numberOfWorkspaces())) % numberOfWorkspaces()); | 1542 | if (delta) |
1543 | changeWorkspaceID( (static_cast<signed>(numberOfWorkspaces()) + currentWorkspaceID() - (delta % numberOfWorkspaces())) % numberOfWorkspaces()); | ||
1544 | else if (m_former_workspace) | ||
1545 | changeWorkspaceID(m_former_workspace->workspaceID()); | ||
1535 | } | 1546 | } |
1536 | 1547 | ||
1537 | /** | 1548 | /** |
diff --git a/src/Screen.hh b/src/Screen.hh index 30228ee..30fbb4a 100644 --- a/src/Screen.hh +++ b/src/Screen.hh | |||
@@ -502,6 +502,7 @@ private: | |||
502 | std::unique_ptr<ToolButtonMap> m_toolButtonMap; | 502 | std::unique_ptr<ToolButtonMap> m_toolButtonMap; |
503 | 503 | ||
504 | Workspace *m_current_workspace; | 504 | Workspace *m_current_workspace; |
505 | Workspace *m_former_workspace; | ||
505 | 506 | ||
506 | WorkspaceNames m_workspace_names; | 507 | WorkspaceNames m_workspace_names; |
507 | Workspaces m_workspaces_list; | 508 | Workspaces m_workspaces_list; |
diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc index 3a1a3b4..bca56c6 100644 --- a/src/WorkspaceCmd.cc +++ b/src/WorkspaceCmd.cc | |||
@@ -357,15 +357,13 @@ REGISTER_COMMAND_PARSER(workspace, parseIntCmd, void); | |||
357 | } // end anonymous namespace | 357 | } // end anonymous namespace |
358 | 358 | ||
359 | void NextWorkspaceCmd::execute() { | 359 | void NextWorkspaceCmd::execute() { |
360 | BScreen *screen = Fluxbox::instance()->mouseScreen(); | 360 | if (BScreen *screen = Fluxbox::instance()->mouseScreen()) |
361 | if (screen != 0) | 361 | screen->nextWorkspace(m_option); |
362 | screen->nextWorkspace(m_option == 0 ? 1 : m_option); | ||
363 | } | 362 | } |
364 | 363 | ||
365 | void PrevWorkspaceCmd::execute() { | 364 | void PrevWorkspaceCmd::execute() { |
366 | BScreen *screen = Fluxbox::instance()->mouseScreen(); | 365 | if (BScreen *screen = Fluxbox::instance()->mouseScreen()) |
367 | if (screen != 0) | 366 | screen->prevWorkspace(m_option); |
368 | screen->prevWorkspace(m_option == 0 ? 1 : m_option); | ||
369 | } | 367 | } |
370 | 368 | ||
371 | void LeftWorkspaceCmd::execute() { | 369 | void LeftWorkspaceCmd::execute() { |