Merge lp:~dandrader/qtmir/dontOccludeFreshSurfaces into lp:qtmir

Proposed by Daniel d'Andrada
Status: Merged
Approved by: Gerry Boland
Approved revision: 559
Merged at revision: 559
Proposed branch: lp:~dandrader/qtmir/dontOccludeFreshSurfaces
Merge into: lp:qtmir
Diff against target: 61 lines (+22/-4)
2 files modified
src/modules/Unity/Application/mirsurface.cpp (+16/-4)
src/modules/Unity/Application/mirsurface.h (+6/-0)
To merge this branch: bzr merge lp:~dandrader/qtmir/dontOccludeFreshSurfaces
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
Unity8 CI Bot (community) continuous-integration Approve
Review via email: mp+305036@code.launchpad.net

Commit message

Don't occlude newly created surfaces until some time has passed

Ensures apps are able to render the initial state of their UIs straight away.

The main use case is the dash being created behing the greeter/lockscreen (and therefore occluded) on device start up.

Description of the change

* Are there any related MPs required for this MP to build/function as expected? Please list.
No. Had exposing the age property left as a TODO exactly to avoid the pain of having companion unity-api and unity8 branches, which would, besides slowing down the release of the fix, also cause new conflicts on the ongoing https://requests.ci-train.ubuntu.com/#/ticket/1636

* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

To post a comment you must log in.
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Turns out dash takes longer than I expected to get itself together during device startup, hence the 10 seconds, which has some spare room. Tried 3.5 seconds before and it wasn't enough, for instance (on mako).

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:559
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/367/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2760
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2788
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2648
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2648/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2648
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2648/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2648
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2648/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2648
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2648/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2648
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2648/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2648
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2648/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2648
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2648/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2648
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2648/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2648
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2648/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/367/rebuild

review: Approve (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

+ // TODO: Make it configurable, exposing it as a QML property to shell.
I'm not keen on this, as it pushes the responsibility to the shell. How can shell ever get this value right? IMO It's the apps problem that it isn't drawing a perfect first frame - and I don't understand why Dash/Qt is failing to do this.

However in the meantime, this fix does do the job. Let's use it for now

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/modules/Unity/Application/mirsurface.cpp'
2--- src/modules/Unity/Application/mirsurface.cpp 2016-08-30 12:24:19 +0000
3+++ src/modules/Unity/Application/mirsurface.cpp 2016-09-06 18:20:32 +0000
4@@ -251,6 +251,11 @@
5 QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
6
7 setCloseTimer(new Timer);
8+
9+ QTimer::singleShot(m_minimumAgeForOcclusion, this, [this]() {
10+ m_oldEnoughToBeOccluded = true;
11+ updateVisibility();
12+ });
13 }
14
15 MirSurface::~MirSurface()
16@@ -787,10 +792,17 @@
17 void MirSurface::updateVisibility()
18 {
19 bool newVisible = false;
20- QHashIterator<qintptr, View> i(m_views);
21- while (i.hasNext()) {
22- i.next();
23- newVisible |= i.value().visible;
24+
25+ if (m_oldEnoughToBeOccluded) {
26+ QHashIterator<qintptr, View> i(m_views);
27+ while (i.hasNext()) {
28+ i.next();
29+ newVisible |= i.value().visible;
30+ }
31+ } else {
32+ // Surface is too young to get occluded. Let it remain exposed for a bit to ensure that it displays
33+ // a properly formed UI on start up.
34+ newVisible = true;
35 }
36
37 if (newVisible != visible()) {
38
39=== modified file 'src/modules/Unity/Application/mirsurface.h'
40--- src/modules/Unity/Application/mirsurface.h 2016-08-30 12:24:19 +0000
41+++ src/modules/Unity/Application/mirsurface.h 2016-09-06 18:20:32 +0000
42@@ -22,6 +22,7 @@
43
44 // Qt
45 #include <QCursor>
46+#include <QElapsedTimer>
47 #include <QMutex>
48 #include <QPointer>
49 #include <QRect>
50@@ -246,6 +247,11 @@
51 };
52 ClosingState m_closingState{NotClosing};
53 AbstractTimer *m_closeTimer{nullptr};
54+
55+ // TODO: Make it configurable, exposing it as a QML property to shell.
56+ // In milliseconds.
57+ const int m_minimumAgeForOcclusion{10000};
58+ bool m_oldEnoughToBeOccluded{false};
59 };
60
61 } // namespace qtmir

Subscribers

People subscribed via source and target branches