news download themes documentation links










CurrentWindowCmd.cc

00001 // CurrentWindowCmd.cc for Fluxbox - an X11 Window manager
00002 // Copyright (c) 2003 Henrik Kinnunen (fluxgen{<a*t>}users.sourceforge.net)
00003 //                and Simon Bowden (rathnor at users.sourceforge.net)
00004 //
00005 // Permission is hereby granted, free of charge, to any person obtaining a
00006 // copy of this software and associated documentation files (the "Software"),
00007 // to deal in the Software without restriction, including without limitation
00008 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
00009 // and/or sell copies of the Software, and to permit persons to whom the
00010 // Software is furnished to do so, subject to the following conditions:
00011 //
00012 // The above copyright notice and this permission notice shall be included in
00013 // all copies or substantial portions of the Software.
00014 //
00015 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00016 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00017 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00018 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00019 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00020 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00021 // DEALINGS IN THE SOFTWARE.
00022 
00023 // $Id: CurrentWindowCmd.cc,v 1.8 2003/10/26 12:36:55 fluxgen Exp $
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()) // guarantee that fbwindow() exists too
00053         real_execute();
00054 }
00055 
00056 WinClient &WindowHelperCmd::winclient() {
00057     // will exist from execute above
00058     return *Fluxbox::instance()->getFocusedWindow();
00059 }
00060 
00061 FluxboxWindow &WindowHelperCmd::fbwindow() {
00062     // will exist from execute above
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 }

Fluxbox CVS-Jan-2003




      



Got comments about the page? Send them to webmaster.
If you have general Fluxbox related questions ask them on our irc channel or mailing lists.

Show Source








Designed by aLEczapKA