KWayland::Client::Surface

Search for usage in LXR

#include <surface.h>

Inheritance diagram for KWayland::Client::Surface:

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 &region)
 
void damageBuffer (const QRect &rect)
 
void damageBuffer (const QRegion &region)
 
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
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () 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< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, 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 QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () 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
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (const QObject *object)
 
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)
 
QThreadthread () const const
 

Static Public Member Functions

static const QList< Surface * > & all ()
 
static SurfacefromQtWinId (WId wid)
 
static SurfacefromWindow (QWindow *window)
 
static Surfaceget (wl_surface *native)
 
- Static Public Member Functions inherited from QObject
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

- Properties inherited from QObject
 objectName
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QObject
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
 
QObjectsender () 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

Definition at line 43 of file surface.h.

Member Enumeration Documentation

◆ CommitFlag

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

Definition at line 133 of file surface.h.

Member Function Documentation

◆ all()

const QList< Surface * > & KWayland::Client::Surface::all ( )
static

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]

void KWayland::Client::Surface::attachBuffer ( Buffer buffer,
const QPoint offset = QPoint() 
)

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
bufferThe buffer to attach to this Surface
offsetPosition 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

void KWayland::Client::Surface::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 Surface* KWayland::Client::Surface::fromQtWinId ( WId  wid)
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()

static Surface* KWayland::Client::Surface::fromWindow ( QWindow window)
static

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()

Surface * KWayland::Client::Surface::get ( wl_surface *  native)
static
Returns
The Surface referencing the native wl_surface or null if there is no such Surface.

Definition at line 212 of file surface.cpp.

◆ id()

quint32 KWayland::Client::Surface::id ( ) const
Returns
the id of the referenced wl_proxy.
Since
5.4

Definition at line 248 of file surface.cpp.

◆ isValid()

bool KWayland::Client::Surface::isValid ( ) const
Returns
true if managing a wl_surface.

Definition at line 228 of file surface.cpp.

◆ outputEntered

void KWayland::Client::Surface::outputEntered ( KWayland::Client::Output o)
signal

Emitted whenever a change in the Surface (e.g.

creation, movement, resize) results in a part of the Surface being within the scanout region of the Output o.

Parameters
oThe Output the Surface intersects with
See also
outputLeft
outputs
Since
5.27

◆ outputLeft

void KWayland::Client::Surface::outputLeft ( KWayland::Client::Output o)
signal

Emitted whenever a change in the Surface (e.g.

creation, movement, resize, unmapping) results in the Surface no longer being within the scanout region of the Output o.

Parameters
oThe Output the Surface no longer intersects with
See also
outputEntered
outputs
Since
5.27

◆ outputs()

QVector< Output * > KWayland::Client::Surface::outputs ( ) const
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
regionThe 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
regionThe 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:
This file is part of the KDE documentation.
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.