kwin/tiling/tiling.h
Arthur Arlt 3634525613 Refactoring Tiling
This initial commit introduces a new class Tiling. It is provided by
the files tiling/tiling.h and tiling/tiling.cpp. It covers all the
Tiling functionality which was provided by Workspace. In this initial
commit, all the functions were just moved and adjusted.
A  new member variable m_tiling is introduced to Workspace, which
makes the new class Tiling accessible from Workspace.
The Tiling pointer is created in the constructor and deleted in
the deconstructor. Also a getter method tiling() is provided.
All calls from other classes are updated to use the methods in class
Tiling now.
2011-07-28 12:35:51 +02:00

108 lines
No EOL
3.7 KiB
C++

/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2009 Nikhil Marathe <nsm.nikhil@gmail.com>
Copyright (C) 2011 Arthur Arlt <a.arlt@stud.uni-heidelberg.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef KWIN_TILING_H
#define KWIN_TILING_H
#include <kdecoration.h>
#include "client.h"
#include <QtCore/QVector>
namespace KWin {
class Tile;
class TilingLayout;
class Tiling : public QObject {
Q_OBJECT
public:
Tiling(Workspace *w);
~Tiling();
bool tilingEnabled() const;
void setTilingEnabled(bool tiling);
bool tileable(Client *c);
void createTile(Client *c);
void removeTile(Client *c);
// updates geometry of tiles on all desktops,
// this rearranges the tiles.
void updateAllTiles();
QVector< TilingLayout* >& getTilingLayouts();
// The notification functions are called from
// various points in existing code so that
// tiling can take any action if required.
// They are defined in tiling.cpp
void notifyTilingWindowResize(Client *c, const QRect &moveResizeGeom, const QRect &orig);
void notifyTilingWindowMove(Client *c, const QRect &moveResizeGeom, const QRect &orig);
void notifyTilingWindowResizeDone(Client *c, const QRect &moveResizeGeom, const QRect &orig, bool canceled);
void notifyTilingWindowMoveDone(Client *c, const QRect &moveResizeGeom, const QRect &orig, bool canceled);
void notifyTilingWindowDesktopChanged(Client *c, int old_desktop);
void notifyTilingWindowActivated(Client *c);
void notifyTilingWindowMinimizeToggled(Client *c);
void notifyTilingWindowMaximized(Client *c, KDecorationDefines::WindowOperation op);
KDecorationDefines::Position supportedTilingResizeMode(Client *c, KDecorationDefines::Position currentMode);
public Q_SLOTS:
// user actions, usually bound to shortcuts
// and also provided through the D-BUS interface.
void slotToggleTiling();
void slotToggleFloating();
void slotNextTileLayout();
void slotPreviousTileLayout();
// Changes the focused client
void slotFocusTileLeft();
void slotFocusTileRight();
void slotFocusTileTop();
void slotFocusTileBottom();
// swaps active and adjacent client.
void slotMoveTileLeft();
void slotMoveTileRight();
void slotMoveTileTop();
void slotMoveTileBottom();
void belowCursor();
// NOTE: debug method
void dumpTiles() const;
private:
// try to get a decent tile, either the one with
// focus or the one below the mouse.
Tile* getNiceTile() const;
// int, and not Tile::Direction because
// we are using a forward declaration for Tile
Tile* findAdjacentTile(Tile *ref, int d);
void focusTile(int d);
void moveTile(int d);
Workspace* m_workspace;
bool tilingEnabled_;
// Each tilingLayout is for one virtual desktop.
// The length is always one more than the number of
// virtual desktops so that we can quickly index them
// without having to remember to subtract one.
QVector<TilingLayout *> tilingLayouts;
};
}
#endif // KWIN_TILING_H