2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2015-03-05 09:21:03 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
2015-03-05 09:21:03 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2015-03-05 09:21:03 +00:00
|
|
|
#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"
|
2018-06-07 00:33:54 +00:00
|
|
|
#include "cursor.h"
|
2015-03-05 09:21:03 +00:00
|
|
|
|
2015-04-29 10:02:54 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2015-12-03 15:40:27 +00:00
|
|
|
#include <QElapsedTimer>
|
2016-02-15 12:51:36 +00:00
|
|
|
#include <QPointer>
|
2015-12-03 15:40:27 +00:00
|
|
|
|
2020-04-29 15:18:41 +00:00
|
|
|
namespace KWaylandServer
|
2015-07-09 07:10:33 +00:00
|
|
|
{
|
|
|
|
class PlasmaWindowInterface;
|
|
|
|
}
|
|
|
|
|
2015-12-03 12:24:44 +00:00
|
|
|
namespace KDecoration2
|
|
|
|
{
|
|
|
|
class Decoration;
|
|
|
|
}
|
|
|
|
|
2015-03-05 09:21:03 +00:00
|
|
|
namespace KWin
|
|
|
|
{
|
2019-10-31 13:20:42 +00:00
|
|
|
class Group;
|
2015-03-05 09:21:03 +00:00
|
|
|
|
|
|
|
namespace TabBox
|
|
|
|
{
|
|
|
|
class TabBoxClientImpl;
|
|
|
|
}
|
|
|
|
|
2015-04-29 10:02:54 +00:00
|
|
|
namespace Decoration
|
|
|
|
{
|
2015-12-03 16:27:00 +00:00
|
|
|
class DecoratedClientImpl;
|
2015-04-29 10:02:54 +00:00
|
|
|
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
|
2019-07-03 16:56:36 +00:00
|
|
|
|
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.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-05-21 13:59:27 +00:00
|
|
|
Q_PROPERTY(bool fullScreen READ isFullScreen WRITE setFullScreen NOTIFY fullScreenChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-05-21 13:59:27 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-05-21 13:59:27 +00:00
|
|
|
Q_PROPERTY(bool fullScreenable READ isFullScreenable)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
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
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-12 15:08:19 +00:00
|
|
|
Q_PROPERTY(bool active READ isActive NOTIFY activeChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
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.
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
* This is a legacy property, use x11DesktopIds instead
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-13 11:54:11 +00:00
|
|
|
Q_PROPERTY(int desktop READ desktop WRITE setDesktop NOTIFY desktopChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-03-13 11:54:11 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client is on all desktops. That is desktop is -1.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-13 11:54:11 +00:00
|
|
|
Q_PROPERTY(bool onAllDesktops READ isOnAllDesktops WRITE setOnAllDesktops NOTIFY desktopChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2020-09-18 15:57:39 +00:00
|
|
|
/**
|
|
|
|
* The activities this client is on. If it's on all activities the property is empty.
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(QStringList activities READ activities WRITE setOnActivities NOTIFY activitiesChanged)
|
|
|
|
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
/**
|
|
|
|
* The x11 ids for all desktops this client is in. On X11 this list will always have a length of 1
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2018-11-13 16:18:46 +00:00
|
|
|
Q_PROPERTY(QVector<uint> x11DesktopIds READ x11DesktopIds NOTIFY x11DesktopIdsChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-06-06 20:08:12 +00:00
|
|
|
/**
|
|
|
|
* Indicates that the window should not be included on a taskbar.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-06-06 20:08:12 +00:00
|
|
|
Q_PROPERTY(bool skipTaskbar READ skipTaskbar WRITE setSkipTaskbar NOTIFY skipTaskbarChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-06-06 19:17:23 +00:00
|
|
|
/**
|
|
|
|
* Indicates that the window should not be included on a Pager.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-06-06 19:17:23 +00:00
|
|
|
Q_PROPERTY(bool skipPager READ skipPager WRITE setSkipPager NOTIFY skipPagerChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-03-12 14:35:36 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client should be excluded from window switching effects.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-12 14:35:36 +00:00
|
|
|
Q_PROPERTY(bool skipSwitcher READ skipSwitcher WRITE setSkipSwitcher NOTIFY skipSwitcherChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
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.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-12 14:37:48 +00:00
|
|
|
Q_PROPERTY(bool closeable READ isCloseable)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-03-12 14:44:39 +00:00
|
|
|
Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-03-13 08:36:43 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client is set to be kept above other windows.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-13 08:36:43 +00:00
|
|
|
Q_PROPERTY(bool keepAbove READ keepAbove WRITE setKeepAbove NOTIFY keepAboveChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-03-13 08:36:43 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client is set to be kept below other windows.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-13 08:36:43 +00:00
|
|
|
Q_PROPERTY(bool keepBelow READ keepBelow WRITE setKeepBelow NOTIFY keepBelowChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
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.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-13 12:39:53 +00:00
|
|
|
Q_PROPERTY(bool shadeable READ isShadeable)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-03-13 12:39:53 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client is shaded.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-13 12:39:53 +00:00
|
|
|
Q_PROPERTY(bool shade READ isShade WRITE setShade NOTIFY shadeChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
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.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-13 13:45:21 +00:00
|
|
|
Q_PROPERTY(bool minimizable READ isMinimizable)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-03-13 13:45:21 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client is minimized.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-13 13:45:21 +00:00
|
|
|
Q_PROPERTY(bool minimized READ isMinimized WRITE setMinimized NOTIFY minimizedChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-11-05 10:30:02 +00:00
|
|
|
/**
|
|
|
|
* The optional geometry representing the minimized Client in e.g a taskbar.
|
2019-03-25 18:11:15 +00:00
|
|
|
* See _NET_WM_ICON_GEOMETRY at https://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
2015-11-05 10:30:02 +00:00
|
|
|
* The value is evaluated each time the getter is called.
|
|
|
|
* Because of that no changed signal is provided.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-11-05 10:30:02 +00:00
|
|
|
Q_PROPERTY(QRect iconGeometry READ iconGeometry)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
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.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-13 09:33:31 +00:00
|
|
|
Q_PROPERTY(bool specialWindow READ isSpecialWindow)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
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).
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-13 10:19:46 +00:00
|
|
|
Q_PROPERTY(bool demandsAttention READ isDemandingAttention WRITE demandAttention NOTIFY demandsAttentionChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
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.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-05-20 12:39:40 +00:00
|
|
|
Q_PROPERTY(QString caption READ caption NOTIFY captionChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-05-27 11:21:56 +00:00
|
|
|
/**
|
|
|
|
* Minimum size as specified in WM_NORMAL_HINTS
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-05-27 11:21:56 +00:00
|
|
|
Q_PROPERTY(QSize minSize READ minSize)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-05-27 11:21:56 +00:00
|
|
|
/**
|
|
|
|
* Maximum size as specified in WM_NORMAL_HINTS
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-05-27 11:21:56 +00:00
|
|
|
Q_PROPERTY(QSize maxSize READ maxSize)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
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.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-07-22 06:42:48 +00:00
|
|
|
Q_PROPERTY(bool wantsInput READ wantsInput)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-09-11 08:57:00 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client is a transient Window to another Window.
|
|
|
|
* @see transientFor
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-09-11 08:57:00 +00:00
|
|
|
Q_PROPERTY(bool transient READ isTransient NOTIFY transientChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-09-11 09:37:40 +00:00
|
|
|
/**
|
|
|
|
* The Client to which this Client is a transient if any.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-09-11 09:37:40 +00:00
|
|
|
Q_PROPERTY(KWin::AbstractClient *transientFor READ transientFor NOTIFY transientChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-09-14 07:04:20 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client represents a modal window.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-09-14 07:04:20 +00:00
|
|
|
Q_PROPERTY(bool modal READ isModal NOTIFY modalChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-10-13 08:52:01 +00:00
|
|
|
/**
|
2020-02-05 09:28:50 +00:00
|
|
|
* The geometry of this Client. Be aware that depending on resize mode the frameGeometryChanged
|
|
|
|
* signal might be emitted at each resize step or only at the end of the resize operation.
|
2020-05-11 17:15:06 +00:00
|
|
|
*
|
|
|
|
* @deprecated Use frameGeometry
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-09-27 10:01:10 +00:00
|
|
|
Q_PROPERTY(QRect geometry READ frameGeometry WRITE setFrameGeometry)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2020-05-11 17:15:06 +00:00
|
|
|
/**
|
|
|
|
* The geometry of this Client. Be aware that depending on resize mode the frameGeometryChanged
|
|
|
|
* signal might be emitted at each resize step or only at the end of the resize operation.
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(QRect frameGeometry READ frameGeometry WRITE setFrameGeometry)
|
|
|
|
|
2015-10-16 11:15:09 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client is currently being moved by the user.
|
|
|
|
* Notify signal is emitted when the Client starts or ends move/resize mode.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-10-16 11:15:09 +00:00
|
|
|
Q_PROPERTY(bool move READ isMove NOTIFY moveResizedChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-10-16 11:15:09 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client is currently being resized by the user.
|
|
|
|
* Notify signal is emitted when the Client starts or ends move/resize mode.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-10-16 11:15:09 +00:00
|
|
|
Q_PROPERTY(bool resize READ isResize NOTIFY moveResizedChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-12-03 12:28:22 +00:00
|
|
|
/**
|
|
|
|
* Whether the decoration is currently using an alpha channel.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-12-03 12:28:22 +00:00
|
|
|
Q_PROPERTY(bool decorationHasAlpha READ decorationHasAlpha)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-12-03 13:03:54 +00:00
|
|
|
/**
|
|
|
|
* Whether the window has a decoration or not.
|
|
|
|
* This property is not allowed to be set by applications themselves.
|
|
|
|
* The decision whether a window has a border or not belongs to the window manager.
|
|
|
|
* If this property gets abused by application developers, it will be removed again.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-12-03 13:03:54 +00:00
|
|
|
Q_PROPERTY(bool noBorder READ noBorder WRITE setNoBorder)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-12-03 16:11:14 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client provides context help. Mostly needed by decorations to decide whether to
|
|
|
|
* show the help button or not.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-12-03 16:11:14 +00:00
|
|
|
Q_PROPERTY(bool providesContextHelp READ providesContextHelp CONSTANT)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2016-08-29 05:53:26 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client can be maximized both horizontally and vertically.
|
|
|
|
* The property is evaluated each time it is invoked.
|
|
|
|
* Because of that there is no notify signal.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-08-29 05:53:26 +00:00
|
|
|
Q_PROPERTY(bool maximizable READ isMaximizable)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2016-08-29 05:53:26 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client is moveable. Even if it is not moveable, it might be possible to move
|
|
|
|
* it to another screen. The property is evaluated each time it is invoked.
|
|
|
|
* Because of that there is no notify signal.
|
|
|
|
* @see moveableAcrossScreens
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-08-29 05:53:26 +00:00
|
|
|
Q_PROPERTY(bool moveable READ isMovable)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2016-08-29 05:53:26 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client can be moved to another screen. The property is evaluated each time it is invoked.
|
|
|
|
* Because of that there is no notify signal.
|
|
|
|
* @see moveable
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-08-29 05:53:26 +00:00
|
|
|
Q_PROPERTY(bool moveableAcrossScreens READ isMovableAcrossScreens)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2016-08-29 05:53:26 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client can be resized. The property is evaluated each time it is invoked.
|
|
|
|
* Because of that there is no notify signal.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-08-29 05:53:26 +00:00
|
|
|
Q_PROPERTY(bool resizeable READ isResizable)
|
2016-10-27 13:59:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The desktop file name of the application this AbstractClient belongs to.
|
|
|
|
*
|
|
|
|
* This is either the base name without full path and without file extension of the
|
|
|
|
* desktop file for the window's application (e.g. "org.kde.foo").
|
|
|
|
*
|
|
|
|
* The application's desktop file name can also be the full path to the desktop file
|
|
|
|
* (e.g. "/opt/kde/share/org.kde.foo.desktop") in case it's not in a standard location.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-10-27 13:59:08 +00:00
|
|
|
Q_PROPERTY(QByteArray desktopFileName READ desktopFileName NOTIFY desktopFileNameChanged)
|
2017-01-11 09:21:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether an application menu is available for this Client
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2017-01-11 09:21:03 +00:00
|
|
|
Q_PROPERTY(bool hasApplicationMenu READ hasApplicationMenu NOTIFY hasApplicationMenuChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2017-01-11 09:21:03 +00:00
|
|
|
/**
|
|
|
|
* Whether the application menu for this Client is currently opened
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2017-01-11 09:21:03 +00:00
|
|
|
Q_PROPERTY(bool applicationMenuActive READ applicationMenuActive NOTIFY applicationMenuActiveChanged)
|
|
|
|
|
2017-04-05 09:16:23 +00:00
|
|
|
/**
|
|
|
|
* Whether this client is unresponsive.
|
|
|
|
*
|
|
|
|
* When an application failed to react on a ping request in time, it is
|
|
|
|
* considered unresponsive. This usually indicates that the application froze or crashed.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2017-04-05 09:16:23 +00:00
|
|
|
Q_PROPERTY(bool unresponsive READ unresponsive NOTIFY unresponsiveChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2018-10-08 08:32:57 +00:00
|
|
|
/**
|
|
|
|
* The color scheme set on this client
|
|
|
|
* Absolute file path, or name of palette in the user's config directory following KColorSchemes format.
|
|
|
|
* An empty string indicates the default palette from kdeglobals is used.
|
2019-01-11 13:36:17 +00:00
|
|
|
* @note this indicates the colour scheme requested, which might differ from the theme applied if the colorScheme cannot be found
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2018-10-08 08:32:57 +00:00
|
|
|
Q_PROPERTY(QString colorScheme READ colorScheme NOTIFY colorSchemeChanged)
|
|
|
|
|
2015-03-05 09:21:03 +00:00
|
|
|
public:
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
~AbstractClient() override;
|
2015-03-05 09:21:03 +00:00
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2020-07-16 07:17:19 +00:00
|
|
|
bool isZombie() const;
|
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.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-12 15:08:19 +00:00
|
|
|
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;
|
|
|
|
|
2019-09-27 10:33:42 +00:00
|
|
|
QMargins frameMargins() const override;
|
2015-12-08 09:47:53 +00:00
|
|
|
QPoint clientPos() const override {
|
|
|
|
return QPoint(borderLeft(), borderTop());
|
|
|
|
}
|
|
|
|
|
2015-03-05 09:21:03 +00:00
|
|
|
virtual void updateMouseGrab();
|
2017-08-20 06:56:13 +00:00
|
|
|
/**
|
2019-01-12 10:31:32 +00:00
|
|
|
* @returns The caption consisting of captionNormal and captionSuffix
|
2017-08-20 06:56:13 +00:00
|
|
|
* @see captionNormal
|
|
|
|
* @see captionSuffix
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2017-08-20 07:35:15 +00:00
|
|
|
QString caption() const;
|
2017-08-20 06:56:13 +00:00
|
|
|
/**
|
|
|
|
* @returns The caption as set by the AbstractClient without any suffix.
|
|
|
|
* @see caption
|
|
|
|
* @see captionSuffix
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2017-08-20 06:56:13 +00:00
|
|
|
virtual QString captionNormal() const = 0;
|
|
|
|
/**
|
|
|
|
* @returns The suffix added to the caption (e.g. shortcut, machine name, etc.)
|
|
|
|
* @see caption
|
|
|
|
* @see captionNormal
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2017-08-20 06:56:13 +00:00
|
|
|
virtual QString captionSuffix() const = 0;
|
2020-08-19 07:31:38 +00:00
|
|
|
virtual bool isPlaceable() const;
|
2015-03-05 09:21:03 +00:00
|
|
|
virtual bool isCloseable() const = 0;
|
|
|
|
// TODO: remove boolean trap
|
|
|
|
virtual bool isShown(bool shaded_is_shown) const = 0;
|
2016-07-04 13:06:20 +00:00
|
|
|
virtual bool isHiddenInternal() const = 0;
|
2015-05-23 07:02:11 +00:00
|
|
|
// TODO: remove boolean trap
|
|
|
|
virtual void hideClient(bool hide) = 0;
|
2020-02-04 18:12:07 +00:00
|
|
|
virtual bool isFullScreenable() const;
|
|
|
|
virtual bool isFullScreen() const;
|
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
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-09-11 11:31:41 +00:00
|
|
|
virtual bool hasTransientPlacementHint() const;
|
|
|
|
/**
|
2018-10-19 22:21:54 +00:00
|
|
|
* Only valid id hasTransientPlacementHint is true
|
|
|
|
* @returns The position the transient wishes to position itself
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2018-10-19 22:21:54 +00:00
|
|
|
virtual QRect transientPlacement(const QRect &bounds) 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
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-09-11 12:14:21 +00:00
|
|
|
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
|
2020-03-04 07:55:26 +00:00
|
|
|
virtual void addTransient(AbstractClient *client);
|
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
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-13 09:33:31 +00:00
|
|
|
bool isSpecialWindow() const;
|
2015-10-14 11:37:46 +00:00
|
|
|
void sendToScreen(int screen);
|
2017-07-21 18:22:56 +00:00
|
|
|
const QKeySequence &shortcut() const {
|
|
|
|
return _shortcut;
|
|
|
|
}
|
|
|
|
void setShortcut(const QString &cut);
|
2020-05-07 16:26:24 +00:00
|
|
|
bool performMouseCommand(Options::MouseCommand, const QPoint &globalPos);
|
2015-03-13 11:54:11 +00:00
|
|
|
void setOnAllDesktops(bool set);
|
|
|
|
void setDesktop(int);
|
2018-11-13 16:18:46 +00:00
|
|
|
void enterDesktop(VirtualDesktop *desktop);
|
|
|
|
void leaveDesktop(VirtualDesktop *desktop);
|
2019-01-17 23:43:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the window as being on the attached list of desktops
|
|
|
|
* On X11 it will be set to the last entry
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2018-11-13 16:18:46 +00:00
|
|
|
void setDesktops(QVector<VirtualDesktop *> desktops);
|
|
|
|
|
2015-03-13 11:54:11 +00:00
|
|
|
int desktop() const override {
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
return m_desktops.isEmpty() ? (int)NET::OnAllDesktops : m_desktops.last()->x11DesktopNumber();
|
|
|
|
}
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
QVector<VirtualDesktop *> desktops() const override {
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
return m_desktops;
|
2015-03-13 11:54:11 +00:00
|
|
|
}
|
2018-11-13 16:18:46 +00:00
|
|
|
QVector<uint> x11DesktopIds() const;
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
|
2015-03-13 13:45:21 +00:00
|
|
|
void setMinimized(bool set);
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* Minimizes this client plus its transients
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-13 13:45:21 +00:00
|
|
|
void minimize(bool avoid_animation = false);
|
|
|
|
void unminimize(bool avoid_animation = false);
|
|
|
|
bool isMinimized() const {
|
|
|
|
return m_minimized;
|
|
|
|
}
|
2020-02-04 18:12:07 +00:00
|
|
|
virtual void setFullScreen(bool set, bool user = true);
|
2019-09-14 08:58:12 +00:00
|
|
|
|
2018-05-05 10:06:24 +00:00
|
|
|
virtual void setClientShown(bool shown);
|
2019-09-14 08:58:12 +00:00
|
|
|
|
2020-02-04 19:14:13 +00:00
|
|
|
QRect geometryRestore() const;
|
|
|
|
virtual MaximizeMode maximizeMode() const;
|
2018-10-07 16:51:42 +00:00
|
|
|
virtual MaximizeMode requestedMaximizeMode() const;
|
2015-10-13 08:22:18 +00:00
|
|
|
void maximize(MaximizeMode);
|
2019-02-02 18:17:44 +00:00
|
|
|
/**
|
|
|
|
* Sets the maximization according to @p vertically and @p horizontally.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-03-25 16:33:50 +00:00
|
|
|
Q_INVOKABLE void setMaximize(bool vertically, bool horizontally);
|
2020-08-17 08:08:16 +00:00
|
|
|
virtual bool noBorder() const;
|
|
|
|
virtual void setNoBorder(bool set);
|
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;
|
2019-02-02 18:17:44 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is resizable or has a fixed size.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-06 10:33:51 +00:00
|
|
|
virtual bool isResizable() const = 0;
|
2019-02-02 18:17:44 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is moveable or has a fixed position.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-06 10:33:51 +00:00
|
|
|
virtual bool isMovable() const = 0;
|
2019-02-02 18:17:44 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window can be moved to another screen.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-06 10:33:51 +00:00
|
|
|
virtual bool isMovableAcrossScreens() const = 0;
|
2015-03-13 12:39:53 +00:00
|
|
|
/**
|
|
|
|
* @c true only for @c ShadeNormal
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-13 12:39:53 +00:00
|
|
|
bool isShade() const {
|
|
|
|
return shadeMode() == ShadeNormal;
|
|
|
|
}
|
2020-05-07 16:26:24 +00:00
|
|
|
ShadeMode shadeMode() const; // Prefer isShade()
|
2015-03-13 12:39:53 +00:00
|
|
|
void setShade(bool set);
|
2020-05-07 16:26:24 +00:00
|
|
|
void setShade(ShadeMode mode);
|
|
|
|
void toggleShade();
|
|
|
|
void cancelShadeHoverTimer();
|
2015-03-13 12:39:53 +00:00
|
|
|
/**
|
|
|
|
* Whether the Client can be shaded. Default implementation returns @c false.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-13 12:39:53 +00:00
|
|
|
virtual bool isShadeable() const;
|
2020-02-04 19:14:13 +00:00
|
|
|
virtual bool isMaximizable() const;
|
2020-02-04 18:35:50 +00:00
|
|
|
virtual bool isMinimizable() const;
|
2016-08-22 14:55:48 +00:00
|
|
|
virtual QRect iconGeometry() const;
|
2020-02-04 18:12:07 +00:00
|
|
|
virtual bool userCanSetFullScreen() const;
|
2020-08-17 08:08:16 +00:00
|
|
|
virtual bool userCanSetNoBorder() const;
|
2017-10-01 19:48:57 +00:00
|
|
|
virtual void checkNoBorder();
|
2017-10-01 14:38:57 +00:00
|
|
|
virtual void setOnActivities(QStringList newActivitiesList);
|
2015-03-06 10:33:51 +00:00
|
|
|
virtual void setOnAllActivities(bool set) = 0;
|
2017-10-01 14:38:57 +00:00
|
|
|
const WindowRules* rules() const {
|
|
|
|
return &m_rules;
|
|
|
|
}
|
|
|
|
void removeRule(Rules* r);
|
|
|
|
void setupWindowRules(bool ignore_temporary);
|
|
|
|
void evaluateWindowRules();
|
2020-01-16 13:58:49 +00:00
|
|
|
virtual void applyWindowRules();
|
2020-07-22 11:00:11 +00:00
|
|
|
virtual bool takeFocus() = 0;
|
2015-03-06 14:04:59 +00:00
|
|
|
virtual bool wantsInput() const = 0;
|
2016-10-12 13:09:52 +00:00
|
|
|
/**
|
|
|
|
* Whether a dock window wants input.
|
|
|
|
*
|
|
|
|
* By default KWin doesn't pass focus to a dock window unless a force activate
|
|
|
|
* request is provided.
|
|
|
|
*
|
|
|
|
* This method allows to have dock windows take focus also through flags set on
|
|
|
|
* the window.
|
|
|
|
*
|
|
|
|
* The default implementation returns @c false.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-10-12 13:09:52 +00:00
|
|
|
virtual bool dockWantsInput() const;
|
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;
|
2017-10-01 14:38:57 +00:00
|
|
|
virtual void updateWindowRules(Rules::Types selection);
|
2015-03-05 09:21:03 +00:00
|
|
|
|
2015-10-26 14:49:03 +00:00
|
|
|
void growHorizontal();
|
|
|
|
void shrinkHorizontal();
|
|
|
|
void growVertical();
|
|
|
|
void shrinkVertical();
|
2015-10-23 11:36:53 +00:00
|
|
|
void updateMoveResize(const QPointF ¤tGlobalCursor);
|
2015-10-28 09:43:49 +00:00
|
|
|
/**
|
|
|
|
* Ends move resize when all pointer buttons are up again.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-10-28 09:43:49 +00:00
|
|
|
void endMoveResize();
|
2015-10-23 13:32:10 +00:00
|
|
|
void keyPressEvent(uint key_code);
|
2015-03-12 09:24:38 +00:00
|
|
|
|
2016-02-18 10:30:52 +00:00
|
|
|
void enterEvent(const QPoint &globalPos);
|
2016-02-18 12:00:50 +00:00
|
|
|
void leaveEvent();
|
2016-02-18 10:30:52 +00:00
|
|
|
|
2015-03-12 09:38:20 +00:00
|
|
|
/**
|
|
|
|
* These values represent positions inside an area
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-12 09:38:20 +00:00
|
|
|
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;
|
2016-05-12 08:28:40 +00:00
|
|
|
bool titlebarPositionUnderMouse() 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
|
2015-10-26 10:30:34 +00:00
|
|
|
void packTo(int left, int top);
|
2015-03-12 10:02:09 +00:00
|
|
|
|
2019-02-02 18:17:44 +00:00
|
|
|
/**
|
|
|
|
* Sets the quick tile mode ("snap") of this window.
|
2015-03-12 10:14:44 +00:00
|
|
|
* This will also handle preserving and restoring of window geometry as necessary.
|
|
|
|
* @param mode The tile mode (left/right) to give this window.
|
2019-01-13 07:22:11 +00:00
|
|
|
* @param keyboard Defines whether to take keyboard cursor into account.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
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
|
|
|
|
2020-03-04 07:55:26 +00:00
|
|
|
void placeIn(const QRect &area);
|
|
|
|
|
2015-05-27 08:16:46 +00:00
|
|
|
enum ForceGeometry_t { NormalGeometrySet, ForceGeometrySet };
|
[x11] Add support for _GTK_FRAME_EXTENTS
Summary:
KDE is known for having a strong view on the client-side decorations vs
server-side decorations issue. The main argument raised against CSD is
that desktop will look less consistent when clients start drawing window
decorations by themselves, which is somewhat true. It all ties to how
well each toolkit is integrated with the desktop environment.
KDE doesn't control the desktop market on Linux. Another big "player"
is GNOME. Both KDE and GNOME have very polarized views on in which
direction desktop should move forward. The KDE community is pushing more
toward server-side decorations while the GNOME community is pushing
more toward client-side decorations. Both communities have developed
great applications and it's not rare to see a GNOME application being
used in KDE Plasma. The only problem is that these different views are
not left behind the curtain and our users pay the price. Resizing GTK
clients in Plasma became practically impossible due to resize borders
having small hit area.
When a client draws its window decoration, it's more likely that it also
draws the drop-shadow around the decoration. The compositor must know
the extents of the shadow so things like snapping and so on work as
expected. And here lies the problem... While the xdg-shell protocol has
a way to specify such things, the NetWM spec doesn't have anything like
that. There's _GTK_FRAME_EXTENTS in the wild, however the problem with
it is that it's a proprietary atom, which is specific only to GTK apps.
Due to that, _GTK_FRAME_EXTENTS wasn't implemented because implementing
anything like that would require major changes in how we think about
geometry.
Recent xdg-shell window geometry patches adjusted geometry abstractions
in kwin to such a degree that it's very easy to add support for client
side decorated clients on X11. We just have to make sure that the
X11Client class provides correct buffer geometry and frame geometry when
the gtk frame extents are set.
Even though the X11 code is feature frozen, I still think it's worth
to have _GTK_FRAME_EXTENTS support in kwin because it will fix the resize
issues. Also, because KWin/Wayland is unfortunately far from becoming
default, it will help us with testing some implementation bits of the
window geometry from xdg-shell.
BUG: 390550
FIXED-IN: 5.18.0
Test Plan:
Things like quick tiling, maximizing, tiling scripts and so on work as
expected with GTK clients.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: cblack, trmdi, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24660
2019-10-08 08:46:59 +00:00
|
|
|
virtual 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);
|
2020-03-25 15:15:23 +00:00
|
|
|
virtual void resizeWithChecks(const QSize& s, ForceGeometry_t force = NormalGeometrySet) = 0;
|
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;
|
2020-03-25 15:15:23 +00:00
|
|
|
virtual void setFrameGeometry(const QRect &rect, ForceGeometry_t force = NormalGeometrySet) = 0;
|
2020-01-18 00:12:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* How to resize the window in order to obey constraints (mainly aspect ratios).
|
|
|
|
*/
|
2020-01-17 21:30:56 +00:00
|
|
|
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:44:50 +00:00
|
|
|
};
|
2015-06-19 22:14:15 +00:00
|
|
|
|
Refactor geometry constraints code
Summary:
Currently, there are a couple of issues with sizeForClientSize(). First
of all, we have a method called clientSizeToFrameSize() which does similar
thing except applying geometry constraints and checking window rules. The
other issue is that sizeForClientSize() is doing a bit too much, it checks
window rules, it applies a bunch of geometry constrains. Sometimes it
does not perform conversion between client sizes and frame sizes!
This change attempts to address those issues by replacing sizeForClientSize
with two similar methods and changing semantics of some methods of the
X11Client class.
The most significant difference between sizeForClientSize() and the new
methods is that neither constrainClientSize() nor constrainFrameSize()
check window rules. This is up to users of those methods. In many places,
we don't have to check window rules because we check isResizable(),
which returns false if the frame size is enforced by a window rule.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D26828
2020-02-12 10:38:40 +00:00
|
|
|
virtual QSize constrainClientSize(const QSize &size, SizeMode mode = SizeModeAny) const;
|
|
|
|
QSize constrainFrameSize(const QSize &size, SizeMode mode = SizeModeAny) const;
|
2015-10-13 07:51:40 +00:00
|
|
|
QSize adjustedSize() const;
|
|
|
|
|
[x11] Add support for _GTK_FRAME_EXTENTS
Summary:
KDE is known for having a strong view on the client-side decorations vs
server-side decorations issue. The main argument raised against CSD is
that desktop will look less consistent when clients start drawing window
decorations by themselves, which is somewhat true. It all ties to how
well each toolkit is integrated with the desktop environment.
KDE doesn't control the desktop market on Linux. Another big "player"
is GNOME. Both KDE and GNOME have very polarized views on in which
direction desktop should move forward. The KDE community is pushing more
toward server-side decorations while the GNOME community is pushing
more toward client-side decorations. Both communities have developed
great applications and it's not rare to see a GNOME application being
used in KDE Plasma. The only problem is that these different views are
not left behind the curtain and our users pay the price. Resizing GTK
clients in Plasma became practically impossible due to resize borders
having small hit area.
When a client draws its window decoration, it's more likely that it also
draws the drop-shadow around the decoration. The compositor must know
the extents of the shadow so things like snapping and so on work as
expected. And here lies the problem... While the xdg-shell protocol has
a way to specify such things, the NetWM spec doesn't have anything like
that. There's _GTK_FRAME_EXTENTS in the wild, however the problem with
it is that it's a proprietary atom, which is specific only to GTK apps.
Due to that, _GTK_FRAME_EXTENTS wasn't implemented because implementing
anything like that would require major changes in how we think about
geometry.
Recent xdg-shell window geometry patches adjusted geometry abstractions
in kwin to such a degree that it's very easy to add support for client
side decorated clients on X11. We just have to make sure that the
X11Client class provides correct buffer geometry and frame geometry when
the gtk frame extents are set.
Even though the X11 code is feature frozen, I still think it's worth
to have _GTK_FRAME_EXTENTS support in kwin because it will fix the resize
issues. Also, because KWin/Wayland is unfortunately far from becoming
default, it will help us with testing some implementation bits of the
window geometry from xdg-shell.
BUG: 390550
FIXED-IN: 5.18.0
Test Plan:
Things like quick tiling, maximizing, tiling scripts and so on work as
expected with GTK clients.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: cblack, trmdi, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D24660
2019-10-08 08:46:59 +00:00
|
|
|
/**
|
|
|
|
* Calculates the matching client position for the given frame position @p point.
|
|
|
|
*/
|
|
|
|
virtual QPoint framePosToClientPos(const QPoint &point) const;
|
|
|
|
/**
|
|
|
|
* Calculates the matching frame position for the given client position @p point.
|
|
|
|
*/
|
|
|
|
virtual QPoint clientPosToFramePos(const QPoint &point) const;
|
|
|
|
/**
|
|
|
|
* Calculates the matching client size for the given frame size @p size.
|
|
|
|
*
|
|
|
|
* Notice that size constraints won't be applied.
|
|
|
|
*
|
|
|
|
* Default implementation returns the frame size with frame margins being excluded.
|
|
|
|
*/
|
|
|
|
virtual QSize frameSizeToClientSize(const QSize &size) const;
|
|
|
|
/**
|
|
|
|
* Calculates the matching frame size for the given client size @p size.
|
|
|
|
*
|
|
|
|
* Notice that size constraints won't be applied.
|
|
|
|
*
|
|
|
|
* Default implementation returns the client size with frame margins being included.
|
|
|
|
*/
|
|
|
|
virtual QSize clientSizeToFrameSize(const QSize &size) const;
|
|
|
|
/**
|
|
|
|
* Calculates the matching client rect for the given frame rect @p rect.
|
|
|
|
*
|
|
|
|
* Notice that size constraints won't be applied.
|
|
|
|
*/
|
|
|
|
QRect frameRectToClientRect(const QRect &rect) const;
|
|
|
|
/**
|
|
|
|
* Calculates the matching frame rect for the given client rect @p rect.
|
|
|
|
*
|
|
|
|
* Notice that size constraints won't be applied.
|
|
|
|
*/
|
|
|
|
QRect clientRectToFrameRect(const QRect &rect) const;
|
|
|
|
|
2020-01-28 20:18:57 +00:00
|
|
|
/**
|
|
|
|
* Returns @c true if the Client is being interactively moved; otherwise @c false.
|
|
|
|
*/
|
2015-10-16 11:15:09 +00:00
|
|
|
bool isMove() const {
|
|
|
|
return isMoveResize() && moveResizePointerMode() == PositionCenter;
|
|
|
|
}
|
2020-01-28 20:18:57 +00:00
|
|
|
/**
|
|
|
|
* Returns @c true if the Client is being interactively resized; otherwise @c false.
|
|
|
|
*/
|
2015-10-16 11:15:09 +00:00
|
|
|
bool isResize() const {
|
|
|
|
return isMoveResize() && moveResizePointerMode() != PositionCenter;
|
|
|
|
}
|
2015-10-16 13:27:53 +00:00
|
|
|
/**
|
|
|
|
* Cursor shape for move/resize mode.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2018-06-07 00:33:54 +00:00
|
|
|
CursorShape cursor() const {
|
2015-10-16 13:27:53 +00:00
|
|
|
return m_moveResize.cursor;
|
|
|
|
}
|
2015-10-16 11:15:09 +00:00
|
|
|
|
2020-08-17 13:14:20 +00:00
|
|
|
virtual StrutRect strutRect(StrutArea area) const;
|
|
|
|
StrutRects strutRects() 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.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-07-09 14:11:51 +00:00
|
|
|
Options::MouseCommand getMouseCommand(Qt::MouseButton button, bool *handled) const;
|
|
|
|
Options::MouseCommand getWheelCommand(Qt::Orientation orientation, bool *handled) const;
|
|
|
|
|
2015-12-03 12:24:44 +00:00
|
|
|
// decoration related
|
|
|
|
KDecoration2::Decoration *decoration() {
|
2015-12-04 07:12:49 +00:00
|
|
|
return m_decoration.decoration;
|
2015-12-03 12:24:44 +00:00
|
|
|
}
|
|
|
|
const KDecoration2::Decoration *decoration() const {
|
2015-12-04 07:12:49 +00:00
|
|
|
return m_decoration.decoration;
|
2015-12-03 12:24:44 +00:00
|
|
|
}
|
|
|
|
bool isDecorated() const {
|
2015-12-04 07:12:49 +00:00
|
|
|
return m_decoration.decoration != nullptr;
|
2015-12-03 12:24:44 +00:00
|
|
|
}
|
2015-12-03 16:27:00 +00:00
|
|
|
QPointer<Decoration::DecoratedClientImpl> decoratedClient() const;
|
|
|
|
void setDecoratedClient(QPointer<Decoration::DecoratedClientImpl> client);
|
2015-12-03 12:28:22 +00:00
|
|
|
bool decorationHasAlpha() const;
|
2015-12-03 12:31:25 +00:00
|
|
|
void triggerDecorationRepaint();
|
2015-12-03 12:48:54 +00:00
|
|
|
virtual void layoutDecorationRects(QRect &left, QRect &top, QRect &right, QRect &bottom) const;
|
2016-03-11 11:48:01 +00:00
|
|
|
void processDecorationMove(const QPoint &localPos, const QPoint &globalPos);
|
2015-12-03 15:40:27 +00:00
|
|
|
bool processDecorationButtonPress(QMouseEvent *event, bool ignoreMenu = false);
|
|
|
|
void processDecorationButtonRelease(QMouseEvent *event);
|
2015-12-03 12:24:44 +00:00
|
|
|
|
2015-12-17 14:47:36 +00:00
|
|
|
/**
|
|
|
|
* TODO: fix boolean traps
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2020-08-17 07:51:55 +00:00
|
|
|
virtual void updateDecoration(bool check_workspace_pos, bool force = false);
|
2015-12-17 14:47:36 +00:00
|
|
|
|
2015-12-03 16:11:14 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* Returns whether the window provides context help or not. If it does,
|
|
|
|
* you should show a help menu item or a help button like '?' and call
|
|
|
|
* contextHelp() if this is invoked.
|
|
|
|
*
|
|
|
|
* Default implementation returns @c false.
|
|
|
|
* @see showContextHelp;
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-12-03 16:11:14 +00:00
|
|
|
virtual bool providesContextHelp() const;
|
|
|
|
|
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* Invokes context help on the window. Only works if the window
|
|
|
|
* actually provides context help.
|
|
|
|
*
|
|
|
|
* Default implementation does nothing.
|
|
|
|
*
|
|
|
|
* @see providesContextHelp()
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-12-03 16:11:14 +00:00
|
|
|
virtual void showContextHelp();
|
|
|
|
|
2016-09-15 09:44:32 +00:00
|
|
|
QRect inputGeometry() const override;
|
Adapt to input region changes in kwayland-server
SurfaceInterface::inputIsInfinite() has been dropped. If the surface has
no any input region specified, SurfaceInterface::input() will return a
region that corresponds to the rect of the surface (0, 0, width, height).
While the new design is more robust, for example it's no longer possible
to forget to check SurfaceInterface::inputIsInfinite(), it has shown some
issues in the input stack of kwin.
Currently, acceptsInput() will return false if you attempt to click the
server-side decoration for a surface whose input region is not empty.
Therefore, it's possible for an application to set an input region with
a width and a height of 1. If user doesn't know about KSysGuard or the
possibility of closing apps via the task manager, they won't be able to
close such an application.
Another issue is that if an application has specified an empty input
region on purpose, user will be still able click it. With the new
behavior of SurfaceInterface::input(), this is no longer an issue and it
is handled properly by kwin.
2020-10-17 12:47:25 +00:00
|
|
|
bool hitTest(const QPoint &point) const override;
|
2016-09-15 09:44:32 +00:00
|
|
|
|
virtualkeyboard: resize the focused window to make room for the keyboard
Summary:
alternative approach: try to resize the winidow to make room for the keyboard.
the new input wayland protocol doesn't have anymore the overlap rectangle (and it would not be going to work with qwidget apps anyways)
in the future will probably be needed anextension to the input protocol v3 which partially gets back this, tough window resizing is needed regardless
what's missing: the resize should be "temporary" and the window should be restored to its previous geometry when the keyboard closes
Test Plan: tested with test QML code
Reviewers: #plasma, #kwin, bshah, graesslin, romangg, davidedmundson
Reviewed By: #plasma, #kwin, romangg, davidedmundson
Subscribers: nicolasfella, mart, kwin, davidedmundson, graesslin
Tags: #kwin
Maniphest Tasks: T9815
Differential Revision: https://phabricator.kde.org/D18818
2019-03-20 10:04:51 +00:00
|
|
|
/**
|
|
|
|
* @returns the geometry of the virtual keyboard
|
|
|
|
* This geometry is in global coordinates
|
|
|
|
*/
|
|
|
|
QRect virtualKeyboardGeometry() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the geometry of the virtual keyboard, The window may resize itself in order to make space for the keybaord
|
|
|
|
* This geometry is in global coordinates
|
|
|
|
*/
|
2020-09-01 08:58:46 +00:00
|
|
|
virtual void setVirtualKeyboardGeometry(const QRect &geo);
|
virtualkeyboard: resize the focused window to make room for the keyboard
Summary:
alternative approach: try to resize the winidow to make room for the keyboard.
the new input wayland protocol doesn't have anymore the overlap rectangle (and it would not be going to work with qwidget apps anyways)
in the future will probably be needed anextension to the input protocol v3 which partially gets back this, tough window resizing is needed regardless
what's missing: the resize should be "temporary" and the window should be restored to its previous geometry when the keyboard closes
Test Plan: tested with test QML code
Reviewers: #plasma, #kwin, bshah, graesslin, romangg, davidedmundson
Reviewed By: #plasma, #kwin, romangg, davidedmundson
Subscribers: nicolasfella, mart, kwin, davidedmundson, graesslin
Tags: #kwin
Maniphest Tasks: T9815
Differential Revision: https://phabricator.kde.org/D18818
2019-03-20 10:04:51 +00:00
|
|
|
|
2016-09-15 19:03:40 +00:00
|
|
|
/**
|
|
|
|
* Restores the AbstractClient after it had been hidden due to show on screen edge functionality.
|
|
|
|
* The AbstractClient also gets raised (e.g. Panel mode windows can cover) and the AbstractClient
|
|
|
|
* gets informed in a window specific way that it is shown and raised again.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2020-08-17 10:22:10 +00:00
|
|
|
virtual void showOnScreenEdge();
|
2016-09-15 19:03:40 +00:00
|
|
|
|
2016-10-27 13:59:08 +00:00
|
|
|
QByteArray desktopFileName() const {
|
|
|
|
return m_desktopFileName;
|
|
|
|
}
|
|
|
|
|
2016-11-15 15:48:20 +00:00
|
|
|
/**
|
|
|
|
* Tries to terminate the process of this AbstractClient.
|
|
|
|
*
|
|
|
|
* Implementing subclasses can perform a windowing system solution for terminating.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-11-15 15:48:20 +00:00
|
|
|
virtual void killWindow() = 0;
|
2020-02-19 15:22:23 +00:00
|
|
|
virtual void destroyClient() = 0;
|
2016-11-15 15:48:20 +00:00
|
|
|
|
2017-11-05 09:10:17 +00:00
|
|
|
enum class SameApplicationCheck {
|
|
|
|
RelaxedForActive = 1 << 0,
|
|
|
|
AllowCrossProcesses = 1 << 1
|
|
|
|
};
|
|
|
|
Q_DECLARE_FLAGS(SameApplicationChecks, SameApplicationCheck)
|
|
|
|
static bool belongToSameApplication(const AbstractClient* c1, const AbstractClient* c2, SameApplicationChecks checks = SameApplicationChecks());
|
2015-03-05 09:21:03 +00:00
|
|
|
|
2017-01-11 09:21:03 +00:00
|
|
|
bool hasApplicationMenu() const;
|
|
|
|
bool applicationMenuActive() const {
|
|
|
|
return m_applicationMenuActive;
|
|
|
|
}
|
|
|
|
void setApplicationMenuActive(bool applicationMenuActive);
|
|
|
|
|
|
|
|
QString applicationMenuServiceName() const {
|
|
|
|
return m_applicationMenuServiceName;
|
|
|
|
}
|
|
|
|
QString applicationMenuObjectPath() const {
|
|
|
|
return m_applicationMenuObjectPath;
|
|
|
|
}
|
2020-08-19 09:21:00 +00:00
|
|
|
|
|
|
|
virtual QString preferredColorScheme() const;
|
|
|
|
QString colorScheme() const;
|
|
|
|
void setColorScheme(const QString &colorScheme);
|
2017-01-11 09:21:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Request showing the application menu bar
|
|
|
|
* @param actionId The DBus menu ID of the action that should be highlighted, 0 for the root menu
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2017-01-11 09:21:03 +00:00
|
|
|
void showApplicationMenu(int actionId);
|
|
|
|
|
2017-04-05 09:16:23 +00:00
|
|
|
bool unresponsive() const;
|
|
|
|
|
2018-12-31 17:57:13 +00:00
|
|
|
/**
|
|
|
|
* Default implementation returns @c null.
|
|
|
|
* Mostly intended for X11 clients, from EWMH:
|
2019-01-13 07:22:11 +00:00
|
|
|
* @verbatim
|
2018-12-31 17:57:13 +00:00
|
|
|
* If the WM_TRANSIENT_FOR property is set to None or Root window, the window should be
|
|
|
|
* treated as a transient for all other windows in the same group. It has been noted that this
|
|
|
|
* is a slight ICCCM violation, but as this behavior is pretty standard for many toolkits and
|
|
|
|
* window managers, and is extremely unlikely to break anything, it seems reasonable to document
|
|
|
|
* it as standard.
|
2019-01-13 07:22:11 +00:00
|
|
|
* @endverbatim
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2018-12-31 17:57:13 +00:00
|
|
|
virtual bool groupTransient() const;
|
|
|
|
/**
|
|
|
|
* Default implementation returns @c null.
|
|
|
|
*
|
|
|
|
* Mostly for X11 clients, holds the client group
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2018-12-31 17:57:13 +00:00
|
|
|
virtual const Group *group() const;
|
|
|
|
/**
|
|
|
|
* Default implementation returns @c null.
|
|
|
|
*
|
|
|
|
* Mostly for X11 clients, holds the client group
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2018-12-31 17:57:13 +00:00
|
|
|
virtual Group *group();
|
|
|
|
|
2019-05-10 07:47:05 +00:00
|
|
|
/**
|
|
|
|
* Returns whether this is an internal client.
|
|
|
|
*
|
|
|
|
* Internal clients are created by KWin and used for special purpose windows,
|
|
|
|
* like the task switcher, etc.
|
2019-07-03 16:44:37 +00:00
|
|
|
*
|
|
|
|
* Default implementation returns @c false.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-05-10 07:47:05 +00:00
|
|
|
virtual bool isInternal() const;
|
|
|
|
|
[wayland] Apply window rules only to xdg-shell clients
Summary:
There are rules that have to be applied only once, e.g. every Remember
and Apply Initially rule, as well rules that need to configure the client,
e.g. size, etc. In the best scenario the compositor would evaluate such
rules when the client is about to be mapped.
This change limits window rules only to xdg-shell clients because right
now only this protocol lets compositors to intervene in the client
initialization process. Also, it makes things a bit easier for us on the
compositor side.
xdg-shell protocol satisfies most of ours requirements to implement window
rules, but not all of them. If the client is about to be mapped for the
second time and its size is forced by a rule, then compositor may need
to configure it. Currently, xdg-shell protocol doesn't have any mechanism
that a client could use to notify the compositor about its intent to map.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: fmonteiro, davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D19411
2019-07-09 11:58:57 +00:00
|
|
|
/**
|
|
|
|
* Returns whether window rules can be applied to this client.
|
|
|
|
*
|
2020-08-20 11:31:48 +00:00
|
|
|
* Default implementation returns @c false.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[wayland] Apply window rules only to xdg-shell clients
Summary:
There are rules that have to be applied only once, e.g. every Remember
and Apply Initially rule, as well rules that need to configure the client,
e.g. size, etc. In the best scenario the compositor would evaluate such
rules when the client is about to be mapped.
This change limits window rules only to xdg-shell clients because right
now only this protocol lets compositors to intervene in the client
initialization process. Also, it makes things a bit easier for us on the
compositor side.
xdg-shell protocol satisfies most of ours requirements to implement window
rules, but not all of them. If the client is about to be mapped for the
second time and its size is forced by a rule, then compositor may need
to configure it. Currently, xdg-shell protocol doesn't have any mechanism
that a client could use to notify the compositor about its intent to map.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: fmonteiro, davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D19411
2019-07-09 11:58:57 +00:00
|
|
|
virtual bool supportsWindowRules() const;
|
|
|
|
|
2020-04-21 14:52:20 +00:00
|
|
|
/**
|
|
|
|
* Return window management interface
|
|
|
|
*/
|
2020-04-29 15:18:41 +00:00
|
|
|
KWaylandServer::PlasmaWindowInterface *windowManagementInterface() const {
|
2020-04-21 14:52:20 +00:00
|
|
|
return m_windowManagementInterface;
|
|
|
|
}
|
|
|
|
|
2015-03-05 09:21:03 +00:00
|
|
|
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.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-13 10:19:46 +00:00
|
|
|
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();
|
2020-09-18 15:57:39 +00:00
|
|
|
void activitiesChanged(KWin::AbstractClient* client);
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
void x11DesktopIdsChanged();
|
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);
|
2018-10-08 08:32:57 +00:00
|
|
|
void colorSchemeChanged();
|
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-10-16 11:15:09 +00:00
|
|
|
void moveResizedChanged();
|
2018-06-07 00:33:54 +00:00
|
|
|
void moveResizeCursorChanged(CursorShape);
|
2015-10-22 13:47:02 +00:00
|
|
|
void clientStartUserMovedResized(KWin::AbstractClient*);
|
|
|
|
void clientStepUserMovedResized(KWin::AbstractClient *, const QRect&);
|
|
|
|
void clientFinishUserMovedResized(KWin::AbstractClient*);
|
2015-12-03 16:18:37 +00:00
|
|
|
void closeableChanged(bool);
|
|
|
|
void minimizeableChanged(bool);
|
|
|
|
void shadeableChanged(bool);
|
|
|
|
void maximizeableChanged(bool);
|
2016-10-27 13:59:08 +00:00
|
|
|
void desktopFileNameChanged();
|
2020-03-03 22:26:10 +00:00
|
|
|
void applicationMenuChanged();
|
2017-01-11 09:21:03 +00:00
|
|
|
void hasApplicationMenuChanged(bool);
|
|
|
|
void applicationMenuActiveChanged(bool);
|
2017-04-05 09:16:23 +00:00
|
|
|
void unresponsiveChanged(bool);
|
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();
|
2020-07-15 09:14:50 +00:00
|
|
|
bool isMostRecentlyRaised() const;
|
2020-07-16 07:17:19 +00:00
|
|
|
void markAsZombie();
|
2015-12-07 15:18:30 +00:00
|
|
|
/**
|
|
|
|
* Whether the window accepts focus.
|
|
|
|
* The difference to wantsInput is that the implementation should not check rules and return
|
|
|
|
* what the window effectively supports.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-12-07 15:18:30 +00:00
|
|
|
virtual bool acceptsFocus() const = 0;
|
2015-03-12 15:08:19 +00:00
|
|
|
/**
|
2019-01-11 13:36:17 +00:00
|
|
|
* Called from setActive once the active value got updated, but before the changed signal
|
2015-03-12 15:08:19 +00:00
|
|
|
* is emitted.
|
|
|
|
*
|
|
|
|
* Default implementation does nothing.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-12 15:08:19 +00:00
|
|
|
virtual void doSetActive();
|
2015-03-13 08:36:43 +00:00
|
|
|
/**
|
2019-01-11 13:36:17 +00:00
|
|
|
* Called from setKeepAbove once the keepBelow value got updated, but before the changed signal
|
2015-03-13 08:36:43 +00:00
|
|
|
* is emitted.
|
|
|
|
*
|
|
|
|
* Default implementation does nothing.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-13 08:36:43 +00:00
|
|
|
virtual void doSetKeepAbove();
|
|
|
|
/**
|
2019-01-11 13:36:17 +00:00
|
|
|
* Called from setKeepBelow once the keepBelow value got updated, but before the changed signal
|
2015-03-13 08:36:43 +00:00
|
|
|
* is emitted.
|
|
|
|
*
|
|
|
|
* Default implementation does nothing.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-13 08:36:43 +00:00
|
|
|
virtual void doSetKeepBelow();
|
2020-05-07 16:26:24 +00:00
|
|
|
/**
|
|
|
|
* Called from setShade() once the shadeMode value got updated, but before the changed signal
|
|
|
|
* is emitted.
|
|
|
|
*
|
|
|
|
* Default implementation does nothing.
|
|
|
|
*/
|
|
|
|
virtual void doSetShade(ShadeMode previousShadeMode);
|
2015-03-13 11:54:11 +00:00
|
|
|
/**
|
2019-01-11 13:36:17 +00:00
|
|
|
* Called from setDeskop once the desktop value got updated, but before the changed signal
|
2015-03-13 11:54:11 +00:00
|
|
|
* is emitted.
|
|
|
|
*
|
|
|
|
* Default implementation does nothing.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2020-02-03 00:19:46 +00:00
|
|
|
virtual void doSetDesktop();
|
2015-03-13 13:45:21 +00:00
|
|
|
/**
|
2019-01-11 13:36:17 +00:00
|
|
|
* Called from @ref minimize and @ref unminimize once the minimized value got updated, but before the
|
2015-03-13 13:45:21 +00:00
|
|
|
* changed signal is emitted.
|
|
|
|
*
|
|
|
|
* Default implementation does nothig.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-03-13 13:45:21 +00:00
|
|
|
virtual void doMinimize();
|
2017-11-05 09:10:17 +00:00
|
|
|
virtual bool belongsToSameApplication(const AbstractClient *other, SameApplicationChecks checks) 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();
|
2018-05-24 04:33:39 +00:00
|
|
|
virtual void doSetSkipSwitcher();
|
2020-02-02 23:23:47 +00:00
|
|
|
virtual void doSetDemandsAttention();
|
2020-08-23 11:23:23 +00:00
|
|
|
virtual void doSetQuickTileMode();
|
2015-06-06 19:17:23 +00:00
|
|
|
|
2015-07-09 07:10:33 +00:00
|
|
|
void setupWindowManagementInterface();
|
|
|
|
void destroyWindowManagementInterface();
|
2020-08-19 09:21:00 +00:00
|
|
|
void updateColorScheme();
|
2015-09-11 09:37:40 +00:00
|
|
|
void setTransientFor(AbstractClient *transientFor);
|
2015-09-14 08:55:27 +00:00
|
|
|
/**
|
|
|
|
* Just removes the @p cl from the transients without any further checks.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-09-14 08:55:27 +00:00
|
|
|
void removeTransientFromList(AbstractClient* cl);
|
2015-09-11 09:37:40 +00:00
|
|
|
|
2020-08-07 19:01:42 +00:00
|
|
|
virtual Layer belongsToLayer() const;
|
2015-09-17 09:06:59 +00:00
|
|
|
virtual bool belongsToDesktop() const;
|
|
|
|
void invalidateLayer();
|
2018-01-06 10:24:31 +00:00
|
|
|
bool isActiveFullScreen() const;
|
2015-09-17 09:06:59 +00:00
|
|
|
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-12-03 12:54:16 +00:00
|
|
|
int borderLeft() const;
|
|
|
|
int borderRight() const;
|
|
|
|
int borderTop() const;
|
|
|
|
int borderBottom() const;
|
2020-02-04 19:14:13 +00:00
|
|
|
virtual void changeMaximize(bool horizontal, bool vertical, bool adjust);
|
|
|
|
void setGeometryRestore(const QRect &rect);
|
virtualkeyboard: resize the focused window to make room for the keyboard
Summary:
alternative approach: try to resize the winidow to make room for the keyboard.
the new input wayland protocol doesn't have anymore the overlap rectangle (and it would not be going to work with qwidget apps anyways)
in the future will probably be needed anextension to the input protocol v3 which partially gets back this, tough window resizing is needed regardless
what's missing: the resize should be "temporary" and the window should be restored to its previous geometry when the keyboard closes
Test Plan: tested with test QML code
Reviewers: #plasma, #kwin, bshah, graesslin, romangg, davidedmundson
Reviewed By: #plasma, #kwin, romangg, davidedmundson
Subscribers: nicolasfella, mart, kwin, davidedmundson, graesslin
Tags: #kwin
Maniphest Tasks: T9815
Differential Revision: https://phabricator.kde.org/D18818
2019-03-20 10:04:51 +00:00
|
|
|
|
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.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-10-15 13:28:01 +00:00
|
|
|
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);
|
2019-10-10 11:52:26 +00:00
|
|
|
QRect bufferGeometryBeforeUpdateBlocking() const;
|
2019-10-10 11:49:11 +00:00
|
|
|
QRect frameGeometryBeforeUpdateBlocking() const;
|
2020-06-01 10:43:49 +00:00
|
|
|
QRect clientGeometryBeforeUpdateBlocking() const;
|
2015-10-15 11:11:21 +00:00
|
|
|
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.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-10-15 10:50:28 +00:00
|
|
|
void addRepaintDuringGeometryUpdates();
|
2015-10-12 08:50:20 +00:00
|
|
|
|
2015-10-16 07:08:02 +00:00
|
|
|
/**
|
|
|
|
* @returns whether the Client is currently in move resize mode
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-10-16 07:08:02 +00:00
|
|
|
bool isMoveResize() const {
|
|
|
|
return m_moveResize.enabled;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Sets whether the Client is in move resize mode to @p enabled.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-10-16 07:08:02 +00:00
|
|
|
void setMoveResize(bool enabled) {
|
|
|
|
m_moveResize.enabled = enabled;
|
|
|
|
}
|
2015-10-16 07:23:46 +00:00
|
|
|
/**
|
|
|
|
* @returns whether the move resize mode is unrestricted.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-10-16 07:23:46 +00:00
|
|
|
bool isUnrestrictedMoveResize() const {
|
|
|
|
return m_moveResize.unrestricted;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Sets whether move resize mode is unrestricted to @p set.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-10-16 07:23:46 +00:00
|
|
|
void setUnrestrictedMoveResize(bool set) {
|
|
|
|
m_moveResize.unrestricted = set;
|
|
|
|
}
|
2015-10-16 07:46:33 +00:00
|
|
|
QPoint moveOffset() const {
|
|
|
|
return m_moveResize.offset;
|
|
|
|
}
|
|
|
|
void setMoveOffset(const QPoint &offset) {
|
|
|
|
m_moveResize.offset = offset;
|
|
|
|
}
|
|
|
|
QPoint invertedMoveOffset() const {
|
|
|
|
return m_moveResize.invertedOffset;
|
|
|
|
}
|
|
|
|
void setInvertedMoveOffset(const QPoint &offset) {
|
|
|
|
m_moveResize.invertedOffset = offset;
|
|
|
|
}
|
2015-10-16 07:57:53 +00:00
|
|
|
QRect initialMoveResizeGeometry() const {
|
|
|
|
return m_moveResize.initialGeometry;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Sets the initial move resize geometry to the current geometry.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-10-16 07:57:53 +00:00
|
|
|
void updateInitialMoveResizeGeometry();
|
2015-10-16 09:13:41 +00:00
|
|
|
QRect moveResizeGeometry() const {
|
|
|
|
return m_moveResize.geometry;
|
|
|
|
}
|
|
|
|
void setMoveResizeGeometry(const QRect &geo) {
|
|
|
|
m_moveResize.geometry = geo;
|
|
|
|
}
|
2015-10-16 11:10:55 +00:00
|
|
|
Position moveResizePointerMode() const {
|
|
|
|
return m_moveResize.pointer;
|
|
|
|
}
|
|
|
|
void setMoveResizePointerMode(Position mode) {
|
|
|
|
m_moveResize.pointer = mode;
|
|
|
|
}
|
2015-10-16 12:58:43 +00:00
|
|
|
bool isMoveResizePointerButtonDown() const {
|
|
|
|
return m_moveResize.buttonDown;
|
|
|
|
}
|
|
|
|
void setMoveResizePointerButtonDown(bool down) {
|
|
|
|
m_moveResize.buttonDown = down;
|
|
|
|
}
|
2015-10-16 13:53:28 +00:00
|
|
|
int moveResizeStartScreen() const {
|
|
|
|
return m_moveResize.startScreen;
|
|
|
|
}
|
2015-10-16 11:18:59 +00:00
|
|
|
void checkUnrestrictedMoveResize();
|
2015-10-16 13:27:53 +00:00
|
|
|
/**
|
2019-02-02 18:17:44 +00:00
|
|
|
* Sets an appropriate cursor shape for the logical mouse position.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-10-16 13:27:53 +00:00
|
|
|
void updateCursor();
|
2015-10-22 15:27:05 +00:00
|
|
|
void startDelayedMoveResize();
|
|
|
|
void stopDelayedMoveResize();
|
2015-10-22 16:16:21 +00:00
|
|
|
bool startMoveResize();
|
|
|
|
/**
|
2019-01-11 13:36:17 +00:00
|
|
|
* Called from startMoveResize.
|
2015-10-22 16:16:21 +00:00
|
|
|
*
|
|
|
|
* Implementing classes should return @c false if starting move resize should
|
2019-01-12 10:31:32 +00:00
|
|
|
* get aborted. In that case startMoveResize will also return @c false.
|
2015-10-22 16:16:21 +00:00
|
|
|
*
|
|
|
|
* Base implementation returns @c true.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-10-22 16:16:21 +00:00
|
|
|
virtual bool doStartMoveResize();
|
2020-02-17 18:39:17 +00:00
|
|
|
virtual void doFinishMoveResize();
|
2015-10-22 14:01:51 +00:00
|
|
|
void finishMoveResize(bool cancel);
|
2015-10-22 13:58:24 +00:00
|
|
|
/**
|
|
|
|
* Leaves the move resize mode.
|
|
|
|
*
|
|
|
|
* Inheriting classes must invoke the base implementation which
|
|
|
|
* ensures that the internal mode is properly ended.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-10-22 13:58:24 +00:00
|
|
|
virtual void leaveMoveResize();
|
2015-10-23 10:27:06 +00:00
|
|
|
virtual void positionGeometryTip();
|
2015-10-23 11:05:55 +00:00
|
|
|
void performMoveResize();
|
|
|
|
/**
|
|
|
|
* Called from performMoveResize() after actually performing the change of geometry.
|
|
|
|
* Implementing subclasses can perform windowing system specific handling here.
|
|
|
|
*
|
|
|
|
* Default implementation does nothing.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-10-23 11:05:55 +00:00
|
|
|
virtual void doPerformMoveResize();
|
2015-10-23 11:32:18 +00:00
|
|
|
/*
|
|
|
|
* Checks if the mouse cursor is near the edge of the screen and if so
|
|
|
|
* activates quick tiling or maximization
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-10-23 11:32:18 +00:00
|
|
|
void checkQuickTilingMaximizationZones(int xroot, int yroot);
|
2015-10-23 11:33:18 +00:00
|
|
|
/**
|
|
|
|
* Whether a sync request is still pending.
|
|
|
|
* Default implementation returns @c false.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-10-23 11:33:18 +00:00
|
|
|
virtual bool isWaitingForMoveResizeSync() const;
|
|
|
|
/**
|
|
|
|
* Called during handling a resize. Implementing subclasses can use this
|
|
|
|
* method to perform windowing system specific syncing.
|
|
|
|
*
|
|
|
|
* Default implementation does nothing.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-10-23 11:33:18 +00:00
|
|
|
virtual void doResizeSync();
|
|
|
|
void handleMoveResize(int x, int y, int x_root, int y_root);
|
|
|
|
void handleMoveResize(const QPoint &local, const QPoint &global);
|
2015-12-03 14:27:21 +00:00
|
|
|
void dontMoveResize();
|
2015-10-16 07:08:02 +00:00
|
|
|
|
2015-10-26 14:49:03 +00:00
|
|
|
virtual QSize resizeIncrements() const;
|
|
|
|
|
2015-10-28 09:43:49 +00:00
|
|
|
/**
|
2015-12-03 13:07:32 +00:00
|
|
|
* Returns the position depending on the Decoration's section under mouse.
|
|
|
|
* If no decoration it returns PositionCenter.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-12-03 13:07:32 +00:00
|
|
|
Position mousePosition() const;
|
2015-10-28 09:43:49 +00:00
|
|
|
|
2015-10-22 15:08:17 +00:00
|
|
|
static bool haveResizeEffect() {
|
|
|
|
return s_haveResizeEffect;
|
|
|
|
}
|
|
|
|
static void updateHaveResizeEffect();
|
|
|
|
static void resetHaveResizeEffect() {
|
|
|
|
s_haveResizeEffect = false;
|
|
|
|
}
|
|
|
|
|
2015-12-03 12:24:44 +00:00
|
|
|
void setDecoration(KDecoration2::Decoration *decoration) {
|
2015-12-04 07:12:49 +00:00
|
|
|
m_decoration.decoration = decoration;
|
2015-12-03 12:24:44 +00:00
|
|
|
}
|
2020-02-25 12:57:44 +00:00
|
|
|
virtual void createDecoration(const QRect &oldGeometry);
|
2015-12-03 12:24:44 +00:00
|
|
|
virtual void destroyDecoration();
|
2015-12-03 15:40:27 +00:00
|
|
|
void startDecorationDoubleClickTimer();
|
2016-01-05 10:43:12 +00:00
|
|
|
void invalidateDecorationDoubleClickTimer();
|
2020-10-17 12:43:16 +00:00
|
|
|
void updateDecorationInputShape();
|
2015-12-03 12:24:44 +00:00
|
|
|
|
2018-03-11 16:13:32 +00:00
|
|
|
void setDesktopFileName(QByteArray name);
|
2016-10-27 13:59:08 +00:00
|
|
|
QString iconFromDesktopFile() const;
|
|
|
|
|
2017-01-11 09:21:03 +00:00
|
|
|
void updateApplicationMenuServiceName(const QString &serviceName);
|
|
|
|
void updateApplicationMenuObjectPath(const QString &objectPath);
|
|
|
|
|
2017-04-05 09:16:23 +00:00
|
|
|
void setUnresponsive(bool unresponsive);
|
|
|
|
|
2017-07-21 18:22:56 +00:00
|
|
|
virtual void setShortcutInternal();
|
2017-08-03 05:11:40 +00:00
|
|
|
QString shortcutCaptionSuffix() const;
|
|
|
|
virtual void updateCaption() = 0;
|
2017-07-21 18:22:56 +00:00
|
|
|
|
2017-08-20 06:56:13 +00:00
|
|
|
/**
|
2019-01-13 07:22:11 +00:00
|
|
|
* Looks for another AbstractClient with same captionNormal and captionSuffix.
|
2017-08-20 06:56:13 +00:00
|
|
|
* If no such AbstractClient exists @c nullptr is returned.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2017-08-20 06:56:13 +00:00
|
|
|
AbstractClient *findClientWithSameCaption() const;
|
|
|
|
|
2017-10-01 14:38:57 +00:00
|
|
|
void finishWindowRules();
|
|
|
|
void discardTemporaryRules();
|
|
|
|
|
2018-05-05 19:24:49 +00:00
|
|
|
bool tabTo(AbstractClient *other, bool behind, bool activate);
|
|
|
|
|
2020-05-07 16:26:24 +00:00
|
|
|
void startShadeHoverTimer();
|
|
|
|
void startShadeUnhoverTimer();
|
|
|
|
|
2020-09-01 08:58:46 +00:00
|
|
|
// The geometry that the client should be restored when the virtual keyboard closes
|
|
|
|
QRect keyboardGeometryRestore() const;
|
|
|
|
void setKeyboardGeometryRestore(const QRect &geom);
|
|
|
|
|
|
|
|
QRect m_virtualKeyboardGeometry;
|
2020-05-07 16:26:24 +00:00
|
|
|
private Q_SLOTS:
|
|
|
|
void shadeHover();
|
|
|
|
void shadeUnhover();
|
|
|
|
|
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
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-06-06 20:08:12 +00:00
|
|
|
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;
|
2020-07-16 07:17:19 +00:00
|
|
|
bool m_zombie = 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;
|
2020-05-07 16:26:24 +00:00
|
|
|
QTimer *m_shadeHoverTimer = nullptr;
|
|
|
|
ShadeMode m_shadeMode = ShadeNone;
|
2018-11-07 16:22:41 +00:00
|
|
|
QVector <VirtualDesktop *> m_desktops;
|
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
|
|
|
|
2020-04-29 15:18:41 +00:00
|
|
|
KWaylandServer::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
|
2017-07-18 19:12:37 +00:00
|
|
|
QuickTileMode m_electricMode = QuickTileFlag::None;
|
2015-10-12 08:12:07 +00:00
|
|
|
bool m_electricMaximizing = false;
|
2019-02-02 18:17:44 +00:00
|
|
|
// The quick tile mode of this window.
|
2017-07-18 19:12:37 +00:00
|
|
|
int m_quickTileMode = int(QuickTileFlag::None);
|
2015-10-23 11:32:18 +00:00
|
|
|
QTimer *m_electricMaximizingDelay = nullptr;
|
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;
|
2019-10-10 11:52:26 +00:00
|
|
|
QRect m_bufferGeometryBeforeUpdateBlocking;
|
2019-10-10 11:49:11 +00:00
|
|
|
QRect m_frameGeometryBeforeUpdateBlocking;
|
2020-06-01 10:43:49 +00:00
|
|
|
QRect m_clientGeometryBeforeUpdateBlocking;
|
virtualkeyboard: resize the focused window to make room for the keyboard
Summary:
alternative approach: try to resize the winidow to make room for the keyboard.
the new input wayland protocol doesn't have anymore the overlap rectangle (and it would not be going to work with qwidget apps anyways)
in the future will probably be needed anextension to the input protocol v3 which partially gets back this, tough window resizing is needed regardless
what's missing: the resize should be "temporary" and the window should be restored to its previous geometry when the keyboard closes
Test Plan: tested with test QML code
Reviewers: #plasma, #kwin, bshah, graesslin, romangg, davidedmundson
Reviewed By: #plasma, #kwin, romangg, davidedmundson
Subscribers: nicolasfella, mart, kwin, davidedmundson, graesslin
Tags: #kwin
Maniphest Tasks: T9815
Differential Revision: https://phabricator.kde.org/D18818
2019-03-20 10:04:51 +00:00
|
|
|
QRect m_keyboardGeometryRestore;
|
2020-02-04 19:14:13 +00:00
|
|
|
QRect m_maximizeGeometryRestore;
|
2015-10-16 07:08:02 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
bool enabled = false;
|
2015-10-16 07:23:46 +00:00
|
|
|
bool unrestricted = false;
|
2015-10-16 07:46:33 +00:00
|
|
|
QPoint offset;
|
|
|
|
QPoint invertedOffset;
|
2015-10-16 07:57:53 +00:00
|
|
|
QRect initialGeometry;
|
2015-10-16 09:13:41 +00:00
|
|
|
QRect geometry;
|
2015-10-16 11:10:55 +00:00
|
|
|
Position pointer = PositionCenter;
|
2015-10-16 12:58:43 +00:00
|
|
|
bool buttonDown = false;
|
2018-06-07 00:33:54 +00:00
|
|
|
CursorShape cursor = Qt::ArrowCursor;
|
2015-10-16 13:53:28 +00:00
|
|
|
int startScreen = 0;
|
2015-10-22 15:27:05 +00:00
|
|
|
QTimer *delayedTimer = nullptr;
|
2015-10-16 07:08:02 +00:00
|
|
|
} m_moveResize;
|
2015-10-22 15:08:17 +00:00
|
|
|
|
2015-12-04 07:12:49 +00:00
|
|
|
struct {
|
|
|
|
KDecoration2::Decoration *decoration = nullptr;
|
|
|
|
QPointer<Decoration::DecoratedClientImpl> client;
|
|
|
|
QElapsedTimer doubleClickTimer;
|
2020-10-17 12:43:16 +00:00
|
|
|
QRegion inputRegion;
|
2015-12-04 07:12:49 +00:00
|
|
|
} m_decoration;
|
2016-10-27 13:59:08 +00:00
|
|
|
QByteArray m_desktopFileName;
|
|
|
|
|
2017-01-11 09:21:03 +00:00
|
|
|
bool m_applicationMenuActive = false;
|
|
|
|
QString m_applicationMenuServiceName;
|
|
|
|
QString m_applicationMenuObjectPath;
|
2015-10-22 15:08:17 +00:00
|
|
|
|
2017-04-05 09:16:23 +00:00
|
|
|
bool m_unresponsive = false;
|
|
|
|
|
2017-07-21 18:22:56 +00:00
|
|
|
QKeySequence _shortcut;
|
|
|
|
|
2017-10-01 14:38:57 +00:00
|
|
|
WindowRules m_rules;
|
|
|
|
|
2015-10-22 15:08:17 +00:00
|
|
|
static bool s_haveResizeEffect;
|
2015-10-13 11:15:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper for AbstractClient::blockGeometryUpdates() being called in pairs (true/false)
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-10-13 11:15:39 +00:00
|
|
|
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-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*>)
|
2017-11-05 09:10:17 +00:00
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::AbstractClient::SameApplicationChecks)
|
2015-03-05 09:21:03 +00:00
|
|
|
|
|
|
|
#endif
|