2015-03-05 09:21:03 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
|
|
|
|
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_ABSTRACT_CLIENT_H
|
|
|
|
#define KWIN_ABSTRACT_CLIENT_H
|
|
|
|
|
|
|
|
#include "toplevel.h"
|
2015-03-06 09:05:40 +00:00
|
|
|
#include "options.h"
|
2015-03-12 14:35:36 +00:00
|
|
|
#include "rules.h"
|
2015-10-15 11:39:49 +00:00
|
|
|
#include "tabgroup.h"
|
2015-03-05 09:21:03 +00:00
|
|
|
|
2015-04-29 10:02:54 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2015-07-09 07:10:33 +00:00
|
|
|
namespace KWayland
|
|
|
|
{
|
|
|
|
namespace Server
|
|
|
|
{
|
|
|
|
class PlasmaWindowInterface;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-05 09:21:03 +00:00
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
namespace TabBox
|
|
|
|
{
|
|
|
|
class TabBoxClientImpl;
|
|
|
|
}
|
|
|
|
|
2015-04-29 10:02:54 +00:00
|
|
|
namespace Decoration
|
|
|
|
{
|
|
|
|
class DecorationPalette;
|
|
|
|
}
|
|
|
|
|
2015-10-14 07:58:16 +00:00
|
|
|
class KWIN_EXPORT AbstractClient : public Toplevel
|
2015-03-05 09:21:03 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2015-05-21 13:59:27 +00:00
|
|
|
/**
|
|
|
|
* Whether this Client is fullScreen. A Client might either be fullScreen due to the _NET_WM property
|
|
|
|
* or through a legacy support hack. The fullScreen state can only be changed if the Client does not
|
|
|
|
* use the legacy hack. To be sure whether the state changed, connect to the notify signal.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool fullScreen READ isFullScreen WRITE setFullScreen NOTIFY fullScreenChanged)
|
|
|
|
/**
|
|
|
|
* Whether the Client can be set to fullScreen. The property is evaluated each time it is invoked.
|
|
|
|
* Because of that there is no notify signal.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool fullScreenable READ isFullScreenable)
|
2015-03-12 09:43:46 +00:00
|
|
|
/**
|
|
|
|
* Whether this Client is the currently visible Client in its Client Group (Window Tabs).
|
|
|
|
* For change connect to the visibleChanged signal on the Client's Group.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool isCurrentTab READ isCurrentTab)
|
2015-03-12 15:08:19 +00:00
|
|
|
/**
|
|
|
|
* Whether this Client is active or not. Use Workspace::activateClient() to activate a Client.
|
|
|
|
* @see Workspace::activateClient
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool active READ isActive NOTIFY activeChanged)
|
2015-03-13 11:54:11 +00:00
|
|
|
/**
|
|
|
|
* The desktop this Client is on. If the Client is on all desktops the property has value -1.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(int desktop READ desktop WRITE setDesktop NOTIFY desktopChanged)
|
|
|
|
/**
|
|
|
|
* Whether the Client is on all desktops. That is desktop is -1.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool onAllDesktops READ isOnAllDesktops WRITE setOnAllDesktops NOTIFY desktopChanged)
|
2015-06-06 20:08:12 +00:00
|
|
|
/**
|
|
|
|
* Indicates that the window should not be included on a taskbar.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool skipTaskbar READ skipTaskbar WRITE setSkipTaskbar NOTIFY skipTaskbarChanged)
|
2015-06-06 19:17:23 +00:00
|
|
|
/**
|
|
|
|
* Indicates that the window should not be included on a Pager.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool skipPager READ skipPager WRITE setSkipPager NOTIFY skipPagerChanged)
|
2015-03-12 14:35:36 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client should be excluded from window switching effects.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool skipSwitcher READ skipSwitcher WRITE setSkipSwitcher NOTIFY skipSwitcherChanged)
|
2015-03-12 14:37:48 +00:00
|
|
|
/**
|
|
|
|
* Whether the window can be closed by the user. The value is evaluated each time the getter is called.
|
|
|
|
* Because of that no changed signal is provided.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool closeable READ isCloseable)
|
2015-03-12 14:44:39 +00:00
|
|
|
Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged)
|
2015-03-13 08:36:43 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client is set to be kept above other windows.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool keepAbove READ keepAbove WRITE setKeepAbove NOTIFY keepAboveChanged)
|
|
|
|
/**
|
|
|
|
* Whether the Client is set to be kept below other windows.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool keepBelow READ keepBelow WRITE setKeepBelow NOTIFY keepBelowChanged)
|
2015-03-13 12:39:53 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client can be shaded. The property is evaluated each time it is invoked.
|
|
|
|
* Because of that there is no notify signal.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool shadeable READ isShadeable)
|
|
|
|
/**
|
|
|
|
* Whether the Client is shaded.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool shade READ isShade WRITE setShade NOTIFY shadeChanged)
|
2015-03-13 13:45:21 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client can be minimized. The property is evaluated each time it is invoked.
|
|
|
|
* Because of that there is no notify signal.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool minimizable READ isMinimizable)
|
|
|
|
/**
|
|
|
|
* Whether the Client is minimized.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool minimized READ isMinimized WRITE setMinimized NOTIFY minimizedChanged)
|
2015-03-13 09:33:31 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is any of special windows types (desktop, dock, splash, ...),
|
|
|
|
* i.e. window types that usually don't have a window frame and the user does not use window
|
|
|
|
* management (moving, raising,...) on them.
|
|
|
|
* The value is evaluated each time the getter is called.
|
|
|
|
* Because of that no changed signal is provided.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool specialWindow READ isSpecialWindow)
|
2015-03-13 10:19:46 +00:00
|
|
|
/**
|
|
|
|
* Whether window state _NET_WM_STATE_DEMANDS_ATTENTION is set. This state indicates that some
|
|
|
|
* action in or with the window happened. For example, it may be set by the Window Manager if
|
|
|
|
* the window requested activation but the Window Manager refused it, or the application may set
|
|
|
|
* it if it finished some work. This state may be set by both the Client and the Window Manager.
|
|
|
|
* It should be unset by the Window Manager when it decides the window got the required attention
|
|
|
|
* (usually, that it got activated).
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool demandsAttention READ isDemandingAttention WRITE demandAttention NOTIFY demandsAttentionChanged)
|
2015-05-20 12:39:40 +00:00
|
|
|
/**
|
|
|
|
* The Caption of the Client. Read from WM_NAME property together with a suffix for hostname and shortcut.
|
|
|
|
* To read only the caption as provided by WM_NAME, use the getter with an additional @c false value.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(QString caption READ caption NOTIFY captionChanged)
|
2015-05-27 11:21:56 +00:00
|
|
|
/**
|
|
|
|
* Minimum size as specified in WM_NORMAL_HINTS
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(QSize minSize READ minSize)
|
|
|
|
/**
|
|
|
|
* Maximum size as specified in WM_NORMAL_HINTS
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(QSize maxSize READ maxSize)
|
2015-07-22 06:42:48 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client can accept keyboard focus.
|
|
|
|
* The value is evaluated each time the getter is called.
|
|
|
|
* Because of that no changed signal is provided.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool wantsInput READ wantsInput)
|
2015-09-11 08:57:00 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client is a transient Window to another Window.
|
|
|
|
* @see transientFor
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool transient READ isTransient NOTIFY transientChanged)
|
2015-09-11 09:37:40 +00:00
|
|
|
/**
|
|
|
|
* The Client to which this Client is a transient if any.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(KWin::AbstractClient *transientFor READ transientFor NOTIFY transientChanged)
|
2015-09-14 07:04:20 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client represents a modal window.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool modal READ isModal NOTIFY modalChanged)
|
2015-10-13 08:52:01 +00:00
|
|
|
/**
|
|
|
|
* The geometry of this Client. Be aware that depending on resize mode the geometryChanged signal
|
|
|
|
* might be emitted at each resize step or only at the end of the resize operation.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(QRect geometry READ geometry WRITE setGeometry)
|
2015-03-05 09:21:03 +00:00
|
|
|
public:
|
|
|
|
virtual ~AbstractClient();
|
|
|
|
|
2015-03-12 14:21:07 +00:00
|
|
|
QWeakPointer<TabBox::TabBoxClientImpl> tabBoxClient() const {
|
|
|
|
return m_tabBoxClient.toWeakRef();
|
|
|
|
}
|
2015-03-12 14:25:05 +00:00
|
|
|
bool isFirstInTabBox() const {
|
|
|
|
return m_firstInTabBox;
|
|
|
|
}
|
2015-03-12 14:35:36 +00:00
|
|
|
bool skipSwitcher() const {
|
|
|
|
return m_skipSwitcher;
|
|
|
|
}
|
|
|
|
void setSkipSwitcher(bool set);
|
2015-03-12 14:21:07 +00:00
|
|
|
|
2015-06-06 20:08:12 +00:00
|
|
|
bool skipTaskbar() const {
|
|
|
|
return m_skipTaskbar;
|
|
|
|
}
|
|
|
|
void setSkipTaskbar(bool set);
|
|
|
|
void setOriginalSkipTaskbar(bool set);
|
|
|
|
bool originalSkipTaskbar() const {
|
|
|
|
return m_originalSkipTaskbar;
|
|
|
|
}
|
|
|
|
|
2015-06-06 19:17:23 +00:00
|
|
|
bool skipPager() const {
|
|
|
|
return m_skipPager;
|
|
|
|
}
|
|
|
|
void setSkipPager(bool set);
|
|
|
|
|
2015-03-12 14:44:39 +00:00
|
|
|
const QIcon &icon() const {
|
|
|
|
return m_icon;
|
|
|
|
}
|
|
|
|
|
2015-03-12 15:08:19 +00:00
|
|
|
bool isActive() const {
|
|
|
|
return m_active;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Sets the client's active state to \a act.
|
|
|
|
*
|
|
|
|
* This function does only change the visual appearance of the client,
|
|
|
|
* it does not change the focus setting. Use
|
|
|
|
* Workspace::activateClient() or Workspace::requestFocus() instead.
|
|
|
|
*
|
|
|
|
* If a client receives or looses the focus, it calls setActive() on
|
|
|
|
* its own.
|
|
|
|
**/
|
|
|
|
void setActive(bool);
|
|
|
|
|
2015-03-13 08:36:43 +00:00
|
|
|
bool keepAbove() const {
|
|
|
|
return m_keepAbove;
|
|
|
|
}
|
|
|
|
void setKeepAbove(bool);
|
|
|
|
bool keepBelow() const {
|
|
|
|
return m_keepBelow;
|
|
|
|
}
|
|
|
|
void setKeepBelow(bool);
|
|
|
|
|
2015-03-13 10:19:46 +00:00
|
|
|
void demandAttention(bool set = true);
|
|
|
|
bool isDemandingAttention() const {
|
|
|
|
return m_demandsAttention;
|
|
|
|
}
|
|
|
|
|
2015-03-13 09:26:10 +00:00
|
|
|
void cancelAutoRaise();
|
|
|
|
|
2015-03-13 09:31:35 +00:00
|
|
|
bool wantsTabFocus() const;
|
|
|
|
|
2015-03-05 09:21:03 +00:00
|
|
|
virtual void updateMouseGrab();
|
|
|
|
virtual QString caption(bool full = true, bool stripped = false) const = 0;
|
|
|
|
virtual bool isCloseable() const = 0;
|
|
|
|
// TODO: remove boolean trap
|
|
|
|
virtual bool isShown(bool shaded_is_shown) const = 0;
|
2015-05-23 07:02:11 +00:00
|
|
|
// TODO: remove boolean trap
|
|
|
|
virtual void hideClient(bool hide) = 0;
|
2015-05-21 13:59:27 +00:00
|
|
|
virtual bool isFullScreenable() const = 0;
|
2015-03-05 09:21:03 +00:00
|
|
|
virtual bool isFullScreen() const = 0;
|
2015-03-05 12:59:18 +00:00
|
|
|
// TODO: remove boolean trap
|
|
|
|
virtual AbstractClient *findModal(bool allow_itself = false) = 0;
|
2015-03-05 12:35:54 +00:00
|
|
|
virtual bool isTransient() const;
|
2015-09-11 11:31:41 +00:00
|
|
|
/**
|
|
|
|
* @returns Whether there is a hint available to place the AbstractClient on it's parent, default @c false.
|
|
|
|
* @see transientPlacementHint
|
|
|
|
**/
|
|
|
|
virtual bool hasTransientPlacementHint() const;
|
|
|
|
/**
|
|
|
|
* @returns The recommended position of the transient in parent coordinates
|
|
|
|
**/
|
|
|
|
virtual QPoint transientPlacementHint() const;
|
2015-09-11 09:37:40 +00:00
|
|
|
const AbstractClient* transientFor() const;
|
|
|
|
AbstractClient* transientFor();
|
2015-09-11 12:14:21 +00:00
|
|
|
/**
|
|
|
|
* @returns @c true if c is the transient_for window for this client,
|
|
|
|
* or recursively the transient_for window
|
|
|
|
* @todo: remove boolean trap
|
|
|
|
**/
|
|
|
|
virtual bool hasTransient(const AbstractClient* c, bool indirect) const;
|
2015-09-14 08:55:27 +00:00
|
|
|
const QList<AbstractClient*>& transients() const; // Is not indirect
|
2015-09-14 09:27:56 +00:00
|
|
|
virtual void removeTransient(AbstractClient* cl);
|
2015-09-11 13:55:23 +00:00
|
|
|
virtual QList<AbstractClient*> mainClients() const; // Call once before loop , is not indirect
|
|
|
|
QList<AbstractClient*> allMainClients() const; // Call once before loop , is indirect
|
2015-03-05 12:35:54 +00:00
|
|
|
/**
|
|
|
|
* Returns true for "special" windows and false for windows which are "normal"
|
|
|
|
* (normal=window which has a border, can be moved by the user, can be closed, etc.)
|
|
|
|
* true for Desktop, Dock, Splash, Override and TopMenu (and Toolbar??? - for now)
|
|
|
|
* false for Normal, Dialog, Utility and Menu (and Toolbar??? - not yet) TODO
|
|
|
|
*/
|
2015-03-13 09:33:31 +00:00
|
|
|
bool isSpecialWindow() const;
|
2015-10-14 11:37:46 +00:00
|
|
|
void sendToScreen(int screen);
|
2015-03-06 08:03:08 +00:00
|
|
|
virtual const QKeySequence &shortcut() const = 0;
|
|
|
|
virtual void setShortcut(const QString &cut) = 0;
|
2015-07-09 14:08:01 +00:00
|
|
|
virtual bool performMouseCommand(Options::MouseCommand, const QPoint &globalPos);
|
2015-03-13 11:54:11 +00:00
|
|
|
void setOnAllDesktops(bool set);
|
|
|
|
void setDesktop(int);
|
|
|
|
int desktop() const override {
|
|
|
|
return m_desktop;
|
|
|
|
}
|
2015-03-13 13:45:21 +00:00
|
|
|
void setMinimized(bool set);
|
|
|
|
/**
|
|
|
|
* Minimizes this client plus its transients
|
|
|
|
*/
|
|
|
|
void minimize(bool avoid_animation = false);
|
|
|
|
void unminimize(bool avoid_animation = false);
|
|
|
|
bool isMinimized() const {
|
|
|
|
return m_minimized;
|
|
|
|
}
|
2015-03-06 09:05:40 +00:00
|
|
|
virtual void setFullScreen(bool set, bool user = true) = 0;
|
|
|
|
virtual TabGroup *tabGroup() const;
|
|
|
|
Q_INVOKABLE virtual bool untab(const QRect &toGeometry = QRect(), bool clientRemoved = false);
|
2015-03-12 09:43:46 +00:00
|
|
|
virtual bool isCurrentTab() const;
|
2015-10-12 08:17:38 +00:00
|
|
|
virtual QRect geometryRestore() const = 0;
|
2015-03-06 09:05:40 +00:00
|
|
|
virtual MaximizeMode maximizeMode() const = 0;
|
2015-10-13 08:22:18 +00:00
|
|
|
void maximize(MaximizeMode);
|
|
|
|
void setMaximize(bool vertically, bool horizontally);
|
2015-03-06 09:05:40 +00:00
|
|
|
virtual bool noBorder() const = 0;
|
|
|
|
virtual void setNoBorder(bool set) = 0;
|
2015-03-06 10:33:51 +00:00
|
|
|
virtual void blockActivityUpdates(bool b = true) = 0;
|
2015-04-29 10:02:54 +00:00
|
|
|
QPalette palette() const;
|
|
|
|
const Decoration::DecorationPalette *decorationPalette() const;
|
2015-10-13 09:17:06 +00:00
|
|
|
virtual bool isDecorated() const;
|
2015-03-06 10:33:51 +00:00
|
|
|
virtual bool isResizable() const = 0;
|
|
|
|
virtual bool isMovable() const = 0;
|
|
|
|
virtual bool isMovableAcrossScreens() const = 0;
|
2015-03-13 12:39:53 +00:00
|
|
|
/**
|
|
|
|
* @c true only for @c ShadeNormal
|
|
|
|
**/
|
|
|
|
bool isShade() const {
|
|
|
|
return shadeMode() == ShadeNormal;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Default implementation returns @c ShadeNone
|
|
|
|
**/
|
|
|
|
virtual ShadeMode shadeMode() const; // Prefer isShade()
|
|
|
|
void setShade(bool set);
|
|
|
|
/**
|
|
|
|
* Default implementation does nothing
|
|
|
|
**/
|
|
|
|
virtual void setShade(ShadeMode mode);
|
|
|
|
/**
|
|
|
|
* Whether the Client can be shaded. Default implementation returns @c false.
|
|
|
|
**/
|
|
|
|
virtual bool isShadeable() const;
|
2015-03-06 10:33:51 +00:00
|
|
|
virtual bool isMaximizable() const = 0;
|
|
|
|
virtual bool isMinimizable() const = 0;
|
|
|
|
virtual bool userCanSetFullScreen() const = 0;
|
|
|
|
virtual bool userCanSetNoBorder() const = 0;
|
|
|
|
virtual void setOnAllActivities(bool set) = 0;
|
2015-03-06 11:38:07 +00:00
|
|
|
virtual const WindowRules* rules() const = 0;
|
2015-03-06 14:04:59 +00:00
|
|
|
virtual void takeFocus() = 0;
|
|
|
|
virtual bool wantsInput() const = 0;
|
2015-10-13 08:59:51 +00:00
|
|
|
void checkWorkspacePosition(QRect oldGeometry = QRect(), int oldDesktop = -2, QRect oldClientGeometry = QRect());
|
2015-03-12 10:24:27 +00:00
|
|
|
virtual xcb_timestamp_t userTime() const;
|
2015-03-12 14:35:36 +00:00
|
|
|
virtual void updateWindowRules(Rules::Types selection) = 0;
|
2015-03-05 09:21:03 +00:00
|
|
|
|
2015-03-12 09:24:38 +00:00
|
|
|
virtual void growHorizontal();
|
|
|
|
virtual void shrinkHorizontal();
|
|
|
|
virtual void growVertical();
|
|
|
|
virtual void shrinkVertical();
|
2015-06-05 03:06:20 +00:00
|
|
|
virtual void updateMoveResize(const QPointF ¤tGlobalCursor);
|
2015-03-12 09:24:38 +00:00
|
|
|
|
2015-03-12 09:38:20 +00:00
|
|
|
/**
|
|
|
|
* These values represent positions inside an area
|
|
|
|
*/
|
|
|
|
enum Position {
|
|
|
|
// without prefix, they'd conflict with Qt::TopLeftCorner etc. :(
|
|
|
|
PositionCenter = 0x00,
|
|
|
|
PositionLeft = 0x01,
|
|
|
|
PositionRight = 0x02,
|
|
|
|
PositionTop = 0x04,
|
|
|
|
PositionBottom = 0x08,
|
|
|
|
PositionTopLeft = PositionLeft | PositionTop,
|
|
|
|
PositionTopRight = PositionRight | PositionTop,
|
|
|
|
PositionBottomLeft = PositionLeft | PositionBottom,
|
|
|
|
PositionBottomRight = PositionRight | PositionBottom
|
|
|
|
};
|
2015-03-13 12:54:30 +00:00
|
|
|
Position titlebarPosition() const;
|
2015-03-12 09:38:20 +00:00
|
|
|
|
2015-03-12 10:02:09 +00:00
|
|
|
// a helper for the workspace window packing. tests for screen validity and updates since in maximization case as with normal moving
|
|
|
|
virtual void packTo(int left, int top);
|
|
|
|
|
2015-03-12 10:14:44 +00:00
|
|
|
enum QuickTileFlag {
|
|
|
|
QuickTileNone = 0,
|
|
|
|
QuickTileLeft = 1,
|
|
|
|
QuickTileRight = 1<<1,
|
|
|
|
QuickTileTop = 1<<2,
|
|
|
|
QuickTileBottom = 1<<3,
|
|
|
|
QuickTileHorizontal = QuickTileLeft|QuickTileRight,
|
|
|
|
QuickTileVertical = QuickTileTop|QuickTileBottom,
|
|
|
|
QuickTileMaximize = QuickTileLeft|QuickTileRight|QuickTileTop|QuickTileBottom
|
|
|
|
};
|
|
|
|
Q_DECLARE_FLAGS(QuickTileMode, QuickTileFlag)
|
|
|
|
/** Set the quick tile mode ("snap") of this window.
|
|
|
|
* This will also handle preserving and restoring of window geometry as necessary.
|
|
|
|
* @param mode The tile mode (left/right) to give this window.
|
|
|
|
*/
|
2015-10-13 14:08:57 +00:00
|
|
|
void setQuickTileMode(QuickTileMode mode, bool keyboard = false);
|
|
|
|
QuickTileMode quickTileMode() const {
|
|
|
|
return QuickTileMode(m_quickTileMode);
|
|
|
|
}
|
2015-09-17 09:06:59 +00:00
|
|
|
Layer layer() const override;
|
|
|
|
void updateLayer();
|
2015-03-12 10:14:44 +00:00
|
|
|
|
2015-05-27 08:16:46 +00:00
|
|
|
enum ForceGeometry_t { NormalGeometrySet, ForceGeometrySet };
|
2015-10-15 13:28:01 +00:00
|
|
|
void move(int x, int y, ForceGeometry_t force = NormalGeometrySet);
|
2015-05-27 08:16:46 +00:00
|
|
|
void move(const QPoint &p, ForceGeometry_t force = NormalGeometrySet);
|
2015-05-27 09:48:33 +00:00
|
|
|
virtual void resizeWithChecks(int w, int h, ForceGeometry_t force = NormalGeometrySet) = 0;
|
|
|
|
void resizeWithChecks(const QSize& s, ForceGeometry_t force = NormalGeometrySet);
|
2015-05-27 09:51:45 +00:00
|
|
|
void keepInArea(QRect area, bool partial = false);
|
2015-05-27 11:21:56 +00:00
|
|
|
virtual QSize minSize() const;
|
|
|
|
virtual QSize maxSize() const;
|
2015-10-13 08:52:01 +00:00
|
|
|
virtual void setGeometry(int x, int y, int w, int h, ForceGeometry_t force = NormalGeometrySet) = 0;
|
|
|
|
void setGeometry(const QRect& r, ForceGeometry_t force = NormalGeometrySet);
|
2015-10-13 07:44:50 +00:00
|
|
|
/// How to resize the window in order to obey constains (mainly aspect ratios)
|
|
|
|
enum Sizemode {
|
|
|
|
SizemodeAny,
|
|
|
|
SizemodeFixedW, ///< Try not to affect width
|
|
|
|
SizemodeFixedH, ///< Try not to affect height
|
|
|
|
SizemodeMax ///< Try not to make it larger in either direction
|
|
|
|
};
|
2015-10-13 07:49:31 +00:00
|
|
|
/**
|
|
|
|
*Calculate the appropriate frame size for the given client size @p wsize.
|
|
|
|
*
|
|
|
|
* @p wsize is adapted according to the window's size hints (minimum, maximum and incremental size changes).
|
|
|
|
*
|
|
|
|
* Default implementation returns the passed in @p wsize.
|
|
|
|
*/
|
|
|
|
virtual QSize sizeForClientSize(const QSize &wsize, Sizemode mode = SizemodeAny, bool noframe = false) const;
|
2015-06-19 22:14:15 +00:00
|
|
|
|
2015-10-13 07:51:40 +00:00
|
|
|
QSize adjustedSize(const QSize&, Sizemode mode = SizemodeAny) const;
|
|
|
|
QSize adjustedSize() const;
|
|
|
|
|
2015-06-19 22:14:15 +00:00
|
|
|
virtual bool hasStrut() const;
|
2015-05-27 08:16:46 +00:00
|
|
|
|
2015-09-14 07:04:20 +00:00
|
|
|
void setModal(bool modal);
|
|
|
|
bool isModal() const;
|
|
|
|
|
2015-07-09 14:11:51 +00:00
|
|
|
/**
|
|
|
|
* Determines the mouse command for the given @p button in the current state.
|
|
|
|
*
|
|
|
|
* The @p handled argument specifies whether the button was handled or not.
|
|
|
|
* This value should be used to determine whether the mouse button should be
|
|
|
|
* passed to the AbstractClient or being filtered out.
|
|
|
|
**/
|
|
|
|
Options::MouseCommand getMouseCommand(Qt::MouseButton button, bool *handled) const;
|
|
|
|
Options::MouseCommand getWheelCommand(Qt::Orientation orientation, bool *handled) const;
|
|
|
|
|
2015-03-05 09:21:03 +00:00
|
|
|
// TODO: remove boolean trap
|
|
|
|
static bool belongToSameApplication(const AbstractClient* c1, const AbstractClient* c2, bool active_hack = false);
|
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
virtual void closeWindow() = 0;
|
|
|
|
|
2015-03-12 14:35:36 +00:00
|
|
|
Q_SIGNALS:
|
2015-05-21 13:59:27 +00:00
|
|
|
void fullScreenChanged();
|
2015-06-06 20:08:12 +00:00
|
|
|
void skipTaskbarChanged();
|
2015-06-06 19:17:23 +00:00
|
|
|
void skipPagerChanged();
|
2015-03-12 14:35:36 +00:00
|
|
|
void skipSwitcherChanged();
|
2015-03-12 14:44:39 +00:00
|
|
|
void iconChanged();
|
2015-03-12 15:08:19 +00:00
|
|
|
void activeChanged();
|
2015-03-13 08:36:43 +00:00
|
|
|
void keepAboveChanged(bool);
|
|
|
|
void keepBelowChanged(bool);
|
2015-03-13 10:19:46 +00:00
|
|
|
/**
|
|
|
|
* Emitted whenever the demands attention state changes.
|
|
|
|
**/
|
|
|
|
void demandsAttentionChanged();
|
2015-03-13 10:48:08 +00:00
|
|
|
void desktopPresenceChanged(KWin::AbstractClient*, int); // to be forwarded by Workspace
|
2015-03-13 11:54:11 +00:00
|
|
|
void desktopChanged();
|
2015-03-13 12:39:53 +00:00
|
|
|
void shadeChanged();
|
2015-03-13 13:45:21 +00:00
|
|
|
void minimizedChanged();
|
|
|
|
void clientMinimized(KWin::AbstractClient* client, bool animate);
|
|
|
|
void clientUnminimized(KWin::AbstractClient* client, bool animate);
|
2015-04-29 10:02:54 +00:00
|
|
|
void paletteChanged(const QPalette &p);
|
2015-05-20 12:39:40 +00:00
|
|
|
void captionChanged();
|
2015-06-07 01:17:34 +00:00
|
|
|
void clientMaximizedStateChanged(KWin::AbstractClient*, MaximizeMode);
|
|
|
|
void clientMaximizedStateChanged(KWin::AbstractClient* c, bool h, bool v);
|
2015-09-11 08:57:00 +00:00
|
|
|
void transientChanged();
|
2015-09-14 07:04:20 +00:00
|
|
|
void modalChanged();
|
2015-10-12 07:38:42 +00:00
|
|
|
void quickTileModeChanged();
|
2015-03-12 14:35:36 +00:00
|
|
|
|
2015-03-05 09:21:03 +00:00
|
|
|
protected:
|
|
|
|
AbstractClient();
|
2015-03-12 14:25:05 +00:00
|
|
|
void setFirstInTabBox(bool enable) {
|
|
|
|
m_firstInTabBox = enable;
|
|
|
|
}
|
2015-03-12 14:44:39 +00:00
|
|
|
void setIcon(const QIcon &icon);
|
2015-03-13 09:26:10 +00:00
|
|
|
void startAutoRaise();
|
|
|
|
void autoRaise();
|
2015-03-12 15:08:19 +00:00
|
|
|
/**
|
|
|
|
* Called from ::setActive once the active value got updated, but before the changed signal
|
|
|
|
* is emitted.
|
|
|
|
*
|
|
|
|
* Default implementation does nothing.
|
|
|
|
**/
|
|
|
|
virtual void doSetActive();
|
2015-03-13 08:36:43 +00:00
|
|
|
/**
|
|
|
|
* Called from ::setKeepAbove once the keepBelow value got updated, but before the changed signal
|
|
|
|
* is emitted.
|
|
|
|
*
|
|
|
|
* Default implementation does nothing.
|
|
|
|
**/
|
|
|
|
virtual void doSetKeepAbove();
|
|
|
|
/**
|
|
|
|
* Called from ::setKeepBelow once the keepBelow value got updated, but before the changed signal
|
|
|
|
* is emitted.
|
|
|
|
*
|
|
|
|
* Default implementation does nothing.
|
|
|
|
**/
|
|
|
|
virtual void doSetKeepBelow();
|
2015-03-13 11:54:11 +00:00
|
|
|
/**
|
|
|
|
* Called from ::setDeskop once the desktop value got updated, but before the changed signal
|
|
|
|
* is emitted.
|
|
|
|
*
|
|
|
|
* Default implementation does nothing.
|
|
|
|
* @param desktop The new desktop the Client is on
|
|
|
|
* @param was_desk The desktop the Client was on before
|
|
|
|
**/
|
|
|
|
virtual void doSetDesktop(int desktop, int was_desk);
|
2015-03-13 13:45:21 +00:00
|
|
|
/**
|
|
|
|
* Called from ::minimize and ::unminimize once the minimized value got updated, but before the
|
|
|
|
* changed signal is emitted.
|
|
|
|
*
|
|
|
|
* Default implementation does nothig.
|
|
|
|
**/
|
|
|
|
virtual void doMinimize();
|
2015-03-05 09:21:03 +00:00
|
|
|
// TODO: remove boolean trap
|
|
|
|
virtual bool belongsToSameApplication(const AbstractClient *other, bool active_hack) const = 0;
|
2015-03-12 14:21:07 +00:00
|
|
|
|
2015-06-06 20:08:12 +00:00
|
|
|
virtual void doSetSkipTaskbar();
|
2015-06-06 19:17:23 +00:00
|
|
|
virtual void doSetSkipPager();
|
|
|
|
|
2015-07-09 07:10:33 +00:00
|
|
|
void setupWindowManagementInterface();
|
|
|
|
void destroyWindowManagementInterface();
|
|
|
|
|
2015-04-29 10:02:54 +00:00
|
|
|
void updateColorScheme(QString path);
|
|
|
|
|
2015-09-11 09:37:40 +00:00
|
|
|
void setTransientFor(AbstractClient *transientFor);
|
2015-09-14 08:55:27 +00:00
|
|
|
virtual void addTransient(AbstractClient* cl);
|
|
|
|
/**
|
|
|
|
* Just removes the @p cl from the transients without any further checks.
|
|
|
|
**/
|
|
|
|
void removeTransientFromList(AbstractClient* cl);
|
2015-09-11 09:37:40 +00:00
|
|
|
|
2015-09-17 09:06:59 +00:00
|
|
|
Layer belongsToLayer() const;
|
|
|
|
virtual bool belongsToDesktop() const;
|
|
|
|
void invalidateLayer();
|
|
|
|
virtual bool isActiveFullScreen() const;
|
|
|
|
virtual Layer layerForDock() const;
|
2015-09-14 10:04:23 +00:00
|
|
|
|
2015-10-12 07:56:54 +00:00
|
|
|
// electric border / quick tiling
|
|
|
|
void setElectricBorderMode(QuickTileMode mode);
|
|
|
|
QuickTileMode electricBorderMode() const {
|
|
|
|
return m_electricMode;
|
|
|
|
}
|
2015-10-12 08:12:07 +00:00
|
|
|
void setElectricBorderMaximizing(bool maximizing);
|
|
|
|
bool isElectricBorderMaximizing() const {
|
|
|
|
return m_electricMaximizing;
|
|
|
|
}
|
2015-10-12 08:21:01 +00:00
|
|
|
QRect electricBorderMaximizeGeometry(QPoint pos, int desktop);
|
2015-10-13 14:08:57 +00:00
|
|
|
void updateQuickTileMode(QuickTileMode newMode) {
|
|
|
|
m_quickTileMode = newMode;
|
|
|
|
}
|
2015-10-12 07:56:54 +00:00
|
|
|
|
2015-10-12 08:50:20 +00:00
|
|
|
// geometry handling
|
|
|
|
void checkOffscreenPosition(QRect *geom, const QRect &screenArea);
|
2015-10-12 10:00:33 +00:00
|
|
|
virtual int borderLeft() const;
|
|
|
|
virtual int borderRight() const;
|
|
|
|
virtual int borderTop() const;
|
|
|
|
virtual int borderBottom() const;
|
2015-10-13 08:22:18 +00:00
|
|
|
virtual void changeMaximize(bool horizontal, bool vertical, bool adjust) = 0;
|
2015-10-13 11:52:03 +00:00
|
|
|
virtual void setGeometryRestore(const QRect &geo) = 0;
|
2015-10-15 13:28:01 +00:00
|
|
|
/**
|
|
|
|
* Called from move after updating the geometry. Can be reimplemented to perform specific tasks.
|
|
|
|
* The base implementation does nothing.
|
|
|
|
**/
|
|
|
|
virtual void doMove(int x, int y);
|
2015-10-13 11:15:39 +00:00
|
|
|
void blockGeometryUpdates(bool block);
|
|
|
|
void blockGeometryUpdates();
|
|
|
|
void unblockGeometryUpdates();
|
|
|
|
bool areGeometryUpdatesBlocked() const;
|
|
|
|
enum PendingGeometry_t {
|
|
|
|
PendingGeometryNone,
|
|
|
|
PendingGeometryNormal,
|
|
|
|
PendingGeometryForced
|
|
|
|
};
|
|
|
|
PendingGeometry_t pendingGeometryUpdate() const;
|
|
|
|
void setPendingGeometryUpdate(PendingGeometry_t update);
|
2015-10-15 11:11:21 +00:00
|
|
|
QRect geometryBeforeUpdateBlocking() const {
|
|
|
|
return m_geometryBeforeUpdateBlocking;
|
|
|
|
}
|
|
|
|
void updateGeometryBeforeUpdateBlocking();
|
2015-10-15 10:50:28 +00:00
|
|
|
/**
|
|
|
|
* Schedules a repaint for the visibleRect before and after a
|
|
|
|
* geometry update. The current visibleRect is stored for the
|
|
|
|
* next time this method is called as the before geometry.
|
|
|
|
**/
|
|
|
|
void addRepaintDuringGeometryUpdates();
|
2015-10-12 08:50:20 +00:00
|
|
|
|
2015-10-15 11:39:49 +00:00
|
|
|
/**
|
|
|
|
* Convenient method to update the TabGroup states if there is one present.
|
|
|
|
* Marked as virtual as TabGroup does not yet handle AbstractClient, but only
|
|
|
|
* subclasses of AbstractClient. Given that the default implementation does nothing.
|
|
|
|
**/
|
|
|
|
virtual void updateTabGroupStates(TabGroup::States states);
|
|
|
|
|
2015-03-12 14:21:07 +00:00
|
|
|
private:
|
2015-04-29 10:02:54 +00:00
|
|
|
void handlePaletteChange();
|
2015-03-12 14:21:07 +00:00
|
|
|
QSharedPointer<TabBox::TabBoxClientImpl> m_tabBoxClient;
|
2015-03-12 14:25:05 +00:00
|
|
|
bool m_firstInTabBox = false;
|
2015-06-06 20:08:12 +00:00
|
|
|
bool m_skipTaskbar = false;
|
|
|
|
/**
|
|
|
|
* Unaffected by KWin
|
|
|
|
**/
|
|
|
|
bool m_originalSkipTaskbar = false;
|
2015-06-06 19:17:23 +00:00
|
|
|
bool m_skipPager = false;
|
2015-03-12 14:35:36 +00:00
|
|
|
bool m_skipSwitcher = false;
|
2015-03-12 14:44:39 +00:00
|
|
|
QIcon m_icon;
|
2015-03-12 15:08:19 +00:00
|
|
|
bool m_active = false;
|
2015-03-13 08:36:43 +00:00
|
|
|
bool m_keepAbove = false;
|
|
|
|
bool m_keepBelow = false;
|
2015-03-13 10:19:46 +00:00
|
|
|
bool m_demandsAttention = false;
|
2015-03-13 13:45:21 +00:00
|
|
|
bool m_minimized = false;
|
2015-03-13 09:26:10 +00:00
|
|
|
QTimer *m_autoRaiseTimer = nullptr;
|
2015-03-13 11:54:11 +00:00
|
|
|
int m_desktop = 0; // 0 means not on any desktop yet
|
2015-04-29 10:02:54 +00:00
|
|
|
|
|
|
|
QString m_colorScheme;
|
|
|
|
std::shared_ptr<Decoration::DecorationPalette> m_palette;
|
|
|
|
static QHash<QString, std::weak_ptr<Decoration::DecorationPalette>> s_palettes;
|
|
|
|
static std::shared_ptr<Decoration::DecorationPalette> s_defaultPalette;
|
2015-07-09 07:10:33 +00:00
|
|
|
|
|
|
|
KWayland::Server::PlasmaWindowInterface *m_windowManagementInterface = nullptr;
|
2015-09-11 09:37:40 +00:00
|
|
|
|
|
|
|
AbstractClient *m_transientFor = nullptr;
|
2015-09-14 08:55:27 +00:00
|
|
|
QList<AbstractClient*> m_transients;
|
2015-09-14 07:04:20 +00:00
|
|
|
bool m_modal = false;
|
2015-09-17 09:06:59 +00:00
|
|
|
Layer m_layer = UnknownLayer;
|
2015-10-12 07:56:54 +00:00
|
|
|
|
|
|
|
// electric border/quick tiling
|
|
|
|
QuickTileMode m_electricMode = QuickTileNone;
|
2015-10-12 08:12:07 +00:00
|
|
|
bool m_electricMaximizing = false;
|
2015-10-13 14:08:57 +00:00
|
|
|
/** The quick tile mode of this window.
|
|
|
|
*/
|
|
|
|
int m_quickTileMode = QuickTileNone;
|
2015-10-13 11:15:39 +00:00
|
|
|
|
|
|
|
// geometry
|
|
|
|
int m_blockGeometryUpdates = 0; // > 0 = New geometry is remembered, but not actually set
|
|
|
|
PendingGeometry_t m_pendingGeometryUpdate = PendingGeometryNone;
|
|
|
|
friend class GeometryUpdatesBlocker;
|
2015-10-15 10:50:28 +00:00
|
|
|
QRect m_visibleRectBeforeGeometryUpdate;
|
2015-10-15 11:11:21 +00:00
|
|
|
QRect m_geometryBeforeUpdateBlocking;
|
2015-10-13 11:15:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper for AbstractClient::blockGeometryUpdates() being called in pairs (true/false)
|
|
|
|
*/
|
|
|
|
class GeometryUpdatesBlocker
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit GeometryUpdatesBlocker(AbstractClient* c)
|
|
|
|
: cl(c) {
|
|
|
|
cl->blockGeometryUpdates(true);
|
|
|
|
}
|
|
|
|
~GeometryUpdatesBlocker() {
|
|
|
|
cl->blockGeometryUpdates(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
AbstractClient* cl;
|
2015-03-05 09:21:03 +00:00
|
|
|
};
|
|
|
|
|
2015-05-27 08:16:46 +00:00
|
|
|
inline void AbstractClient::move(const QPoint& p, ForceGeometry_t force)
|
|
|
|
{
|
|
|
|
move(p.x(), p.y(), force);
|
|
|
|
}
|
|
|
|
|
2015-05-27 09:48:33 +00:00
|
|
|
inline void AbstractClient::resizeWithChecks(const QSize& s, AbstractClient::ForceGeometry_t force)
|
|
|
|
{
|
|
|
|
resizeWithChecks(s.width(), s.height(), force);
|
|
|
|
}
|
|
|
|
|
2015-10-13 08:52:01 +00:00
|
|
|
inline void AbstractClient::setGeometry(const QRect& r, ForceGeometry_t force)
|
|
|
|
{
|
|
|
|
setGeometry(r.x(), r.y(), r.width(), r.height(), force);
|
|
|
|
}
|
|
|
|
|
2015-09-14 08:55:27 +00:00
|
|
|
inline const QList<AbstractClient*>& AbstractClient::transients() const
|
|
|
|
{
|
|
|
|
return m_transients;
|
|
|
|
}
|
|
|
|
|
2015-10-13 11:15:39 +00:00
|
|
|
inline bool AbstractClient::areGeometryUpdatesBlocked() const
|
|
|
|
{
|
|
|
|
return m_blockGeometryUpdates != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void AbstractClient::blockGeometryUpdates()
|
|
|
|
{
|
|
|
|
m_blockGeometryUpdates++;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void AbstractClient::unblockGeometryUpdates()
|
|
|
|
{
|
|
|
|
m_blockGeometryUpdates--;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline AbstractClient::PendingGeometry_t AbstractClient::pendingGeometryUpdate() const
|
|
|
|
{
|
|
|
|
return m_pendingGeometryUpdate;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void AbstractClient::setPendingGeometryUpdate(PendingGeometry_t update)
|
|
|
|
{
|
|
|
|
m_pendingGeometryUpdate = update;
|
|
|
|
}
|
|
|
|
|
2015-03-05 09:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(KWin::AbstractClient*)
|
|
|
|
Q_DECLARE_METATYPE(QList<KWin::AbstractClient*>)
|
2015-03-12 10:14:44 +00:00
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::AbstractClient::QuickTileMode)
|
2015-03-05 09:21:03 +00:00
|
|
|
|
|
|
|
#endif
|