aboutsummaryrefslogtreecommitdiff
path: root/src/CurrentWindowCmd.cc
diff options
context:
space:
mode:
authormarkt <markt>2007-10-13 21:51:37 (GMT)
committermarkt <markt>2007-10-13 21:51:37 (GMT)
commita59428d67a95a9df16554962f0a6257d6378328a (patch)
treef856ed9300c34f7a17d499f22d895610cfbc08e5 /src/CurrentWindowCmd.cc
parent41b5c6dadb1f474675660cef18b812d4c2338ed2 (diff)
downloadfluxbox-a59428d67a95a9df16554962f0a6257d6378328a.zip
fluxbox-a59428d67a95a9df16554962f0a6257d6378328a.tar.bz2
merged changes from pre-devel
Diffstat (limited to 'src/CurrentWindowCmd.cc')
-rw-r--r--src/CurrentWindowCmd.cc46
1 files changed, 20 insertions, 26 deletions
diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc
index b6c3c0e..4a60e63 100644
--- a/src/CurrentWindowCmd.cc
+++ b/src/CurrentWindowCmd.cc
@@ -31,17 +31,24 @@
31 31
32#include "FocusControl.hh" 32#include "FocusControl.hh"
33 33
34CurrentWindowCmd::CurrentWindowCmd(Action act):m_action(act) { } 34void WindowHelperCmd::execute() {
35 m_win = 0;
36 if (FocusControl::focusedFbWindow()) // guarantee that fbwindow() exists too
37 real_execute();
38}
35 39
36void CurrentWindowCmd::execute() { 40void WindowHelperCmd::execute(FluxboxWindow &win) {
37 FluxboxWindow *win = FocusControl::focusedFbWindow(); 41 m_win = &win;
38 if (win) 42 real_execute();
39 (win->*m_action)();
40} 43}
41 44
45FluxboxWindow &WindowHelperCmd::fbwindow() {
46 // will exist from execute above
47 return (m_win ? *m_win : *FocusControl::focusedFbWindow());
48}
42 49
43void KillWindowCmd::real_execute() { 50void CurrentWindowCmd::real_execute() {
44 winclient().sendClose(true); 51 (fbwindow().*m_action)();
45} 52}
46 53
47void SetHeadCmd::real_execute() { 54void SetHeadCmd::real_execute() {
@@ -54,13 +61,14 @@ void SendToWorkspaceCmd::real_execute() {
54 61
55void SendToNextWorkspaceCmd::real_execute() { 62void SendToNextWorkspaceCmd::real_execute() {
56 const int ws_nr = 63 const int ws_nr =
57 ( fbwindow().screen().currentWorkspaceID() + m_workspace_num ) % 64 ( fbwindow().workspaceNumber() + m_workspace_num ) %
58 fbwindow().screen().numberOfWorkspaces(); 65 fbwindow().screen().numberOfWorkspaces();
59 fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow(), false); 66 fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow(), false);
60} 67}
61 68
62void SendToPrevWorkspaceCmd::real_execute() { 69void SendToPrevWorkspaceCmd::real_execute() {
63 int ws_nr = fbwindow().screen().currentWorkspaceID() - m_workspace_num; 70 int ws_nr = (fbwindow().workspaceNumber() - m_workspace_num) %
71 fbwindow().screen().numberOfWorkspaces();
64 if ( ws_nr < 0 ) 72 if ( ws_nr < 0 )
65 ws_nr += fbwindow().screen().numberOfWorkspaces(); 73 ws_nr += fbwindow().screen().numberOfWorkspaces();
66 fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow(), false); 74 fbwindow().screen().sendToWorkspace(ws_nr, &fbwindow(), false);
@@ -72,13 +80,14 @@ void TakeToWorkspaceCmd::real_execute() {
72 80
73void TakeToNextWorkspaceCmd::real_execute() { 81void TakeToNextWorkspaceCmd::real_execute() {
74 unsigned int workspace_num= 82 unsigned int workspace_num=
75 ( fbwindow().screen().currentWorkspaceID() + m_workspace_num ) % 83 ( fbwindow().workspaceNumber() + m_workspace_num ) %
76 fbwindow().screen().numberOfWorkspaces(); 84 fbwindow().screen().numberOfWorkspaces();
77 fbwindow().screen().sendToWorkspace(workspace_num, &fbwindow()); 85 fbwindow().screen().sendToWorkspace(workspace_num, &fbwindow());
78} 86}
79 87
80void TakeToPrevWorkspaceCmd::real_execute() { 88void TakeToPrevWorkspaceCmd::real_execute() {
81 int workspace_num= fbwindow().screen().currentWorkspaceID() - m_workspace_num; 89 int workspace_num = (fbwindow().workspaceNumber() - m_workspace_num) %
90 fbwindow().screen().numberOfWorkspaces();
82 if ( workspace_num < 0 ) 91 if ( workspace_num < 0 )
83 workspace_num += fbwindow().screen().numberOfWorkspaces(); 92 workspace_num += fbwindow().screen().numberOfWorkspaces();
84 fbwindow().screen().sendToWorkspace(workspace_num, &fbwindow()); 93 fbwindow().screen().sendToWorkspace(workspace_num, &fbwindow());
@@ -97,21 +106,6 @@ void GoToTabCmd::real_execute() {
97 (*it)->focus(); 106 (*it)->focus();
98} 107}
99 108
100void WindowHelperCmd::execute() {
101 if (FocusControl::focusedFbWindow()) // guarantee that fbwindow() exists too
102 real_execute();
103}
104
105WinClient &WindowHelperCmd::winclient() {
106 // will exist from execute above
107 return *FocusControl::focusedWindow();
108}
109
110FluxboxWindow &WindowHelperCmd::fbwindow() {
111 // will exist from execute above
112 return *FocusControl::focusedFbWindow();
113}
114
115MoveCmd::MoveCmd(const int step_size_x, const int step_size_y) : 109MoveCmd::MoveCmd(const int step_size_x, const int step_size_y) :
116 m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } 110 m_step_size_x(step_size_x), m_step_size_y(step_size_y) { }
117 111