Merge lp:~nick-dedekind/qtmir/persistent_surface_id into lp:qtmir

Proposed by Nick Dedekind
Status: Superseded
Proposed branch: lp:~nick-dedekind/qtmir/persistent_surface_id
Merge into: lp:qtmir
Prerequisite: lp:~mir-team/qtmir/mir-0.24-compatibility
Diff against target: 514 lines (+132/-27)
17 files modified
CMakeLists.txt (+1/-1)
debian/control (+2/-2)
debian/gles-patches/convert-to-gles.patch (+7/-7)
src/modules/Unity/Application/mirsurface.cpp (+10/-3)
src/modules/Unity/Application/mirsurface.h (+4/-0)
src/modules/Unity/Application/mirsurfacemanager.cpp (+16/-2)
src/modules/Unity/Application/mirsurfacemanager.h (+6/-1)
src/platforms/mirserver/mirserver.h (+1/-0)
tests/framework/CMakeLists.txt (+1/-0)
tests/framework/fake_mirsurface.cpp (+2/-0)
tests/framework/fake_mirsurface.h (+1/-0)
tests/framework/mock_persistent_surface_store.cpp (+30/-0)
tests/framework/mock_persistent_surface_store.h (+24/-0)
tests/framework/qtmir_test.cpp (+18/-5)
tests/framework/qtmir_test.h (+3/-0)
tests/modules/SurfaceManager/mirsurface_test.cpp (+4/-4)
tests/modules/SurfaceManager/mirsurfaceitem_test.cpp (+2/-2)
To merge this branch: bzr merge lp:~nick-dedekind/qtmir/persistent_surface_id
Reviewer Review Type Date Requested Status
Daniel d'Andrada (community) Needs Fixing
Unity8 CI Bot (community) continuous-integration Needs Fixing
Review via email: mp+297293@code.launchpad.net

This proposal supersedes a proposal from 2016-06-09.

This proposal has been superseded by a proposal from 2016-08-22.

Commit message

Added implementation for MirSurfaceInterface::persistentId

Description of the change

* Are there any related MPs required for this MP to build/function as expected? Please list.
https://code.launchpad.net/~unity-team/unity-api/persistent_surface_id/+merge/303552
https://code.launchpad.net/~nick-dedekind/unity8/persistent_surface_id/+merge/296994

 * Did you perform an exploratory manual test run of your code change and any related functionality?
 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?

Requires mir 0.24

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:506
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/273/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/1942/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1968
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1902
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1902
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1902
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1893/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1893/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1893/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1893/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1893/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1893/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1893/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1893/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1893/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:507
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/274/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/1952/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1978
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1912
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1912
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1912
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1903/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1903/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1903/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1903/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1903/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1903/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1903/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1903/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1903/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal

Shouldn't you bump the required mir version to something higher than 0.22 as the needed API will land only in a later version?

review: Needs Information
Revision history for this message
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal

/home/dandrader/qtmir/persistent_surface_id/src/platforms/mirserver/screen.cpp:218:59: error: 'const Width {aka const class mir::geometry::detail::IntWrapper<mir::geometry::WidthTag>}' has no member named 'as_float'
/home/dandrader/qtmir/persistent_surface_id/src/platforms/mirserver/screen.cpp:219:61: error: 'const Height {aka const class mir::geometry::detail::IntWrapper<mir::geometry::HeightTag>}' has no member named 'as_float'

/home/dandrader/qtmir/persistent_surface_id/tests/framework/qtmir_test.cpp:168:92: required from here
/usr/include/c++/5/ext/new_allocator.h:120:4: error: invalid new-expression of abstract class type 'mir::scene::MockSession'

Getting some build failures. Maybe it needs to have some "mir-0.23 compatibility branch" as prereq...

Revision history for this message
Nick Dedekind (nick-dedekind) wrote : Posted in a previous version of this proposal

