on xenial help sign in
occlusion detection in spreads delegates propogated to surface items
commitf292b580bd2640d9800cb7f5ac4bf81935986dd9 authorNick Dedekind <nick.dedekind@canonical.com> dateWed 23 Sep 2015, 14:14 (11 years ago) parent76b6250
6 files changed+44−2
debian/control+1−1 qml/Stages/PhoneStage.qml+7−1 qml/Stages/TabletStage.qml+8 tests/mocks/Unity/Application/MirSurface.cpp+18 tests/mocks/Unity/Application/MirSurface.h+5 tests/mocks/Unity/Application/MirSurfaceItem.cpp+5
debian/control+1−1
@@ -28,7 +28,7 @@ Build-Depends: cmake,
2828 libqt5xmlpatterns5-dev,
2929 libsystemsettings-dev,
3030 libudev-dev,
31− libunity-api-dev (>= 7.100),
31+ libunity-api-dev (>= 7.101),
3232 libusermetricsoutput1-dev,
3333 libxcb1-dev,
3434 pkg-config,
qml/Stages/PhoneStage.qml+7−1
@@ -524,7 +524,13 @@ Rectangle {
524524 }
525525
526526 // Hiding tiles when their progress is negative or reached the maximum
527− visible: (progress >= 0 && progress < 1.7)
527+ property bool occluded: {
528+ if (spreadView.active && (progress >= 0 && progress < 1.7)) return false;
529+ if (!spreadView.active && isFocused) return false;
530+ return true;
531+ }
532+
533+ visible: !occluded
528534 || (isDash && priv.focusedAppDelegateIsDislocated)
529535
530536
qml/Stages/TabletStage.qml+8
@@ -676,6 +676,14 @@ Rectangle {
676676 return tileProgress;
677677 }
678678
679+ // Hiding tiles when their progress is negative or reached the maximum
680+ property bool occluded: {
681+ if (spreadView.active) return false;
682+ else if (isFocused) return false;
683+ return true;
684+ }
685+ visible: !occluded
686+
679687 animatedProgress: {
680688 if (spreadView.phase == 0 && (spreadTile.active || spreadView.nextInStack == index)) {
681689 if (progress < spreadView.positionMarker1) {
tests/mocks/Unity/Application/MirSurface.cpp+18
@@ -31,6 +31,7 @@ MirSurface::MirSurface(const QString& name,
3131 , m_screenshotUrl(screenshot)
3232 , m_qmlFilePath(qmlFilePath)
3333 , m_live(true)
34+ , m_visibility(Mir::Exposed)
3435 , m_viewCount(0)
3536 , m_activeFocus(false)
3637 , m_width(-1)
@@ -73,6 +74,11 @@ bool MirSurface::live() const
7374 return m_live;
7475}
7576
77+Mir::Visibility MirSurface::visibility() const
78+{
79+ return m_visibility;
80+}
81+
7682void MirSurface::setLive(bool live)
7783{
7884 qDebug().nospace() << "MirSurface::setLive("<<live<<") " << name();
@@ -158,6 +164,18 @@ void MirSurface::setActiveFocus(bool value)
158164 Q_EMIT activeFocusChanged(value);
159165}
160166
167+void MirSurface::setVisibility(Mir::Visibility visibility)
168+{
169+ qDebug() << "MirSurface::setVisibility(visibility=" << visibility << ")";
170+
171+ if (m_visibility == visibility)
172+ return;
173+
174+ m_visibility = visibility;
175+
176+ Q_EMIT visibilityChanged(m_visibility);
177+}
178+
161179int MirSurface::width() const
162180{
163181 return m_width;
tests/mocks/Unity/Application/MirSurface.h+5
@@ -58,6 +58,8 @@ public:
5858
5959 bool live() const override;
6060
61+ Mir::Visibility visibility() const override;
62+
6163 Mir::OrientationAngle orientationAngle() const override;
6264 void setOrientationAngle(Mir::OrientationAngle) override;
6365
@@ -84,6 +86,8 @@ public:
8486 bool activeFocus() const;
8587 void setActiveFocus(bool);
8688
89+ void setVisibility(Mir::Visibility visibility);
90+
8791Q_SIGNALS:
8892 void stateChanged(Mir::State);
8993 void liveChanged(bool live);
@@ -104,6 +108,7 @@ private:
104108 QUrl m_screenshotUrl;
105109 QString m_qmlFilePath;
106110 bool m_live;
111+ Mir::Visibility m_visibility;
107112 int m_viewCount;
108113 bool m_activeFocus;
109114 int m_width;
tests/mocks/Unity/Application/MirSurfaceItem.cpp+5
@@ -203,6 +203,7 @@ void MirSurfaceItem::setSurface(MirSurfaceInterface* surface)
203203 m_qmlSurface->incrementViewCount();
204204
205205 m_qmlSurface->setActiveFocus(hasActiveFocus());
206+ m_qmlSurface->setVisibility(isVisible() ? Mir::Exposed : Mir::Occluded);
206207
207208 updateSurfaceSize();
208209
@@ -251,6 +252,10 @@ void MirSurfaceItem::itemChange(ItemChange change, const ItemChangeData & value)
251252 if (m_qmlSurface) {
252253 m_qmlSurface->setActiveFocus(value.boolValue);
253254 }
255+ } else if (change == QQuickItem::ItemVisibleHasChanged) {
256+ if (m_qmlSurface) {
257+ m_qmlSurface->setVisibility(value.boolValue ? Mir::Exposed : Mir::Occluded);
258+ }
254259 }
255260}
256261