2020-03-15 15:19:28 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
2020-07-04 07:51:33 +00:00
|
|
|
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
2014-08-28 07:52:35 +00:00
|
|
|
|
2020-03-15 15:19:28 +00:00
|
|
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
|
|
|
*/
|
2021-03-10 16:08:30 +00:00
|
|
|
#pragma once
|
2014-08-28 07:52:35 +00:00
|
|
|
|
2023-11-14 13:53:24 +00:00
|
|
|
#include "core/colorspace.h"
|
2022-05-25 08:39:03 +00:00
|
|
|
#include "core/output.h"
|
2023-10-19 14:35:14 +00:00
|
|
|
#include "core/renderbackend.h"
|
2014-08-28 07:52:35 +00:00
|
|
|
|
2020-06-10 07:42:16 +00:00
|
|
|
#include <QMatrix4x4>
|
2014-08-28 07:52:35 +00:00
|
|
|
#include <QObject>
|
|
|
|
#include <QRegion>
|
|
|
|
|
2023-05-02 18:47:17 +00:00
|
|
|
struct wl_resource;
|
|
|
|
|
2023-04-28 07:30:18 +00:00
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2023-09-13 17:59:29 +00:00
|
|
|
class GraphicsBuffer;
|
2015-08-26 12:42:58 +00:00
|
|
|
class BlurInterface;
|
2023-05-02 18:47:17 +00:00
|
|
|
class ClientConnection;
|
2020-11-03 18:44:32 +00:00
|
|
|
class ConfinedPointerV1Interface;
|
2015-09-02 16:13:25 +00:00
|
|
|
class ContrastInterface;
|
2014-08-28 07:52:35 +00:00
|
|
|
class CompositorInterface;
|
2023-05-02 18:47:17 +00:00
|
|
|
class LinuxDmaBufV1Feedback;
|
2020-11-03 18:44:32 +00:00
|
|
|
class LockedPointerV1Interface;
|
2023-05-02 18:47:17 +00:00
|
|
|
class OutputInterface;
|
2015-07-15 09:07:50 +00:00
|
|
|
class ShadowInterface;
|
2015-09-09 11:04:11 +00:00
|
|
|
class SlideInterface;
|
2014-10-14 12:04:35 +00:00
|
|
|
class SubSurfaceInterface;
|
2020-07-04 07:51:33 +00:00
|
|
|
class SurfaceInterfacePrivate;
|
2023-09-10 07:44:07 +00:00
|
|
|
class Transaction;
|
2014-08-28 07:52:35 +00:00
|
|
|
|
2022-09-13 12:21:43 +00:00
|
|
|
enum class PresentationHint {
|
|
|
|
VSync,
|
|
|
|
Async
|
|
|
|
};
|
|
|
|
|
2023-09-06 14:44:17 +00:00
|
|
|
/**
|
|
|
|
* The SurfaceRole class represents a role assigned to a wayland surface.
|
|
|
|
*/
|
|
|
|
class KWIN_EXPORT SurfaceRole
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit SurfaceRole(const QByteArray &name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The human readable name of the surface role.
|
|
|
|
*/
|
|
|
|
QByteArray name() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QByteArray m_name;
|
|
|
|
};
|
|
|
|
|
2015-09-10 11:36:42 +00:00
|
|
|
/**
|
|
|
|
* @brief Resource representing a wl_surface.
|
|
|
|
*
|
|
|
|
* The SurfaceInterface gets created by the CompositorInterface. A SurfaceInterface normally
|
|
|
|
* takes up a role by being "attached" to either a ShellSurfaceInterface, a SubSurfaceInterface
|
|
|
|
* or a Cursor.
|
|
|
|
*
|
|
|
|
* The implementation of the SurfaceInterface does not only wrap the features exposed by wl_surface,
|
|
|
|
* but goes further by integrating the information added to a SurfaceInterface by other interfaces.
|
|
|
|
* This should make interacting from the server easier, it only needs to monitor the SurfaceInterface
|
|
|
|
* and does not need to track each specific interface.
|
|
|
|
*
|
2023-04-28 07:30:18 +00:00
|
|
|
* The SurfaceInterface takes care of reference/unreferencing the GraphicsBuffer attached to it.
|
|
|
|
* As long as a GraphicsBuffer is attached, the released signal won't be sent. If the GraphicsBuffer
|
2015-09-10 11:36:42 +00:00
|
|
|
* is no longer needed by the SurfaceInterface, it will get unreferenced and might be automatically
|
|
|
|
* deleted (if it's no longer referenced).
|
|
|
|
*
|
|
|
|
* @see CompositorInterface
|
2023-04-28 07:30:18 +00:00
|
|
|
* @see GraphicsBuffer
|
2015-09-10 11:36:42 +00:00
|
|
|
* @see SubSurfaceInterface
|
|
|
|
* @see BlurInterface
|
|
|
|
* @see ContrastInterface
|
|
|
|
* @see ShadowInterface
|
|
|
|
* @see SlideInterface
|
2021-11-23 13:15:41 +00:00
|
|
|
* @see LinuxDmaBufV1Feedback
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2022-04-22 09:27:33 +00:00
|
|
|
class KWIN_EXPORT SurfaceInterface : public QObject
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2015-09-10 11:36:42 +00:00
|
|
|
/**
|
|
|
|
* The opaque region for a translucent buffer.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-08-28 07:52:35 +00:00
|
|
|
Q_PROPERTY(QRegion opaque READ opaque NOTIFY opaqueChanged)
|
2015-09-10 11:36:42 +00:00
|
|
|
/**
|
|
|
|
* The current input region.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-08-28 07:52:35 +00:00
|
|
|
Q_PROPERTY(QRegion input READ input NOTIFY inputChanged)
|
2022-05-16 20:13:39 +00:00
|
|
|
Q_PROPERTY(QSizeF size READ size NOTIFY sizeChanged)
|
2014-08-28 07:52:35 +00:00
|
|
|
public:
|
2020-07-04 07:51:33 +00:00
|
|
|
explicit SurfaceInterface(CompositorInterface *compositor, wl_resource *resource);
|
|
|
|
~SurfaceInterface() override;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the object id for this Wayland surface.
|
|
|
|
*/
|
|
|
|
uint32_t id() const;
|
|
|
|
/**
|
|
|
|
* Returns the Wayland client that owns this SurfaceInterface.
|
|
|
|
*/
|
|
|
|
ClientConnection *client() const;
|
|
|
|
/**
|
|
|
|
* Returns the Wayland resource corresponding to this SurfaceInterface.
|
|
|
|
*/
|
|
|
|
wl_resource *resource() const;
|
|
|
|
/**
|
|
|
|
* Returns the compositor for this SurfaceInterface.
|
|
|
|
*/
|
|
|
|
CompositorInterface *compositor() const;
|
|
|
|
|
2023-09-06 14:44:17 +00:00
|
|
|
/**
|
|
|
|
* Returns the role of this surface, or @c null if no role has been assigned to the surface.
|
|
|
|
*
|
|
|
|
* Once a role is given to the surface, it is permanent.
|
|
|
|
*/
|
|
|
|
SurfaceRole *role() const;
|
|
|
|
void setRole(SurfaceRole *role);
|
|
|
|
|
2020-05-23 18:12:36 +00:00
|
|
|
/**
|
|
|
|
* Maps the specified @a point from the surface-local coordinates to buffer pixel coordinates.
|
|
|
|
*
|
|
|
|
* Note that there is no direct connection between points in the surface-local coordinates
|
|
|
|
* and points in the buffer pixel coordinates. In order to map points between the two spaces,
|
|
|
|
* one has to use mapToBuffer() and mapFromBuffer().
|
|
|
|
*
|
2020-06-10 07:42:16 +00:00
|
|
|
* The returned value will become invalid when the surfaceToBufferMatrixChanged() signal is emitted.
|
|
|
|
*
|
|
|
|
* @see surfaceToBufferMatrix(), surfaceToBufferMatrixChanged()
|
2020-05-23 18:12:36 +00:00
|
|
|
*/
|
|
|
|
QPointF mapToBuffer(const QPointF &point) const;
|
|
|
|
/**
|
|
|
|
* Maps the specified @a region from the surface-local coordinates to buffer pixel coordinates.
|
|
|
|
*
|
|
|
|
* Note that there is no direct connection between regions in the surface-local coordinates
|
|
|
|
* and regions in the buffer pixel coordinates. In order to map regions between the two spaces,
|
|
|
|
* one has to use mapToBuffer() and mapFromBuffer().
|
|
|
|
*
|
2020-06-10 07:42:16 +00:00
|
|
|
* The returned value will become invalid when the surfaceToBufferMatrixChanged() signal is emitted.
|
|
|
|
*
|
|
|
|
* @see surfaceToBufferMatrix(), surfaceToBufferMatrixChanged()
|
2020-05-23 18:12:36 +00:00
|
|
|
*/
|
|
|
|
QRegion mapToBuffer(const QRegion ®ion) const;
|
2020-06-10 07:42:16 +00:00
|
|
|
/**
|
|
|
|
* Returns the projection matrix from the surface-local coordinates to buffer coordinates.
|
|
|
|
*
|
|
|
|
* @see surfaceToBufferMatrixChanged()
|
|
|
|
*/
|
|
|
|
QMatrix4x4 surfaceToBufferMatrix() const;
|
2020-05-23 18:12:36 +00:00
|
|
|
|
2021-02-26 12:17:37 +00:00
|
|
|
/**
|
|
|
|
* Maps the specified @a point in this surface's coordinate system to the equivalent point
|
|
|
|
* within the @a child's coordinate system, and returns the mapped point.
|
|
|
|
*
|
|
|
|
* If this surface is not an ancestor of the @a child, a null point is returned.
|
|
|
|
*/
|
|
|
|
QPointF mapToChild(SurfaceInterface *child, const QPointF &point) const;
|
|
|
|
|
2014-08-28 07:52:35 +00:00
|
|
|
void frameRendered(quint32 msec);
|
2021-02-02 12:51:21 +00:00
|
|
|
bool hasFrameCallbacks() const;
|
2014-08-28 07:52:35 +00:00
|
|
|
|
2023-10-19 14:35:14 +00:00
|
|
|
std::unique_ptr<PresentationFeedback> takePresentationFeedback(Output *output);
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
QRegion opaque() const;
|
|
|
|
QRegion input() const;
|
2023-06-12 11:12:16 +00:00
|
|
|
QRegion bufferDamage() const;
|
2023-07-04 06:13:49 +00:00
|
|
|
QRectF bufferSourceBox() const;
|
2020-06-19 07:07:22 +00:00
|
|
|
/**
|
|
|
|
* Returns the buffer transform that had been applied to the buffer to compensate for
|
|
|
|
* output rotation.
|
|
|
|
*
|
|
|
|
* If the surface is on an output that is rotated 90 degrees clockwise, the buffer will
|
|
|
|
* be rotated 90 degrees counter clockwise.
|
|
|
|
*/
|
2023-09-13 17:59:29 +00:00
|
|
|
OutputTransform bufferTransform() const;
|
2015-09-10 11:36:42 +00:00
|
|
|
/**
|
2023-04-28 07:30:18 +00:00
|
|
|
* @returns the current GraphicsBuffer, might be @c nullptr.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2023-09-13 17:59:29 +00:00
|
|
|
GraphicsBuffer *buffer() const;
|
2014-09-19 05:06:31 +00:00
|
|
|
QPoint offset() const;
|
2020-05-24 10:46:27 +00:00
|
|
|
/**
|
|
|
|
* Returns the current size of the surface, in surface coordinates.
|
|
|
|
*
|
|
|
|
* Note that there is no direct relationship between the surface size and the buffer size.
|
|
|
|
* In order to determine the size of the currently attached buffer, use buffer()->size().
|
|
|
|
*/
|
2022-05-16 20:13:39 +00:00
|
|
|
QSizeF size() const;
|
2020-02-21 10:16:38 +00:00
|
|
|
/**
|
|
|
|
* Returns the rectangle that bounds this surface and all of its sub-surfaces.
|
|
|
|
*
|
|
|
|
* QPoint(0, 0) corresponds to the upper left corner of this surface.
|
|
|
|
*/
|
2022-05-16 20:13:39 +00:00
|
|
|
QRectF boundingRect() const;
|
2020-06-30 06:06:53 +00:00
|
|
|
/**
|
|
|
|
* Returns the size of the attached buffer, in device pixels.
|
|
|
|
*
|
|
|
|
* If no buffer is attached to this surface, an invalid QSize will be returned.
|
|
|
|
*/
|
|
|
|
QSize bufferSize() const;
|
2014-09-19 05:06:31 +00:00
|
|
|
|
2014-10-14 12:04:35 +00:00
|
|
|
/**
|
|
|
|
* @returns The SubSurface for this Surface in case there is one.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2020-10-31 14:03:30 +00:00
|
|
|
SubSurfaceInterface *subSurface() const;
|
2014-10-14 12:04:35 +00:00
|
|
|
/**
|
2021-06-01 10:50:33 +00:00
|
|
|
* Returns the sub-surfaces that are below this surface. The sub-surfaces are sorted
|
|
|
|
* from bottom to top.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2021-06-01 10:50:33 +00:00
|
|
|
QList<SubSurfaceInterface *> below() const;
|
|
|
|
/**
|
|
|
|
* Returns the sub-surfaces that are above this surface. The sub-surfaces are sorted
|
|
|
|
* from bottom to top.
|
|
|
|
*/
|
|
|
|
QList<SubSurfaceInterface *> above() const;
|
2014-10-14 12:04:35 +00:00
|
|
|
|
2015-07-15 09:07:50 +00:00
|
|
|
/**
|
|
|
|
* @returns The Shadow for this Surface.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2023-09-07 10:56:54 +00:00
|
|
|
ShadowInterface *shadow() const;
|
2015-07-15 09:07:50 +00:00
|
|
|
|
2015-08-26 12:42:58 +00:00
|
|
|
/**
|
|
|
|
* @returns The Blur for this Surface.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2023-09-07 10:56:54 +00:00
|
|
|
BlurInterface *blur() const;
|
2015-08-26 12:42:58 +00:00
|
|
|
|
2015-09-09 11:04:11 +00:00
|
|
|
/**
|
|
|
|
* @returns The Slide for this Surface.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2023-09-07 10:56:54 +00:00
|
|
|
SlideInterface *slideOnShowHide() const;
|
2015-09-09 11:04:11 +00:00
|
|
|
|
2015-09-02 16:13:25 +00:00
|
|
|
/**
|
|
|
|
* @returns The Contrast for this Surface.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2023-09-07 10:56:54 +00:00
|
|
|
ContrastInterface *contrast() const;
|
2015-09-02 16:13:25 +00:00
|
|
|
|
2016-03-29 10:05:05 +00:00
|
|
|
/**
|
|
|
|
* Whether the SurfaceInterface is currently considered to be mapped.
|
2023-04-28 07:30:18 +00:00
|
|
|
* A SurfaceInterface is mapped if it has a non-null GraphicsBuffer attached.
|
2016-03-29 10:05:05 +00:00
|
|
|
* If the SurfaceInterface references a SubSurfaceInterface it is only considered
|
2023-04-28 07:30:18 +00:00
|
|
|
* mapped if it has a GraphicsBuffer attached and the parent SurfaceInterface is mapped.
|
2016-03-29 10:05:05 +00:00
|
|
|
*
|
|
|
|
* @returns Whether the SurfaceInterface is currently mapped
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-03-29 10:05:05 +00:00
|
|
|
bool isMapped() const;
|
|
|
|
|
2016-04-05 12:26:53 +00:00
|
|
|
/**
|
|
|
|
* Finds the SurfaceInterface at the given @p position in surface-local coordinates.
|
|
|
|
* This can be either a descendant SurfaceInterface honoring the stacking order or
|
|
|
|
* the SurfaceInterface itself if its geometry contains the given @p position.
|
|
|
|
*
|
|
|
|
* If no such SurfaceInterface is found, e.g. because the SurfaceInterface is unmapped,
|
|
|
|
* @c nullptr is returned.
|
|
|
|
*
|
|
|
|
* @param position The position in surface-local coordinates
|
|
|
|
* @returns Child surface at the given @p position or surface itself at the position, might be @c nullptr
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-04-05 12:26:53 +00:00
|
|
|
SurfaceInterface *surfaceAt(const QPointF &position);
|
|
|
|
|
2018-10-02 16:11:52 +00:00
|
|
|
/**
|
|
|
|
* Finds the input receiving SurfaceInterface at the given @p position in surface-local coordinates.
|
|
|
|
* This can be either a descendant SurfaceInterface honoring the stacking order or
|
|
|
|
* the SurfaceInterface itself if its geometry contains the given @p position.
|
|
|
|
*
|
|
|
|
* If no such SurfaceInterface is found, e.g. because the SurfaceInterface is unmapped or there is no
|
|
|
|
* input region containing the position,
|
|
|
|
* @c nullptr is returned.
|
|
|
|
*
|
|
|
|
* @param position The position in surface-local coordinates
|
|
|
|
* @returns Input receiving child surface at the given @p position or surface itself at the position, might be @c nullptr
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2018-10-02 16:11:52 +00:00
|
|
|
SurfaceInterface *inputSurfaceAt(const QPointF &position);
|
|
|
|
|
2016-08-22 12:18:23 +00:00
|
|
|
/**
|
|
|
|
* Sets the @p outputs this SurfaceInterface overlaps with, may be empty.
|
|
|
|
*
|
|
|
|
* The compositor should update whenever the SurfaceInterface becomes visible on
|
|
|
|
* an OutputInterface by e.g. getting (un)mapped, resized, moved, etc.
|
|
|
|
*
|
|
|
|
* @see outputs
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2023-10-23 17:57:59 +00:00
|
|
|
void setOutputs(const QList<OutputInterface *> &outputs, OutputInterface *primaryOutput);
|
2016-08-22 12:18:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns All OutputInterfaces the SurfaceInterface is on.
|
|
|
|
* @see setOutputs
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2023-10-19 06:50:15 +00:00
|
|
|
QList<OutputInterface *> outputs() const;
|
2016-08-22 12:18:23 +00:00
|
|
|
|
2016-11-08 13:17:15 +00:00
|
|
|
/**
|
|
|
|
* Pointer confinement installed on this SurfaceInterface.
|
|
|
|
* @see pointerConstraintsChanged
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2020-11-03 18:44:32 +00:00
|
|
|
ConfinedPointerV1Interface *confinedPointer() const;
|
2016-11-08 13:17:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Pointer lock installed on this SurfaceInterface.
|
|
|
|
* @see pointerConstraintsChanged
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2020-11-03 18:44:32 +00:00
|
|
|
LockedPointerV1Interface *lockedPointer() const;
|
2016-11-08 13:17:15 +00:00
|
|
|
|
2017-10-20 16:28:25 +00:00
|
|
|
/**
|
|
|
|
* @returns Whether this SurfaceInterface wants idle to be inhibited on the Output it is shown
|
|
|
|
* @see inhibitsIdleChanged
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2017-10-20 16:28:25 +00:00
|
|
|
bool inhibitsIdle() const;
|
|
|
|
|
2021-11-23 13:15:41 +00:00
|
|
|
/**
|
|
|
|
* dmabuf feedback installed on this SurfaceInterface
|
|
|
|
*/
|
|
|
|
LinuxDmaBufV1Feedback *dmabufFeedbackV1() const;
|
|
|
|
|
2022-05-25 08:39:03 +00:00
|
|
|
/**
|
|
|
|
* @returns the current content type of this surface
|
|
|
|
*/
|
2023-09-13 17:59:29 +00:00
|
|
|
ContentType contentType() const;
|
2022-05-25 08:39:03 +00:00
|
|
|
|
2015-09-10 11:36:42 +00:00
|
|
|
/**
|
|
|
|
* @returns The SurfaceInterface for the @p native resource.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-09-19 05:06:31 +00:00
|
|
|
static SurfaceInterface *get(wl_resource *native);
|
2015-02-09 13:31:20 +00:00
|
|
|
/**
|
2015-04-02 07:41:48 +00:00
|
|
|
* @returns The SurfaceInterface with given @p id for @p client, if it exists, otherwise @c nullptr.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2015-04-02 07:41:48 +00:00
|
|
|
static SurfaceInterface *get(quint32 id, const ClientConnection *client);
|
2014-08-28 07:52:35 +00:00
|
|
|
|
2022-04-25 14:07:34 +00:00
|
|
|
/**
|
|
|
|
* @see ClientConnection::setScaleOverride
|
|
|
|
*/
|
|
|
|
qreal scaleOverride() const;
|
|
|
|
/**
|
|
|
|
* Convert a co-ordinate from kwin logical space to surface logical space
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
QPoint toSurfaceLocal(const QPoint &point) const;
|
|
|
|
/**
|
|
|
|
* Convert a co-ordinate from kwin logical space to surface logical space
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
QPointF toSurfaceLocal(const QPointF &point) const;
|
|
|
|
|
2022-09-13 12:21:43 +00:00
|
|
|
/**
|
|
|
|
* @returns if the client thinks the content of this surface is suitable for presentation with tearing
|
|
|
|
*/
|
|
|
|
PresentationHint presentationHint() const;
|
|
|
|
|
2022-06-30 22:23:35 +00:00
|
|
|
/**
|
2023-02-08 20:32:28 +00:00
|
|
|
* Sets a preferred buffer scale that clients should provide buffers in
|
2022-06-30 22:23:35 +00:00
|
|
|
* @param scale
|
|
|
|
*/
|
2023-02-08 20:32:28 +00:00
|
|
|
void setPreferredBufferScale(qreal scale);
|
2022-06-30 22:23:35 +00:00
|
|
|
|
2023-02-08 20:43:16 +00:00
|
|
|
/**
|
|
|
|
* Sets the preferred buffer transform for this surface.
|
|
|
|
*
|
|
|
|
* This indicates to the client the preferred buffer transform to use when
|
|
|
|
* attaching buffers to this surface.
|
|
|
|
*/
|
2023-09-13 17:59:29 +00:00
|
|
|
void setPreferredBufferTransform(OutputTransform transform);
|
2023-02-08 20:43:16 +00:00
|
|
|
|
2023-09-10 07:44:07 +00:00
|
|
|
/**
|
|
|
|
* The first committed transaction that is scheduled to be applied to this surface.
|
|
|
|
*/
|
|
|
|
Transaction *firstTransaction() const;
|
|
|
|
void setFirstTransaction(Transaction *transaction);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The last committed transaction that is scheduled to be applied to this surface.
|
|
|
|
*/
|
|
|
|
Transaction *lastTransaction() const;
|
|
|
|
void setLastTransaction(Transaction *transaction);
|
|
|
|
|
2023-10-18 08:34:31 +00:00
|
|
|
const ColorDescription &colorDescription() const;
|
|
|
|
|
2023-10-25 16:36:33 +00:00
|
|
|
void setPreferredColorDescription(const ColorDescription &descr);
|
|
|
|
|
2023-11-14 06:58:00 +00:00
|
|
|
/**
|
|
|
|
* Traverses the surface sub-tree with this surface as the root.
|
|
|
|
*/
|
|
|
|
void traverseTree(std::function<void(SurfaceInterface *surface)> callback);
|
|
|
|
|
2014-08-28 07:52:35 +00:00
|
|
|
Q_SIGNALS:
|
2020-07-04 07:51:33 +00:00
|
|
|
/**
|
2020-07-16 13:18:56 +00:00
|
|
|
* This signal is emitted when the underlying wl_surface resource is about to be freed.
|
|
|
|
*
|
|
|
|
* The unbound() signal is emitted either when the client that owns the surface has been
|
|
|
|
* destroyed or if the surface has been destroyed due to a destructor request.
|
|
|
|
*
|
|
|
|
* The SurfaceInterface object and the associated wl_surface resource are valid when this
|
|
|
|
* signal is emitted.
|
2020-07-04 07:51:33 +00:00
|
|
|
*/
|
2020-07-16 13:18:56 +00:00
|
|
|
void aboutToBeDestroyed();
|
2020-06-10 07:42:16 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted when the projection matrix from the surface-local coordinate space
|
|
|
|
* to the buffer coordinate space has been changed.
|
|
|
|
*
|
|
|
|
* Note that the compositor will most likely need to re-compute the texture coordinates after
|
|
|
|
* the surface-to-buffer matrix has been changed.
|
|
|
|
*/
|
|
|
|
void surfaceToBufferMatrixChanged();
|
2015-09-10 11:36:42 +00:00
|
|
|
/**
|
|
|
|
* Emitted whenever the SurfaceInterface got damaged.
|
|
|
|
* The signal is only emitted during the commit of state.
|
2023-04-28 07:30:18 +00:00
|
|
|
* A damage means that a new GraphicsBuffer got attached.
|
2015-09-10 11:36:42 +00:00
|
|
|
*
|
|
|
|
* @see buffer
|
|
|
|
* @see damage
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2021-08-29 05:11:06 +00:00
|
|
|
void damaged(const QRegion &);
|
|
|
|
void opaqueChanged(const QRegion &);
|
|
|
|
void inputChanged(const QRegion &);
|
2020-05-24 10:46:27 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted when the buffer transform has changed.
|
|
|
|
*/
|
2023-07-10 10:33:09 +00:00
|
|
|
void bufferTransformChanged(KWin::OutputTransform);
|
2023-07-26 08:55:34 +00:00
|
|
|
void bufferSourceBoxChanged();
|
2020-06-30 06:06:53 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted when the size of the attached buffer has changed.
|
|
|
|
*/
|
|
|
|
void bufferSizeChanged();
|
2020-05-04 11:55:15 +00:00
|
|
|
/**
|
|
|
|
* Emitted when the Surface becomes visible, i.e. a non-null buffer has been attached.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2020-05-04 11:55:15 +00:00
|
|
|
void mapped();
|
2014-11-28 07:33:32 +00:00
|
|
|
/**
|
|
|
|
* Emitted when the Surface removes its content
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2014-11-28 07:33:32 +00:00
|
|
|
void unmapped();
|
2015-03-03 09:16:11 +00:00
|
|
|
/**
|
2020-05-24 10:46:27 +00:00
|
|
|
* This signal is emitted when the surface size has changed.
|
|
|
|
*/
|
2015-03-03 09:16:11 +00:00
|
|
|
void sizeChanged();
|
2015-07-15 09:07:50 +00:00
|
|
|
void shadowChanged();
|
2015-08-26 12:42:58 +00:00
|
|
|
void blurChanged();
|
2015-09-09 11:04:11 +00:00
|
|
|
void slideOnShowHideChanged();
|
2015-09-02 16:13:25 +00:00
|
|
|
void contrastChanged();
|
2020-02-21 22:13:08 +00:00
|
|
|
/**
|
|
|
|
* Emitted whenever a new child sub-surface @p subSurface is added.
|
|
|
|
*/
|
|
|
|
void childSubSurfaceAdded(SubSurfaceInterface *subSurface);
|
|
|
|
/**
|
|
|
|
* Emitted whenver the child sub-surface @p subSurface is removed.
|
|
|
|
*/
|
|
|
|
void childSubSurfaceRemoved(SubSurfaceInterface *subSurface);
|
2021-02-02 17:27:46 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted when the list of child subsurfaces changes.
|
|
|
|
*/
|
|
|
|
void childSubSurfacesChanged();
|
2014-08-28 07:52:35 +00:00
|
|
|
|
2016-11-08 13:17:15 +00:00
|
|
|
/**
|
|
|
|
* Emitted whenever a pointer constraint get (un)installed on this SurfaceInterface.
|
|
|
|
*
|
|
|
|
* The pointer constraint does not get activated, the compositor needs to activate
|
|
|
|
* the lock/confinement.
|
|
|
|
*
|
|
|
|
* @see confinedPointer
|
|
|
|
* @see lockedPointer
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2016-11-08 13:17:15 +00:00
|
|
|
void pointerConstraintsChanged();
|
|
|
|
|
2017-10-20 16:28:25 +00:00
|
|
|
/**
|
|
|
|
* Emitted whenever the SurfaceInterface starts/ends to inhibit idle.
|
|
|
|
* @see inhibitsIdle
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2017-10-20 16:28:25 +00:00
|
|
|
void inhibitsIdleChanged();
|
|
|
|
|
2023-10-18 08:34:31 +00:00
|
|
|
void colorDescriptionChanged();
|
|
|
|
|
2019-02-12 14:06:12 +00:00
|
|
|
/**
|
|
|
|
* Emitted when the Surface has been committed.
|
|
|
|
*
|
|
|
|
* This signal is emitted after all the relevant damage and xyzChanged signals
|
|
|
|
* for this commit are emitted.
|
2021-03-16 08:17:36 +00:00
|
|
|
*/
|
2019-02-12 14:06:12 +00:00
|
|
|
void committed();
|
|
|
|
|
2022-05-16 17:03:52 +00:00
|
|
|
/**
|
|
|
|
* This signal is emitted when a surface commit with the specified \a serial has been cached
|
|
|
|
* to be applied later.
|
|
|
|
*/
|
|
|
|
void stateStashed(quint32 serial);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This signal is emitted when the state in a surface commit with the specified \a serial
|
|
|
|
* has been applied.
|
|
|
|
*/
|
|
|
|
void stateApplied(quint32 serial);
|
|
|
|
|
2014-08-28 07:52:35 +00:00
|
|
|
private:
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<SurfaceInterfacePrivate> d;
|
2020-07-04 07:51:33 +00:00
|
|
|
friend class SurfaceInterfacePrivate;
|
2014-08-28 07:52:35 +00:00
|
|
|
};
|
|
|
|
|
2022-05-16 17:03:52 +00:00
|
|
|
/**
|
|
|
|
* The SurfaceExtension class is the base class for wl_surface extensions. The SurfaceExtension
|
|
|
|
* helps with managing extension state and keeping it in sync with the surface state.
|
|
|
|
*/
|
|
|
|
template<typename Commit>
|
|
|
|
class SurfaceExtension : public QObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit SurfaceExtension(SurfaceInterface *surface)
|
|
|
|
{
|
|
|
|
connect(surface, &SurfaceInterface::stateStashed, this, &SurfaceExtension::stashState);
|
|
|
|
connect(surface, &SurfaceInterface::stateApplied, this, &SurfaceExtension::applyState);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void apply(Commit *commit) = 0;
|
|
|
|
|
|
|
|
Commit pending;
|
|
|
|
QMap<quint32, Commit> stashed;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void stashState(quint32 serial)
|
|
|
|
{
|
|
|
|
Commit stash = std::exchange(pending, Commit{});
|
|
|
|
stashed.insert(serial, stash);
|
|
|
|
}
|
|
|
|
|
|
|
|
void applyState(quint32 serial)
|
|
|
|
{
|
|
|
|
if (!stashed.isEmpty()) {
|
|
|
|
if (stashed.firstKey() == serial) {
|
|
|
|
Commit stash = stashed.take(serial);
|
|
|
|
apply(&stash);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
apply(&pending);
|
|
|
|
pending = Commit{};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-09-13 17:59:29 +00:00
|
|
|
} // namespace KWin
|
2014-08-28 07:52:35 +00:00
|
|
|
|
2023-09-13 17:59:29 +00:00
|
|
|
Q_DECLARE_METATYPE(KWin::SurfaceInterface *)
|