diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2016-04-28 12:09:13 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2016-04-29 11:37:32 +0000 |
commit | 32a09df9a1b42806be0fd82a40f5837a22cfa52c (patch) | |
tree | 65e2b4ba3e6c0277b9da74382231d5f16dee8f28 /src/compositor/compositor_api/qwaylandsurface.cpp | |
parent | 3004d09437aca95544be88f60bae9b3f1d412a63 (diff) |
Compositor API: Add bufferScale property to QWaylandSurface
Change-Id: I1d4e4b65e5a58e3f314551bb10226fa58650becb
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Diffstat (limited to 'src/compositor/compositor_api/qwaylandsurface.cpp')
-rw-r--r-- | src/compositor/compositor_api/qwaylandsurface.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp index 3a16ed27a..ea4c4672e 100644 --- a/src/compositor/compositor_api/qwaylandsurface.cpp +++ b/src/compositor/compositor_api/qwaylandsurface.cpp @@ -126,6 +126,7 @@ QWaylandSurfacePrivate::QWaylandSurfacePrivate() , buffer(0) , role(0) , inputRegion(infiniteRegion()) + , bufferScale(1) , isCursorSurface(false) , destroyed(false) , mapped(false) @@ -137,6 +138,7 @@ QWaylandSurfacePrivate::QWaylandSurfacePrivate() pending.buffer = 0; pending.newlyAttached = false; pending.inputRegion = infiniteRegion(); + pending.bufferScale = 1; #ifndef QT_NO_DEBUG addUninitializedSurface(this); #endif @@ -170,6 +172,15 @@ void QWaylandSurfacePrivate::setSize(const QSize &s) } } +void QWaylandSurfacePrivate::setBufferScale(int scale) +{ + Q_Q(QWaylandSurface); + if (scale == bufferScale) + return; + bufferScale = scale; + emit q->bufferScaleChanged(); +} + void QWaylandSurfacePrivate::removeFrameCallback(QtWayland::FrameCallback *callback) { pendingFrameCallbacks.removeOne(callback); @@ -272,6 +283,8 @@ void QWaylandSurfacePrivate::surface_commit(Resource *) pending.newlyAttached = false; pending.damage = QRegion(); + setBufferScale(pending.bufferScale); + if (buffer) buffer->setCommitted(); @@ -307,6 +320,12 @@ void QWaylandSurfacePrivate::surface_set_buffer_transform(Resource *resource, in emit q->contentOrientationChanged(); } +void QWaylandSurfacePrivate::surface_set_buffer_scale(QtWaylandServer::wl_surface::Resource *resource, int32_t scale) +{ + Q_UNUSED(resource); + pending.bufferScale = scale; +} + void QWaylandSurfacePrivate::setBackBuffer(QtWayland::SurfaceBuffer *b, const QRegion &d) { Q_Q(QWaylandSurface); @@ -497,6 +516,27 @@ QSize QWaylandSurface::size() const } /*! + * \qmlproperty size QtWaylandCompositor::WaylandSurface::bufferScale + * + * This property holds the WaylandSurface's buffer scale. The buffer scale lets + * a client supply higher resolution buffer data for use on high resolution + * outputs. + */ + +/*! + * \property QWaylandSurface::bufferScale + * + * This property holds the QWaylandSurface's buffer scale. The buffer scale + * lets a client supply higher resolution buffer data for use on high + * resolution outputs. + */ +int QWaylandSurface::bufferScale() const +{ + Q_D(const QWaylandSurface); + return d->bufferScale; +} + +/*! * \qmlproperty enum QtWaylandCompositor::WaylandSurface::contentOrientation * * This property holds the orientation of the WaylandSurface's contents. |