diff options
Diffstat (limited to 'src/CurrentWindowCmd.cc')
-rw-r--r-- | src/CurrentWindowCmd.cc | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc index f4d4af7..b8913bb 100644 --- a/src/CurrentWindowCmd.cc +++ b/src/CurrentWindowCmd.cc | |||
@@ -20,58 +20,68 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: CurrentWindowCmd.cc,v 1.2 2003/07/26 13:44:00 rathnor Exp $ | 23 | // $Id: CurrentWindowCmd.cc,v 1.3 2003/07/28 15:06:33 rathnor Exp $ |
24 | 24 | ||
25 | #include "CurrentWindowCmd.hh" | 25 | #include "CurrentWindowCmd.hh" |
26 | 26 | ||
27 | #include "fluxbox.hh" | 27 | #include "fluxbox.hh" |
28 | #include "Window.hh" | 28 | #include "Window.hh" |
29 | #include "Screen.hh" | 29 | #include "Screen.hh" |
30 | #include "WinClient.hh" | ||
30 | 31 | ||
31 | CurrentWindowCmd::CurrentWindowCmd(Action act):m_action(act) { } | 32 | CurrentWindowCmd::CurrentWindowCmd(Action act):m_action(act) { } |
32 | 33 | ||
33 | void CurrentWindowCmd::execute() { | 34 | void CurrentWindowCmd::execute() { |
34 | Fluxbox *fb = Fluxbox::instance(); | 35 | WinClient *client = Fluxbox::instance()->getFocusedWindow(); |
35 | if (fb->getFocusedWindow() != 0) | 36 | if (client && client->fbwindow()) |
36 | (*fb->getFocusedWindow().*m_action)(); | 37 | (client->fbwindow()->*m_action)(); |
37 | } | 38 | } |
38 | 39 | ||
39 | 40 | ||
40 | void KillWindowCmd::real_execute() { | 41 | void KillWindowCmd::real_execute() { |
41 | XKillClient(FbTk::App::instance()->display(), window().clientWindow()); | 42 | winclient().sendClose(true); |
42 | } | 43 | } |
43 | 44 | ||
44 | void SendToWorkspaceCmd::real_execute() { | 45 | void SendToWorkspaceCmd::real_execute() { |
45 | if (m_workspace_num >= 0 && m_workspace_num < window().screen().getNumberOfWorkspaces()) | 46 | if (m_workspace_num >= 0 && m_workspace_num < fbwindow().screen().getNumberOfWorkspaces()) |
46 | window().screen().sendToWorkspace(m_workspace_num, &window()); | 47 | fbwindow().screen().sendToWorkspace(m_workspace_num, &fbwindow()); |
47 | } | 48 | } |
48 | 49 | ||
49 | void WindowHelperCmd::execute() { | 50 | void WindowHelperCmd::execute() { |
50 | if (Fluxbox::instance()->getFocusedWindow()) | 51 | WinClient *client = Fluxbox::instance()->getFocusedWindow(); |
52 | if (client && client->fbwindow()) // guarantee that fbwindow() exists too | ||
51 | real_execute(); | 53 | real_execute(); |
52 | } | 54 | } |
53 | 55 | ||
54 | FluxboxWindow &WindowHelperCmd::window() { | 56 | WinClient &WindowHelperCmd::winclient() { |
57 | // will exist from execute above | ||
55 | return *Fluxbox::instance()->getFocusedWindow(); | 58 | return *Fluxbox::instance()->getFocusedWindow(); |
56 | } | 59 | } |
57 | 60 | ||
61 | FluxboxWindow &WindowHelperCmd::fbwindow() { | ||
62 | // will exist from execute above | ||
63 | return *Fluxbox::instance()->getFocusedWindow()->fbwindow(); | ||
64 | } | ||
65 | |||
58 | MoveLeftCmd::MoveLeftCmd(int step_size):MoveHelper(step_size) { } | 66 | MoveLeftCmd::MoveLeftCmd(int step_size):MoveHelper(step_size) { } |
59 | void MoveLeftCmd::real_execute() { | 67 | void MoveLeftCmd::real_execute() { |
60 | window().move(window().x() - stepSize(), window().y()); | 68 | fbwindow().move(fbwindow().x() - stepSize(), |
69 | fbwindow().y()); | ||
61 | } | 70 | } |
62 | 71 | ||
63 | MoveRightCmd::MoveRightCmd(int step_size):MoveHelper(step_size) { } | 72 | MoveRightCmd::MoveRightCmd(int step_size):MoveHelper(step_size) { } |
64 | void MoveRightCmd::real_execute() { | 73 | void MoveRightCmd::real_execute() { |
65 | window().move(window().x() + stepSize(), window().y()); | 74 | fbwindow().move(fbwindow().x() + stepSize(), |
75 | fbwindow().y()); | ||
66 | } | 76 | } |
67 | 77 | ||
68 | MoveDownCmd::MoveDownCmd(int step_size):MoveHelper(step_size) { } | 78 | MoveDownCmd::MoveDownCmd(int step_size):MoveHelper(step_size) { } |
69 | void MoveDownCmd::real_execute() { | 79 | void MoveDownCmd::real_execute() { |
70 | window().move(window().x(), window().y() + stepSize()); | 80 | fbwindow().move(fbwindow().x(), fbwindow().y() + stepSize()); |
71 | } | 81 | } |
72 | 82 | ||
73 | MoveUpCmd::MoveUpCmd(int step_size):MoveHelper(step_size) { } | 83 | MoveUpCmd::MoveUpCmd(int step_size):MoveHelper(step_size) { } |
74 | void MoveUpCmd::real_execute() { | 84 | void MoveUpCmd::real_execute() { |
75 | window().move(window().x(), window().y() - stepSize()); | 85 | fbwindow().move(fbwindow().x(), fbwindow().y() - stepSize()); |
76 | } | 86 | } |
77 | 87 | ||