2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2006 Lubos Lunak <l.lunak@kde.org>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#ifndef KWIN_TOPLEVEL_H
|
|
|
|
#define KWIN_TOPLEVEL_H
|
|
|
|
|
2013-04-26 09:27:30 +00:00
|
|
|
// kwin
|
2013-07-01 06:37:59 +00:00
|
|
|
#include "input.h"
|
2007-04-29 17:35:43 +00:00
|
|
|
#include "utils.h"
|
2012-11-16 07:23:47 +00:00
|
|
|
#include "virtualdesktops.h"
|
2013-09-10 05:09:44 +00:00
|
|
|
#include "xcbutils.h"
|
2013-04-26 08:41:24 +00:00
|
|
|
// KDE
|
2014-03-18 13:32:53 +00:00
|
|
|
#include <NETWM>
|
2013-04-26 09:27:30 +00:00
|
|
|
// Qt
|
|
|
|
#include <QObject>
|
2015-12-07 13:25:08 +00:00
|
|
|
#include <QMatrix4x4>
|
2018-11-18 19:13:55 +00:00
|
|
|
#include <QUuid>
|
2013-04-26 09:27:30 +00:00
|
|
|
// xcb
|
2013-04-26 09:12:52 +00:00
|
|
|
#include <xcb/damage.h>
|
2012-03-28 18:29:33 +00:00
|
|
|
#include <xcb/xfixes.h>
|
2014-04-29 05:49:54 +00:00
|
|
|
// c++
|
|
|
|
#include <functional>
|
2012-03-28 18:29:33 +00:00
|
|
|
|
2015-08-18 12:40:26 +00:00
|
|
|
class QOpenGLFramebufferObject;
|
|
|
|
|
2020-04-29 15:18:41 +00:00
|
|
|
namespace KWaylandServer
|
2015-02-09 15:08:53 +00:00
|
|
|
{
|
|
|
|
class SurfaceInterface;
|
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2013-01-07 07:07:27 +00:00
|
|
|
class ClientMachine;
|
2019-10-31 13:20:42 +00:00
|
|
|
class Deleted;
|
2007-04-29 17:35:43 +00:00
|
|
|
class EffectWindowImpl;
|
2011-03-27 10:33:07 +00:00
|
|
|
class Shadow;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2014-04-07 14:23:17 +00:00
|
|
|
/**
|
|
|
|
* Enum to describe the reason why a Toplevel has to be released.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2014-04-07 14:23:17 +00:00
|
|
|
enum class ReleaseReason {
|
|
|
|
Release, ///< Normal Release after e.g. an Unmap notify event (window still valid)
|
|
|
|
Destroyed, ///< Release after an Destroy notify event (window no longer valid)
|
|
|
|
KWinShutsDown ///< Release on KWin Shutdown (window still valid)
|
|
|
|
};
|
|
|
|
|
2019-10-02 09:57:59 +00:00
|
|
|
class KWIN_EXPORT Toplevel : public QObject
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
Q_OBJECT
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-06-01 14:25:21 +00:00
|
|
|
Q_PROPERTY(bool alpha READ hasAlpha NOTIFY hasAlphaChanged)
|
2011-12-18 09:29:32 +00:00
|
|
|
Q_PROPERTY(qulonglong frameId READ frameId)
|
2019-09-27 10:01:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This property holds the geometry of the Toplevel, excluding invisible
|
|
|
|
* portions, e.g. client-side and server-side drop-shadows, etc.
|
|
|
|
*
|
|
|
|
* @deprecated Use frameGeometry property instead.
|
|
|
|
*/
|
2020-02-05 09:28:50 +00:00
|
|
|
Q_PROPERTY(QRect geometry READ frameGeometry NOTIFY frameGeometryChanged)
|
2019-09-27 10:01:10 +00:00
|
|
|
|
2019-10-03 19:43:28 +00:00
|
|
|
/**
|
|
|
|
* This property holds rectangle that the pixmap or buffer of this Toplevel
|
|
|
|
* occupies on the screen. This rectangle includes invisible portions of the
|
|
|
|
* client, e.g. client-side drop shadows, etc.
|
|
|
|
*/
|
2020-02-05 09:28:50 +00:00
|
|
|
Q_PROPERTY(QRect bufferGeometry READ bufferGeometry)
|
2019-10-03 19:43:28 +00:00
|
|
|
|
2019-09-27 10:01:10 +00:00
|
|
|
/**
|
|
|
|
* This property holds the geometry of the Toplevel, excluding invisible
|
|
|
|
* portions, e.g. server-side and client-side drop-shadows, etc.
|
|
|
|
*/
|
2020-02-05 09:28:50 +00:00
|
|
|
Q_PROPERTY(QRect frameGeometry READ frameGeometry NOTIFY frameGeometryChanged)
|
2019-09-27 10:01:10 +00:00
|
|
|
|
2019-09-27 10:10:13 +00:00
|
|
|
/**
|
|
|
|
* This property holds the position of the Toplevel's frame geometry.
|
|
|
|
*/
|
2011-12-18 09:29:32 +00:00
|
|
|
Q_PROPERTY(QPoint pos READ pos)
|
2019-09-27 10:10:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This property holds the size of the Toplevel's frame geometry.
|
|
|
|
*/
|
2011-12-18 09:29:32 +00:00
|
|
|
Q_PROPERTY(QSize size READ size)
|
2019-09-27 10:10:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This property holds the x position of the Toplevel's frame geometry.
|
|
|
|
*/
|
2011-12-18 09:29:32 +00:00
|
|
|
Q_PROPERTY(int x READ x)
|
2019-09-27 10:10:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This property holds the y position of the Toplevel's frame geometry.
|
|
|
|
*/
|
2011-12-18 09:29:32 +00:00
|
|
|
Q_PROPERTY(int y READ y)
|
2019-09-27 10:10:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This property holds the width of the Toplevel's frame geometry.
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(int width READ width)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This property holds the height of the Toplevel's frame geometry.
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(int height READ height)
|
|
|
|
|
|
|
|
Q_PROPERTY(QRect visibleRect READ visibleRect)
|
|
|
|
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged)
|
|
|
|
Q_PROPERTY(int screen READ screen NOTIFY screenChanged)
|
|
|
|
Q_PROPERTY(qulonglong windowId READ windowId CONSTANT)
|
2011-12-29 09:19:36 +00:00
|
|
|
Q_PROPERTY(int desktop READ desktop)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2012-06-22 07:29:32 +00:00
|
|
|
/**
|
|
|
|
* Whether the window is on all desktops. That is desktop is -1.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-06-22 07:29:32 +00:00
|
|
|
Q_PROPERTY(bool onAllDesktops READ isOnAllDesktops)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2011-12-29 09:19:36 +00:00
|
|
|
Q_PROPERTY(QRect rect READ rect)
|
|
|
|
Q_PROPERTY(QPoint clientPos READ clientPos)
|
|
|
|
Q_PROPERTY(QSize clientSize READ clientSize)
|
2014-04-11 06:06:26 +00:00
|
|
|
Q_PROPERTY(QByteArray resourceName READ resourceName NOTIFY windowClassChanged)
|
|
|
|
Q_PROPERTY(QByteArray resourceClass READ resourceClass NOTIFY windowClassChanged)
|
2014-04-10 09:12:48 +00:00
|
|
|
Q_PROPERTY(QByteArray windowRole READ windowRole NOTIFY windowRoleChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2011-12-29 09:19:36 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is a desktop background window (the one with wallpaper).
|
2019-03-25 18:11:15 +00:00
|
|
|
* See _NET_WM_WINDOW_TYPE_DESKTOP at https://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-12-29 09:19:36 +00:00
|
|
|
Q_PROPERTY(bool desktopWindow READ isDesktop)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2011-12-29 09:19:36 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is a dock (i.e. a panel).
|
2019-03-25 18:11:15 +00:00
|
|
|
* See _NET_WM_WINDOW_TYPE_DOCK at https://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-12-29 09:19:36 +00:00
|
|
|
Q_PROPERTY(bool dock READ isDock)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2011-12-29 09:19:36 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is a standalone (detached) toolbar window.
|
2019-03-25 18:11:15 +00:00
|
|
|
* See _NET_WM_WINDOW_TYPE_TOOLBAR at https://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-12-29 09:19:36 +00:00
|
|
|
Q_PROPERTY(bool toolbar READ isToolbar)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2011-12-29 09:19:36 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is a torn-off menu.
|
2019-03-25 18:11:15 +00:00
|
|
|
* See _NET_WM_WINDOW_TYPE_MENU at https://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-12-29 09:19:36 +00:00
|
|
|
Q_PROPERTY(bool menu READ isMenu)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2011-12-29 09:19:36 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is a "normal" window, i.e. an application or any other window
|
|
|
|
* for which none of the specialized window types fit.
|
2019-03-25 18:11:15 +00:00
|
|
|
* See _NET_WM_WINDOW_TYPE_NORMAL at https://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-12-29 09:19:36 +00:00
|
|
|
Q_PROPERTY(bool normalWindow READ isNormalWindow)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2011-12-29 09:19:36 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is a dialog window.
|
2019-03-25 18:11:15 +00:00
|
|
|
* See _NET_WM_WINDOW_TYPE_DIALOG at https://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-12-29 09:19:36 +00:00
|
|
|
Q_PROPERTY(bool dialog READ isDialog)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2011-12-29 09:19:36 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is a splashscreen. Note that many (especially older) applications
|
|
|
|
* do not support marking their splash windows with this type.
|
2019-03-25 18:11:15 +00:00
|
|
|
* See _NET_WM_WINDOW_TYPE_SPLASH at https://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-12-29 09:19:36 +00:00
|
|
|
Q_PROPERTY(bool splash READ isSplash)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2011-12-29 09:19:36 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is a utility window, such as a tool window.
|
2019-03-25 18:11:15 +00:00
|
|
|
* See _NET_WM_WINDOW_TYPE_UTILITY at https://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-12-29 09:19:36 +00:00
|
|
|
Q_PROPERTY(bool utility READ isUtility)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2011-12-29 09:19:36 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is a dropdown menu (i.e. a popup directly or indirectly open
|
|
|
|
* from the applications menubar).
|
2019-03-25 18:11:15 +00:00
|
|
|
* See _NET_WM_WINDOW_TYPE_DROPDOWN_MENU at https://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-12-29 09:19:36 +00:00
|
|
|
Q_PROPERTY(bool dropdownMenu READ isDropdownMenu)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2011-12-29 09:19:36 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is a popup menu (that is not a torn-off or dropdown menu).
|
2019-03-25 18:11:15 +00:00
|
|
|
* See _NET_WM_WINDOW_TYPE_POPUP_MENU at https://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-12-29 09:19:36 +00:00
|
|
|
Q_PROPERTY(bool popupMenu READ isPopupMenu)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2011-12-29 09:19:36 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is a tooltip.
|
2019-03-25 18:11:15 +00:00
|
|
|
* See _NET_WM_WINDOW_TYPE_TOOLTIP at https://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-12-29 09:19:36 +00:00
|
|
|
Q_PROPERTY(bool tooltip READ isTooltip)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2011-12-29 09:19:36 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is a window with a notification.
|
2019-03-25 18:11:15 +00:00
|
|
|
* See _NET_WM_WINDOW_TYPE_NOTIFICATION at https://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-12-29 09:19:36 +00:00
|
|
|
Q_PROPERTY(bool notification READ isNotification)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2019-05-02 08:29:38 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is a window with a critical notification.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-05-02 08:29:38 +00:00
|
|
|
Q_PROPERTY(bool criticalNotification READ isCriticalNotification)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-01-02 11:11:54 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is an On Screen Display.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-01-02 11:11:54 +00:00
|
|
|
Q_PROPERTY(bool onScreenDisplay READ isOnScreenDisplay)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2011-12-29 09:19:36 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is a combobox popup.
|
2019-03-25 18:11:15 +00:00
|
|
|
* See _NET_WM_WINDOW_TYPE_COMBO at https://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-12-29 09:19:36 +00:00
|
|
|
Q_PROPERTY(bool comboBox READ isComboBox)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2011-12-29 09:19:36 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is a Drag&Drop icon.
|
2019-03-25 18:11:15 +00:00
|
|
|
* See _NET_WM_WINDOW_TYPE_DND at https://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-12-29 09:19:36 +00:00
|
|
|
Q_PROPERTY(bool dndIcon READ isDNDIcon)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2011-12-29 09:19:36 +00:00
|
|
|
/**
|
|
|
|
* Returns the NETWM window type
|
2019-03-25 18:11:15 +00:00
|
|
|
* See https://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-12-29 09:19:36 +00:00
|
|
|
Q_PROPERTY(int windowType READ windowType)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2020-09-18 15:57:39 +00:00
|
|
|
Q_PROPERTY(QStringList activities READ activities)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2012-01-15 09:51:09 +00:00
|
|
|
/**
|
|
|
|
* Whether this Toplevel is managed by KWin (it has control over its placement and other
|
|
|
|
* aspects, as opposed to override-redirect windows that are entirely handled by the application).
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-01-15 09:51:09 +00:00
|
|
|
Q_PROPERTY(bool managed READ isClient CONSTANT)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2012-01-15 09:51:09 +00:00
|
|
|
/**
|
|
|
|
* Whether this Toplevel represents an already deleted window and only kept for the compositor for animations.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-01-15 09:51:09 +00:00
|
|
|
Q_PROPERTY(bool deleted READ isDeleted CONSTANT)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2012-01-15 10:03:15 +00:00
|
|
|
/**
|
|
|
|
* Whether the window has an own shape
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-01-15 10:03:15 +00:00
|
|
|
Q_PROPERTY(bool shaped READ shape NOTIFY shapedChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2014-01-24 11:34:16 +00:00
|
|
|
/**
|
|
|
|
* Whether the window does not want to be animated on window close.
|
|
|
|
* There are legit reasons for this like a screenshot application which does not want it's
|
|
|
|
* window being captured.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2014-01-24 11:34:16 +00:00
|
|
|
Q_PROPERTY(bool skipsCloseAnimation READ skipsCloseAnimation WRITE setSkipCloseAnimation NOTIFY skipCloseAnimationChanged)
|
2019-07-03 16:56:36 +00:00
|
|
|
|
2015-01-09 10:16:57 +00:00
|
|
|
/**
|
|
|
|
* The Id of the Wayland Surface associated with this Toplevel.
|
|
|
|
* On X11 only setups the value is @c 0.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-01-09 10:16:57 +00:00
|
|
|
Q_PROPERTY(quint32 surfaceId READ surfaceId NOTIFY surfaceIdChanged)
|
2015-08-31 13:47:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface to the Wayland Surface.
|
|
|
|
* Relevant only in Wayland, in X11 it will be nullptr
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2020-04-29 15:18:41 +00:00
|
|
|
Q_PROPERTY(KWaylandServer::SurfaceInterface *surface READ surface)
|
2015-08-31 13:47:01 +00:00
|
|
|
|
[effects] Make Scale and Glide effects Wayland-friendly
Summary:
The Scale effect and the Glide effect have to animate only ordinary
windows(i.e. the ones that are considered to be apps).
On X11, in order to distinguish ordinary windows from combo box popups,
popup menus, and other popups, those effects check whether given window
is managed.
On Wayland, there is no concept of managed/unmanaged windows.
XDG Shell protocol defines 2 surface roles:
* xdg_toplevel;
* and, xdg_popup.
The former can be used to implement typical windows, the ones that can
be minimized, maximized, etc.
The latter can be used to implement tooltips, popup menus, etc. Thus,
that's a good criteria to filter popup windows.
CCBUG: 398100
Reviewers: #kwin, graesslin, davidedmundson
Reviewed By: #kwin, graesslin, davidedmundson
Subscribers: davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15117
2018-10-08 18:08:13 +00:00
|
|
|
/**
|
|
|
|
* Whether the window is a popup.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[effects] Make Scale and Glide effects Wayland-friendly
Summary:
The Scale effect and the Glide effect have to animate only ordinary
windows(i.e. the ones that are considered to be apps).
On X11, in order to distinguish ordinary windows from combo box popups,
popup menus, and other popups, those effects check whether given window
is managed.
On Wayland, there is no concept of managed/unmanaged windows.
XDG Shell protocol defines 2 surface roles:
* xdg_toplevel;
* and, xdg_popup.
The former can be used to implement typical windows, the ones that can
be minimized, maximized, etc.
The latter can be used to implement tooltips, popup menus, etc. Thus,
that's a good criteria to filter popup windows.
CCBUG: 398100
Reviewers: #kwin, graesslin, davidedmundson
Reviewed By: #kwin, graesslin, davidedmundson
Subscribers: davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15117
2018-10-08 18:08:13 +00:00
|
|
|
Q_PROPERTY(bool popupWindow READ isPopupWindow)
|
|
|
|
|
2019-03-19 14:01:29 +00:00
|
|
|
/**
|
|
|
|
* Whether this Toplevel represents the outline.
|
|
|
|
*
|
|
|
|
* @note It's always @c false if compositing is turned off.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-03-19 14:01:29 +00:00
|
|
|
Q_PROPERTY(bool outline READ isOutline)
|
|
|
|
|
2019-09-02 10:39:53 +00:00
|
|
|
/**
|
|
|
|
* This property holds a UUID to uniquely identify this Toplevel.
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(QUuid internalId READ internalId CONSTANT)
|
|
|
|
|
2020-08-21 13:44:52 +00:00
|
|
|
/**
|
|
|
|
* The pid of the process owning this window.
|
|
|
|
*
|
|
|
|
* @since 5.20
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(int pid READ pid CONSTANT)
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
public:
|
2013-05-08 11:39:06 +00:00
|
|
|
explicit Toplevel();
|
2013-09-10 06:13:33 +00:00
|
|
|
virtual xcb_window_t frameId() const;
|
2016-05-02 15:47:39 +00:00
|
|
|
xcb_window_t window() const;
|
|
|
|
/**
|
2019-01-12 10:31:32 +00:00
|
|
|
* @return a unique identifier for the Toplevel. On X11 same as @ref window
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-05-02 15:47:39 +00:00
|
|
|
virtual quint32 windowId() const;
|
2019-10-03 19:43:28 +00:00
|
|
|
/**
|
|
|
|
* Returns the geometry of the pixmap or buffer attached to this Toplevel.
|
|
|
|
*
|
|
|
|
* For X11 clients, this method returns server-side geometry of the Toplevel.
|
|
|
|
*
|
|
|
|
* For Wayland clients, this method returns rectangle that the main surface
|
|
|
|
* occupies on the screen, in global screen coordinates.
|
|
|
|
*/
|
|
|
|
virtual QRect bufferGeometry() const = 0;
|
2019-12-02 17:36:13 +00:00
|
|
|
/**
|
|
|
|
* Returns the extents of invisible portions in the pixmap.
|
|
|
|
*
|
|
|
|
* An X11 pixmap may contain invisible space around the actual contents of the
|
|
|
|
* client. That space is reserved for server-side decoration, which we usually
|
|
|
|
* want to skip when building contents window quads.
|
|
|
|
*
|
|
|
|
* Default implementation returns a margins object with all margins set to 0.
|
|
|
|
*/
|
|
|
|
virtual QMargins bufferMargins() const;
|
2019-09-27 10:01:10 +00:00
|
|
|
/**
|
|
|
|
* Returns the geometry of the Toplevel, excluding invisible portions, e.g.
|
|
|
|
* server-side and client-side drop shadows, etc.
|
|
|
|
*/
|
|
|
|
QRect frameGeometry() const;
|
2020-06-01 10:43:49 +00:00
|
|
|
/**
|
|
|
|
* Returns the geometry of the client window, in global screen coordinates.
|
|
|
|
*/
|
|
|
|
QRect clientGeometry() const;
|
2019-09-27 10:33:42 +00:00
|
|
|
/**
|
|
|
|
* Returns the extents of the server-side decoration.
|
|
|
|
*
|
|
|
|
* Note that the returned margins object will have all margins set to 0 if
|
|
|
|
* the client doesn't have a server-side decoration.
|
|
|
|
*
|
|
|
|
* Default implementation returns a margins object with all margins set to 0.
|
|
|
|
*/
|
|
|
|
virtual QMargins frameMargins() const;
|
2016-09-15 09:44:32 +00:00
|
|
|
/**
|
|
|
|
* The geometry of the Toplevel which accepts input events. This might be larger
|
|
|
|
* than the actual geometry, e.g. to support resizing outside the window.
|
|
|
|
*
|
|
|
|
* Default implementation returns same as geometry.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-09-15 09:44:32 +00:00
|
|
|
virtual QRect inputGeometry() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
QSize size() const;
|
|
|
|
QPoint pos() const;
|
|
|
|
QRect rect() const;
|
|
|
|
int x() const;
|
|
|
|
int y() const;
|
|
|
|
int width() const;
|
|
|
|
int height() const;
|
|
|
|
bool isOnScreen(int screen) const; // true if it's at least partially there
|
2013-04-03 10:19:27 +00:00
|
|
|
bool isOnActiveScreen() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
int screen() const; // the screen where the center is
|
2017-11-01 17:54:21 +00:00
|
|
|
/**
|
|
|
|
* The scale of the screen this window is currently on
|
2019-01-11 13:36:17 +00:00
|
|
|
* @note The buffer scale can be different.
|
2017-11-01 17:54:21 +00:00
|
|
|
* @since 5.12
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2017-11-01 17:54:21 +00:00
|
|
|
qreal screenScale() const; //
|
2019-08-26 07:44:04 +00:00
|
|
|
/**
|
|
|
|
* Returns the ratio between physical pixels and device-independent pixels for
|
|
|
|
* the attached buffer (or pixmap).
|
|
|
|
*
|
|
|
|
* For X11 clients, this method always returns 1.
|
|
|
|
*/
|
|
|
|
virtual qreal bufferScale() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual QPoint clientPos() const = 0; // inside of geometry()
|
2015-12-08 09:11:26 +00:00
|
|
|
/**
|
|
|
|
* Describes how the client's content maps to the window geometry including the frame.
|
|
|
|
* The default implementation is a 1:1 mapping meaning the frame is part of the content.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-12-08 09:11:26 +00:00
|
|
|
virtual QPoint clientContentPos() const;
|
2020-06-01 10:43:49 +00:00
|
|
|
QSize clientSize() const;
|
2020-01-28 18:45:58 +00:00
|
|
|
/**
|
|
|
|
* Returns a rectangle that the window occupies on the screen, including drop-shadows.
|
|
|
|
*/
|
|
|
|
virtual QRect visibleRect() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual QRect transparentRect() const = 0;
|
2012-01-15 09:51:09 +00:00
|
|
|
virtual bool isClient() const;
|
|
|
|
virtual bool isDeleted() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2020-10-17 12:40:51 +00:00
|
|
|
/**
|
|
|
|
* Maps the specified @a point from the global screen coordinates to the frame coordinates.
|
|
|
|
*/
|
|
|
|
QPoint mapToFrame(const QPoint &point) const;
|
|
|
|
/**
|
|
|
|
* Maps the specified @a point from the global screen coordinates to the surface-local
|
|
|
|
* coordinates of the main surface. For X11 clients, this function maps the specified point
|
|
|
|
* from the global screen coordinates to the buffer-local coordinates.
|
|
|
|
*/
|
|
|
|
QPoint mapToLocal(const QPoint &point) const;
|
|
|
|
QPointF mapToLocal(const QPointF &point) const;
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
// prefer isXXX() instead
|
|
|
|
// 0 for supported types means default for managed/unmanaged types
|
2012-09-06 07:09:31 +00:00
|
|
|
virtual NET::WindowType windowType(bool direct = false, int supported_types = 0) const = 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
bool hasNETSupport() const;
|
|
|
|
bool isDesktop() const;
|
|
|
|
bool isDock() const;
|
|
|
|
bool isToolbar() const;
|
|
|
|
bool isMenu() const;
|
|
|
|
bool isNormalWindow() const; // normal as in 'NET::Normal or NET::Unknown non-transient'
|
|
|
|
bool isDialog() const;
|
|
|
|
bool isSplash() const;
|
|
|
|
bool isUtility() const;
|
|
|
|
bool isDropdownMenu() const;
|
|
|
|
bool isPopupMenu() const; // a context popup, not dropdown, not torn-off
|
|
|
|
bool isTooltip() const;
|
|
|
|
bool isNotification() const;
|
2019-05-02 08:29:38 +00:00
|
|
|
bool isCriticalNotification() const;
|
2015-01-02 11:11:54 +00:00
|
|
|
bool isOnScreenDisplay() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
bool isComboBox() const;
|
|
|
|
bool isDNDIcon() const;
|
|
|
|
|
2015-11-16 10:19:38 +00:00
|
|
|
virtual bool isLockScreen() const;
|
|
|
|
virtual bool isInputMethod() const;
|
2019-03-19 14:01:29 +00:00
|
|
|
virtual bool isOutline() const;
|
2015-11-16 10:19:38 +00:00
|
|
|
|
2017-04-27 09:40:35 +00:00
|
|
|
/**
|
|
|
|
* Returns the virtual desktop within the workspace() the client window
|
|
|
|
* is located in, 0 if it isn't located on any special desktop (not mapped yet),
|
|
|
|
* or NET::OnAllDesktops. Do not use desktop() directly, use
|
|
|
|
* isOnDesktop() instead.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual int desktop() const = 0;
|
2018-11-07 16:22:41 +00:00
|
|
|
virtual QVector<VirtualDesktop *> desktops() const = 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual QStringList activities() const = 0;
|
|
|
|
bool isOnDesktop(int d) const;
|
|
|
|
bool isOnActivity(const QString &activity) const;
|
|
|
|
bool isOnCurrentDesktop() const;
|
|
|
|
bool isOnCurrentActivity() const;
|
|
|
|
bool isOnAllDesktops() const;
|
|
|
|
bool isOnAllActivities() const;
|
|
|
|
|
2015-03-04 07:53:51 +00:00
|
|
|
virtual QByteArray windowRole() const;
|
2012-04-12 19:52:44 +00:00
|
|
|
QByteArray sessionId() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
QByteArray resourceName() const;
|
|
|
|
QByteArray resourceClass() const;
|
2016-06-23 17:40:40 +00:00
|
|
|
QByteArray wmCommand();
|
2011-01-30 14:34:42 +00:00
|
|
|
QByteArray wmClientMachine(bool use_localhost) const;
|
2013-01-07 07:07:27 +00:00
|
|
|
const ClientMachine *clientMachine() const;
|
2018-12-23 07:56:15 +00:00
|
|
|
virtual bool isLocalhost() const;
|
2019-09-06 14:30:26 +00:00
|
|
|
xcb_window_t wmClientLeader() const;
|
2017-05-13 15:02:30 +00:00
|
|
|
virtual pid_t pid() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
static bool resourceMatch(const Toplevel* c1, const Toplevel* c2);
|
|
|
|
|
|
|
|
bool readyForPainting() const; // true if the window has been already painted its contents
|
2014-04-25 10:06:39 +00:00
|
|
|
xcb_visualid_t visual() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
bool shape() const;
|
2015-06-18 21:19:13 +00:00
|
|
|
QRegion inputShape() const;
|
2015-03-16 08:13:19 +00:00
|
|
|
virtual void setOpacity(double opacity);
|
2015-03-04 06:56:51 +00:00
|
|
|
virtual double opacity() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
int depth() const;
|
|
|
|
bool hasAlpha() const;
|
2012-04-28 07:39:39 +00:00
|
|
|
virtual bool setupCompositing();
|
2014-04-07 14:23:17 +00:00
|
|
|
virtual void finishCompositing(ReleaseReason releaseReason = ReleaseReason::Release);
|
2012-01-15 10:39:01 +00:00
|
|
|
Q_INVOKABLE void addRepaint(const QRect& r);
|
|
|
|
Q_INVOKABLE void addRepaint(const QRegion& r);
|
|
|
|
Q_INVOKABLE void addRepaint(int x, int y, int w, int h);
|
2012-02-07 16:01:41 +00:00
|
|
|
Q_INVOKABLE void addLayerRepaint(const QRect& r);
|
|
|
|
Q_INVOKABLE void addLayerRepaint(const QRegion& r);
|
|
|
|
Q_INVOKABLE void addLayerRepaint(int x, int y, int w, int h);
|
2012-01-15 10:39:01 +00:00
|
|
|
Q_INVOKABLE virtual void addRepaintFull();
|
2011-01-30 14:34:42 +00:00
|
|
|
// these call workspace->addRepaint(), but first transform the damage if needed
|
|
|
|
void addWorkspaceRepaint(const QRect& r);
|
|
|
|
void addWorkspaceRepaint(int x, int y, int w, int h);
|
|
|
|
QRegion repaints() const;
|
2012-02-07 16:01:41 +00:00
|
|
|
void resetRepaints();
|
2011-01-30 14:34:42 +00:00
|
|
|
QRegion damage() const;
|
2013-05-15 11:07:10 +00:00
|
|
|
void resetDamage();
|
2011-01-30 14:34:42 +00:00
|
|
|
EffectWindowImpl* effectWindow();
|
2011-04-03 09:31:33 +00:00
|
|
|
const EffectWindowImpl* effectWindow() const;
|
2013-04-24 08:46:34 +00:00
|
|
|
/**
|
|
|
|
* Window will be temporarily painted as if being at the top of the stack.
|
|
|
|
* Only available if Compositor is active, if not active, this method is a no-op.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2013-04-24 08:46:34 +00:00
|
|
|
void elevate(bool elevate);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2011-03-27 10:33:07 +00:00
|
|
|
/**
|
|
|
|
* Returns the pointer to the Toplevel's Shadow. A Shadow
|
|
|
|
* is only available if Compositing is enabled and the corresponding X window
|
|
|
|
* has the Shadow property set.
|
2019-09-29 11:15:18 +00:00
|
|
|
* @returns The Shadow belonging to this Toplevel, @c null if there's no Shadow.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-04-03 09:31:33 +00:00
|
|
|
const Shadow *shadow() const;
|
|
|
|
Shadow *shadow();
|
|
|
|
/**
|
|
|
|
* Updates the Shadow associated with this Toplevel from X11 Property.
|
|
|
|
* Call this method when the Property changes or Compositing is started.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-09-29 11:26:04 +00:00
|
|
|
void updateShadow();
|
2014-07-24 06:55:57 +00:00
|
|
|
/**
|
|
|
|
* Whether the Toplevel currently wants the shadow to be rendered. Default
|
|
|
|
* implementation always returns @c true.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2014-07-24 06:55:57 +00:00
|
|
|
virtual bool wantsShadowToBeRendered() const;
|
2011-03-27 10:33:07 +00:00
|
|
|
|
2011-10-22 09:02:49 +00:00
|
|
|
/**
|
|
|
|
* This method returns the area that the Toplevel window reports to be opaque.
|
2019-01-12 10:31:32 +00:00
|
|
|
* It is supposed to only provide valuable information if hasAlpha is @c true .
|
2011-10-22 09:02:49 +00:00
|
|
|
* @see hasAlpha
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-10-22 09:02:49 +00:00
|
|
|
const QRegion& opaqueRegion() const;
|
|
|
|
|
2012-04-07 14:43:27 +00:00
|
|
|
virtual Layer layer() const = 0;
|
|
|
|
|
2012-03-28 18:29:33 +00:00
|
|
|
/**
|
|
|
|
* Resets the damage state and sends a request for the damage region.
|
|
|
|
* A call to this function must be followed by a call to getDamageRegionReply(),
|
|
|
|
* or the reply will be leaked.
|
|
|
|
*
|
|
|
|
* Returns true if the window was damaged, and false otherwise.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-03-28 18:29:33 +00:00
|
|
|
bool resetAndFetchDamage();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the reply from a previous call to resetAndFetchDamage().
|
|
|
|
* Calling this function is a no-op if there is no pending reply.
|
|
|
|
* Call damage() to return the fetched region.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-03-28 18:29:33 +00:00
|
|
|
void getDamageRegionReply();
|
|
|
|
|
2014-01-24 11:34:16 +00:00
|
|
|
bool skipsCloseAnimation() const;
|
|
|
|
void setSkipCloseAnimation(bool set);
|
|
|
|
|
2015-01-09 10:16:57 +00:00
|
|
|
quint32 surfaceId() const;
|
2020-04-29 15:18:41 +00:00
|
|
|
KWaylandServer::SurfaceInterface *surface() const;
|
|
|
|
void setSurface(KWaylandServer::SurfaceInterface *surface);
|
2015-01-09 10:16:57 +00:00
|
|
|
|
2015-08-18 12:40:26 +00:00
|
|
|
const QSharedPointer<QOpenGLFramebufferObject> &internalFramebufferObject() const;
|
2019-08-26 07:44:04 +00:00
|
|
|
QImage internalImageObject() const;
|
2015-08-18 12:40:26 +00:00
|
|
|
|
2015-12-07 13:25:08 +00:00
|
|
|
/**
|
|
|
|
* @returns Transformation to map from global to window coordinates.
|
|
|
|
*
|
|
|
|
* Default implementation returns a translation on negative pos().
|
|
|
|
* @see pos
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-12-07 13:25:08 +00:00
|
|
|
virtual QMatrix4x4 inputTransformation() const;
|
|
|
|
|
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
|
|
|
/**
|
|
|
|
* Returns @c true if the toplevel can accept input at the specified position @a point.
|
|
|
|
*/
|
|
|
|
virtual bool hitTest(const QPoint &point) const;
|
|
|
|
|
2017-03-25 17:41:28 +00:00
|
|
|
/**
|
|
|
|
* The window has a popup grab. This means that when it got mapped the
|
|
|
|
* parent window had an implicit (pointer) grab.
|
|
|
|
*
|
|
|
|
* Normally this is only relevant for transient windows.
|
|
|
|
*
|
|
|
|
* Once the popup grab ends (e.g. pointer press outside of any Toplevel of
|
|
|
|
* the client), the method popupDone should be invoked.
|
|
|
|
*
|
|
|
|
* The default implementation returns @c false.
|
|
|
|
* @see popupDone
|
|
|
|
* @since 5.10
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2017-03-25 17:41:28 +00:00
|
|
|
virtual bool hasPopupGrab() const {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* This method should be invoked for Toplevels with a popup grab when
|
|
|
|
* the grab ends.
|
|
|
|
*
|
|
|
|
* The default implementation does nothing.
|
|
|
|
* @see hasPopupGrab
|
|
|
|
* @since 5.10
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2017-03-25 17:41:28 +00:00
|
|
|
virtual void popupDone() {};
|
|
|
|
|
2014-03-20 06:52:18 +00:00
|
|
|
/**
|
|
|
|
* @brief Finds the Toplevel matching the condition expressed in @p func in @p list.
|
|
|
|
*
|
|
|
|
* The method is templated to operate on either a list of Toplevels or on a list of
|
|
|
|
* a subclass type of Toplevel.
|
|
|
|
* @param list The list to search in
|
|
|
|
* @param func The condition function (compare std::find_if)
|
|
|
|
* @return T* The found Toplevel or @c null if there is no matching Toplevel
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-02-09 15:07:30 +00:00
|
|
|
template <class T, class U>
|
|
|
|
static T *findInList(const QList<T*> &list, std::function<bool (const U*)> func);
|
2014-03-20 06:52:18 +00:00
|
|
|
|
[effects] Make Scale and Glide effects Wayland-friendly
Summary:
The Scale effect and the Glide effect have to animate only ordinary
windows(i.e. the ones that are considered to be apps).
On X11, in order to distinguish ordinary windows from combo box popups,
popup menus, and other popups, those effects check whether given window
is managed.
On Wayland, there is no concept of managed/unmanaged windows.
XDG Shell protocol defines 2 surface roles:
* xdg_toplevel;
* and, xdg_popup.
The former can be used to implement typical windows, the ones that can
be minimized, maximized, etc.
The latter can be used to implement tooltips, popup menus, etc. Thus,
that's a good criteria to filter popup windows.
CCBUG: 398100
Reviewers: #kwin, graesslin, davidedmundson
Reviewed By: #kwin, graesslin, davidedmundson
Subscribers: davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15117
2018-10-08 18:08:13 +00:00
|
|
|
/**
|
|
|
|
* Whether the window is a popup.
|
|
|
|
*
|
|
|
|
* Popups can be used to implement popup menus, tooltips, combo boxes, etc.
|
|
|
|
*
|
|
|
|
* @since 5.15
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[effects] Make Scale and Glide effects Wayland-friendly
Summary:
The Scale effect and the Glide effect have to animate only ordinary
windows(i.e. the ones that are considered to be apps).
On X11, in order to distinguish ordinary windows from combo box popups,
popup menus, and other popups, those effects check whether given window
is managed.
On Wayland, there is no concept of managed/unmanaged windows.
XDG Shell protocol defines 2 surface roles:
* xdg_toplevel;
* and, xdg_popup.
The former can be used to implement typical windows, the ones that can
be minimized, maximized, etc.
The latter can be used to implement tooltips, popup menus, etc. Thus,
that's a good criteria to filter popup windows.
CCBUG: 398100
Reviewers: #kwin, graesslin, davidedmundson
Reviewed By: #kwin, graesslin, davidedmundson
Subscribers: davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15117
2018-10-08 18:08:13 +00:00
|
|
|
virtual bool isPopupWindow() const;
|
|
|
|
|
2018-11-18 19:13:55 +00:00
|
|
|
/**
|
|
|
|
* A UUID to uniquely identify this Toplevel independent of windowing system.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2018-11-18 19:13:55 +00:00
|
|
|
QUuid internalId() const
|
|
|
|
{
|
|
|
|
return m_internalId;
|
|
|
|
}
|
|
|
|
|
2013-07-22 14:07:39 +00:00
|
|
|
Q_SIGNALS:
|
2011-03-06 09:30:23 +00:00
|
|
|
void opacityChanged(KWin::Toplevel* toplevel, qreal oldOpacity);
|
2020-09-22 00:13:11 +00:00
|
|
|
void damaged(KWin::Toplevel* toplevel, const QRegion& damage);
|
2020-07-14 11:34:25 +00:00
|
|
|
void inputTransformationChanged();
|
2020-02-05 09:28:50 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted when the Toplevel's frame geometry changes.
|
|
|
|
* @deprecated since 5.19, use frameGeometryChanged instead
|
|
|
|
*/
|
2011-04-03 10:43:57 +00:00
|
|
|
void geometryChanged();
|
2011-06-19 20:07:19 +00:00
|
|
|
void geometryShapeChanged(KWin::Toplevel* toplevel, const QRect& old);
|
2012-03-24 21:42:29 +00:00
|
|
|
void paddingChanged(KWin::Toplevel* toplevel, const QRect& old);
|
2011-06-21 11:52:25 +00:00
|
|
|
void windowClosed(KWin::Toplevel* toplevel, KWin::Deleted* deleted);
|
2012-01-24 16:00:40 +00:00
|
|
|
void windowShown(KWin::Toplevel* toplevel);
|
2015-06-10 15:45:59 +00:00
|
|
|
void windowHidden(KWin::Toplevel* toplevel);
|
2012-01-15 10:03:15 +00:00
|
|
|
/**
|
|
|
|
* Signal emitted when the window's shape state changed. That is if it did not have a shape
|
|
|
|
* and received one or if the shape was withdrawn. Think of Chromium enabling/disabling KWin's
|
|
|
|
* decoration.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-01-15 10:03:15 +00:00
|
|
|
void shapedChanged();
|
2012-08-23 11:42:59 +00:00
|
|
|
/**
|
|
|
|
* Emitted whenever the state changes in a way, that the Compositor should
|
|
|
|
* schedule a repaint of the scene.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-23 11:42:59 +00:00
|
|
|
void needsRepaint();
|
2013-03-26 06:45:08 +00:00
|
|
|
/**
|
|
|
|
* Emitted whenever the Toplevel's screen changes. This can happen either in consequence to
|
|
|
|
* a screen being removed/added or if the Toplevel's geometry changes.
|
|
|
|
* @since 4.11
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2013-03-26 06:45:08 +00:00
|
|
|
void screenChanged();
|
2014-01-24 11:34:16 +00:00
|
|
|
void skipCloseAnimationChanged();
|
2014-04-10 09:12:48 +00:00
|
|
|
/**
|
|
|
|
* Emitted whenever the window role of the window changes.
|
|
|
|
* @since 5.0
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2014-04-10 09:12:48 +00:00
|
|
|
void windowRoleChanged();
|
2014-04-11 06:06:26 +00:00
|
|
|
/**
|
|
|
|
* Emitted whenever the window class name or resource name of the window changes.
|
|
|
|
* @since 5.0
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2014-04-11 06:06:26 +00:00
|
|
|
void windowClassChanged();
|
2015-01-09 10:16:57 +00:00
|
|
|
/**
|
|
|
|
* Emitted when a Wayland Surface gets associated with this Toplevel.
|
|
|
|
* @since 5.3
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-01-09 10:16:57 +00:00
|
|
|
void surfaceIdChanged(quint32);
|
2015-06-01 14:25:21 +00:00
|
|
|
/**
|
|
|
|
* @since 5.4
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2015-06-01 14:25:21 +00:00
|
|
|
void hasAlphaChanged();
|
2013-03-26 06:45:08 +00:00
|
|
|
|
2016-06-26 13:57:38 +00:00
|
|
|
/**
|
|
|
|
* Emitted whenever the Surface for this Toplevel changes.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2016-06-26 13:57:38 +00:00
|
|
|
void surfaceChanged();
|
|
|
|
|
2017-11-01 17:54:21 +00:00
|
|
|
/*
|
|
|
|
* Emitted when the client's screen changes onto a screen of a different scale
|
|
|
|
* or the screen we're on changes
|
|
|
|
* @since 5.12
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2017-11-01 17:54:21 +00:00
|
|
|
void screenScaleChanged();
|
|
|
|
|
Try to invalidate quad cache when shadow is changed
Summary:
213239a0ea0a9c0967bb68d1eda7a8d4d6a09498 tried to address the case when
a wayland client gets shadow after it was mapped, but because of poor
testing from my side, another bug was introduced. If a decoration tooltip
or the user actions popup is shown, then in some cases it can be blank.
Usually, SurfaceInterface::shadowChanged proceeds SurfaceInterface::sizeChanged,
so when the shadow is installed, window quads cache is rebuilt. But
because shell client already knows the geometry of the internal client,
goemetryShapeChanged is not emitted, thus the cache is not updated.
It would be better just to invalidate the cache when the shadow is
installed, uninstalled, or updated. This reduces the number of
unnecessary invocations of Scene::Window::buildQuads and also moves
handling of the window quads cache away from the Shadow class.
BUG: 399490
FIXED-IN: 5.15.0
Test Plan: Decoration tooltips are no longer blank.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17215
2018-11-27 13:25:22 +00:00
|
|
|
/**
|
|
|
|
* Emitted whenever the client's shadow changes.
|
|
|
|
* @since 5.15
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
Try to invalidate quad cache when shadow is changed
Summary:
213239a0ea0a9c0967bb68d1eda7a8d4d6a09498 tried to address the case when
a wayland client gets shadow after it was mapped, but because of poor
testing from my side, another bug was introduced. If a decoration tooltip
or the user actions popup is shown, then in some cases it can be blank.
Usually, SurfaceInterface::shadowChanged proceeds SurfaceInterface::sizeChanged,
so when the shadow is installed, window quads cache is rebuilt. But
because shell client already knows the geometry of the internal client,
goemetryShapeChanged is not emitted, thus the cache is not updated.
It would be better just to invalidate the cache when the shadow is
installed, uninstalled, or updated. This reduces the number of
unnecessary invocations of Scene::Window::buildQuads and also moves
handling of the window quads cache away from the Shadow class.
BUG: 399490
FIXED-IN: 5.15.0
Test Plan: Decoration tooltips are no longer blank.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17215
2018-11-27 13:25:22 +00:00
|
|
|
void shadowChanged();
|
|
|
|
|
2020-07-14 12:00:29 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted when the Toplevel's buffer geometry changes.
|
|
|
|
*/
|
|
|
|
void bufferGeometryChanged(KWin::Toplevel *toplevel, const QRect &oldGeometry);
|
2020-02-05 09:28:50 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted when the Toplevel's frame geometry changes.
|
|
|
|
*/
|
|
|
|
void frameGeometryChanged(KWin::Toplevel *toplevel, const QRect &oldGeometry);
|
2020-06-01 10:43:49 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted when the Toplevel's client geometry has changed.
|
|
|
|
*/
|
|
|
|
void clientGeometryChanged(KWin::Toplevel *toplevel, const QRect &oldGeometry);
|
2020-02-05 09:28:50 +00:00
|
|
|
|
2013-03-26 06:45:08 +00:00
|
|
|
protected Q_SLOTS:
|
|
|
|
/**
|
|
|
|
* Checks whether the screen number for this Toplevel changed and updates if needed.
|
|
|
|
* Any method changing the geometry of the Toplevel should call this method.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2013-03-26 06:45:08 +00:00
|
|
|
void checkScreen();
|
|
|
|
void setupCheckScreenConnection();
|
|
|
|
void removeCheckScreenConnection();
|
2013-06-28 12:23:22 +00:00
|
|
|
void setReadyForPainting();
|
2011-03-06 09:30:23 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
protected:
|
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
|
|
|
~Toplevel() override;
|
2013-09-10 06:13:33 +00:00
|
|
|
void setWindowHandles(xcb_window_t client);
|
2019-09-06 14:30:26 +00:00
|
|
|
void detectShape(xcb_window_t id);
|
2013-07-26 11:17:23 +00:00
|
|
|
virtual void propertyNotifyEvent(xcb_property_notify_event_t *e);
|
2013-04-26 09:00:08 +00:00
|
|
|
virtual void damageNotifyEvent();
|
2015-01-09 10:16:57 +00:00
|
|
|
virtual void clientMessageEvent(xcb_client_message_event_t *e);
|
2011-01-30 14:34:42 +00:00
|
|
|
void discardWindowPixmap();
|
|
|
|
void addDamageFull();
|
2015-02-24 09:54:28 +00:00
|
|
|
virtual void addDamage(const QRegion &damage);
|
2015-01-15 13:33:28 +00:00
|
|
|
Xcb::Property fetchWmClientLeader() const;
|
|
|
|
void readWmClientLeader(Xcb::Property &p);
|
2011-01-30 14:34:42 +00:00
|
|
|
void getWmClientLeader();
|
|
|
|
void getWmClientMachine();
|
2012-08-16 19:19:54 +00:00
|
|
|
/**
|
|
|
|
* @returns Whether there is a compositor and it is active.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2012-08-16 19:19:54 +00:00
|
|
|
bool compositing() const;
|
2011-10-22 09:02:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This function fetches the opaque region from this Toplevel.
|
|
|
|
* Will only be called on corresponding property changes and for initialization.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2011-10-22 09:02:49 +00:00
|
|
|
void getWmOpaqueRegion();
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void getResourceClass();
|
2015-07-20 07:37:36 +00:00
|
|
|
void setResourceClass(const QByteArray &name, const QByteArray &className = QByteArray());
|
2015-01-15 14:19:04 +00:00
|
|
|
Xcb::Property fetchSkipCloseAnimation() const;
|
|
|
|
void readSkipCloseAnimation(Xcb::Property &prop);
|
2014-01-24 11:34:16 +00:00
|
|
|
void getSkipCloseAnimation();
|
2011-01-30 14:34:42 +00:00
|
|
|
void copyToDeleted(Toplevel* c);
|
|
|
|
void disownDataPassedToDeleted();
|
|
|
|
void deleteEffectWindow();
|
2015-06-01 14:25:21 +00:00
|
|
|
void setDepth(int depth);
|
2019-12-04 13:18:34 +00:00
|
|
|
QRect m_frameGeometry;
|
2020-06-01 10:43:49 +00:00
|
|
|
QRect m_clientGeometry;
|
2014-04-25 10:06:39 +00:00
|
|
|
xcb_visualid_t m_visual;
|
2011-01-30 14:34:42 +00:00
|
|
|
int bit_depth;
|
2013-11-18 12:54:30 +00:00
|
|
|
NETWinInfo* info;
|
2011-01-30 14:34:42 +00:00
|
|
|
bool ready_for_painting;
|
|
|
|
QRegion repaints_region; // updating, repaint just requires repaint of that area
|
2012-02-07 16:01:41 +00:00
|
|
|
QRegion layer_repaints_region;
|
2019-08-26 07:44:04 +00:00
|
|
|
/**
|
|
|
|
* An FBO object KWin internal windows might render to.
|
|
|
|
*/
|
|
|
|
QSharedPointer<QOpenGLFramebufferObject> m_internalFBO;
|
|
|
|
QImage m_internalImage;
|
2012-03-28 18:29:33 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
bool m_isDamaged;
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
private:
|
|
|
|
// when adding new data members, check also copyToDeleted()
|
2018-11-18 19:13:55 +00:00
|
|
|
QUuid m_internalId;
|
2013-09-10 05:09:44 +00:00
|
|
|
Xcb::Window m_client;
|
2013-04-26 09:12:52 +00:00
|
|
|
xcb_damage_damage_t damage_handle;
|
2011-01-30 14:34:42 +00:00
|
|
|
QRegion damage_region; // damage is really damaged window (XDamage) and texture needs
|
|
|
|
bool is_shape;
|
|
|
|
EffectWindowImpl* effect_window;
|
|
|
|
QByteArray resource_name;
|
|
|
|
QByteArray resource_class;
|
2013-01-07 07:07:27 +00:00
|
|
|
ClientMachine *m_clientMachine;
|
2019-09-06 14:30:26 +00:00
|
|
|
xcb_window_t m_wmClientLeader;
|
2012-03-28 18:29:33 +00:00
|
|
|
bool m_damageReplyPending;
|
2011-10-22 09:02:49 +00:00
|
|
|
QRegion opaque_region;
|
2012-03-28 18:29:33 +00:00
|
|
|
xcb_xfixes_fetch_region_cookie_t m_regionCookie;
|
2013-03-26 06:45:08 +00:00
|
|
|
int m_screen;
|
2014-01-24 11:34:16 +00:00
|
|
|
bool m_skipCloseAnimation;
|
2015-01-09 10:16:57 +00:00
|
|
|
quint32 m_surfaceId = 0;
|
2020-04-29 15:18:41 +00:00
|
|
|
KWaylandServer::SurfaceInterface *m_surface = nullptr;
|
2011-01-30 14:34:42 +00:00
|
|
|
// when adding new data members, check also copyToDeleted()
|
2017-11-01 17:54:21 +00:00
|
|
|
qreal m_screenScale = 1.0;
|
2011-01-30 14:34:42 +00:00
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-09-10 05:09:44 +00:00
|
|
|
inline xcb_window_t Toplevel::window() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2013-09-10 05:09:44 +00:00
|
|
|
return m_client;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-09-10 06:13:33 +00:00
|
|
|
inline void Toplevel::setWindowHandles(xcb_window_t w)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2019-08-31 14:28:37 +00:00
|
|
|
Q_ASSERT(!m_client.isValid() && w != XCB_WINDOW_NONE);
|
2013-09-10 05:09:44 +00:00
|
|
|
m_client.reset(w, false);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2020-06-01 10:43:49 +00:00
|
|
|
inline QRect Toplevel::clientGeometry() const
|
|
|
|
{
|
|
|
|
return m_clientGeometry;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline QSize Toplevel::clientSize() const
|
|
|
|
{
|
|
|
|
return m_clientGeometry.size();
|
|
|
|
}
|
|
|
|
|
2019-09-27 10:01:10 +00:00
|
|
|
inline QRect Toplevel::frameGeometry() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2019-12-04 13:18:34 +00:00
|
|
|
return m_frameGeometry;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline QSize Toplevel::size() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2019-12-04 13:18:34 +00:00
|
|
|
return m_frameGeometry.size();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline QPoint Toplevel::pos() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2019-12-04 13:18:34 +00:00
|
|
|
return m_frameGeometry.topLeft();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline int Toplevel::x() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2019-12-04 13:18:34 +00:00
|
|
|
return m_frameGeometry.x();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline int Toplevel::y() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2019-12-04 13:18:34 +00:00
|
|
|
return m_frameGeometry.y();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline int Toplevel::width() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2019-12-04 13:18:34 +00:00
|
|
|
return m_frameGeometry.width();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline int Toplevel::height() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2019-12-04 13:18:34 +00:00
|
|
|
return m_frameGeometry.height();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline QRect Toplevel::rect() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
|
|
|
return QRect(0, 0, width(), height());
|
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2007-06-25 08:51:44 +00:00
|
|
|
inline bool Toplevel::readyForPainting() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-06-25 08:51:44 +00:00
|
|
|
return ready_for_painting;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-06-25 08:51:44 +00:00
|
|
|
|
2014-04-25 10:06:39 +00:00
|
|
|
inline xcb_visualid_t Toplevel::visual() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2014-04-25 10:06:39 +00:00
|
|
|
return m_visual;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Toplevel::isDesktop() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return windowType() == NET::Desktop;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Toplevel::isDock() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return windowType() == NET::Dock;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Toplevel::isMenu() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2011-06-24 10:19:47 +00:00
|
|
|
return windowType() == NET::Menu;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Toplevel::isToolbar() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return windowType() == NET::Toolbar;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Toplevel::isSplash() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return windowType() == NET::Splash;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Toplevel::isUtility() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return windowType() == NET::Utility;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Toplevel::isDialog() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return windowType() == NET::Dialog;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Toplevel::isNormalWindow() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return windowType() == NET::Normal;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Toplevel::isDropdownMenu() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return windowType() == NET::DropdownMenu;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Toplevel::isPopupMenu() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return windowType() == NET::PopupMenu;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Toplevel::isTooltip() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return windowType() == NET::Tooltip;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Toplevel::isNotification() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return windowType() == NET::Notification;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2019-05-02 08:29:38 +00:00
|
|
|
inline bool Toplevel::isCriticalNotification() const
|
|
|
|
{
|
|
|
|
return windowType() == NET::CriticalNotification;
|
|
|
|
}
|
|
|
|
|
2015-01-02 11:11:54 +00:00
|
|
|
inline bool Toplevel::isOnScreenDisplay() const
|
|
|
|
{
|
|
|
|
return windowType() == NET::OnScreenDisplay;
|
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
inline bool Toplevel::isComboBox() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return windowType() == NET::ComboBox;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Toplevel::isDNDIcon() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return windowType() == NET::DNDIcon;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2015-11-16 10:19:38 +00:00
|
|
|
inline bool Toplevel::isLockScreen() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool Toplevel::isInputMethod() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-03-19 14:01:29 +00:00
|
|
|
inline bool Toplevel::isOutline() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
inline QRegion Toplevel::damage() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return damage_region;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline QRegion Toplevel::repaints() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2012-02-07 16:01:41 +00:00
|
|
|
return repaints_region.translated(pos()) | layer_repaints_region;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Toplevel::shape() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return is_shape;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline int Toplevel::depth() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return bit_depth;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline bool Toplevel::hasAlpha() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return depth() == 32;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-10-22 09:02:49 +00:00
|
|
|
inline const QRegion& Toplevel::opaqueRegion() const
|
|
|
|
{
|
|
|
|
return opaque_region;
|
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
inline
|
|
|
|
EffectWindowImpl* Toplevel::effectWindow()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return effect_window;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-04-03 09:31:33 +00:00
|
|
|
inline
|
|
|
|
const EffectWindowImpl* Toplevel::effectWindow() const
|
|
|
|
{
|
|
|
|
return effect_window;
|
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
inline bool Toplevel::isOnAllDesktops() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
[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 kwinApp()->operationMode() == Application::OperationModeWaylandOnly ||
|
|
|
|
kwinApp()->operationMode() == Application::OperationModeXwayland
|
|
|
|
//Wayland
|
|
|
|
? desktops().isEmpty()
|
|
|
|
//X11
|
|
|
|
: desktop() == NET::OnAllDesktops;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2010-05-11 20:30:20 +00:00
|
|
|
inline bool Toplevel::isOnAllActivities() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2010-05-11 20:30:20 +00:00
|
|
|
return activities().isEmpty();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2010-05-11 20:30:20 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
inline bool Toplevel::isOnDesktop(int d) 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
|
|
|
return (kwinApp()->operationMode() == Application::OperationModeWaylandOnly ||
|
|
|
|
kwinApp()->operationMode() == Application::OperationModeXwayland
|
|
|
|
? desktops().contains(VirtualDesktopManager::self()->desktopForX11Id(d))
|
|
|
|
: desktop() == d
|
|
|
|
) || isOnAllDesktops();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
inline bool Toplevel::isOnActivity(const QString &activity) const
|
|
|
|
{
|
2010-05-11 20:30:20 +00:00
|
|
|
return activities().isEmpty() || activities().contains(activity);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2010-05-11 20:30:20 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
inline bool Toplevel::isOnCurrentDesktop() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2012-11-16 07:23:47 +00:00
|
|
|
return isOnDesktop(VirtualDesktopManager::self()->current());
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline QByteArray Toplevel::resourceName() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return resource_name; // it is always lowercase
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline QByteArray Toplevel::resourceClass() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return resource_class; // it is always lowercase
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-01-07 07:07:27 +00:00
|
|
|
inline const ClientMachine *Toplevel::clientMachine() const
|
|
|
|
{
|
|
|
|
return m_clientMachine;
|
|
|
|
}
|
|
|
|
|
2015-01-09 10:16:57 +00:00
|
|
|
inline quint32 Toplevel::surfaceId() const
|
|
|
|
{
|
|
|
|
return m_surfaceId;
|
|
|
|
}
|
|
|
|
|
2020-04-29 15:18:41 +00:00
|
|
|
inline KWaylandServer::SurfaceInterface *Toplevel::surface() const
|
2015-02-09 15:08:53 +00:00
|
|
|
{
|
|
|
|
return m_surface;
|
|
|
|
}
|
|
|
|
|
2015-08-18 12:40:26 +00:00
|
|
|
inline const QSharedPointer<QOpenGLFramebufferObject> &Toplevel::internalFramebufferObject() const
|
|
|
|
{
|
|
|
|
return m_internalFBO;
|
|
|
|
}
|
|
|
|
|
2019-08-26 07:44:04 +00:00
|
|
|
inline QImage Toplevel::internalImageObject() const
|
|
|
|
{
|
|
|
|
return m_internalImage;
|
|
|
|
}
|
|
|
|
|
2015-12-08 09:11:26 +00:00
|
|
|
inline QPoint Toplevel::clientContentPos() const
|
|
|
|
{
|
|
|
|
return QPoint(0, 0);
|
|
|
|
}
|
|
|
|
|
2015-02-09 15:07:30 +00:00
|
|
|
template <class T, class U>
|
|
|
|
inline T *Toplevel::findInList(const QList<T*> &list, std::function<bool (const U*)> func)
|
2014-03-20 06:52:18 +00:00
|
|
|
{
|
2015-02-09 15:07:30 +00:00
|
|
|
static_assert(std::is_base_of<U, T>::value,
|
|
|
|
"U must be derived from T");
|
2014-03-20 06:52:18 +00:00
|
|
|
const auto it = std::find_if(list.begin(), list.end(), func);
|
|
|
|
if (it == list.end()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return *it;
|
|
|
|
}
|
|
|
|
|
[effects] Make Scale and Glide effects Wayland-friendly
Summary:
The Scale effect and the Glide effect have to animate only ordinary
windows(i.e. the ones that are considered to be apps).
On X11, in order to distinguish ordinary windows from combo box popups,
popup menus, and other popups, those effects check whether given window
is managed.
On Wayland, there is no concept of managed/unmanaged windows.
XDG Shell protocol defines 2 surface roles:
* xdg_toplevel;
* and, xdg_popup.
The former can be used to implement typical windows, the ones that can
be minimized, maximized, etc.
The latter can be used to implement tooltips, popup menus, etc. Thus,
that's a good criteria to filter popup windows.
CCBUG: 398100
Reviewers: #kwin, graesslin, davidedmundson
Reviewed By: #kwin, graesslin, davidedmundson
Subscribers: davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15117
2018-10-08 18:08:13 +00:00
|
|
|
inline bool Toplevel::isPopupWindow() const
|
|
|
|
{
|
|
|
|
switch (windowType()) {
|
|
|
|
case NET::ComboBox:
|
|
|
|
case NET::DropdownMenu:
|
|
|
|
case NET::PopupMenu:
|
|
|
|
case NET::Tooltip:
|
|
|
|
return true;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-02 10:44:10 +00:00
|
|
|
KWIN_EXPORT QDebug operator<<(QDebug debug, const Toplevel *toplevel);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
} // namespace
|
2013-02-06 14:25:02 +00:00
|
|
|
Q_DECLARE_METATYPE(KWin::Toplevel*)
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#endif
|