summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2016-08-19 13:06:08 +0200
committerPaul Olav Tvete <paul.tvete@qt.io>2016-08-22 11:31:18 +0000
commitb7075b72200b7b087e2c34fa449737970981ccea (patch)
treeaeae0620bd3c64a8f836619d68ae5b4fd139dbf6
parent768a28b284fa806cba38f864c56ba2e2c37296f2 (diff)
Rename QWaylandSurface::isMapped to hasContent
It was potentially misleading, since "mapped" is already used with a slightly different meaning in the Wayland protocol. In the protocol, mapped means that the surface should be rendered. The renamed property, on the other hand, is true if the surface has a buffer with contents attached and committed. In some cases this is not the same, i.e. the drag icon after dropping, or xdg_popups after popup_done. Change-Id: Idc359433c6130e3815de57b21d4edb13e318887d Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
-rw-r--r--examples/wayland/minimal-cpp/window.cpp2
-rw-r--r--examples/wayland/qwindow-compositor/compositor.cpp8
-rw-r--r--examples/wayland/qwindow-compositor/compositor.h2
-rw-r--r--examples/wayland/qwindow-compositor/window.cpp2
-rw-r--r--examples/wayland/server-buffer/compositor/main.cpp2
-rw-r--r--src/compositor/compositor_api/qwaylandoutput.cpp2
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp8
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.cpp24
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.h6
-rw-r--r--src/compositor/compositor_api/qwaylandsurface_p.h2
-rw-r--r--src/compositor/extensions/qwaylandwlshellintegration.cpp10
-rw-r--r--src/compositor/extensions/qwaylandwlshellintegration_p.h2
-rw-r--r--tests/auto/compositor/tst_compositor.cpp10
13 files changed, 40 insertions, 40 deletions
diff --git a/examples/wayland/minimal-cpp/window.cpp b/examples/wayland/minimal-cpp/window.cpp
index 25ea6b64f..2d529cce5 100644
--- a/examples/wayland/minimal-cpp/window.cpp
+++ b/examples/wayland/minimal-cpp/window.cpp
@@ -85,7 +85,7 @@ void Window::paintGL()
continue;
GLuint textureId = view->getTexture();
QWaylandSurface *surface = view->surface();
- if (surface && surface->isMapped()) {
+ if (surface && surface->hasContent()) {
QSize s = surface->size();
QPointF pos(sillyrandom(width() - s.width()), sillyrandom(height() - s.height()));
QRectF surfaceGeometry(pos, s);
diff --git a/examples/wayland/qwindow-compositor/compositor.cpp b/examples/wayland/qwindow-compositor/compositor.cpp
index b7cdbbd9f..13e5718d2 100644
--- a/examples/wayland/qwindow-compositor/compositor.cpp
+++ b/examples/wayland/qwindow-compositor/compositor.cpp
@@ -171,7 +171,7 @@ void Compositor::create()
void Compositor::onSurfaceCreated(QWaylandSurface *surface)
{
connect(surface, &QWaylandSurface::surfaceDestroyed, this, &Compositor::surfaceDestroyed);
- connect(surface, &QWaylandSurface::mappedChanged, this, &Compositor::surfaceMappedChanged);
+ connect(surface, &QWaylandSurface::hasContentChanged, this, &Compositor::surfaceHasContentChanged);
connect(surface, &QWaylandSurface::redraw, this, &Compositor::triggerRender);
connect(surface, &QWaylandSurface::subsurfacePositionChanged, this, &Compositor::onSubsurfacePositionChanged);
@@ -184,10 +184,10 @@ void Compositor::onSurfaceCreated(QWaylandSurface *surface)
connect(surface, &QWaylandSurface::offsetForNextFrame, view, &View::onOffsetForNextFrame);
}
-void Compositor::surfaceMappedChanged()
+void Compositor::surfaceHasContentChanged()
{
QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());
- if (surface->isMapped()) {
+ if (surface->hasContent()) {
if (surface->role() == QWaylandWlShellSurface::role()
|| surface->role() == QWaylandXdgSurface::role()
|| surface->role() == QWaylandXdgPopup::role()) {
@@ -374,7 +374,7 @@ void Compositor::adjustCursorSurface(QWaylandSurface *surface, int hotspotX, int
m_cursorHotspotX = hotspotX;
m_cursorHotspotY = hotspotY;
- if (surface && surface->isMapped())
+ if (surface && surface->hasContent())
updateCursor();
}
diff --git a/examples/wayland/qwindow-compositor/compositor.h b/examples/wayland/qwindow-compositor/compositor.h
index 243e5dbef..3de25a9bb 100644
--- a/examples/wayland/qwindow-compositor/compositor.h
+++ b/examples/wayland/qwindow-compositor/compositor.h
@@ -119,7 +119,7 @@ signals:
void frameOffset(const QPoint &offset);
private slots:
- void surfaceMappedChanged();
+ void surfaceHasContentChanged();
void surfaceDestroyed();
void viewSurfaceDestroyed();
void onStartMove();
diff --git a/examples/wayland/qwindow-compositor/window.cpp b/examples/wayland/qwindow-compositor/window.cpp
index 86a1f8651..b73c7be39 100644
--- a/examples/wayland/qwindow-compositor/window.cpp
+++ b/examples/wayland/qwindow-compositor/window.cpp
@@ -129,7 +129,7 @@ void Window::paintGL()
m_textureBlitter.bind(currentTarget);
}
QWaylandSurface *surface = view->surface();
- if (surface && surface->isMapped()) {
+ if (surface && surface->hasContent()) {
QSize s = surface->size();
if (!s.isEmpty()) {
if (m_mouseView == view && m_grabState == ResizeGrab && m_resizeAnchored)
diff --git a/examples/wayland/server-buffer/compositor/main.cpp b/examples/wayland/server-buffer/compositor/main.cpp
index 57ca647b6..9c5ee42a1 100644
--- a/examples/wayland/server-buffer/compositor/main.cpp
+++ b/examples/wayland/server-buffer/compositor/main.cpp
@@ -219,7 +219,7 @@ protected:
void onSurfaceCreated(QWaylandSurface *surface) {
QWaylandQuickItem *item = new QWaylandQuickItem();
item->setSurface(surface);
- connect(surface, &QWaylandSurface::mappedChanged, this, &QmlCompositor::surfaceMapped);
+ connect(surface, &QWaylandSurface::hasContentChanged, this, &QmlCompositor::surfaceMapped);
}
void share_buffer_bind_resource(Resource *resource) Q_DECL_OVERRIDE
diff --git a/src/compositor/compositor_api/qwaylandoutput.cpp b/src/compositor/compositor_api/qwaylandoutput.cpp
index 65bac3352..9e66b9a44 100644
--- a/src/compositor/compositor_api/qwaylandoutput.cpp
+++ b/src/compositor/compositor_api/qwaylandoutput.cpp
@@ -842,7 +842,7 @@ void QWaylandOutput::sendFrameCallbacks()
Q_D(QWaylandOutput);
for (int i = 0; i < d->surfaceViews.size(); i++) {
const QWaylandSurfaceViewMapper &surfacemapper = d->surfaceViews.at(i);
- if (surfacemapper.surface && surfacemapper.surface->isMapped()) {
+ if (surfacemapper.surface && surfacemapper.surface->hasContent()) {
if (!surfacemapper.has_entered) {
surfaceEnter(surfacemapper.surface);
d->surfaceViews[i].has_entered = true;
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp
index 2b24938fa..975802790 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -783,7 +783,7 @@ void QWaylandQuickItem::handleSurfaceChanged()
{
Q_D(QWaylandQuickItem);
if (d->oldSurface) {
- disconnect(d->oldSurface, &QWaylandSurface::mappedChanged, this, &QWaylandQuickItem::surfaceMappedChanged);
+ disconnect(d->oldSurface, &QWaylandSurface::hasContentChanged, this, &QWaylandQuickItem::surfaceMappedChanged);
disconnect(d->oldSurface, &QWaylandSurface::parentChanged, this, &QWaylandQuickItem::parentChanged);
disconnect(d->oldSurface, &QWaylandSurface::sizeChanged, this, &QWaylandQuickItem::updateSize);
disconnect(d->oldSurface, &QWaylandSurface::bufferScaleChanged, this, &QWaylandQuickItem::updateSize);
@@ -796,7 +796,7 @@ void QWaylandQuickItem::handleSurfaceChanged()
#endif
}
if (QWaylandSurface *newSurface = d->view->surface()) {
- connect(newSurface, &QWaylandSurface::mappedChanged, this, &QWaylandQuickItem::surfaceMappedChanged);
+ connect(newSurface, &QWaylandSurface::hasContentChanged, this, &QWaylandQuickItem::surfaceMappedChanged);
connect(newSurface, &QWaylandSurface::parentChanged, this, &QWaylandQuickItem::parentChanged);
connect(newSurface, &QWaylandSurface::sizeChanged, this, &QWaylandQuickItem::updateSize);
connect(newSurface, &QWaylandSurface::bufferScaleChanged, this, &QWaylandQuickItem::updateSize);
@@ -1068,9 +1068,9 @@ void QWaylandQuickItem::updateInputMethod(Qt::InputMethodQueries queries)
QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
{
Q_D(QWaylandQuickItem);
- const bool mapped = surface() && surface()->isMapped() && d->view->currentBuffer().hasBuffer();
+ const bool hasContent = surface() && surface()->hasContent() && d->view->currentBuffer().hasBuffer();
- if (!mapped || !d->paintEnabled) {
+ if (!hasContent || !d->paintEnabled) {
delete oldNode;
return 0;
}
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp
index 98f6a1d28..09eba77e0 100644
--- a/src/compositor/compositor_api/qwaylandsurface.cpp
+++ b/src/compositor/compositor_api/qwaylandsurface.cpp
@@ -129,7 +129,7 @@ QWaylandSurfacePrivate::QWaylandSurfacePrivate()
, bufferScale(1)
, isCursorSurface(false)
, destroyed(false)
- , mapped(false)
+ , hasContent(false)
, isInitialized(false)
, contentOrientation(Qt::PrimaryOrientation)
, inputMethodControl(Q_NULLPTR)
@@ -193,9 +193,9 @@ void QWaylandSurfacePrivate::notifyViewsAboutDestruction()
foreach (QWaylandView *view, views) {
QWaylandViewPrivate::get(view)->markSurfaceAsDestroyed(q);
}
- if (mapped) {
- mapped = false;
- emit q->mappedChanged();
+ if (hasContent) {
+ hasContent = false;
+ emit q->hasContentChanged();
}
}
@@ -342,10 +342,10 @@ void QWaylandSurfacePrivate::setBackBuffer(QtWayland::SurfaceBuffer *b, const QR
emit q->damaged(damage);
- bool oldMapped = mapped;
- mapped = QtWayland::SurfaceBuffer::hasContent(buffer);
- if (oldMapped != mapped)
- emit q->mappedChanged();
+ bool oldHasContent = hasContent;
+ hasContent = QtWayland::SurfaceBuffer::hasContent(buffer);
+ if (oldHasContent != hasContent)
+ emit q->hasContentChanged();
if (!pending.offset.isNull())
emit q->offsetForNextFrame(pending.offset);
@@ -484,20 +484,20 @@ QWaylandClient *QWaylandSurface::client() const
}
/*!
- * \qmlproperty bool QtWaylandCompositor::WaylandSurface::isMapped
+ * \qmlproperty bool QtWaylandCompositor::WaylandSurface::hasContent
*
* This property holds whether the WaylandSurface has content.
*/
/*!
- * \property QWaylandSurface::isMapped
+ * \property QWaylandSurface::hasContent
*
* This property holds whether the QWaylandSurface has content.
*/
-bool QWaylandSurface::isMapped() const
+bool QWaylandSurface::hasContent() const
{
Q_D(const QWaylandSurface);
- return d->mapped;
+ return d->hasContent;
}
/*!
diff --git a/src/compositor/compositor_api/qwaylandsurface.h b/src/compositor/compositor_api/qwaylandsurface.h
index 13cf0e437..ed358fefa 100644
--- a/src/compositor/compositor_api/qwaylandsurface.h
+++ b/src/compositor/compositor_api/qwaylandsurface.h
@@ -82,7 +82,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandSurface : public QWaylandObject
Q_PROPERTY(int bufferScale READ bufferScale NOTIFY bufferScaleChanged)
Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation NOTIFY contentOrientationChanged)
Q_PROPERTY(QWaylandSurface::Origin origin READ origin NOTIFY originChanged)
- Q_PROPERTY(bool isMapped READ isMapped NOTIFY mappedChanged)
+ Q_PROPERTY(bool hasContent READ hasContent NOTIFY hasContentChanged)
Q_PROPERTY(bool cursorSurface READ isCursorSurface WRITE markAsCursorSurface)
public:
@@ -105,7 +105,7 @@ public:
bool setRole(QWaylandSurfaceRole *role, wl_resource *errorResource, uint32_t errorCode);
QWaylandSurfaceRole *role() const;
- bool isMapped() const;
+ bool hasContent() const;
QSize size() const;
int bufferScale() const;
@@ -144,7 +144,7 @@ protected:
QWaylandSurface(QWaylandSurfacePrivate &dptr);
Q_SIGNALS:
- void mappedChanged();
+ void hasContentChanged();
void damaged(const QRegion &rect);
void parentChanged(QWaylandSurface *newParent, QWaylandSurface *oldParent);
void childAdded(QWaylandSurface *child);
diff --git a/src/compositor/compositor_api/qwaylandsurface_p.h b/src/compositor/compositor_api/qwaylandsurface_p.h
index e37179cc6..0596b61ba 100644
--- a/src/compositor/compositor_api/qwaylandsurface_p.h
+++ b/src/compositor/compositor_api/qwaylandsurface_p.h
@@ -171,7 +171,7 @@ public: //member variables
int bufferScale;
bool isCursorSurface;
bool destroyed;
- bool mapped;
+ bool hasContent;
bool isInitialized;
Qt::ScreenOrientation contentOrientation;
QWindow::Visibility visibility;
diff --git a/src/compositor/extensions/qwaylandwlshellintegration.cpp b/src/compositor/extensions/qwaylandwlshellintegration.cpp
index ee4783ba9..1acc01dd7 100644
--- a/src/compositor/extensions/qwaylandwlshellintegration.cpp
+++ b/src/compositor/extensions/qwaylandwlshellintegration.cpp
@@ -111,8 +111,8 @@ void WlShellIntegration::handleSetPopup(QWaylandSeat *seat, QWaylandSurface *par
if (!popupShellSurfaces.contains(m_shellSurface)) {
popupShellSurfaces.append(m_shellSurface);
- QObject::connect(m_shellSurface->surface(), &QWaylandSurface::mappedChanged,
- this, &WlShellIntegration::handleSurfaceUnmapped);
+ QObject::connect(m_shellSurface->surface(), &QWaylandSurface::hasContentChanged,
+ this, &WlShellIntegration::handleSurfaceHasContentChanged);
}
}
@@ -120,8 +120,8 @@ void WlShellIntegration::handlePopupClosed()
{
handlePopupRemoved();
if (m_shellSurface)
- QObject::disconnect(m_shellSurface->surface(), &QWaylandSurface::mappedChanged,
- this, &WlShellIntegration::handleSurfaceUnmapped);
+ QObject::disconnect(m_shellSurface->surface(), &QWaylandSurface::hasContentChanged,
+ this, &WlShellIntegration::handleSurfaceHasContentChanged);
}
void WlShellIntegration::handlePopupRemoved()
@@ -141,7 +141,7 @@ void WlShellIntegration::handleShellSurfaceDestroyed()
m_shellSurface = nullptr;
}
-void WlShellIntegration::handleSurfaceUnmapped()
+void WlShellIntegration::handleSurfaceHasContentChanged()
{
if (!m_shellSurface || !m_shellSurface->surface()->size().isEmpty())
return;
diff --git a/src/compositor/extensions/qwaylandwlshellintegration_p.h b/src/compositor/extensions/qwaylandwlshellintegration_p.h
index 69bbbcd9c..f68040cdf 100644
--- a/src/compositor/extensions/qwaylandwlshellintegration_p.h
+++ b/src/compositor/extensions/qwaylandwlshellintegration_p.h
@@ -69,7 +69,7 @@ private Q_SLOTS:
void handleStartResize(QWaylandSeat *seat, QWaylandWlShellSurface::ResizeEdge edges);
void handleSetPopup(QWaylandSeat *seat, QWaylandSurface *parent, const QPoint &relativeToParent);
void handleShellSurfaceDestroyed();
- void handleSurfaceUnmapped();
+ void handleSurfaceHasContentChanged();
void adjustOffsetForNextFrame(const QPointF &offset);
private:
diff --git a/tests/auto/compositor/tst_compositor.cpp b/tests/auto/compositor/tst_compositor.cpp
index 606a7e7a8..05e876dd0 100644
--- a/tests/auto/compositor/tst_compositor.cpp
+++ b/tests/auto/compositor/tst_compositor.cpp
@@ -212,10 +212,10 @@ void tst_WaylandCompositor::mapSurface()
QWaylandSurface *waylandSurface = compositor.surfaces.at(0);
- QSignalSpy mappedSpy(waylandSurface, SIGNAL(mappedChanged()));
+ QSignalSpy hasContentSpy(waylandSurface, SIGNAL(hasContentChanged()));
QCOMPARE(waylandSurface->size(), QSize());
- QCOMPARE(waylandSurface->isMapped(), false);
+ QCOMPARE(waylandSurface->hasContent(), false);
QSize size(256, 256);
ShmBuffer buffer(size, client.shm);
@@ -227,8 +227,8 @@ void tst_WaylandCompositor::mapSurface()
wl_surface_commit(surface);
QTRY_COMPARE(waylandSurface->size(), size);
- QTRY_COMPARE(waylandSurface->isMapped(), true);
- QTRY_COMPARE(mappedSpy.count(), 1);
+ QTRY_COMPARE(waylandSurface->hasContent(), true);
+ QTRY_COMPARE(hasContentSpy.count(), 1);
wl_surface_destroy(surface);
}
@@ -296,7 +296,7 @@ void tst_WaylandCompositor::frameCallback()
wl_surface_damage(surface, 0, 0, size.width(), size.height());
wl_surface_commit(surface);
- QTRY_COMPARE(waylandSurface->isMapped(), true);
+ QTRY_COMPARE(waylandSurface->hasContent(), true);
QTRY_COMPARE(damagedSpy.count(), i + 1);
QCOMPARE(static_cast<BufferView*>(waylandSurface->views().first())->image(), buffer.image);