on xenial help sign in
occlusion detection in spreads delegates propogated to surface items
f292b58Nick Dedekind
debian/control+1−1
@@ -28,7 +28,7 @@ Build-Depends: cmake,
28 libqt5xmlpatterns5-dev,
28 libqt5xmlpatterns5-dev,
29 libsystemsettings-dev,
29 libsystemsettings-dev,
30 libudev-dev,
30 libudev-dev,
31− libunity-api-dev (>= 7.100),
31+ libunity-api-dev (>= 7.101),
32 libusermetricsoutput1-dev,
32 libusermetricsoutput1-dev,
33 libxcb1-dev,
33 libxcb1-dev,
34 pkg-config,
34 pkg-config,
qml/Stages/PhoneStage.qml+7−1
@@ -524,7 +524,13 @@ Rectangle {
524 }
524 }
525
525
526 // Hiding tiles when their progress is negative or reached the maximum
526 // Hiding tiles when their progress is negative or reached the maximum
527+ property bool occluded: {
527− visible: (progress >= 0 && progress < 1.7)
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
528 || (isDash && priv.focusedAppDelegateIsDislocated)
534 || (isDash && priv.focusedAppDelegateIsDislocated)
529
535
530
536
qml/Stages/TabletStage.qml+8
@@ -676,6 +676,14 @@ Rectangle {
676 return tileProgress;
676 return tileProgress;
677 }
677 }
678
678
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+
679 animatedProgress: {
687 animatedProgress: {
680 if (spreadView.phase == 0 && (spreadTile.active || spreadView.nextInStack == index)) {
688 if (spreadView.phase == 0 && (spreadTile.active || spreadView.nextInStack == index)) {
681 if (progress < spreadView.positionMarker1) {
689 if (progress < spreadView.positionMarker1) {
tests/mocks/Unity/Application/MirSurface.cpp+18
@@ -31,6 +31,7 @@ MirSurface::MirSurface(const QString& name,
31 , m_screenshotUrl(screenshot)
31 , m_screenshotUrl(screenshot)
32 , m_qmlFilePath(qmlFilePath)
32 , m_qmlFilePath(qmlFilePath)
33 , m_live(true)
33 , m_live(true)
34+ , m_visibility(Mir::Exposed)
34 , m_viewCount(0)
35 , m_viewCount(0)
35 , m_activeFocus(false)
36 , m_activeFocus(false)
36 , m_width(-1)
37 , m_width(-1)
@@ -73,6 +74,11 @@ bool MirSurface::live() const
73 return m_live;
74 return m_live;
74}
75}
75
76
77+Mir::Visibility MirSurface::visibility() const
78+{
79+ return m_visibility;
80+}
81+
76void MirSurface::setLive(bool live)
82void MirSurface::setLive(bool live)
77{
83{
78 qDebug().nospace() << "MirSurface::setLive("<<live<<") " << name();
84 qDebug().nospace() << "MirSurface::setLive("<<live<<") " << name();
@@ -158,6 +164,18 @@ void MirSurface::setActiveFocus(bool value)
158 Q_EMIT activeFocusChanged(value);
164 Q_EMIT activeFocusChanged(value);
159}
165}
160
166
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+
161int MirSurface::width() const
179int MirSurface::width() const
162{
180{
163 return m_width;
181 return m_width;
tests/mocks/Unity/Application/MirSurface.h+5
@@ -58,6 +58,8 @@ public:
58
58
59 bool live() const override;
59 bool live() const override;
60
60
61+ Mir::Visibility visibility() const override;
62+
61 Mir::OrientationAngle orientationAngle() const override;
63 Mir::OrientationAngle orientationAngle() const override;
62 void setOrientationAngle(Mir::OrientationAngle) override;
64 void setOrientationAngle(Mir::OrientationAngle) override;
63
65
@@ -84,6 +86,8 @@ public:
84 bool activeFocus() const;
86 bool activeFocus() const;
85 void setActiveFocus(bool);
87 void setActiveFocus(bool);
86
88
89+ void setVisibility(Mir::Visibility visibility);
90+
87Q_SIGNALS:
91Q_SIGNALS:
88 void stateChanged(Mir::State);
92 void stateChanged(Mir::State);
89 void liveChanged(bool live);
93 void liveChanged(bool live);
@@ -104,6 +108,7 @@ private:
104 QUrl m_screenshotUrl;
108 QUrl m_screenshotUrl;
105 QString m_qmlFilePath;
109 QString m_qmlFilePath;
106 bool m_live;
110 bool m_live;
111+ Mir::Visibility m_visibility;
107 int m_viewCount;
112 int m_viewCount;
108 bool m_activeFocus;
113 bool m_activeFocus;
109 int m_width;
114 int m_width;
tests/mocks/Unity/Application/MirSurfaceItem.cpp+5
@@ -203,6 +203,7 @@ void MirSurfaceItem::setSurface(MirSurfaceInterface* surface)
203 m_qmlSurface->incrementViewCount();
203 m_qmlSurface->incrementViewCount();
204
204
205 m_qmlSurface->setActiveFocus(hasActiveFocus());
205 m_qmlSurface->setActiveFocus(hasActiveFocus());
206+ m_qmlSurface->setVisibility(isVisible() ? Mir::Exposed : Mir::Occluded);
206
207
207 updateSurfaceSize();
208 updateSurfaceSize();
208
209
@@ -251,6 +252,10 @@ void MirSurfaceItem::itemChange(ItemChange change, const ItemChangeData & value)
251 if (m_qmlSurface) {
252 if (m_qmlSurface) {
252 m_qmlSurface->setActiveFocus(value.boolValue);
253 m_qmlSurface->setActiveFocus(value.boolValue);
253 }
254 }
255+ } else if (change == QQuickItem::ItemVisibleHasChanged) {
256+ if (m_qmlSurface) {
257+ m_qmlSurface->setVisibility(value.boolValue ? Mir::Exposed : Mir::Occluded);
258+ }
254 }
259 }
255}
260}
256
261