all repos — fluxbox @ 79cd21ce0fe56f4b38a96ecccc969f740b801cc8

custom fork of the fluxbox windowmanager

bugfix for SendToPrevWorkspace/TakeToPrevWorkspace, destination was calculated
wrong due to (wrong) implicit casting effects
mathias mathias
commit

79cd21ce0fe56f4b38a96ecccc969f740b801cc8

parent

a59428d67a95a9df16554962f0a6257d6378328a

3 files changed, 26 insertions(+), 19 deletions(-)

jump to
M ChangeLogChangeLog

@@ -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)
M src/CurrentWindowCmd.ccsrc/CurrentWindowCmd.cc

@@ -61,16 +61,18 @@ }

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 @@ fbwindow().screen().sendToWorkspace(m_workspace_num, &fbwindow());

} 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() {
M src/CurrentWindowCmd.hhsrc/CurrentWindowCmd.hh

@@ -77,20 +77,20 @@ };

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 @@ };

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; };