KWin
Loading...
Searching...
No Matches
Signals | Public Member Functions | Static Public Member Functions | Properties | Friends | List of all members
KWin::SurfaceInterface Class Reference

Resource representing a wl_surface. More...

#include <surface.h>

Inheritance diagram for KWin::SurfaceInterface:

Signals

void aboutToBeDestroyed ()
 
void damaged (const QRegion &)
 
void opaqueChanged (const QRegion &)
 
void inputChanged (const QRegion &)
 
void bufferTransformChanged (KWin::OutputTransform)
 
void bufferSourceBoxChanged ()
 
void bufferSizeChanged ()
 
void mapped ()
 
void unmapped ()
 
void sizeChanged ()
 
void shadowChanged ()
 
void blurChanged ()
 
void slideOnShowHideChanged ()
 
void contrastChanged ()
 
void childSubSurfaceAdded (SubSurfaceInterface *subSurface)
 
void childSubSurfaceRemoved (SubSurfaceInterface *subSurface)
 
void childSubSurfacesChanged ()
 
void pointerConstraintsChanged ()
 
void inhibitsIdleChanged ()
 
void colorDescriptionChanged ()
 
void presentationModeHintChanged ()
 
void committed ()
 
void stateStashed (quint32 serial)
 
void stateApplied (quint32 serial)
 

Public Member Functions

 SurfaceInterface (CompositorInterface *compositor, wl_resource *resource)
 
 ~SurfaceInterface () override
 
uint32_t id () const
 
ClientConnectionclient () const
 
wl_resource * resource () const
 
CompositorInterfacecompositor () const
 
SurfaceRolerole () const
 
void setRole (SurfaceRole *role)
 
QPointF mapToChild (SurfaceInterface *child, const QPointF &point) const
 
void frameRendered (quint32 msec)
 
bool hasFrameCallbacks () const
 
std::unique_ptr< PresentationFeedbacktakePresentationFeedback (Output *output)
 
QRegion opaque () const
 
QRegion input () const
 
QRegion bufferDamage () const
 
QRectF bufferSourceBox () const
 
OutputTransform bufferTransform () const
 
GraphicsBufferbuffer () const
 
QPoint offset () const
 
QSizeF size () const
 
QRectF boundingRect () const
 
QSize bufferSize () const
 
SubSurfaceInterfacesubSurface () const
 
QList< SubSurfaceInterface * > below () const
 
QList< SubSurfaceInterface * > above () const
 
ShadowInterfaceshadow () const
 
BlurInterfaceblur () const
 
SlideInterfaceslideOnShowHide () const
 
ContrastInterfacecontrast () const
 
bool isMapped () const
 
SurfaceInterfacesurfaceAt (const QPointF &position)
 
SurfaceInterfaceinputSurfaceAt (const QPointF &position)
 
void setOutputs (const QList< OutputInterface * > &outputs, OutputInterface *primaryOutput)
 
QList< OutputInterface * > outputs () const
 
ConfinedPointerV1InterfaceconfinedPointer () const
 
LockedPointerV1InterfacelockedPointer () const
 
bool inhibitsIdle () const
 
LinuxDmaBufV1FeedbackdmabufFeedbackV1 () const
 
ContentType contentType () const
 
qreal scaleOverride () const
 
QPoint toSurfaceLocal (const QPoint &point) const
 
QPointF toSurfaceLocal (const QPointF &point) const
 
PresentationModeHint presentationModeHint () const
 
void setPreferredBufferScale (qreal scale)
 
void setPreferredBufferTransform (OutputTransform transform)
 
TransactionfirstTransaction () const
 
void setFirstTransaction (Transaction *transaction)
 
TransactionlastTransaction () const
 
void setLastTransaction (Transaction *transaction)
 
const ColorDescriptioncolorDescription () const
 
void setPreferredColorDescription (const ColorDescription &descr)
 
void traverseTree (std::function< void(SurfaceInterface *surface)> callback)
 

Static Public Member Functions

static SurfaceInterfaceget (wl_resource *native)
 
static SurfaceInterfaceget (quint32 id, const ClientConnection *client)
 

Properties