> /home/dandrader/qtmir/persistent_surface_id/src/platforms/mirserver/screen.cpp
> :218:59: error: 'const Width {aka const class
> mir::geometry::detail::IntWrapper<mir::geometry::WidthTag>}' has no member
> named 'as_float'
> /home/dandrader/qtmir/persistent_surface_id/src/platforms/mirserver/screen.cpp
> :219:61: error: 'const Height {aka const class
> mir::geometry::detail::IntWrapper<mir::geometry::HeightTag>}' has no member
> named 'as_float'
>
> /home/dandrader/qtmir/persistent_surface_id/tests/framework/qtmir_test.cpp:168
> :92: required from here
> /usr/include/c++/5/ext/new_allocator.h:120:4: error: invalid new-expression of
> abstract class type 'mir::scene::MockSession'
>
> Getting some build failures. Maybe it needs to have some "mir-0.23
> compatibility branch" as prereq...

You building against trunk (aka 0.24)?

Revision history for this message
Nick Dedekind (nick-dedekind) wrote : Posted in a previous version of this proposal

> >
> /home/dandrader/qtmir/persistent_surface_id/src/platforms/mirserver/screen.cpp
> > :218:59: error: 'const Width {aka const class
> > mir::geometry::detail::IntWrapper<mir::geometry::WidthTag>}' has no member
> > named 'as_float'
> >
> /home/dandrader/qtmir/persistent_surface_id/src/platforms/mirserver/screen.cpp
> > :219:61: error: 'const Height {aka const class
> > mir::geometry::detail::IntWrapper<mir::geometry::HeightTag>}' has no member
> > named 'as_float'
> >
> >
> /home/dandrader/qtmir/persistent_surface_id/tests/framework/qtmir_test.cpp:168
> > :92: required from here
> > /usr/include/c++/5/ext/new_allocator.h:120:4: error: invalid new-expression
> of
> > abstract class type 'mir::scene::MockSession'
> >
> > Getting some build failures. Maybe it needs to have some "mir-0.23
> > compatibility branch" as prereq...
>
> You building against trunk (aka 0.24)?

Right, you're building against the prereq mir branch i guess. There's a compatibility branch for mir 0.24 which I've added (lp:~mir-team/qtmir/mir-0.24-compatibility). I need to resubmit this proposal with it as a prereq.

Revision history for this message
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal

On 13/06/2016 11:20, Nick Dedekind wrote:
> Right, you're building against the prereq mir branch i guess. There's a compatibility branch for mir 0.24 which I've added (lp:~mir-team/qtmir/mir-0.24-compatibility). I need to resubmit this proposal with it as a prereq.

I thought mir trunk would be 0.23, but ok.

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

FAILED: Continuous integration, rev:507
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/275/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/1958/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1984
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1918
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1918
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1918
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1909/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1909/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1909/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1909/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1909/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1909/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1909/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1909/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1909/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

Annoyingly the changelog for mir/trunk hasn't been updated to 0.24 yet. So I need to wait until then before updating the mir requirement or it won't build.

508. By Nick Dedekind

merged with parent

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

FAILED: Continuous integration, rev:508
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/276/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/1960/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1986
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1920
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1920
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1920
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1911/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1911/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/1911/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1911/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1911/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/1911/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1911/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1911/console
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/1911/console

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

silo 036 is about to land and it has lp:~kdub/qtmir/0.24-compatibility

Please rebase this branch on top of it as there are many conflicts.

review: Needs Fixing

Unmerged revisions

508. By Nick Dedekind

merged with parent

507. By Nick Dedekind

removed persistentId from log

506. By Nick Dedekind

gles

505. By Nick Dedekind

