7#include <QtWaylandCompositor/QWaylandSeat>
8#include <QtWaylandCompositor/QWaylandCompositor>
10#include <QtWaylandCompositor/private/qwaylandsurface_p.h>
11#include <QtWaylandCompositor/private/qwaylandoutput_p.h>
13#include <QtCore/QMutex>
14#include <QtCore/qpointer.h>
24 QPointer<QWaylandView> deleteGuard(
q);
25 emit q->surfaceDestroyed();
26 if (!deleteGuard.isNull())
84 return d->renderObject;
138 if (
d->surface == newSurface)
141 d->setSurface(newSurface);
142 d->clearFrontBuffer();
166 if (
d->output == newOutput)
169 if (
d->output &&
d->surface)
172 d->output = newOutput;
174 if (
d->output &&
d->surface)
193 d->nextDamage = damage;
194 d->nextBufferCommitted =
true;
208 if (!
d->nextBufferCommitted && !
d->forceAdvanceSucceed)
214 if (
d->surface &&
d->surface->primaryView() ==
this) {
215 const auto views =
d->surface->views();
217 if (
view !=
this &&
view->allowDiscardFrontBuffer() &&
view->d_func()->currentBuffer ==
d->currentBuffer)
218 view->discardCurrentBuffer();
223 d->forceAdvanceSucceed =
false;
224 d->nextBufferCommitted =
false;
225 d->currentBuffer =
d->nextBuffer;
226 d->currentDamage =
d->nextDamage;
238 d->forceAdvanceSucceed =
true;
248 return d->currentBuffer;
258 return d->currentDamage;
283 return d->bufferLocked;
289 if (
d->bufferLocked == locked)
291 d->bufferLocked = locked;
316 return d->allowDiscardFrontBuffer;
322 if (
d->allowDiscardFrontBuffer == discard)
324 d->allowDiscardFrontBuffer = discard;
339 d->surface->setPrimaryView(
this);
341 qWarning(
"Calling setPrimary() on a QWaylandView without a surface has no effect.");
352 return d->surface &&
d->surface->primaryView() ==
this;
363 return d->surface->resource();
368#include "moc_qwaylandview.cpp"
The QRegion class specifies a clip region for a painter.
\inmodule QtWaylandCompositor
static QWaylandOutputPrivate * get(QWaylandOutput *output)
\qmltype WaylandOutput \instantiates QWaylandOutput \inqmlmodule QtWayland.Compositor
static QWaylandSurfacePrivate * get(QWaylandSurface *surface)
\qmltype WaylandSurface \instantiates QWaylandSurface \inqmlmodule QtWayland.Compositor
void setSurface(QWaylandSurface *newSurface)
QWaylandSurface * surface
QWaylandBufferRef nextBuffer
QWaylandBufferRef currentBuffer
void markSurfaceAsDestroyed(QWaylandSurface *surface)
\qmltype WaylandView \instantiates QWaylandView \inqmlmodule QtWayland.Compositor
virtual bool advance()
Updates the current buffer and damage region to the latest version committed by the client.
virtual void discardCurrentBuffer()
Force the view to discard its current buffer, to allow it to be reused on the client side.
virtual QRegion currentDamage()
Returns the current damage region of this view.
bool isBufferLocked() const
struct wl_resource * surfaceResource() const
Returns the Wayland surface resource for this QWaylandView.
void allowDiscardFrontBufferChanged()
bool isPrimary() const
Returns true if this QWaylandView is the primary view for the QWaylandSurface.
QWaylandOutput * output
\qmlproperty WaylandOutput QtWayland.Compositor::WaylandView::output
void setSurface(QWaylandSurface *surface)
QWaylandView(QObject *renderObject=nullptr, QObject *parent=nullptr)
Constructs a QWaylandView with the given renderObject and parent.
bool allowDiscardFrontBuffer
\qmlproperty bool QtWayland.Compositor::WaylandView::allowDiscardFrontBuffer
virtual QWaylandBufferRef currentBuffer()
Returns a reference to this view's current buffer.
void setOutput(QWaylandOutput *output)
QWaylandSurface * surface
\qmlproperty WaylandSurface QtWayland.Compositor::WaylandView::surface
void bufferLockedChanged()
~QWaylandView() override
Destroys the QWaylandView.
virtual void bufferCommitted(const QWaylandBufferRef &buffer, const QRegion &damage)
This function is called when a new buffer is committed to this view's surface.
void setPrimary()
Makes this QWaylandView the primary view for the surface.
void setAllowDiscardFrontBuffer(bool discard)
void setBufferLocked(bool locked)
Combined button and popup list for selecting options.
GLdouble GLdouble GLdouble GLdouble q