diff options
Diffstat (limited to 'src/compositor/compositor_api/qwaylandsurface.cpp')
-rw-r--r-- | src/compositor/compositor_api/qwaylandsurface.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp index bae6468ca..a8dc41fd5 100644 --- a/src/compositor/compositor_api/qwaylandsurface.cpp +++ b/src/compositor/compositor_api/qwaylandsurface.cpp @@ -322,7 +322,9 @@ QList<QWaylandOutput *> QWaylandSurface::outputs() const Q_D(const QWaylandSurface); QList<QWaylandOutput *> list; - Q_FOREACH (QtWayland::Output *output, d->outputs()) + const QList<QtWayland::Output *> outputs = d->outputs(); + list.reserve(outputs.count()); + Q_FOREACH (QtWayland::Output *output, outputs) list.append(output->waylandOutput()); return list; } @@ -509,4 +511,30 @@ void QWaylandSurfacePrivate::setType(QWaylandSurface::WindowType type) } } +class QWaylandUnmapLockPrivate +{ +public: + QWaylandSurface *surface; +}; + +/*! + Constructs a QWaylandUnmapLock object. + + The lock will act on the \a surface parameter, and will prevent the surface to + be unmapped, retaining the last valid buffer when the client attachs a NULL buffer. + The lock will be automatically released when deleted. +*/ +QWaylandUnmapLock::QWaylandUnmapLock(QWaylandSurface *surface) + : d(new QWaylandUnmapLockPrivate) +{ + d->surface = surface; + surface->handle()->addUnmapLock(this); +} + +QWaylandUnmapLock::~QWaylandUnmapLock() +{ + d->surface->handle()->removeUnmapLock(this); + delete d; +} + QT_END_NAMESPACE |