From 79cd21ce0fe56f4b38a96ecccc969f740b801cc8 Mon Sep 17 00:00:00 2001 From: mathias Date: Sun, 14 Oct 2007 17:11:38 +0000 Subject: bugfix for SendToPrevWorkspace/TakeToPrevWorkspace, destination was calculated wrong due to (wrong) implicit casting effects --- ChangeLog | 3 +++ src/CurrentWindowCmd.cc | 26 +++++++++++++++----------- src/CurrentWindowCmd.hh | 16 ++++++++-------- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4187012..f756911 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ (Format: Year/Month/Day) Changes for 1.0.1: +*07/10/14: + * Bugfix for SendToPrevWorkspace/TakeToPrevWorkspace (Mathias) + CurrentWindowCmd.cc/hh *07/10/13: * Merged pre-devel branch; see all Changes since 1.0.0 (Mark) * Updated ru_RU (Thanks Konstantin Shashkin) diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc index 4a60e63..58ec78c 100644 --- a/src/CurrentWindowCmd.cc +++ b/src/CurrentWindowCmd.cc @@ -61,16 +61,18 @@ void SendToWorkspaceCmd::real_execute() { void SendToNextWorkspaceCmd::real_execute() { const int ws_nr = - ( fbwindow().workspaceNumber() + m_workspace_num ) % + ( fbwindow().workspaceNumber() + m_delta ) % fbwindow().screen().numberOfWorkspaces(); fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow(), false); } void SendToPrevWorkspaceCmd::real_execute() { - int ws_nr = (fbwindow().workspaceNumber() - m_workspace_num) % - fbwindow().screen().numberOfWorkspaces(); + int ws_nr = (fbwindow().workspaceNumber() - m_delta ); if ( ws_nr < 0 ) ws_nr += fbwindow().screen().numberOfWorkspaces(); + + ws_nr = ws_nr % fbwindow().screen().numberOfWorkspaces(); + fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow(), false); } @@ -79,18 +81,20 @@ void TakeToWorkspaceCmd::real_execute() { } void TakeToNextWorkspaceCmd::real_execute() { - unsigned int workspace_num= - ( fbwindow().workspaceNumber() + m_workspace_num ) % + unsigned int ws_nr = + ( fbwindow().workspaceNumber() + m_delta) % fbwindow().screen().numberOfWorkspaces(); - fbwindow().screen().sendToWorkspace(workspace_num, &fbwindow()); + fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow()); } void TakeToPrevWorkspaceCmd::real_execute() { - int workspace_num = (fbwindow().workspaceNumber() - m_workspace_num) % - fbwindow().screen().numberOfWorkspaces(); - if ( workspace_num < 0 ) - workspace_num += fbwindow().screen().numberOfWorkspaces(); - fbwindow().screen().sendToWorkspace(workspace_num, &fbwindow()); + int ws_nr = (fbwindow().workspaceNumber() - m_delta); + if ( ws_nr < 0 ) + ws_nr += fbwindow().screen().numberOfWorkspaces(); + + ws_nr = ws_nr % fbwindow().screen().numberOfWorkspaces(); + + fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow()); } void GoToTabCmd::real_execute() { diff --git a/src/CurrentWindowCmd.hh b/src/CurrentWindowCmd.hh index 172f9c0..da929d5 100644 --- a/src/CurrentWindowCmd.hh +++ b/src/CurrentWindowCmd.hh @@ -77,20 +77,20 @@ private: class SendToNextWorkspaceCmd: public WindowHelperCmd { public: - explicit SendToNextWorkspaceCmd(int workspace_num):m_workspace_num(workspace_num) { } + explicit SendToNextWorkspaceCmd(int delta):m_delta(delta) { } protected: void real_execute(); private: - const int m_workspace_num; + const int m_delta; }; class SendToPrevWorkspaceCmd: public WindowHelperCmd { public: - explicit SendToPrevWorkspaceCmd(int workspace_num):m_workspace_num(workspace_num) { } + explicit SendToPrevWorkspaceCmd(int delta):m_delta(delta) { } protected: void real_execute(); private: - const int m_workspace_num; + const int m_delta; }; class TakeToWorkspaceCmd : public WindowHelperCmd { @@ -104,20 +104,20 @@ private: class TakeToNextWorkspaceCmd : public WindowHelperCmd { public: - explicit TakeToNextWorkspaceCmd(int workspace_num) : m_workspace_num(workspace_num) { } + explicit TakeToNextWorkspaceCmd(int delta) : m_delta(delta) { } protected: void real_execute(); private: - const int m_workspace_num; + const int m_delta; }; class TakeToPrevWorkspaceCmd : public WindowHelperCmd { public: - explicit TakeToPrevWorkspaceCmd(int workspace_num) : m_workspace_num(workspace_num) { } + explicit TakeToPrevWorkspaceCmd(int delta) : m_delta(delta) { } protected: void real_execute(); private: - const int m_workspace_num; + const int m_delta; }; -- cgit v0.11.2