QRegion opaque
 
QRegion input
 
QSizeF size
 

Friends

class SurfaceInterfacePrivate
 

Detailed Description

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.

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 is no longer needed by the SurfaceInterface, it will get unreferenced and might be automatically deleted (if it's no longer referenced).

See also
CompositorInterface
GraphicsBuffer
SubSurfaceInterface
BlurInterface
ContrastInterface
ShadowInterface
SlideInterface
LinuxDmaBufV1Feedback

Definition at line 79 of file surface.h.

Constructor & Destructor Documentation

◆ SurfaceInterface()

KWin::SurfaceInterface::SurfaceInterface ( CompositorInterface * compositor,
wl_resource * resource )
explicit

Definition at line 410 of file surface.cpp.

◆ ~SurfaceInterface()

KWin::SurfaceInterface::~SurfaceInterface ( )
override

Definition at line 425 of file surface.cpp.

Member Function Documentation

◆ aboutToBeDestroyed

void KWin::SurfaceInterface::aboutToBeDestroyed ( )
signal

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.

◆ above()

QList< SubSurfaceInterface * > KWin::SurfaceInterface::above ( ) const

Returns the sub-surfaces that are above this surface. The sub-surfaces are sorted from bottom to top.

Definition at line 840 of file surface.cpp.

◆ below()

QList< SubSurfaceInterface * > KWin::SurfaceInterface::below ( ) const

Returns the sub-surfaces that are below this surface. The sub-surfaces are sorted from bottom to top.

Definition at line 835 of file surface.cpp.

◆ blur()

BlurInterface * KWin::SurfaceInterface::blur ( ) const
Returns
The Blur for this Surface.

Definition at line 876 of file surface.cpp.

◆ blurChanged

void KWin::SurfaceInterface::blurChanged ( )
signal

◆ boundingRect()

QRectF KWin::SurfaceInterface::boundingRect ( ) const

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.

Definition at line 855 of file surface.cpp.

◆ buffer()

GraphicsBuffer * KWin::SurfaceInterface::buffer ( ) const
Returns
the current GraphicsBuffer, might be nullptr.

Definition at line 809 of file surface.cpp.

◆ bufferDamage()

QRegion KWin::SurfaceInterface::bufferDamage ( ) const

Definition at line 784 of file surface.cpp.

◆ bufferSize()

QSize KWin::SurfaceInterface::bufferSize ( ) const

Returns the size of the attached buffer, in device pixels.

If no buffer is attached to this surface, an invalid QSize will be returned.

Definition at line 1061 of file surface.cpp.

◆ bufferSizeChanged

void KWin::SurfaceInterface::bufferSizeChanged ( )
signal

This signal is emitted when the size of the attached buffer has changed.

◆ bufferSourceBox()

QRectF KWin::SurfaceInterface::bufferSourceBox ( ) const

Definition at line 799 of file surface.cpp.

◆ bufferSourceBoxChanged

void KWin::SurfaceInterface::bufferSourceBoxChanged ( )
signal

◆ bufferTransform()

OutputTransform KWin::SurfaceInterface::bufferTransform ( ) const

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.

Definition at line 804 of file surface.cpp.

◆ bufferTransformChanged

void KWin::SurfaceInterface::bufferTransformChanged ( KWin::OutputTransform )
signal

This signal is emitted when the buffer transform has changed.

◆ childSubSurfaceAdded

void KWin::SurfaceInterface::childSubSurfaceAdded ( SubSurfaceInterface * subSurface)
signal

Emitted whenever a new child sub-surface subSurface is added.

◆ childSubSurfaceRemoved

void KWin::SurfaceInterface::childSubSurfaceRemoved ( SubSurfaceInterface * subSurface)
signal

Emitted whenver the child sub-surface subSurface is removed.

◆ childSubSurfacesChanged

void KWin::SurfaceInterface::childSubSurfacesChanged ( )
signal

This signal is emitted when the list of child subsurfaces changes.

◆ client()

ClientConnection * KWin::SurfaceInterface::client ( ) const

Returns the Wayland client that owns this SurfaceInterface.

Definition at line 444 of file surface.cpp.

◆ colorDescription()

const ColorDescription & KWin::SurfaceInterface::colorDescription ( ) const

Definition at line 1086 of file surface.cpp.

◆ colorDescriptionChanged

void KWin::SurfaceInterface::colorDescriptionChanged ( )
signal

◆ committed

void KWin::SurfaceInterface::committed ( )
signal

Emitted when the Surface has been committed.

This signal is emitted after all the relevant damage and xyzChanged signals for this commit are emitted.

◆ compositor()

CompositorInterface * KWin::SurfaceInterface::compositor ( ) const

Returns the compositor for this SurfaceInterface.

Definition at line 454 of file surface.cpp.

◆ confinedPointer()

ConfinedPointerV1Interface * KWin::SurfaceInterface::confinedPointer ( ) const

Pointer confinement installed on this SurfaceInterface.

See also
pointerConstraintsChanged

Definition at line 1019 of file surface.cpp.

◆ contentType()

ContentType KWin::SurfaceInterface::contentType ( ) const
Returns
the current content type of this surface

Definition at line 1034 of file surface.cpp.

◆ contrast()

ContrastInterface * KWin::SurfaceInterface::contrast ( ) const
Returns
The Contrast for this Surface.

Definition at line 881 of file surface.cpp.

◆ contrastChanged

void KWin::SurfaceInterface::contrastChanged ( )
signal

◆ damaged

void KWin::SurfaceInterface::damaged ( const QRegion & )
signal

Emitted whenever the SurfaceInterface got damaged. The signal is only emitted during the commit of state. A damage means that a new GraphicsBuffer got attached.

See also
buffer
damage

◆ dmabufFeedbackV1()

LinuxDmaBufV1Feedback * KWin::SurfaceInterface::dmabufFeedbackV1 ( ) const

dmabuf feedback installed on this SurfaceInterface

Definition at line 1029 of file surface.cpp.

◆ firstTransaction()

Transaction * KWin::SurfaceInterface::firstTransaction ( ) const

The first committed transaction that is scheduled to be applied to this surface.

Definition at line 1149 of file surface.cpp.

◆ frameRendered()

void KWin::SurfaceInterface::frameRendered ( quint32 msec)

Definition at line 459 of file surface.cpp.

◆ get() [1/2]

SurfaceInterface * KWin::SurfaceInterface::get ( quint32 id,
const ClientConnection * client )
static
Returns
The SurfaceInterface with given id for client, if it exists, otherwise nullptr.

Definition at line 827 of file surface.cpp.

◆ get() [2/2]

SurfaceInterface * KWin::SurfaceInterface::get ( wl_resource * native)
static
Returns
The SurfaceInterface for the native resource.

Definition at line 819 of file surface.cpp.

◆ hasFrameCallbacks()

bool KWin::SurfaceInterface::hasFrameCallbacks ( ) const

Definition at line 479 of file surface.cpp.

◆ id()

uint32_t KWin::SurfaceInterface::id ( ) const

Returns the object id for this Wayland surface.

Definition at line 439 of file surface.cpp.

◆ inhibitsIdle()

bool KWin::SurfaceInterface::inhibitsIdle ( ) const
Returns
Whether this SurfaceInterface wants idle to be inhibited on the Output it is shown
See also
inhibitsIdleChanged

Definition at line 1024 of file surface.cpp.

◆ inhibitsIdleChanged

void KWin::SurfaceInterface::inhibitsIdleChanged ( )
signal

Emitted whenever the SurfaceInterface starts/ends to inhibit idle.

See also
inhibitsIdle

◆ input()

QRegion KWin::SurfaceInterface::input ( ) const

Definition at line 794 of file surface.cpp.

◆ inputChanged

void KWin::SurfaceInterface::inputChanged ( const QRegion & )
signal

◆ inputSurfaceAt()

SurfaceInterface * KWin::SurfaceInterface::inputSurfaceAt ( const QPointF & position)

Finds the input receiving SurfaceInterface at the given 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 position.

If no such SurfaceInterface is found, e.g. because the SurfaceInterface is unmapped or there is no input region containing the position, nullptr is returned.

Parameters
positionThe position in surface-local coordinates
Returns
Input receiving child surface at the given position or surface itself at the position, might be nullptr

Definition at line 982 of file surface.cpp.

◆ isMapped()

bool KWin::SurfaceInterface::isMapped ( ) const

Whether the SurfaceInterface is currently considered to be mapped. A SurfaceInterface is mapped if it has a non-null GraphicsBuffer attached. If the SurfaceInterface references a SubSurfaceInterface it is only considered mapped if it has a GraphicsBuffer attached and the parent SurfaceInterface is mapped.

Returns
Whether the SurfaceInterface is currently mapped

Definition at line 891 of file surface.cpp.

◆ lastTransaction()

Transaction * KWin::SurfaceInterface::lastTransaction ( ) const

The last committed transaction that is scheduled to be applied to this surface.

Definition at line 1159 of file surface.cpp.

◆ lockedPointer()

LockedPointerV1Interface * KWin::SurfaceInterface::lockedPointer ( ) const

Pointer lock installed on this SurfaceInterface.

See also
pointerConstraintsChanged

Definition at line 1014 of file surface.cpp.

◆ mapped

void KWin::SurfaceInterface::mapped ( )
signal

Emitted when the Surface becomes visible, i.e. a non-null buffer has been attached.

◆ mapToChild()

QPointF KWin::SurfaceInterface::mapToChild ( SurfaceInterface * child,
const QPointF & point ) const

Maps the specified point in this surface's coordinate system to the equivalent point within the child's coordinate system, and returns the mapped point.

If this surface is not an ancestor of the child, a null point is returned.

Definition at line 1039 of file surface.cpp.

◆ offset()

QPoint KWin::SurfaceInterface::offset ( ) const

Definition at line 814 of file surface.cpp.

◆ opaque()

QRegion KWin::SurfaceInterface::opaque ( ) const

Definition at line 789 of file surface.cpp.

◆ opaqueChanged

void KWin::SurfaceInterface::opaqueChanged ( const QRegion & )
signal

◆ outputs()

QList< OutputInterface * > KWin::SurfaceInterface::outputs ( ) const
Returns
All OutputInterfaces the SurfaceInterface is on.
See also
setOutputs

Definition at line 896 of file surface.cpp.

◆ pointerConstraintsChanged

void KWin::SurfaceInterface::pointerConstraintsChanged ( )
signal

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 also
confinedPointer
lockedPointer

◆ presentationModeHint()

PresentationModeHint KWin::SurfaceInterface::presentationModeHint ( ) const
Returns
if the client thinks the content of this surface is suitable for presentation with tearing

Definition at line 1081 of file surface.cpp.

◆ presentationModeHintChanged

void KWin::SurfaceInterface::presentationModeHintChanged ( )
signal

◆ resource()

wl_resource * KWin::SurfaceInterface::resource ( ) const

Returns the Wayland resource corresponding to this SurfaceInterface.

Definition at line 449 of file surface.cpp.

◆ role()

SurfaceRole * KWin::SurfaceInterface::role ( ) const

Returns the role of this surface, or null if no role has been assigned to the surface.

Once a role is given to the surface, it is permanent.

Definition at line 429 of file surface.cpp.

◆ scaleOverride()

qreal KWin::SurfaceInterface::scaleOverride ( ) const
See also
ClientConnection::setScaleOverride

Definition at line 1066 of file surface.cpp.

◆ setFirstTransaction()

void KWin::SurfaceInterface::setFirstTransaction ( Transaction * transaction)

Definition at line 1154 of file surface.cpp.

◆ setLastTransaction()

void KWin::SurfaceInterface::setLastTransaction ( Transaction * transaction)

Definition at line 1164 of file surface.cpp.

◆ setOutputs()

void KWin::SurfaceInterface::setOutputs ( const QList< OutputInterface * > & outputs,
OutputInterface * primaryOutput )

Sets the 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 also
outputs

Definition at line 901 of file surface.cpp.

◆ setPreferredBufferScale()

void KWin::SurfaceInterface::setPreferredBufferScale ( qreal scale)

Sets a preferred buffer scale that clients should provide buffers in

Parameters
scale

Definition at line 1108 of file surface.cpp.

◆ setPreferredBufferTransform()

void KWin::SurfaceInterface::setPreferredBufferTransform ( OutputTransform transform)

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.

Definition at line 1130 of file surface.cpp.

◆ setPreferredColorDescription()

void KWin::SurfaceInterface::setPreferredColorDescription ( const ColorDescription & descr)

Definition at line 1091 of file surface.cpp.

◆ setRole()

void KWin::SurfaceInterface::setRole ( SurfaceRole * role)

Definition at line 434 of file surface.cpp.

◆ shadow()

ShadowInterface * KWin::SurfaceInterface::shadow ( ) const
Returns
The Shadow for this Surface.

Definition at line 871 of file surface.cpp.

◆ shadowChanged

void KWin::SurfaceInterface::shadowChanged ( )
signal

◆ size()

QSizeF KWin::SurfaceInterface::size ( ) const

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

Definition at line 850 of file surface.cpp.

◆ sizeChanged

void KWin::SurfaceInterface::sizeChanged ( )
signal

This signal is emitted when the surface size has changed.

◆ slideOnShowHide()

SlideInterface * KWin::SurfaceInterface::slideOnShowHide ( ) const
Returns
The Slide for this Surface.

Definition at line 886 of file surface.cpp.

◆ slideOnShowHideChanged

void KWin::SurfaceInterface::slideOnShowHideChanged ( )
signal

◆ stateApplied

void KWin::SurfaceInterface::stateApplied ( quint32 serial)
signal

This signal is emitted when the state in a surface commit with the specified serial has been applied.

◆ stateStashed

void KWin::SurfaceInterface::stateStashed ( quint32 serial)
signal

This signal is emitted when a surface commit with the specified serial has been cached to be applied later.

◆ subSurface()

SubSurfaceInterface * KWin::SurfaceInterface::subSurface ( ) const
Returns
The SubSurface for this Surface in case there is one.

Definition at line 845 of file surface.cpp.

◆ surfaceAt()

SurfaceInterface * KWin::SurfaceInterface::surfaceAt ( const QPointF & position)

Finds the SurfaceInterface at the given 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 position.

If no such SurfaceInterface is found, e.g. because the SurfaceInterface is unmapped, nullptr is returned.

Parameters
positionThe position in surface-local coordinates
Returns
Child surface at the given position or surface itself at the position, might be nullptr

Definition at line 953 of file surface.cpp.

◆ takePresentationFeedback()

std::unique_ptr< PresentationFeedback > KWin::SurfaceInterface::takePresentationFeedback ( Output * output)

Definition at line 471 of file surface.cpp.

◆ toSurfaceLocal() [1/2]

QPoint KWin::SurfaceInterface::toSurfaceLocal ( const QPoint & point) const

Convert a co-ordinate from kwin logical space to surface logical space

Definition at line 1071 of file surface.cpp.

◆ toSurfaceLocal() [2/2]

QPointF KWin::SurfaceInterface::toSurfaceLocal ( const QPointF & point) const

Convert a co-ordinate from kwin logical space to surface logical space

Definition at line 1076 of file surface.cpp.

◆ traverseTree()

void KWin::SurfaceInterface::traverseTree ( std::function< void(SurfaceInterface *surface)> callback)

Traverses the surface sub-tree with this surface as the root.

Definition at line 1169 of file surface.cpp.

◆ unmapped

void KWin::SurfaceInterface::unmapped ( )
signal

Emitted when the Surface removes its content

Friends And Related Symbol Documentation

◆ SurfaceInterfacePrivate

friend class SurfaceInterfacePrivate
friend

Definition at line 452 of file surface.h.

Property Documentation

◆ input

QRegion KWin::SurfaceInterface::input
read

The current input region.

Definition at line 89 of file surface.h.

◆ opaque

QRegion KWin::SurfaceInterface::opaque
read

The opaque region for a translucent buffer.

Definition at line 85 of file surface.h.

◆ size

QSizeF KWin::SurfaceInterface::size
read

Definition at line 90 of file surface.h.


The documentation for this class was generated from the following files: