@@ -68,6 +68,7 @@ MirSurfaceItem::~MirSurfaceItem()
69 DEBUG_MSG((void*)(this) << name());
69 DEBUG_MSG((void*)(this) << name());
70 setSurface(nullptr);
70 setSurface(nullptr);
71+ delete m_orientationAngle;
73void MirSurfaceItem::printComponentErrors()
74void MirSurfaceItem::printComponentErrors()
@@ -125,7 +126,10 @@ Mir::ShellChrome MirSurfaceItem::shellChrome() const
126Mir::OrientationAngle MirSurfaceItem::orientationAngle() const
127Mir::OrientationAngle MirSurfaceItem::orientationAngle() const
129+ if (m_orientationAngle) {
130+ Q_ASSERT(!m_qmlSurface);
131+ return *m_orientationAngle;
128− if (m_qmlSurface) {
132+ } else if (m_qmlSurface) {
129 return m_qmlSurface->orientationAngle();
133 return m_qmlSurface->orientationAngle();
131 return Mir::Angle0;
135 return Mir::Angle0;
@@ -134,16 +138,24 @@ Mir::OrientationAngle MirSurfaceItem::orientationAngle() const
135void MirSurfaceItem::setOrientationAngle(Mir::OrientationAngle angle)
139void MirSurfaceItem::setOrientationAngle(Mir::OrientationAngle angle)
137− if (!m_qmlSurface)
141+ DEBUG_MSG(angle);
140− if (m_qmlSurface->orientationAngle() == angle)
144+ Q_ASSERT(!m_orientationAngle);
143− m_qmlSurface->setOrientationAngle(angle);
145+ m_qmlSurface->setOrientationAngle(angle);
146+ } else if (!m_orientationAngle) {
147+ m_orientationAngle = new Mir::OrientationAngle;
148+ *m_orientationAngle = angle;
149+ Q_EMIT orientationAngleChanged(angle);
150+ } else if (*m_orientationAngle != angle) {
151+ *m_orientationAngle = angle;
152+ Q_EMIT orientationAngleChanged(angle);
145− QQmlProperty orientationProp(m_qmlItem, "orientationAngle");
156+ QQmlProperty orientationProp(m_qmlItem, "orientationAngle");
146− orientationProp.write(QVariant::fromValue(m_qmlSurface->orientationAngle()));
157+ orientationProp.write(QVariant::fromValue(orientationAngle()));
149void MirSurfaceItem::updateScreenshot(QUrl screenshotUrl)
161void MirSurfaceItem::updateScreenshot(QUrl screenshotUrl)
@@ -175,6 +187,11 @@ void MirSurfaceItem::createQmlContentItem()
175 QQmlProperty screenshotSource(m_qmlItem, "screenshotSource");
187 QQmlProperty screenshotSource(m_qmlItem, "screenshotSource");
176 screenshotSource.write(QVariant::fromValue(m_qmlSurface->screenshotUrl()));
188 screenshotSource.write(QVariant::fromValue(m_qmlSurface->screenshotUrl()));
192+ QQmlProperty orientationProp(m_qmlItem, "orientationAngle");
193+ orientationProp.write(QVariant::fromValue(orientationAngle()));
180void MirSurfaceItem::touchEvent(QTouchEvent * event)
197void MirSurfaceItem::touchEvent(QTouchEvent * event)
@@ -255,7 +272,16 @@ void MirSurfaceItem::setSurface(MirSurfaceInterface* surface)
255 updateSurfaceSize();
272 updateSurfaceSize();
256 updateMirSurfaceVisibility();
273 updateMirSurfaceVisibility();
275+ if (m_orientationAngle) {
276+ m_qmlSurface->setOrientationAngle(*m_orientationAngle);
258− connect(m_qmlSurface, &MirSurface::orientationAngleChanged, this, &MirSurfaceItem::orientationAngleChanged);
277+ connect(m_qmlSurface, &MirSurfaceInterface::orientationAngleChanged, this, &MirSurfaceItem::orientationAngleChanged);
278+ delete m_orientationAngle;
279+ m_orientationAngle = nullptr;
281+ connect(m_qmlSurface, &MirSurfaceInterface::orientationAngleChanged, this, &MirSurfaceItem::orientationAngleChanged);
282+ Q_EMIT orientationAngleChanged(m_qmlSurface->orientationAngle());
259 connect(m_qmlSurface, &MirSurface::screenshotUrlChanged, this, &MirSurfaceItem::updateScreenshot);
285 connect(m_qmlSurface, &MirSurface::screenshotUrlChanged, this, &MirSurfaceItem::updateScreenshot);
260 connect(m_qmlSurface, &MirSurface::liveChanged, this, &MirSurfaceItem::liveChanged);
286 connect(m_qmlSurface, &MirSurface::liveChanged, this, &MirSurfaceItem::liveChanged);
261 connect(m_qmlSurface, &MirSurface::stateChanged, this, &MirSurfaceItem::surfaceStateChanged);
287 connect(m_qmlSurface, &MirSurface::stateChanged, this, &MirSurfaceItem::surfaceStateChanged);