2007-11-27 19:40:25 +00:00
|
|
|
/********************************************************************
|
2007-04-29 17:35:43 +00: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 19:40:25 +00: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 17:35:43 +00:00
|
|
|
|
|
|
|
#ifndef KWIN_PLACEMENT_H
|
|
|
|
#define KWIN_PLACEMENT_H
|
2013-04-05 07:41:25 +00:00
|
|
|
// KWin
|
|
|
|
#include <kwinglobals.h>
|
|
|
|
// Qt
|
2007-04-29 17:35:43 +00:00
|
|
|
#include <QPoint>
|
|
|
|
#include <QRect>
|
|
|
|
#include <QList>
|
|
|
|
|
2013-04-05 07:41:25 +00:00
|
|
|
class QObject;
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2015-05-27 08:22:43 +00:00
|
|
|
class AbstractClient;
|
2007-04-29 17:35:43 +00:00
|
|
|
class Client;
|
|
|
|
|
2015-10-26 10:30:34 +00:00
|
|
|
class KWIN_EXPORT Placement
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
public:
|
2012-11-22 12:06:42 +00:00
|
|
|
virtual ~Placement();
|
2011-01-30 14:34:42 +00: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
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
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 17:35:43 +00:00
|
|
|
|
2015-05-27 11:22:50 +00:00
|
|
|
void place(AbstractClient* c, QRect& area);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2015-05-27 08:34:15 +00:00
|
|
|
void placeAtRandom(AbstractClient* c, const QRect& area, Policy next = Unknown);
|
2015-05-27 11:22:50 +00:00
|
|
|
void placeCascaded(AbstractClient* c, QRect& area, Policy next = Unknown);
|
2015-05-27 08:32:42 +00:00
|
|
|
void placeSmart(AbstractClient* c, const QRect& area, Policy next = Unknown);
|
2015-05-27 11:22:50 +00:00
|
|
|
void placeMaximizing(AbstractClient* c, QRect& area, Policy next = Unknown);
|
2015-05-27 08:28:23 +00:00
|
|
|
void placeCentered(AbstractClient* c, const QRect& area, Policy next = Unknown);
|
2015-05-27 08:25:04 +00:00
|
|
|
void placeZeroCornered(AbstractClient* c, const QRect& area, Policy next = Unknown);
|
2015-05-27 11:22:50 +00:00
|
|
|
void placeDialog(AbstractClient* c, QRect& area, Policy next = Unknown);
|
|
|
|
void placeUtility(AbstractClient* c, QRect& area, Policy next = Unknown);
|
2015-05-27 08:36:59 +00:00
|
|
|
void placeOnScreenDisplay(AbstractClient* c, QRect& area);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
void reinitCascading(int desktop);
|
|
|
|
|
2012-11-22 10:07:33 +00:00
|
|
|
/**
|
|
|
|
* Cascades all clients on the current desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-22 10:07:33 +00:00
|
|
|
void cascadeDesktop();
|
|
|
|
/**
|
|
|
|
* Unclutters the current desktop by smart-placing all clients again.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-11-22 10:07:33 +00:00
|
|
|
void unclutterDesktop();
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
static Policy policyFromString(const QString& policy, bool no_special);
|
|
|
|
static const char* policyToString(Policy policy);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
private:
|
2015-05-27 11:22:50 +00:00
|
|
|
void place(AbstractClient* c, QRect& area, Policy policy, Policy nextPlacement = Unknown);
|
2015-05-27 09:53:51 +00:00
|
|
|
void placeUnderMouse(AbstractClient* c, QRect& area, Policy next = Unknown);
|
2015-05-27 11:22:50 +00:00
|
|
|
void placeOnMainWindow(AbstractClient* c, QRect& area, Policy next = Unknown);
|
2015-09-11 11:31:41 +00:00
|
|
|
void placeTransient(AbstractClient *c);
|
2015-05-27 08:22:43 +00:00
|
|
|
QRect checkArea(const AbstractClient*c, const QRect& area);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
|
|
|
//CT needed for cascading+
|
|
|
|
struct DesktopCascadingInfo {
|
|
|
|
QPoint pos;
|
|
|
|
int col;
|
|
|
|
int row;
|
2007-04-29 17:35:43 +00:00
|
|
|
};
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
QList<DesktopCascadingInfo> cci;
|
|
|
|
|
2013-04-05 07:41:25 +00:00
|
|
|
KWIN_SINGLETON(Placement)
|
2011-01-30 14:34:42 +00:00
|
|
|
};
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|