summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathias <mathias>2007-10-14 17:11:38 (GMT)
committermathias <mathias>2007-10-14 17:11:38 (GMT)
commit79cd21ce0fe56f4b38a96ecccc969f740b801cc8 (patch)
tree4861b4596a22998739e18fa73c1b985d1ea41271 /src
parenta59428d67a95a9df16554962f0a6257d6378328a (diff)
downloadfluxbox_lack-79cd21ce0fe56f4b38a96ecccc969f740b801cc8.zip
fluxbox_lack-79cd21ce0fe56f4b38a96ecccc969f740b801cc8.tar.bz2
bugfix for SendToPrevWorkspace/TakeToPrevWorkspace, destination was calculated
wrong due to (wrong) implicit casting effects
Diffstat (limited to 'src')
-rw-r--r--src/CurrentWindowCmd.cc26
-rw-r--r--src/CurrentWindowCmd.hh16
2 files changed, 23 insertions, 19 deletions
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() {
61 61
62void SendToNextWorkspaceCmd::real_execute() { 62void SendToNextWorkspaceCmd::real_execute() {
63 const int ws_nr = 63 const int ws_nr =
64 ( fbwindow().workspaceNumber() + m_workspace_num ) % 64 ( fbwindow().workspaceNumber() + m_delta ) %
65 fbwindow().screen().numberOfWorkspaces(); 65 fbwindow().screen().numberOfWorkspaces();
66 fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow(), false); 66 fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow(), false);
67} 67}
68 68
69void SendToPrevWorkspaceCmd::real_execute() { 69void SendToPrevWorkspaceCmd::real_execute() {
70 int ws_nr = (fbwindow().workspaceNumber() - m_workspace_num) % 70 int ws_nr = (fbwindow().workspaceNumber() - m_delta );
71 fbwindow().screen().numberOfWorkspaces();
72 if ( ws_nr < 0 ) 71 if ( ws_nr < 0 )
73 ws_nr += fbwindow().screen().numberOfWorkspaces(); 72 ws_nr += fbwindow().screen().numberOfWorkspaces();
73
74 ws_nr = ws_nr % fbwindow().screen().numberOfWorkspaces();
75
74 fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow(), false); 76 fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow(), false);
75} 77}
76 78
@@ -79,18 +81,20 @@ void TakeToWorkspaceCmd::real_execute() {
79} 81}
80 82
81void TakeToNextWorkspaceCmd::real_execute() { 83void TakeToNextWorkspaceCmd::real_execute() {
82 unsigned int workspace_num= 84 unsigned int ws_nr =
83 ( fbwindow().workspaceNumber() + m_workspace_num ) % 85 ( fbwindow().workspaceNumber() + m_delta) %
84 fbwindow().screen().numberOfWorkspaces(); 86 fbwindow().screen().numberOfWorkspaces();
85 fbwindow().screen().sendToWorkspace(workspace_num, &fbwindow()); 87 fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow());
86} 88}
87 89
88void TakeToPrevWorkspaceCmd::real_execute() { 90void TakeToPrevWorkspaceCmd::real_execute() {
89 int workspace_num = (fbwindow().workspaceNumber() - m_workspace_num) % 91 int ws_nr = (fbwindow().workspaceNumber() - m_delta);
90 fbwindow().screen().numberOfWorkspaces(); 92 if ( ws_nr < 0 )
91 if ( workspace_num < 0 ) 93 ws_nr += fbwindow().screen().numberOfWorkspaces();
92 workspace_num += fbwindow().screen().numberOfWorkspaces(); 94
93 fbwindow().screen().sendToWorkspace(workspace_num, &fbwindow()); 95 ws_nr = ws_nr % fbwindow().screen().numberOfWorkspaces();
96
97 fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow());
94} 98}
95 99
96void GoToTabCmd::real_execute() { 100void 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:
77 77
78class SendToNextWorkspaceCmd: public WindowHelperCmd { 78class SendToNextWorkspaceCmd: public WindowHelperCmd {
79public: 79public:
80 explicit SendToNextWorkspaceCmd(int workspace_num):m_workspace_num(workspace_num) { } 80 explicit SendToNextWorkspaceCmd(int delta):m_delta(delta) { }
81protected: 81protected:
82 void real_execute(); 82 void real_execute();
83private: 83private:
84 const int m_workspace_num; 84 const int m_delta;
85}; 85};
86 86
87class SendToPrevWorkspaceCmd: public WindowHelperCmd { 87class SendToPrevWorkspaceCmd: public WindowHelperCmd {
88public: 88public:
89 explicit SendToPrevWorkspaceCmd(int workspace_num):m_workspace_num(workspace_num) { } 89 explicit SendToPrevWorkspaceCmd(int delta):m_delta(delta) { }
90protected: 90protected:
91 void real_execute(); 91 void real_execute();
92private: 92private:
93 const int m_workspace_num; 93 const int m_delta;
94}; 94};
95 95
96class TakeToWorkspaceCmd : public WindowHelperCmd { 96class TakeToWorkspaceCmd : public WindowHelperCmd {
@@ -104,20 +104,20 @@ private:
104 104
105class TakeToNextWorkspaceCmd : public WindowHelperCmd { 105class TakeToNextWorkspaceCmd : public WindowHelperCmd {
106public: 106public:
107 explicit TakeToNextWorkspaceCmd(int workspace_num) : m_workspace_num(workspace_num) { } 107 explicit TakeToNextWorkspaceCmd(int delta) : m_delta(delta) { }
108protected: 108protected:
109 void real_execute(); 109 void real_execute();
110private: 110private:
111 const int m_workspace_num; 111 const int m_delta;
112}; 112};
113 113
114class TakeToPrevWorkspaceCmd : public WindowHelperCmd { 114class TakeToPrevWorkspaceCmd : public WindowHelperCmd {
115public: 115public:
116 explicit TakeToPrevWorkspaceCmd(int workspace_num) : m_workspace_num(workspace_num) { } 116 explicit TakeToPrevWorkspaceCmd(int delta) : m_delta(delta) { }
117protected: 117protected:
118 void real_execute(); 118 void real_execute();
119private: 119private:
120 const int m_workspace_num; 120 const int m_delta;
121}; 121};
122 122
123 123