bugfix for SendToPrevWorkspace/TakeToPrevWorkspace, destination was calculated

wrong due to (wrong) implicit casting effects
This commit is contained in:
mathias 2007-10-14 17:11:38 +00:00
parent a59428d67a
commit 79cd21ce0f
3 changed files with 26 additions and 19 deletions

View file

@ -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)

View file

@ -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() {

View file

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