persistentId

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2016-05-18 20:56:14 +0000
3+++ CMakeLists.txt 2016-06-14 08:51:40 +0000
4@@ -76,7 +76,7 @@
5 pkg_check_modules(GSETTINGS_QT REQUIRED gsettings-qt)
6 pkg_check_modules(QTDBUSTEST libqtdbustest-1 REQUIRED)
7 pkg_check_modules(QTDBUSMOCK libqtdbusmock-1 REQUIRED)
8-pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=17)
9+pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=18)
10
11 include_directories(${APPLICATION_API_INCLUDE_DIRS})
12
13
14=== modified file 'debian/control'
15--- debian/control 2016-06-14 08:51:40 +0000
16+++ debian/control 2016-06-14 08:51:40 +0000
17@@ -22,7 +22,7 @@
18 libubuntu-app-launch2-dev (>= 0.9),
19 libubuntu-application-api-dev (>= 2.1.0),
20 libudev-dev,
21- libunity-api-dev (>= 7.113),
22+ libunity-api-dev (>= 7.114),
23 liburl-dispatcher1-dev,
24 libxkbcommon-dev,
25 libxrender-dev,
26@@ -93,7 +93,7 @@
27 Conflicts: libqtmir,
28 libunity-mir1,
29 Provides: unity-application-impl,
30- unity-application-impl-17,
31+ unity-application-impl-18,
32 Description: Qt plugin for Unity specific Mir APIs
33 QtMir provides Qt/QML bindings for Mir features that are exposed through the
34 qtmir-desktop or qtmir-android QPA plugin such as Application management
35
36=== modified file 'debian/gles-patches/convert-to-gles.patch'
37--- debian/gles-patches/convert-to-gles.patch 2016-06-14 08:51:40 +0000
38+++ debian/gles-patches/convert-to-gles.patch 2016-06-14 08:51:40 +0000
39@@ -1,7 +1,7 @@
40-Index: qtmir-0.24/debian/control
41+Index: qtmir/debian/control
42 ===================================================================
43---- qtmir-0.24.orig/debian/control
44-+++ qtmir-0.24/debian/control
45+--- qtmir.orig/debian/control
46++++ qtmir/debian/control
47 @@ -1,4 +1,4 @@
48 -Source: qtmir
49 +Source: qtmir-gles
50@@ -84,7 +84,7 @@
51 -Conflicts: libqtmir,
52 - libunity-mir1,
53 -Provides: unity-application-impl,
54-- unity-application-impl-17,
55+- unity-application-impl-18,
56 -Description: Qt plugin for Unity specific Mir APIs
57 - QtMir provides Qt/QML bindings for Mir features that are exposed through the
58 - qtmir-desktop or qtmir-android QPA plugin such as Application management
59@@ -111,10 +111,10 @@
60 - QtMir QPA.
61 + This variant of the package is for Android-based phones and tablets (built
62 + against the OpenGLES variant of qtbase).
63-Index: qtmir-0.24/debian/rules
64+Index: qtmir/debian/rules
65 ===================================================================
66---- qtmir-0.24.orig/debian/rules
67-+++ qtmir-0.24/debian/rules
68+--- qtmir.orig/debian/rules
69++++ qtmir/debian/rules
70 @@ -3,60 +3,28 @@
71
72 export DPKG_GENSYMBOLS_CHECK_LEVEL=4
73
74=== modified file 'src/modules/Unity/Application/mirsurface.cpp'
75--- src/modules/Unity/Application/mirsurface.cpp 2016-05-25 13:54:52 +0000
76+++ src/modules/Unity/Application/mirsurface.cpp 2016-06-14 08:51:40 +0000
77@@ -43,8 +43,8 @@
78
79 using namespace qtmir;
80
81-#define DEBUG_MSG qCDebug(QTMIR_SURFACES).nospace() << "MirSurface[" << (void*)this << "," << appId() <<"]::" << __func__
82-#define WARNING_MSG qCWarning(QTMIR_SURFACES).nospace() << "MirSurface[" << (void*)this << "," << appId() <<"]::" << __func__
83+#define DEBUG_MSG qCDebug(QTMIR_SURFACES).nospace() << "MirSurface[" << (void*)this << "," << appId() << "]::" << __func__
84+#define WARNING_MSG qCWarning(QTMIR_SURFACES).nospace() << "MirSurface[" << (void*)this << "," << appId() << "]::" << __func__
85
86 namespace {
87
88@@ -179,6 +179,7 @@
89 } // namespace {
90
91 MirSurface::MirSurface(std::shared_ptr<mir::scene::Surface> surface,
92+ const QString& persistentId,
93 SessionInterface* session,
94 mir::shell::Shell* shell,
95 std::shared_ptr<SurfaceObserver> observer,
96@@ -187,6 +188,7 @@
97 , m_surface(surface)
98 , m_session(session)
99 , m_shell(shell)
100+ , m_persistentId(persistentId)
101 , m_firstFrameDrawn(false)
102 , m_orientationAngle(Mir::Angle0)
103 , m_textureUpdated(false)
104@@ -248,7 +250,7 @@
105
106 MirSurface::~MirSurface()
107 {
108- qCDebug(QTMIR_SURFACES).nospace() << "MirSurface[" << (void*)this << "]::~MirSurface() viewCount=" << m_views.count();
109+ DEBUG_MSG << "() viewCount=" << m_views.count();
110
111 Q_ASSERT(m_views.isEmpty());
112
113@@ -583,6 +585,11 @@
114 return QString::fromStdString(m_surface->name());
115 }
116
117+QString MirSurface::persistentId() const
118+{
119+ return m_persistentId;
120+}
121+
122 void MirSurface::setState(Mir::State qmlState)
123 {
124 int mirState;
125
126=== modified file 'src/modules/Unity/Application/mirsurface.h'
127--- src/modules/Unity/Application/mirsurface.h 2016-05-25 13:54:52 +0000
128+++ src/modules/Unity/Application/mirsurface.h 2016-06-14 08:51:40 +0000
129@@ -54,6 +54,7 @@
130
131 public:
132 MirSurface(std::shared_ptr<mir::scene::Surface> surface,
133+ const QString& persistentId,
134 SessionInterface* session,
135 mir::shell::Shell *shell,
136 std::shared_ptr<SurfaceObserver> observer,
137@@ -67,6 +68,8 @@
138
139 QString name() const override;
140
141+ QString persistentId() const override;
142+
143 QSize size() const override;
144 void resize(int width, int height) override;
145 void resize(const QSize &size) override { resize(size.width(), size.height()); }
146@@ -187,6 +190,7 @@
147 std::shared_ptr<mir::scene::Surface> m_surface;
148 QPointer<SessionInterface> m_session;
149 mir::shell::Shell *const m_shell;
150+ QString m_persistentId;
151 bool m_firstFrameDrawn;
152
153 //FIXME - have to save the state as Mir has no getter for it (bug:1357429)
154
155=== modified file 'src/modules/Unity/Application/mirsurfacemanager.cpp'
156--- src/modules/Unity/Application/mirsurfacemanager.cpp 2016-05-06 08:41:15 +0000
157+++ src/modules/Unity/Application/mirsurfacemanager.cpp 2016-06-14 08:51:40 +0000
158@@ -34,12 +34,15 @@
159 #include "sessionlistener.h"
160 #include "logging.h"
161 #include "creationhints.h"
162+#include "mirserver.h"
163
164 // mir
165 #include <mir/scene/surface.h>
166+#include <mir/shell/persistent_surface_store.h>
167
168
169 namespace ms = mir::scene;
170+namespace msh = mir::shell;
171
172 namespace qtmir {
173
174@@ -69,7 +72,11 @@
175 SessionListener *sessionListener = static_cast<SessionListener*>(nativeInterface->nativeResourceForIntegration("SessionListener"));
176 mir::shell::Shell *shell = static_cast<mir::shell::Shell*>(nativeInterface->nativeResourceForIntegration("Shell"));
177
178- instance = new MirSurfaceManager(shell, SessionManager::singleton());
179+
180+ QSharedPointer<MirServer> mirServer = nativeInterface->mirServer().lock();
181+ instance = new MirSurfaceManager(shell,
182+ SessionManager::singleton(),
183+ mirServer ? mirServer->the_persistent_surface_store() : nullptr);
184
185 connectToSessionListener(instance, sessionListener);
186 }
187@@ -79,10 +86,12 @@
188 MirSurfaceManager::MirSurfaceManager(
189 mir::shell::Shell* shell,
190 SessionManager* sessionManager,
191+ std::shared_ptr<msh::PersistentSurfaceStore> surfaceStore,
192 QObject* parent)
193 : QObject(parent)
194 , m_shell(shell)
195 , m_sessionManager(sessionManager)
196+ , m_surfaceStore(surfaceStore)
197 {
198 qCDebug(QTMIR_SURFACES) << "MirSurfaceManager::MirSurfaceManager - this=" << this;
199 setObjectName("qtmir::SurfaceManager");
200@@ -105,7 +114,12 @@
201 << "creationHints=" << creationHints.toString();
202
203 SessionInterface* session = m_sessionManager->findSession(mirSession);
204- auto qmlSurface = new MirSurface(surface, session, m_shell, observer, creationHints);
205+ auto qmlSurface = new MirSurface(surface,
206+ QString::fromStdString(m_surfaceStore->id_for_surface(surface).serialize_to_string()),
207+ session,
208+ m_shell,
209+ observer,
210+ creationHints);
211 {
212 QMutexLocker lock(&m_mutex);
213 m_mirSurfaceToQmlSurfaceHash.insert(surface.get(), qmlSurface);
214
215=== modified file 'src/modules/Unity/Application/mirsurfacemanager.h'
216--- src/modules/Unity/Application/mirsurfacemanager.h 2016-05-06 08:28:44 +0000
217+++ src/modules/Unity/Application/mirsurfacemanager.h 2016-06-14 08:51:40 +0000
218@@ -38,7 +38,10 @@
219 class Session;
220 class PromptSession;
221 }
222- namespace shell { class Shell; }
223+ namespace shell {
224+ class Shell;
225+ class PersistentSurfaceStore;
226+ }
227 }
228
229 class SurfaceObserver;
230@@ -58,6 +61,7 @@
231 explicit MirSurfaceManager(
232 mir::shell::Shell* shell,
233 SessionManager* sessionManager,
234+ std::shared_ptr<mir::shell::PersistentSurfaceStore> surfaceStore,
235 QObject* parent = nullptr
236 );
237 ~MirSurfaceManager();
238@@ -85,6 +89,7 @@
239 private:
240 mir::shell::Shell *const m_shell;
241 SessionManager* m_sessionManager;
242+ std::shared_ptr<mir::shell::PersistentSurfaceStore> m_surfaceStore;
243 static MirSurfaceManager *instance;
244 MirSurfaceInterface* m_inputMethodSurface = nullptr;
245 };
246
247=== modified file 'src/platforms/mirserver/mirserver.h'
248--- src/platforms/mirserver/mirserver.h 2016-05-06 08:28:44 +0000
249+++ src/platforms/mirserver/mirserver.h 2016-06-14 08:51:40 +0000
250@@ -51,6 +51,7 @@
251 using mir::Server::the_gl_config;
252 using mir::Server::the_main_loop;
253 using mir::Server::the_prompt_session_manager;
254+ using mir::Server::the_persistent_surface_store;
255
256 void stop();
257
258
259=== modified file 'tests/framework/CMakeLists.txt'
260--- tests/framework/CMakeLists.txt 2016-05-24 20:13:10 +0000
261+++ tests/framework/CMakeLists.txt 2016-06-14 08:51:40 +0000
262@@ -28,6 +28,7 @@
263 mock_shared_wakelock.cpp
264 mock_surface.cpp
265 mock_task_controller.cpp
266+ mock_persistent_surface_store.cpp
267 stub_input_channel.cpp
268 fake_surface.h
269 qtmir_test.cpp
270
271=== modified file 'tests/framework/fake_mirsurface.cpp'
272--- tests/framework/fake_mirsurface.cpp 2016-05-24 20:13:10 +0000
273+++ tests/framework/fake_mirsurface.cpp 2016-06-14 08:51:40 +0000
274@@ -54,6 +54,8 @@
275
276 QString FakeMirSurface::name() const { return QString("Fake MirSurface"); }
277
278+QString FakeMirSurface::persistentId() const { return QString("FakeSurfaceId"); }
279+
280 QSize FakeMirSurface::size() const { return m_size; }
281
282 void FakeMirSurface::resize(int width, int height)
283
284=== modified file 'tests/framework/fake_mirsurface.h'
285--- tests/framework/fake_mirsurface.h 2016-05-24 20:13:10 +0000
286+++ tests/framework/fake_mirsurface.h 2016-06-14 08:51:40 +0000
287@@ -53,6 +53,7 @@
288 // unity.shell.application.MirSurfaceInterface
289 Mir::Type type() const override;
290 QString name() const override;
291+ QString persistentId() const override;
292 QSize size() const override;
293 void resize(int width, int height) override;
294 void resize(const QSize &size) override;
295
296=== added file 'tests/framework/mock_persistent_surface_store.cpp'
297--- tests/framework/mock_persistent_surface_store.cpp 1970-01-01 00:00:00 +0000
298+++ tests/framework/mock_persistent_surface_store.cpp 2016-06-14 08:51:40 +0000
299@@ -0,0 +1,30 @@
300+/*
301+ * Copyright (C) 2016 Canonical, Ltd.
302+ *
303+ * This program is free software: you can redistribute it and/or modify it under
304+ * the terms of the GNU Lesser General Public License version 3, as published by
305+ * the Free Software Foundation.
306+ *
307+ * This program is distributed in the hope that it will be useful, but WITHOUT
308+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
309+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
310+ * Lesser General Public License for more details.
311+ *
312+ * You should have received a copy of the GNU Lesser General Public License
313+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
314+ */
315+
316+#include "mock_persistent_surface_store.h"
317+
318+namespace mir
319+{
320+namespace shell
321+{
322+
323+MockPersistentSurfaceStore::MockPersistentSurfaceStore()
324+{
325+
326+}
327+
328+} // namespace shell
329+} // namespace mir
330
331=== added file 'tests/framework/mock_persistent_surface_store.h'
332--- tests/framework/mock_persistent_surface_store.h 1970-01-01 00:00:00 +0000
333+++ tests/framework/mock_persistent_surface_store.h 2016-06-14 08:51:40 +0000
334@@ -0,0 +1,24 @@
335+#ifndef MOCKPERSISTENTSURFACESTORE_H
336+#define MOCKPERSISTENTSURFACESTORE_H
337+
338+#include <mir/shell/persistent_surface_store.h>
339+#include <gmock/gmock.h>
340+
341+namespace mir
342+{
343+namespace shell
344+{
345+
346+class MockPersistentSurfaceStore : public PersistentSurfaceStore
347+{
348+public:
349+ MockPersistentSurfaceStore();
350+
351+ MOCK_METHOD1(id_for_surface, Id(std::shared_ptr<scene::Surface> const& surface));
352+ MOCK_CONST_METHOD1(surface_for_id, std::shared_ptr<scene::Surface>(Id const& id));
353+};
354+
355+}
356+}
357+
358+#endif // MOCKPERSISTENTSURFACESTORE_H
359
360=== modified file 'tests/framework/qtmir_test.cpp'
361--- tests/framework/qtmir_test.cpp 2016-05-06 08:23:46 +0000
362+++ tests/framework/qtmir_test.cpp 2016-06-14 08:51:40 +0000
363@@ -82,11 +82,15 @@
364 class TestMirServerInit : public virtual mir::Server
365 {
366 public:
367- TestMirServerInit(std::shared_ptr<StubPromptSessionManager> const& promptSessionManager)
368+ TestMirServerInit(std::shared_ptr<StubPromptSessionManager> const& promptSessionManager,
369+ std::shared_ptr<StubPersistentSurfaceStore> const& persistentSurfaceStore)
370 : mock_prompt_session_manager(promptSessionManager)
371+ , mock_persistent_surface_store(persistentSurfaceStore)
372 {
373 override_the_prompt_session_manager(
374 [this]{ return the_mock_prompt_session_manager(); });
375+ override_the_persistent_surface_store(
376+ [this]{ return the_mock_persistent_surface_store(); });
377 }
378
379 std::shared_ptr<mir::scene::MockPromptSessionManager> the_mock_prompt_session_manager()
380@@ -94,8 +98,14 @@
381 return mock_prompt_session_manager;
382 }
383
384+ std::shared_ptr<mir::shell::MockPersistentSurfaceStore> the_mock_persistent_surface_store()
385+ {
386+ return mock_persistent_surface_store;
387+ }
388+
389 private:
390 std::shared_ptr<StubPromptSessionManager> const mock_prompt_session_manager;
391+ std::shared_ptr<StubPersistentSurfaceStore> const mock_persistent_surface_store;
392 };
393
394
395@@ -104,8 +114,10 @@
396 class FakeMirServer: private TestMirServerInit, public MirServer
397 {
398 public:
399- FakeMirServer(std::shared_ptr<StubPromptSessionManager> const& promptSessionManager)
400- : TestMirServerInit(promptSessionManager), MirServer(argc, argv, QSharedPointer<ScreensModel>())
401+ FakeMirServer(std::shared_ptr<StubPromptSessionManager> const& promptSessionManager,
402+ std::shared_ptr<StubPersistentSurfaceStore> const& persistentSurfaceStore)
403+ : TestMirServerInit(promptSessionManager, persistentSurfaceStore)
404+ , MirServer(argc, argv, QSharedPointer<ScreensModel>())
405 {
406 }
407
408@@ -119,13 +131,14 @@
409
410 QtMirTest::QtMirTest()
411 : promptSessionManager(std::make_shared<StubPromptSessionManager>())
412- , mirServer(QSharedPointer<MirServer>(new FakeMirServer(promptSessionManager)))
413+ , persistentSurfaceStore(std::make_shared<StubPersistentSurfaceStore>())
414+ , mirServer(QSharedPointer<MirServer>(new FakeMirServer(promptSessionManager, persistentSurfaceStore)))
415 , applicationManager(taskControllerSharedPointer,
416 QSharedPointer<MockSharedWakelock>(&sharedWakelock, [](MockSharedWakelock *){}),
417 QSharedPointer<ProcInfo>(&procInfo,[](ProcInfo *){}),
418 QSharedPointer<MockSettings>(&settings,[](MockSettings *){}))
419 , sessionManager(mirServer, &applicationManager)
420- , surfaceManager(mirShell, &sessionManager)
421+ , surfaceManager(mirShell, &sessionManager, mirServer->the_persistent_surface_store())
422 {
423 }
424
425
426=== modified file 'tests/framework/qtmir_test.h'
427--- tests/framework/qtmir_test.h 2016-05-06 08:28:44 +0000
428+++ tests/framework/qtmir_test.h 2016-06-14 08:51:40 +0000
429@@ -39,6 +39,7 @@
430 #include "mock_shared_wakelock.h"
431 #include "mock_settings.h"
432 #include "mock_task_controller.h"
433+#include "mock_persistent_surface_store.h"
434
435 namespace ms = mir::scene;
436 using namespace qtmir;
437@@ -46,6 +47,7 @@
438 namespace qtmir {
439
440 typedef testing::NiceMock<mir::scene::MockPromptSessionManager> StubPromptSessionManager;
441+typedef testing::NiceMock<mir::shell::MockPersistentSurfaceStore> StubPersistentSurfaceStore;
442
443 // For better output in ASSERT_* and EXPECT_* error messages
444 void PrintTo(const Application::InternalState& state, ::std::ostream* os);
445@@ -69,6 +71,7 @@
446 testing::NiceMock<MockSharedWakelock> sharedWakelock;
447 testing::NiceMock<MockSettings> settings;
448 std::shared_ptr<StubPromptSessionManager> promptSessionManager;
449+ std::shared_ptr<StubPersistentSurfaceStore> persistentSurfaceStore;
450 QSharedPointer<MirServer> mirServer;
451
452 mir::shell::Shell *mirShell{nullptr};
453
454=== modified file 'tests/modules/SurfaceManager/mirsurface_test.cpp'
455--- tests/modules/SurfaceManager/mirsurface_test.cpp 2016-05-24 20:13:10 +0000
456+++ tests/modules/SurfaceManager/mirsurface_test.cpp 2016-06-14 08:51:40 +0000
457@@ -71,7 +71,7 @@
458 EXPECT_CALL(*mockSurface.get(),buffers_ready_for_compositor(_))
459 .WillRepeatedly(Return(1));
460
461- MirSurface *surface = new MirSurface(mockSurface, fakeSession, &m_mockShell, surfaceObserver, CreationHints());
462+ MirSurface *surface = new MirSurface(mockSurface, "1234", fakeSession, &m_mockShell, surfaceObserver, CreationHints());
463 surfaceObserver->frame_posted(1, mir::geometry::Size{1,1});
464
465 QSignalSpy spyFrameDropped(surface, SIGNAL(frameDropped()));
466@@ -92,7 +92,7 @@
467 auto fakeSession = new FakeSession();
468 auto mockSurface = std::make_shared<NiceMock<ms::MockSurface>>();
469
470- MirSurface *surface = new MirSurface(mockSurface, fakeSession, &m_mockShell, nullptr, CreationHints());
471+ MirSurface *surface = new MirSurface(mockSurface, "1234", fakeSession, &m_mockShell, nullptr, CreationHints());
472 bool surfaceDeleted = false;
473 QObject::connect(surface, &QObject::destroyed, surface, [&surfaceDeleted](){ surfaceDeleted = true; });
474
475@@ -123,7 +123,7 @@
476 auto fakeSession = new FakeSession();
477 auto mockSurface = std::make_shared<NiceMock<ms::MockSurface>>();
478
479- MirSurface *surface = new MirSurface(mockSurface, fakeSession, &m_mockShell, nullptr, CreationHints());
480+ MirSurface *surface = new MirSurface(mockSurface, "1234", fakeSession, &m_mockShell, nullptr, CreationHints());
481 bool surfaceDeleted = false;
482 QObject::connect(surface, &QObject::destroyed, surface, [&surfaceDeleted](){ surfaceDeleted = true; });
483
484@@ -161,7 +161,7 @@
485
486 auto mockSurface = std::make_shared<NiceMock<ms::MockSurface>>();
487
488- MirSurface *surface = new MirSurface(mockSurface, fakeSession, &m_mockShell, nullptr, CreationHints());
489+ MirSurface *surface = new MirSurface(mockSurface, "1234", fakeSession, &m_mockShell, nullptr, CreationHints());
490 bool surfaceDeleted = false;
491 QObject::connect(surface, &QObject::destroyed, surface, [&surfaceDeleted](){ surfaceDeleted = true; });
492
493
494=== modified file 'tests/modules/SurfaceManager/mirsurfaceitem_test.cpp'
495--- tests/modules/SurfaceManager/mirsurfaceitem_test.cpp 2016-05-24 20:13:10 +0000
496+++ tests/modules/SurfaceManager/mirsurfaceitem_test.cpp 2016-06-14 08:51:40 +0000
497@@ -174,7 +174,7 @@
498 auto surfaceObserver = std::make_shared<SurfaceObserver>();
499 mir::shell::MockShell mockShell;
500
501- MirSurface *surface = new MirSurface(mockSurface, fakeSession, &mockShell, surfaceObserver, CreationHints());
502+ MirSurface *surface = new MirSurface(mockSurface, "1234", fakeSession, &mockShell, surfaceObserver, CreationHints());
503
504 MirSurfaceItem *surfaceItem = new MirSurfaceItem;
505 QQuickItemPrivate *surfaceItemPrivate = QQuickItemPrivate::get(surfaceItem);
506@@ -230,7 +230,7 @@
507 auto surfaceObserver = std::make_shared<SurfaceObserver>();
508 mir::shell::MockShell mockShell;
509
510- MirSurface *surface = new MirSurface(mockSurface, fakeSession, &mockShell, surfaceObserver, CreationHints());
511+ MirSurface *surface = new MirSurface(mockSurface, "1234", fakeSession, &mockShell, surfaceObserver, CreationHints());
512
513 MirSurfaceItem *surfaceItem1 = new MirSurfaceItem;
514 QQuickItemPrivate *surfaceItem1Private = QQuickItemPrivate::get(surfaceItem1);

Subscribers

People subscribed via source and target branches