2007-11-27 22:40:25 +03:00
|
|
|
/********************************************************************
|
2007-04-29 21:35:43 +04:00
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
|
|
|
Copyright (C) 1997 to 2002 Cristian Tibirna <tibirna@kde.org>
|
|
|
|
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
|
2007-11-27 22:40:25 +03:00
|
|
|
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/>.
|
|
|
|
*********************************************************************/
|
2007-04-29 21:35:43 +04:00
|
|
|
|
|
|
|
#ifndef KWIN_PLACEMENT_H
|
|
|
|
#define KWIN_PLACEMENT_H
|
2013-04-05 11:41:25 +04:00
|
|
|
// KWin
|
|
|
|
#include <kwinglobals.h>
|
|
|
|
// Qt
|
2007-04-29 21:35:43 +04:00
|
|
|
#include <QPoint>
|
|
|
|
#include <QRect>
|
|
|
|
#include <QList>
|
|
|
|
|
2013-04-05 11:41:25 +04:00
|
|
|
class QObject;
|
|
|
|
|
2007-04-29 21:35:43 +04:00
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2015-05-27 11:22:43 +03:00
|
|
|
class AbstractClient;
|
2007-04-29 21:35:43 +04:00
|
|
|
class Client;
|
|
|
|
|
|
|
|
class Placement
|
2011-01-30 17:34:42 +03:00
|
|
|
{
|
|
|
|
public:
|
2012-11-22 16:06:42 +04:00
|
|
|
virtual ~Placement();
|
2011-01-30 17:34:42 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Placement policies. How workspace decides the way windows get positioned
|
|
|
|
* on the screen. The better the policy, the heavier the resource use.
|
|
|
|
* Normally you don't have to worry. What the WM adds to the startup time
|
|
|
|
* is nil compared to the creation of the window itself in the memory
|
|
|
|
*/
|
|
|
|
enum Policy {
|
|
|
|
NoPlacement, // not really a placement
|
|
|
|
Default, // special, means to use the global default
|
|
|
|
Unknown, // special, means the function should use its default
|
|
|
|
Random,
|
|
|
|
Smart,
|
|
|
|
Cascade,
|
|
|
|
Centered,
|
|
|
|
ZeroCornered,
|
|
|
|
UnderMouse, // special
|
|
|
|
OnMainWindow, // special
|
|
|
|
Maximizing
|
|
|
|
};
|
2007-04-29 21:35:43 +04:00
|
|
|
|
2015-05-27 14:22:50 +03:00
|
|
|
void place(AbstractClient* c, QRect& area);
|
2011-01-30 17:34:42 +03:00
|
|
|
|
2015-05-27 11:34:15 +03:00
|
|
|
void placeAtRandom(AbstractClient* c, const QRect& area, Policy next = Unknown);
|
2015-05-27 14:22:50 +03:00
|
|
|
void placeCascaded(AbstractClient* c, QRect& area, Policy next = Unknown);
|
2015-05-27 11:32:42 +03:00
|
|
|
void placeSmart(AbstractClient* c, const QRect& area, Policy next = Unknown);
|
2015-05-27 14:22:50 +03:00
|
|
|
void placeMaximizing(AbstractClient* c, QRect& area, Policy next = Unknown);
|
2015-05-27 11:28:23 +03:00
|
|
|
void placeCentered(AbstractClient* c, const QRect& area, Policy next = Unknown);
|
2015-05-27 11:25:04 +03:00
|
|
|
void placeZeroCornered(AbstractClient* c, const QRect& area, Policy next = Unknown);
|
2015-05-27 14:22:50 +03:00
|
|
|
void placeDialog(AbstractClient* c, QRect& area, Policy next = Unknown);
|
|
|
|
void placeUtility(AbstractClient* c, QRect& area, Policy next = Unknown);
|
2015-05-27 11:36:59 +03:00
|
|
|
void placeOnScreenDisplay(AbstractClient* c, QRect& area);
|
2011-01-30 17:34:42 +03:00
|
|
|
|
|
|
|
void reinitCascading(int desktop);
|
|
|
|
|
2012-11-22 14:07:33 +04:00
|
|
|
/**
|
|
|
|
* Cascades all clients on the current desktop
|
|
|
|
**/
|
|
|
|
void cascadeDesktop();
|
|
|
|
/**
|
|
|
|
* Unclutters the current desktop by smart-placing all clients again.
|
|
|
|
**/
|
|
|
|
void unclutterDesktop();
|
|
|
|
|
2011-01-30 17:34:42 +03:00
|
|
|
static Policy policyFromString(const QString& policy, bool no_special);
|
|
|
|
static const char* policyToString(Policy policy);
|
2007-04-29 21:35:43 +04:00
|
|
|
|
2011-01-30 17:34:42 +03:00
|
|
|
private:
|
2015-05-27 14:22:50 +03:00
|
|
|
void place(AbstractClient* c, QRect& area, Policy policy, Policy nextPlacement = Unknown);
|
2015-05-27 12:53:51 +03:00
|
|
|
void placeUnderMouse(AbstractClient* c, QRect& area, Policy next = Unknown);
|
2015-05-27 14:22:50 +03:00
|
|
|
void placeOnMainWindow(AbstractClient* c, QRect& area, Policy next = Unknown);
|
2015-05-27 11:22:43 +03:00
|
|
|
QRect checkArea(const AbstractClient*c, const QRect& area);
|
2011-01-30 17:34:42 +03:00
|
|
|
|
|
|
|
//CT needed for cascading+
|
|
|
|
struct DesktopCascadingInfo {
|
|
|
|
QPoint pos;
|
|
|
|
int col;
|
|
|
|
int row;
|
2007-04-29 21:35:43 +04:00
|
|
|
};
|
|
|
|
|
2011-01-30 17:34:42 +03:00
|
|
|
QList<DesktopCascadingInfo> cci;
|
|
|
|
|
2013-04-05 11:41:25 +04:00
|
|
|
KWIN_SINGLETON(Placement)
|
2011-01-30 17:34:42 +03:00
|
|
|
};
|
|
|
|
|
2007-04-29 21:35:43 +04:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|