diff options
author | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2015-08-07 12:35:44 +0200 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2015-08-28 13:10:33 +0200 |
commit | dfec7314fd3758375e96d4641d2d6b5bec595320 (patch) | |
tree | 22cfabe1662b3e45795cd66f80388157490d575f /src/compositor/compositor_api/qwaylandsurface.cpp | |
parent | fd9a8983832bbeb240097327ff9f8565f7356b08 (diff) |
Remove output from QWaylandSurface
It is the views that belong to outputs.
This leads to a couple of interesting cases with enter and leave events,
but the implementation says you will get enter events for the first view
of a surface entering an output, and for the last view being removed
from an output.
Also to throttle a surface, there has to be 1 surface which takes care
of this. This is because if multiple views throttle, then the client
might render to quick.
Change-Id: If4bba380fd4d7f506fd769606cbdea4ce58b908d
Diffstat (limited to 'src/compositor/compositor_api/qwaylandsurface.cpp')
-rw-r--r-- | src/compositor/compositor_api/qwaylandsurface.cpp | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp index d6d9b1d53..ca5e3cfb9 100644 --- a/src/compositor/compositor_api/qwaylandsurface.cpp +++ b/src/compositor/compositor_api/qwaylandsurface.cpp @@ -53,7 +53,6 @@ #include "qwaylandsurface_p.h" #include "qwaylandview_p.h" #include "qwaylandbufferref.h" -#include "qwaylandoutput.h" #include <QtGui/QGuiApplication> #include <QtGui/QScreen> @@ -162,20 +161,6 @@ QWaylandCompositor *QWaylandSurface::compositor() const return d->compositor()->waylandCompositor(); } -QWaylandOutput *QWaylandSurface::primaryOutput() const -{ - Q_D(const QWaylandSurface); - if (!d->primaryOutput()) - return Q_NULLPTR; - return d->primaryOutput()->waylandOutput(); -} - -void QWaylandSurface::setPrimaryOutput(QWaylandOutput *output) -{ - Q_D(QWaylandSurface); - d->setPrimaryOutput(output->handle()); -} - void QWaylandSurface::sendFrameCallbacks() { Q_D(QWaylandSurface); @@ -212,22 +197,6 @@ void QWaylandSurface::destroy() deref(); } -void QWaylandSurface::enter(QWaylandOutput *output) -{ - Q_D(QWaylandSurface); - QtWayland::OutputResource *outputResource = output->handle()->outputForClient(d->resource()->client()); - if (outputResource) - handle()->send_enter(outputResource->handle); -} - -void QWaylandSurface::leave(QWaylandOutput *output) -{ - Q_D(QWaylandSurface); - QtWayland::OutputResource *outputResource = output->handle()->outputForClient(d->resource()->client()); - if (outputResource) - d->send_leave(outputResource->handle); -} - void QWaylandSurface::markAsCursorSurface(bool cursorSurface) { Q_D(QWaylandSurface); @@ -271,6 +240,31 @@ void QWaylandSurface::deref() compositor()->handle()->destroySurface(d); } +QWaylandView *QWaylandSurface::throttlingView() const +{ + Q_D(const QWaylandSurface); + if (d->views.isEmpty()) + return Q_NULLPTR; + return d->views.first(); +} + +void QWaylandSurface::setThrottlingView(QWaylandView *view) +{ + Q_D(QWaylandSurface); + + if (!view) + return; + + int index = d->views.indexOf(view); + + if (index < 0) { + view->setSurface(this); + index = d->views.indexOf(view); + } + + d->views.move(index, 0); +} + QList<QWaylandView *> QWaylandSurface::views() const { Q_D(const QWaylandSurface); |