2007-11-27 19:40:25 +00:00
|
|
|
/********************************************************************
|
2007-04-29 17:35:43 +00:00
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
|
2007-11-27 19:40:25 +00:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#ifndef KWIN_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>
|
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>
|
2013-11-18 12:52:38 +00:00
|
|
|
// XLib
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <fixx11h.h>
|
2013-04-26 09:27:30 +00:00
|
|
|
// system
|
|
|
|
#include <assert.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;
|
|
|
|
|
2015-02-09 15:08:53 +00:00
|
|
|
namespace KWayland
|
|
|
|
{
|
|
|
|
namespace Server
|
|
|
|
{
|
|
|
|
class SurfaceInterface;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2013-01-07 07:07:27 +00:00
|
|
|
class ClientMachine;
|
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.
|
|
|
|
*/
|
|
|
|
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)
|
|
|
|
};
|
|
|
|
|
2015-10-14 07:58:16 +00:00
|
|
|
class KWIN_EXPORT Toplevel
|
2014-12-02 10:31:07 +00:00
|
|
|
: public QObject
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
Q_OBJECT
|
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)
|
|
|
|
Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged)
|
2012-03-24 21:42:29 +00:00
|
|
|
Q_PROPERTY(QRect visibleRect READ visibleRect)
|
2011-12-18 09:29:32 +00:00
|
|
|
Q_PROPERTY(int height READ height)
|
|
|
|
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged)
|
|
|
|
Q_PROPERTY(QPoint pos READ pos)
|
2013-03-26 06:45:08 +00:00
|
|
|
Q_PROPERTY(int screen READ screen NOTIFY screenChanged)
|
2011-12-18 09:29:32 +00:00
|
|
|
Q_PROPERTY(QSize size READ size)
|
|
|
|
Q_PROPERTY(int width READ width)
|
2016-05-02 15:47:39 +00:00
|
|
|
Q_PROPERTY(qulonglong windowId READ windowId CONSTANT)
|
2011-12-18 09:29:32 +00:00
|
|
|
Q_PROPERTY(int x READ x)
|
|
|
|
Q_PROPERTY(int y READ y)
|
2011-12-29 09:19:36 +00:00
|
|
|
Q_PROPERTY(int desktop READ desktop)
|
2012-06-22 07:29:32 +00:00
|
|
|
/**
|
|
|
|
* Whether the window is on all desktops. That is desktop is -1.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool onAllDesktops READ isOnAllDesktops)
|
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)
|
2011-12-29 09:19:36 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is a desktop background window (the one with wallpaper).
|
|
|
|
* See _NET_WM_WINDOW_TYPE_DESKTOP at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(bool desktopWindow READ isDesktop)
|
|
|
|
/**
|
|
|
|
* Returns whether the window is a dock (i.e. a panel).
|
|
|
|
* See _NET_WM_WINDOW_TYPE_DOCK at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(bool dock READ isDock)
|
|
|
|
/**
|
|
|
|
* Returns whether the window is a standalone (detached) toolbar window.
|
|
|
|
* See _NET_WM_WINDOW_TYPE_TOOLBAR at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(bool toolbar READ isToolbar)
|
|
|
|
/**
|
|
|
|
* Returns whether the window is a torn-off menu.
|
|
|
|
* See _NET_WM_WINDOW_TYPE_MENU at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(bool menu READ isMenu)
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
* See _NET_WM_WINDOW_TYPE_NORMAL at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(bool normalWindow READ isNormalWindow)
|
|
|
|
/**
|
|
|
|
* Returns whether the window is a dialog window.
|
|
|
|
* See _NET_WM_WINDOW_TYPE_DIALOG at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(bool dialog READ isDialog)
|
|
|
|
/**
|
|
|
|
* Returns whether the window is a splashscreen. Note that many (especially older) applications
|
|
|
|
* do not support marking their splash windows with this type.
|
|
|
|
* See _NET_WM_WINDOW_TYPE_SPLASH at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(bool splash READ isSplash)
|
|
|
|
/**
|
|
|
|
* Returns whether the window is a utility window, such as a tool window.
|
|
|
|
* See _NET_WM_WINDOW_TYPE_UTILITY at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(bool utility READ isUtility)
|
|
|
|
/**
|
|
|
|
* Returns whether the window is a dropdown menu (i.e. a popup directly or indirectly open
|
|
|
|
* from the applications menubar).
|
|
|
|
* See _NET_WM_WINDOW_TYPE_DROPDOWN_MENU at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(bool dropdownMenu READ isDropdownMenu)
|
|
|
|
/**
|
|
|
|
* Returns whether the window is a popup menu (that is not a torn-off or dropdown menu).
|
|
|
|
* See _NET_WM_WINDOW_TYPE_POPUP_MENU at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(bool popupMenu READ isPopupMenu)
|
|
|
|
/**
|
|
|
|
* Returns whether the window is a tooltip.
|
|
|
|
* See _NET_WM_WINDOW_TYPE_TOOLTIP at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(bool tooltip READ isTooltip)
|
|
|
|
/**
|
|
|
|
* Returns whether the window is a window with a notification.
|
|
|
|
* See _NET_WM_WINDOW_TYPE_NOTIFICATION at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(bool notification READ isNotification)
|
2015-01-02 11:11:54 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is an On Screen Display.
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(bool onScreenDisplay READ isOnScreenDisplay)
|
2011-12-29 09:19:36 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the window is a combobox popup.
|
|
|
|
* See _NET_WM_WINDOW_TYPE_COMBO at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(bool comboBox READ isComboBox)
|
|
|
|
/**
|
|
|
|
* Returns whether the window is a Drag&Drop icon.
|
|
|
|
* See _NET_WM_WINDOW_TYPE_DND at http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(bool dndIcon READ isDNDIcon)
|
|
|
|
/**
|
|
|
|
* Returns the NETWM window type
|
|
|
|
* See http://standards.freedesktop.org/wm-spec/wm-spec-latest.html .
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(int windowType READ windowType)
|
2013-03-25 14:18:58 +00:00
|
|
|
Q_PROPERTY(QStringList activities READ activities NOTIFY activitiesChanged)
|
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).
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool managed READ isClient CONSTANT)
|
|
|
|
/**
|
|
|
|
* Whether this Toplevel represents an already deleted window and only kept for the compositor for animations.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool deleted READ isDeleted CONSTANT)
|
2012-01-15 10:03:15 +00:00
|
|
|
/**
|
|
|
|
* Whether the window has an own shape
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool shaped READ shape NOTIFY shapedChanged)
|
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.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool skipsCloseAnimation READ skipsCloseAnimation WRITE setSkipCloseAnimation NOTIFY skipCloseAnimationChanged)
|
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.
|
|
|
|
**/
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
Q_PROPERTY(KWayland::Server::SurfaceInterface *surface READ surface)
|
|
|
|
|
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;
|
|
|
|
/**
|
|
|
|
* @return a unique identifier for the Toplevel. On X11 same as @link {window}
|
|
|
|
**/
|
|
|
|
virtual quint32 windowId() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
QRect geometry() 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.
|
|
|
|
**/
|
|
|
|
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
|
|
|
|
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.
|
|
|
|
**/
|
|
|
|
virtual QPoint clientContentPos() const;
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual QSize clientSize() const = 0;
|
|
|
|
virtual QRect visibleRect() const; // the area the window occupies on the screen
|
|
|
|
virtual QRect decorationRect() const; // rect including the decoration shadows
|
|
|
|
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
|
|
|
|
|
|
|
// 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;
|
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;
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual int desktop() const = 0;
|
|
|
|
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;
|
2011-01-30 14:34:42 +00:00
|
|
|
Window wmClientLeader() const;
|
|
|
|
pid_t pid() const;
|
|
|
|
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.
|
|
|
|
**/
|
|
|
|
void elevate(bool elevate);
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2011-03-27 10:33:07 +00:00
|
|
|
/**
|
|
|
|
* @returns Whether the Toplevel has a Shadow or not
|
|
|
|
* @see shadow
|
|
|
|
**/
|
|
|
|
bool hasShadow() const;
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
* If a shadow is available @link hasShadow returns @c true.
|
|
|
|
* @returns The Shadow belonging to this Toplevel, may be @c NULL.
|
|
|
|
* @see hasShadow
|
|
|
|
**/
|
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.
|
|
|
|
**/
|
|
|
|
void getShadow();
|
2014-07-24 06:55:57 +00:00
|
|
|
/**
|
|
|
|
* Whether the Toplevel currently wants the shadow to be rendered. Default
|
|
|
|
* implementation always returns @c true.
|
|
|
|
**/
|
|
|
|
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.
|
2012-01-01 08:26:27 +00:00
|
|
|
* It is supposed to only provide valuable information if @link hasAlpha is @c true .
|
2011-10-22 09:02:49 +00:00
|
|
|
* @see hasAlpha
|
|
|
|
**/
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
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;
|
2015-02-09 15:08:53 +00:00
|
|
|
KWayland::Server::SurfaceInterface *surface() const;
|
|
|
|
void setSurface(KWayland::Server::SurfaceInterface *surface);
|
2015-01-09 10:16:57 +00:00
|
|
|
|
2015-08-18 12:40:26 +00:00
|
|
|
virtual void setInternalFramebufferObject(const QSharedPointer<QOpenGLFramebufferObject> &fbo);
|
|
|
|
const QSharedPointer<QOpenGLFramebufferObject> &internalFramebufferObject() const;
|
|
|
|
|
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
|
|
|
|
**/
|
|
|
|
virtual QMatrix4x4 inputTransformation() const;
|
|
|
|
|
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
|
|
|
|
*/
|
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
|
|
|
|
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);
|
2011-03-12 14:04:22 +00:00
|
|
|
void damaged(KWin::Toplevel* toplevel, const QRect& damage);
|
2011-03-12 18:18:19 +00:00
|
|
|
void propertyNotify(KWin::Toplevel* toplevel, long a);
|
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.
|
|
|
|
**/
|
|
|
|
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.
|
|
|
|
**/
|
|
|
|
void needsRepaint();
|
2013-03-25 14:18:58 +00:00
|
|
|
void activitiesChanged(KWin::Toplevel* toplevel);
|
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
|
|
|
|
**/
|
|
|
|
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
|
|
|
|
**/
|
|
|
|
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
|
|
|
|
**/
|
|
|
|
void windowClassChanged();
|
2015-01-09 10:16:57 +00:00
|
|
|
/**
|
|
|
|
* Emitted when a Wayland Surface gets associated with this Toplevel.
|
|
|
|
* @since 5.3
|
|
|
|
**/
|
|
|
|
void surfaceIdChanged(quint32);
|
2015-06-01 14:25:21 +00:00
|
|
|
/**
|
|
|
|
* @since 5.4
|
|
|
|
**/
|
|
|
|
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.
|
|
|
|
**/
|
|
|
|
void surfaceChanged();
|
|
|
|
|
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.
|
|
|
|
**/
|
|
|
|
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:
|
|
|
|
virtual ~Toplevel();
|
2013-09-10 06:13:33 +00:00
|
|
|
void setWindowHandles(xcb_window_t client);
|
2011-01-30 14:34:42 +00:00
|
|
|
void detectShape(Window 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.
|
|
|
|
**/
|
|
|
|
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.
|
|
|
|
**/
|
|
|
|
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
|
|
|
virtual void debug(QDebug& stream) const = 0;
|
|
|
|
void copyToDeleted(Toplevel* c);
|
|
|
|
void disownDataPassedToDeleted();
|
|
|
|
friend QDebug& operator<<(QDebug& stream, const Toplevel*);
|
|
|
|
void deleteEffectWindow();
|
2015-06-01 14:25:21 +00:00
|
|
|
void setDepth(int depth);
|
2011-01-30 14:34:42 +00:00
|
|
|
QRect geom;
|
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;
|
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()
|
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;
|
2011-01-30 14:34:42 +00:00
|
|
|
WId wmClientLeaderWin;
|
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;
|
2015-02-09 15:08:53 +00:00
|
|
|
KWayland::Server::SurfaceInterface *m_surface = nullptr;
|
2015-08-18 12:40:26 +00:00
|
|
|
/**
|
|
|
|
* An FBO object KWin internal windows might render to.
|
|
|
|
**/
|
|
|
|
QSharedPointer<QOpenGLFramebufferObject> m_internalFBO;
|
2011-01-30 14:34:42 +00:00
|
|
|
// when adding new data members, check also copyToDeleted()
|
|
|
|
};
|
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
|
|
|
{
|
2013-09-10 05:09:44 +00:00
|
|
|
assert(!m_client.isValid() && w != XCB_WINDOW_NONE);
|
|
|
|
m_client.reset(w, false);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
inline QRect Toplevel::geometry() const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return geom;
|
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
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return geom.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
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return geom.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
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return geom.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
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return geom.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
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return geom.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
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return geom.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
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return 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
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
return desktop() == d || /*desk == 0 ||*/ 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;
|
|
|
|
}
|
|
|
|
|
2015-02-09 15:08:53 +00:00
|
|
|
inline KWayland::Server::SurfaceInterface *Toplevel::surface() const
|
|
|
|
{
|
|
|
|
return m_surface;
|
|
|
|
}
|
|
|
|
|
2015-08-18 12:40:26 +00:00
|
|
|
inline const QSharedPointer<QOpenGLFramebufferObject> &Toplevel::internalFramebufferObject() const
|
|
|
|
{
|
|
|
|
return m_internalFBO;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
QDebug& operator<<(QDebug& stream, const Toplevel*);
|
|
|
|
QDebug& operator<<(QDebug& stream, const ToplevelList&);
|
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
|