00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "CurrentWindowCmd.hh"
00026
00027 #include "fluxbox.hh"
00028 #include "Window.hh"
00029 #include "Screen.hh"
00030 #include "WinClient.hh"
00031
00032 CurrentWindowCmd::CurrentWindowCmd(Action act):m_action(act) { }
00033
00034 void CurrentWindowCmd::execute() {
00035 WinClient *client = Fluxbox::instance()->getFocusedWindow();
00036 if (client && client->fbwindow())
00037 (client->fbwindow()->*m_action)();
00038 }
00039
00040
00041 void KillWindowCmd::real_execute() {
00042 winclient().sendClose(true);
00043 }
00044
00045 void SendToWorkspaceCmd::real_execute() {
00046 if (m_workspace_num >= 0 && m_workspace_num < fbwindow().screen().getNumberOfWorkspaces())
00047 fbwindow().screen().sendToWorkspace(m_workspace_num, &fbwindow());
00048 }
00049
00050 void WindowHelperCmd::execute() {
00051 WinClient *client = Fluxbox::instance()->getFocusedWindow();
00052 if (client && client->fbwindow())
00053 real_execute();
00054 }
00055
00056 WinClient &WindowHelperCmd::winclient() {
00057
00058 return *Fluxbox::instance()->getFocusedWindow();
00059 }
00060
00061 FluxboxWindow &WindowHelperCmd::fbwindow() {
00062
00063 return *Fluxbox::instance()->getFocusedWindow()->fbwindow();
00064 }
00065
00066 MoveCmd::MoveCmd(const int step_size_x, const int step_size_y) :
00067 m_step_size_x(step_size_x), m_step_size_y(step_size_y) { }
00068
00069 void MoveCmd::real_execute() {
00070 fbwindow().move(
00071 fbwindow().x() + m_step_size_x,
00072 fbwindow().y() + m_step_size_y);
00073 }
00074
00075 ResizeCmd::ResizeCmd(const int step_size_x, const int step_size_y) :
00076 m_step_size_x(step_size_x), m_step_size_y(step_size_y) { }
00077
00078 void ResizeCmd::real_execute() {
00079 fbwindow().resize(
00080 fbwindow().width() +
00081 m_step_size_x * fbwindow().winClient().width_inc,
00082 fbwindow().height() +
00083 m_step_size_y * fbwindow().winClient().height_inc);
00084 }
00085
00086 MoveToCmd::MoveToCmd(const int step_size_x, const int step_size_y) :
00087 m_step_size_x(step_size_x), m_step_size_y(step_size_y) { }
00088
00089 void MoveToCmd::real_execute() {
00090 fbwindow().move(m_step_size_x, m_step_size_y);
00091 }
00092
00093 ResizeToCmd::ResizeToCmd(const int step_size_x, const int step_size_y) :
00094 m_step_size_x(step_size_x), m_step_size_y(step_size_y) { }
00095
00096 void ResizeToCmd::real_execute() {
00097 fbwindow().resize(m_step_size_x, m_step_size_y);
00098 }