KWayland::Client::Surface
#include <surface.h>

Public Types | |
enum | CommitFlag { None, FrameCallback } |
Signals | |
void | frameRendered () |
void | outputEntered (KWayland::Client::Output *o) |
void | outputLeft (KWayland::Client::Output *o) |
void | sizeChanged (const QSize &) |
Public Member Functions | |
Surface (QObject *parent=nullptr) | |
void | attachBuffer (Buffer *buffer, const QPoint &offset=QPoint()) |
void | attachBuffer (Buffer::Ptr buffer, const QPoint &offset=QPoint()) |
void | attachBuffer (wl_buffer *buffer, const QPoint &offset=QPoint()) |
void | commit (CommitFlag flag=CommitFlag::FrameCallback) |
void | damage (const QRect &rect) |
void | damage (const QRegion ®ion) |
void | damageBuffer (const QRect &rect) |
void | damageBuffer (const QRegion ®ion) |
void | destroy () |
quint32 | id () const |
bool | isValid () const |
operator wl_surface * () | |
operator wl_surface * () const | |
QVector< Output * > | outputs () const |
void | release () |
qint32 | scale () const |
void | setInputRegion (const Region *region=nullptr) |
void | setOpaqueRegion (const Region *region=nullptr) |
void | setScale (qint32 scale) |
void | setSize (const QSize &size) |
void | setup (wl_surface *surface) |
void | setupFrameCallback () |
QSize | size () const |
![]() | |
QObject (QObject *parent) | |
bool | blockSignals (bool block) |
const QObjectList & | children () const const |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectInfo () |
void | dumpObjectInfo () const const |
void | dumpObjectTree () |
void | dumpObjectTree () const const |
QList< QByteArray > | dynamicPropertyNames () const const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
bool | isWidgetType () const const |
bool | isWindowType () const const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
QVariant | property (const char *name) const const |
Q_CLASSINFO (Name, Value) | |
Q_DISABLE_COPY (Class) | |
Q_DISABLE_COPY_MOVE (Class) | |
Q_DISABLE_MOVE (Class) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_OBJECT Q_OBJECT | |
Q_PROPERTY (...) | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
Q_SIGNAL Q_SIGNAL | |
Q_SIGNALS Q_SIGNALS | |
Q_SLOT Q_SLOT | |
Q_SLOTS Q_SLOTS | |
T | qFindChild (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
QList< T > | qFindChildren (const QObject *obj, const QString &name) |
T | qobject_cast (const QObject *object) |
T | qobject_cast (QObject *object) |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
QThread * | thread () const const |
Static Public Member Functions | |
static const QList< Surface * > & | all () |
static Surface * | fromQtWinId (WId wid) |
static Surface * | fromWindow (QWindow *window) |
static Surface * | get (wl_surface *native) |
![]() | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Additional Inherited Members | |
![]() | |
objectName | |
![]() | |
typedef | QObjectList |
![]() | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
bool | isSignalConnected (const QMetaMethod &signal) const const |
int | receivers (const char *signal) const const |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
Detailed Description
Wrapper for the wl_surface interface.
This class is a convenient wrapper for the wl_surface interface. To create a Surface call Compositor::createSurface.
The main purpose of this class is to setup the next frame which should be rendered. Therefore it provides methods to add damage and to attach a new Buffer and to finalize the frame by calling commit.
- See also
- Compositor
Member Enumeration Documentation
◆ CommitFlag
|
strong |
Flags to be added to commit.
- None: no flag
- FrameCallback: register a frame rendered callback
Instead of setting the FrameCallback flag one can also call setupFrameCallback. If one uses setupFrameCallback one may not use the FrameCallback flag when committing the Surface.
- See also
- commit
- setupFrameCallback
Member Function Documentation
◆ all()
All Surfaces which are currently created.
TODO: KF6 return QList<Surface*> instead of const-ref
Definition at line 223 of file surface.cpp.
◆ attachBuffer() [1/3]
Overloaded method for convenience.
Definition at line 173 of file surface.cpp.
◆ attachBuffer() [2/3]
void KWayland::Client::Surface::attachBuffer | ( | Buffer::Ptr | buffer, |
const QPoint & | offset = QPoint() |
||
) |
Overloaded method for convenience.
Definition at line 178 of file surface.cpp.
◆ attachBuffer() [3/3]
void KWayland::Client::Surface::attachBuffer | ( | wl_buffer * | buffer, |
const QPoint & | offset = QPoint() |
||
) |
Attaches the buffer
to this Surface for the next frame.
- Parameters
-
buffer The buffer to attach to this Surface offset Position of the new upper-left corner in relation to previous frame
Definition at line 167 of file surface.cpp.
◆ damage() [1/2]
void KWayland::Client::Surface::damage | ( | const QRect & | rect | ) |
Mark rect
as damaged for the next frame.
- See also
- damageBuffer
Definition at line 148 of file surface.cpp.
◆ damage() [2/2]
void KWayland::Client::Surface::damage | ( | const QRegion & | region | ) |
Mark region
as damaged for the next frame.
- See also
- damageBuffer
Definition at line 141 of file surface.cpp.
◆ damageBuffer() [1/2]
void KWayland::Client::Surface::damageBuffer | ( | const QRect & | rect | ) |
Mark rect
in buffer coordinates as damaged for the next frame.
- See also
- damage
- Since
- 5.59
Definition at line 161 of file surface.cpp.
◆ damageBuffer() [2/2]
void KWayland::Client::Surface::damageBuffer | ( | const QRegion & | region | ) |
Mark region
in buffer coordinates as damaged for the next frame.
- See also
- damage
- Since
- 5.59
Definition at line 154 of file surface.cpp.
◆ destroy()
void KWayland::Client::Surface::destroy | ( | ) |
Destroys the data held by this Surface.
This method is supposed to be used when the connection to the Wayland server goes away. If the connection is not valid anymore, it's not possible to call release anymore as that calls into the Wayland connection and the call would fail. This method cleans up the data, so that the instance can be deleted or set up to a new wl_surface interface once there is a new connection available.
This method is automatically invoked when the Registry which created this Surface gets destroyed.
- See also
- release
Definition at line 49 of file surface.cpp.
◆ frameRendered
|
signal |
Emitted when the server indicates that the last committed frame has been rendered.
The signal will only be emitted if a callback has been registered by either calling setupFrameCallback or calling commit with the CommitFlag::FrameCallback.
- See also
- setupFrameCallback
- commit
◆ fromQtWinId()
|
static |
Creates a Surface for the given winId
.
This is an integration feature for QtWayland. On non-wayland platforms this method returns nullptr
as well as for not created QWindows.
The returned Surface will be fully setup, but won't be released. It gets automatically destroyed together with the QWindow or the wl_surface corresponding. the wid
.
- Since
- 5.5
- See also
- fromWindow
◆ fromWindow()
Creates a Surface for the given window
.
This is an integration feature for QtWayland. On non-wayland platforms this method returns nullptr
as well as for not created QWindows.
The returned Surface will be fully setup, but won't be released. It gets automatically destroyed together with the window
or when the internal wl_surface get destroyed. QtWayland may destroy wl_surface when hiding the window, you should always call this function instead of holding the returned pointer.
- Since
- 5.4
◆ get()
|
static |
Definition at line 212 of file surface.cpp.
◆ id()
quint32 KWayland::Client::Surface::id | ( | ) | const |
◆ isValid()
bool KWayland::Client::Surface::isValid | ( | ) | const |
- Returns
true
if managing a wl_surface.
Definition at line 228 of file surface.cpp.
◆ outputEntered
|
signal |
◆ outputLeft
|
signal |
◆ outputs()
- Returns
- All Outputs the Surface is on, may be none.
- See also
- outputEntered
- outputLeft
- Since
- 5.27
Definition at line 265 of file surface.cpp.
◆ release()
void KWayland::Client::Surface::release | ( | ) |
Releases the wl_surface interface.
After the interface has been released the Surface instance is no longer valid and can be setup with another wl_surface interface.
Definition at line 44 of file surface.cpp.
◆ scale()
qint32 KWayland::Client::Surface::scale | ( | ) | const |
- Returns
- The current scale factor, if not explicitly set it's
1
.
- See also
- setScale
- Since
- 5.22
Definition at line 254 of file surface.cpp.
◆ setInputRegion()
void KWayland::Client::Surface::setInputRegion | ( | const Region * | region = nullptr | ) |
Sets the input region to region
.
This is a double buffered state and will be applied with the next Surface commit. Initially the Surface is set up to an infinite input region. By passing null
as the input region, it gets reset to an infinite input region.
Note: the Region is being copied and can be destroyed directly after passing to this method.
- Parameters
-
region The new input region or an infinite region if null
- See also
- commit
Definition at line 183 of file surface.cpp.
◆ setOpaqueRegion()
void KWayland::Client::Surface::setOpaqueRegion | ( | const Region * | region = nullptr | ) |
Sets the opaque region to region
.
This is a double buffered state and will be applied with the next Surface commit. Initially the Surface is set up to an empty opaque region. By passing null
as the opaque region, it gets reset to an empty opaque region.
Note: the Region is being copied and can be destroyed directly after passing to this method.
- Parameters
-
region The new opaque region or an empty region if null
- See also
- commit
Definition at line 193 of file surface.cpp.
◆ setScale()
void KWayland::Client::Surface::setScale | ( | qint32 | scale | ) |
The purpose of this method is to allow to supply higher resolution buffer data for use on high resolution outputs.
It's intended that the same buffer scale as the scale of the output that the surface is displayed on is used. This means the compositor can avoid scaling when rendering the surface on that output.
Note that if scale
is larger than 1 you have to attach a buffer that is larger (by a factor of scale in each dimension) than the desired surface size.
The default scale factor is 1.
The state is only applied with the next commit.
- See also
- scale
- commit
- Since
- 5.22
Definition at line 259 of file surface.cpp.
◆ setup()
void KWayland::Client::Surface::setup | ( | wl_surface * | surface | ) |
Setup this Surface to manage the surface
.
When using Compositor::createSurface there is no need to call this method.
Definition at line 54 of file surface.cpp.
◆ setupFrameCallback()
void KWayland::Client::Surface::setupFrameCallback | ( | ) |
Registers a frame rendered callback.
This registers a callback in the Wayland server to be notified once the next frame for this Surface has been rendered. The Surface will emit the signal frameRendered after receiving the callback from the server.
Instead of using this method one should prefer using the CommitFlag::FrameCallback in commit. This method is intended for cases when the Surface is going to be committed on other ways, e.g. through the OpenGL/EGL stack.
- See also
- frameRendered
- commit
Definition at line 126 of file surface.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:50:38 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.