From cdc4338c6b7175e0c2654e42a01ae575722f4fd1 Mon Sep 17 00:00:00 2001 From: mathias Date: Wed, 15 Jun 2005 09:48:46 +0000 Subject: Fixes #1213003, SendToWorkspace shouldnt follow SendToWorkspace and the rest are putting the window onto the new workspace silently, TakeToWorkspace warps to the new workspace with the window. --- ChangeLog | 4 ++++ src/CurrentWindowCmd.cc | 22 ++++++++++++++++++++-- src/CurrentWindowCmd.hh | 28 ++++++++++++++++++++++++++++ src/FbCommandFactory.cc | 9 +++++++++ 4 files changed, 61 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 77f2d11..08ac2be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ (Format: Year/Month/Day) Changes for 0.9.14: *05/06/15: + * Fixes #1213003, SendToWorkspace shouldnt follow (Mathias) + - SendToWorkspace silently changes the workspace of the window + - TakeToWorkspace takes the window and puts it onto the ws + FbCommandFactory.cc CurrentWindowCmd.cc/hh * Fixes #1216020, *.font.effect wont get cleared if not defined in style (Mathias) FbTk/Font.cc *05/06/09: diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc index ba3af0d..834dcad 100644 --- a/src/CurrentWindowCmd.cc +++ b/src/CurrentWindowCmd.cc @@ -48,17 +48,35 @@ void SetHeadCmd::real_execute() { void SendToWorkspaceCmd::real_execute() { if (m_workspace_num >= 0 && m_workspace_num < fbwindow().screen().getNumberOfWorkspaces()) - fbwindow().screen().sendToWorkspace(m_workspace_num, &fbwindow()); + fbwindow().screen().sendToWorkspace(m_workspace_num, &fbwindow(), false); } void SendToNextWorkspaceCmd::real_execute() { + const int ws_nr = + ( fbwindow().screen().currentWorkspaceID() + m_workspace_num ) % + fbwindow().screen().getNumberOfWorkspaces(); + fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow(), false); +} + +void SendToPrevWorkspaceCmd::real_execute() { + int ws_nr = fbwindow().screen().currentWorkspaceID() - m_workspace_num; + if ( ws_nr < 0 ) ws_nr += fbwindow().screen().getNumberOfWorkspaces(); + fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow(), false); +} + +void TakeToWorkspaceCmd::real_execute() { + if (m_workspace_num >= 0 && m_workspace_num < fbwindow().screen().getNumberOfWorkspaces()) + fbwindow().screen().sendToWorkspace(m_workspace_num, &fbwindow()); +} + +void TakeToNextWorkspaceCmd::real_execute() { unsigned int workspace_num= ( fbwindow().screen().currentWorkspaceID() + m_workspace_num ) % fbwindow().screen().getNumberOfWorkspaces(); fbwindow().screen().sendToWorkspace(workspace_num, &fbwindow()); } -void SendToPrevWorkspaceCmd::real_execute() { +void TakeToPrevWorkspaceCmd::real_execute() { int workspace_num= fbwindow().screen().currentWorkspaceID() - m_workspace_num; if ( workspace_num < 0 ) workspace_num+= fbwindow().screen().getNumberOfWorkspaces(); fbwindow().screen().sendToWorkspace(workspace_num, &fbwindow()); diff --git a/src/CurrentWindowCmd.hh b/src/CurrentWindowCmd.hh index 6e17566..0ef7eca 100644 --- a/src/CurrentWindowCmd.hh +++ b/src/CurrentWindowCmd.hh @@ -96,6 +96,34 @@ private: const int m_workspace_num; }; +class TakeToWorkspaceCmd : public WindowHelperCmd { +public: + explicit TakeToWorkspaceCmd(int workspace_num) : m_workspace_num(workspace_num) { } +protected: + void real_execute(); +private: + const int m_workspace_num; +}; + +class TakeToNextWorkspaceCmd : public WindowHelperCmd { +public: + explicit TakeToNextWorkspaceCmd(int workspace_num) : m_workspace_num(workspace_num) { } +protected: + void real_execute(); +private: + const int m_workspace_num; +}; + +class TakeToPrevWorkspaceCmd : public WindowHelperCmd { +public: + explicit TakeToPrevWorkspaceCmd(int workspace_num) : m_workspace_num(workspace_num) { } +protected: + void real_execute(); +private: + const int m_workspace_num; +}; + + // goto tab class GoToTabCmd: public WindowHelperCmd { public: diff --git a/src/FbCommandFactory.cc b/src/FbCommandFactory.cc index ec91a86..f3c6f51 100644 --- a/src/FbCommandFactory.cc +++ b/src/FbCommandFactory.cc @@ -122,6 +122,9 @@ FbCommandFactory::FbCommandFactory() { "stick", "stickwindow", "tab", + "taketoworkspace", + "taketonextworkspace", + "taketoprevworkspace", "toggledecor", "windowmenu", "workspace", @@ -279,6 +282,12 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command, return new SendToNextWorkspaceCmd(atoi(arguments.c_str())); else if (command == "sendtoprevworkspace") return new SendToPrevWorkspaceCmd(atoi(arguments.c_str())); + else if (command == "taketoworkspace") + return new TakeToWorkspaceCmd(atoi(arguments.c_str()) - 1); + else if (command == "taketonextworkspace") + return new TakeToNextWorkspaceCmd(atoi(arguments.c_str())); + else if (command == "taketoprevworkspace") + return new TakeToPrevWorkspaceCmd(atoi(arguments.c_str())); else if (command == "killwindow" || command == "kill") return new KillWindowCmd(); else if (command == "tab") { -- cgit v0.11.2