diff options
author | mathias <mathias> | 2007-10-14 17:11:38 (GMT) |
---|---|---|
committer | mathias <mathias> | 2007-10-14 17:11:38 (GMT) |
commit | 79cd21ce0fe56f4b38a96ecccc969f740b801cc8 (patch) | |
tree | 4861b4596a22998739e18fa73c1b985d1ea41271 /src | |
parent | a59428d67a95a9df16554962f0a6257d6378328a (diff) | |
download | fluxbox-79cd21ce0fe56f4b38a96ecccc969f740b801cc8.zip fluxbox-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.cc | 26 | ||||
-rw-r--r-- | src/CurrentWindowCmd.hh | 16 |
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 | ||
62 | void SendToNextWorkspaceCmd::real_execute() { | 62 | void 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 | ||
69 | void SendToPrevWorkspaceCmd::real_execute() { | 69 | void 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 | ||
81 | void TakeToNextWorkspaceCmd::real_execute() { | 83 | void 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 | ||
88 | void TakeToPrevWorkspaceCmd::real_execute() { | 90 | void 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 | ||
96 | void GoToTabCmd::real_execute() { | 100 | 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: | |||
77 | 77 | ||
78 | class SendToNextWorkspaceCmd: public WindowHelperCmd { | 78 | class SendToNextWorkspaceCmd: public WindowHelperCmd { |
79 | public: | 79 | public: |
80 | explicit SendToNextWorkspaceCmd(int workspace_num):m_workspace_num(workspace_num) { } | 80 | explicit SendToNextWorkspaceCmd(int delta):m_delta(delta) { } |
81 | protected: | 81 | protected: |
82 | void real_execute(); | 82 | void real_execute(); |
83 | private: | 83 | private: |
84 | const int m_workspace_num; | 84 | const int m_delta; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | class SendToPrevWorkspaceCmd: public WindowHelperCmd { | 87 | class SendToPrevWorkspaceCmd: public WindowHelperCmd { |
88 | public: | 88 | public: |
89 | explicit SendToPrevWorkspaceCmd(int workspace_num):m_workspace_num(workspace_num) { } | 89 | explicit SendToPrevWorkspaceCmd(int delta):m_delta(delta) { } |
90 | protected: | 90 | protected: |
91 | void real_execute(); | 91 | void real_execute(); |
92 | private: | 92 | private: |
93 | const int m_workspace_num; | 93 | const int m_delta; |
94 | }; | 94 | }; |
95 | 95 | ||
96 | class TakeToWorkspaceCmd : public WindowHelperCmd { | 96 | class TakeToWorkspaceCmd : public WindowHelperCmd { |
@@ -104,20 +104,20 @@ private: | |||
104 | 104 | ||
105 | class TakeToNextWorkspaceCmd : public WindowHelperCmd { | 105 | class TakeToNextWorkspaceCmd : public WindowHelperCmd { |
106 | public: | 106 | public: |
107 | explicit TakeToNextWorkspaceCmd(int workspace_num) : m_workspace_num(workspace_num) { } | 107 | explicit TakeToNextWorkspaceCmd(int delta) : m_delta(delta) { } |
108 | protected: | 108 | protected: |
109 | void real_execute(); | 109 | void real_execute(); |
110 | private: | 110 | private: |
111 | const int m_workspace_num; | 111 | const int m_delta; |
112 | }; | 112 | }; |
113 | 113 | ||
114 | class TakeToPrevWorkspaceCmd : public WindowHelperCmd { | 114 | class TakeToPrevWorkspaceCmd : public WindowHelperCmd { |
115 | public: | 115 | public: |
116 | explicit TakeToPrevWorkspaceCmd(int workspace_num) : m_workspace_num(workspace_num) { } | 116 | explicit TakeToPrevWorkspaceCmd(int delta) : m_delta(delta) { } |
117 | protected: | 117 | protected: |
118 | void real_execute(); | 118 | void real_execute(); |
119 | private: | 119 | private: |
120 | const int m_workspace_num; | 120 | const int m_delta; |
121 | }; | 121 | }; |
122 | 122 | ||
123 | 123 | ||