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

Proposed by Daniel d'Andrada
Status: Superseded
Proposed branch: lp:~dandrader/qtmir/surfaceDrawn
Merge into: lp:qtmir
Diff against target: 399 lines (+32/-57)
17 files modified
CMakeLists.txt (+1/-1)
debian/control (+2/-2)
src/modules/Unity/Application/mirsurface.cpp (+1/-1)
src/modules/Unity/Application/mirsurface.h (+2/-2)
src/modules/Unity/Application/mirsurfaceinterface.h (+0/-3)
src/modules/Unity/Application/mirsurfacemanager.cpp (+2/-6)
src/modules/Unity/Application/session.cpp (+0/-13)
src/modules/Unity/Application/session.h (+1/-3)
src/modules/Unity/Application/session_interface.h (+1/-1)
tests/framework/fake_mirsurface.cpp (+2/-2)
tests/framework/fake_mirsurface.h (+2/-1)
tests/framework/fake_session.cpp (+1/-1)
tests/framework/fake_session.h (+1/-1)
tests/framework/mock_session.h (+1/-1)
tests/modules/Application/application_test.cpp (+8/-8)
tests/modules/ApplicationManager/application_manager_test.cpp (+1/-1)
tests/modules/SessionManager/session_test.cpp (+6/-10)
To merge this branch: bzr merge lp:~dandrader/qtmir/surfaceDrawn
Reviewer Review Type Date Requested Status
Nick Dedekind (community) code Approve
Unity8 CI Bot (community) continuous-integration Needs Fixing
Review via email: mp+294428@code.launchpad.net

This proposal has been superseded by a proposal from 2016-05-12.

Commit message

Implement MirSurface.drawn property

And no longer hide blank surfaces from shell

Description of the change

* Are there any related MPs required for this MP to build/function as expected? Please list.
https://code.launchpad.net/~dandrader/unity8/surfaceDrawn/+merge/294427
https://code.launchpad.net/~dandrader/unity-api/surfaceDrawn/+merge/294426

* 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
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

Code looks fine. Will test when silo built.
https://requests.ci-train.ubuntu.com/#/ticket/1409

review: Approve (code)
lp:~dandrader/qtmir/surfaceDrawn updated
487. By Daniel d'Andrada

Implement MirSurface.drawn property

And no longer hide blank surfaces from shell

Unmerged revisions

487. By Daniel d'Andrada

Implement MirSurface.drawn property

And no longer hide blank surfaces from shell

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-04-26 07:20:33 +0000
3+++ CMakeLists.txt 2016-05-11 20:34:48 +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=15)
9+pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=16)
10
11 include_directories(${APPLICATION_API_INCLUDE_DIRS})
12
13
14=== modified file 'debian/control'
15--- debian/control 2016-04-28 12:48:42 +0000
16+++ debian/control 2016-05-11 20:34:48 +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.110),
22+ libunity-api-dev (>= 7.112),
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-15,
31+ unity-application-impl-16,
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 'src/modules/Unity/Application/mirsurface.cpp'
37--- src/modules/Unity/Application/mirsurface.cpp 2016-04-26 08:30:26 +0000
38+++ src/modules/Unity/Application/mirsurface.cpp 2016-05-11 20:34:48 +0000
39@@ -263,7 +263,7 @@
40 {
41 if (!m_firstFrameDrawn) {
42 m_firstFrameDrawn = true;
43- Q_EMIT firstFrameDrawn();
44+ Q_EMIT drawnChanged(true);
45 }
46
47 // restart the frame dropper so that items have enough time to render the next frame.
48
49=== modified file 'src/modules/Unity/Application/mirsurface.h'
50--- src/modules/Unity/Application/mirsurface.h 2016-04-26 08:30:26 +0000
51+++ src/modules/Unity/Application/mirsurface.h 2016-05-11 20:34:48 +0000
52@@ -90,6 +90,8 @@
53
54 unity::shell::application::MirSurfaceListInterface* promptSurfaceList() override;
55
56+ bool drawn() const override { return m_firstFrameDrawn; }
57+
58 Q_INVOKABLE void requestFocus() override;
59 Q_INVOKABLE void close() override;
60 Q_INVOKABLE void raise() override;
61@@ -99,8 +101,6 @@
62
63 void setLive(bool value) override;
64
65- bool isFirstFrameDrawn() const override { return m_firstFrameDrawn; }
66-
67 void stopFrameDropper() override;
68 void startFrameDropper() override;
69
70
71=== modified file 'src/modules/Unity/Application/mirsurfaceinterface.h'
72--- src/modules/Unity/Application/mirsurfaceinterface.h 2016-04-29 15:41:00 +0000
73+++ src/modules/Unity/Application/mirsurfaceinterface.h 2016-05-11 20:34:48 +0000
74@@ -44,8 +44,6 @@
75
76 virtual void setLive(bool value) = 0;
77
78- virtual bool isFirstFrameDrawn() const = 0;
79-
80 virtual void stopFrameDropper() = 0;
81 virtual void startFrameDropper() = 0;
82
83@@ -116,7 +114,6 @@
84 void cursorChanged(const QCursor &cursor);
85 void raiseRequested();
86 void closeRequested();
87- void firstFrameDrawn();
88 void framesPosted();
89 void isBeingDisplayedChanged();
90 void frameDropped();
91
92=== modified file 'src/modules/Unity/Application/mirsurfacemanager.cpp'
93--- src/modules/Unity/Application/mirsurfacemanager.cpp 2016-04-29 15:41:00 +0000
94+++ src/modules/Unity/Application/mirsurfacemanager.cpp 2016-05-11 20:34:48 +0000
95@@ -113,18 +113,14 @@
96 }
97
98 if (session)
99- session->registerSurface(qmlSurface);
100+ session->prependSurface(qmlSurface);
101
102 if (qmlSurface->type() == Mir::InputMethodType) {
103 m_inputMethodSurface = qmlSurface;
104 Q_EMIT inputMethodSurfaceChanged();
105 }
106
107- // Only notify QML of surface creation once it has drawn its first frame.
108- connect(qmlSurface, &MirSurfaceInterface::firstFrameDrawn, this, [=]() {
109- tracepoint(qtmir, firstFrameDrawn);
110- Q_EMIT surfaceCreated(qmlSurface);
111- });
112+ Q_EMIT surfaceCreated(qmlSurface);
113
114 // clean up after MirSurface is destroyed
115 connect(qmlSurface, &QObject::destroyed, this, [&](QObject *obj) {
116
117=== modified file 'src/modules/Unity/Application/session.cpp'
118--- src/modules/Unity/Application/session.cpp 2016-04-06 16:52:49 +0000
119+++ src/modules/Unity/Application/session.cpp 2016-05-11 20:34:48 +0000
120@@ -191,19 +191,6 @@
121 Q_EMIT applicationChanged(application);
122 }
123
124-void Session::registerSurface(MirSurfaceInterface *newSurface)
125-{
126- qCDebug(QTMIR_SESSIONS) << "Session::resgisterSurface - session=" << name() << "surface=" << newSurface;
127-
128- // Only notify QML of surface creation once it has drawn its first frame.
129- if (newSurface->isFirstFrameDrawn()) {
130- prependSurface(newSurface);
131- } else {
132- connect(newSurface, &MirSurfaceInterface::firstFrameDrawn,
133- this, [this, newSurface]() { this->prependSurface(newSurface); });
134- }
135-}
136-
137 void Session::prependSurface(MirSurfaceInterface *newSurface)
138 {
139 qCDebug(QTMIR_SESSIONS) << "Session::prependSurface - session=" << name() << "surface=" << newSurface;
140
141=== modified file 'src/modules/Unity/Application/session.h'
142--- src/modules/Unity/Application/session.h 2016-03-28 18:02:26 +0000
143+++ src/modules/Unity/Application/session.h 2016-05-11 20:34:48 +0000
144@@ -57,7 +57,7 @@
145
146 void setApplication(unity::shell::application::ApplicationInfoInterface* item) override;
147
148- void registerSurface(MirSurfaceInterface* surface) override;
149+ void prependSurface(MirSurfaceInterface* surface) override;
150
151 void suspend() override;
152 void resume() override;
153@@ -102,8 +102,6 @@
154
155 void stopPromptSessions();
156
157- void prependSurface(MirSurfaceInterface* surface);
158-
159 std::shared_ptr<mir::scene::Session> m_session;
160 Application* m_application;
161 MirSurfaceListModel m_surfaceList;
162
163=== modified file 'src/modules/Unity/Application/session_interface.h'
164--- src/modules/Unity/Application/session_interface.h 2016-04-06 16:52:49 +0000
165+++ src/modules/Unity/Application/session_interface.h 2016-05-11 20:34:48 +0000
166@@ -77,7 +77,7 @@
167
168 // For MirSurface and MirSurfaceManager use
169
170- virtual void registerSurface(MirSurfaceInterface* surface) = 0;
171+ virtual void prependSurface(MirSurfaceInterface* surface) = 0;
172
173 // For Application use
174
175
176=== modified file 'tests/framework/fake_mirsurface.cpp'
177--- tests/framework/fake_mirsurface.cpp 2016-04-05 18:58:38 +0000
178+++ tests/framework/fake_mirsurface.cpp 2016-05-11 20:34:48 +0000
179@@ -91,7 +91,7 @@
180 }
181 }
182
183-bool FakeMirSurface::isFirstFrameDrawn() const
184+bool FakeMirSurface::drawn() const
185 {
186 return m_isFirstFrameDrawn;
187 }
188@@ -188,7 +188,7 @@
189 {
190 if (!m_isFirstFrameDrawn) {
191 m_isFirstFrameDrawn = true;
192- Q_EMIT firstFrameDrawn();
193+ Q_EMIT drawnChanged(true);
194 }
195 }
196
197
198=== modified file 'tests/framework/fake_mirsurface.h'
199--- tests/framework/fake_mirsurface.h 2016-04-26 08:30:26 +0000
200+++ tests/framework/fake_mirsurface.h 2016-05-11 20:34:48 +0000
201@@ -79,6 +79,8 @@
202
203 unity::shell::application::MirSurfaceListInterface* promptSurfaceList() override { return &m_promptSurfaceList;}
204
205+ bool drawn() const override;
206+
207 void requestFocus() override {
208 Q_EMIT focusRequested();
209 }
210@@ -94,7 +96,6 @@
211 ////
212 // qtmir.MirSurfaceInterface
213
214- bool isFirstFrameDrawn() const override;
215 void stopFrameDropper() override;
216 void startFrameDropper() override;
217 void setLive(bool value) override;
218
219=== modified file 'tests/framework/fake_session.cpp'
220--- tests/framework/fake_session.cpp 2016-03-28 18:02:26 +0000
221+++ tests/framework/fake_session.cpp 2016-05-11 20:34:48 +0000
222@@ -49,7 +49,7 @@
223 return m_session;
224 }
225
226-void FakeSession::registerSurface(MirSurfaceInterface *) {}
227+void FakeSession::prependSurface(MirSurfaceInterface *) {}
228
229 void FakeSession::setApplication(unity::shell::application::ApplicationInfoInterface *app)
230 {
231
232=== modified file 'tests/framework/fake_session.h'
233--- tests/framework/fake_session.h 2016-03-28 18:02:26 +0000
234+++ tests/framework/fake_session.h 2016-05-11 20:34:48 +0000
235@@ -43,7 +43,7 @@
236
237 // For MirSurfaceItem and MirSurfaceManager use
238
239- void registerSurface(MirSurfaceInterface*) override;
240+ void prependSurface(MirSurfaceInterface*) override;
241
242 // For Application use
243
244
245=== modified file 'tests/framework/mock_session.h'
246--- tests/framework/mock_session.h 2016-03-28 18:02:26 +0000
247+++ tests/framework/mock_session.h 2016-05-11 20:34:48 +0000
248@@ -42,7 +42,7 @@
249
250 MOCK_CONST_METHOD0(session, std::shared_ptr<mir::scene::Session>());
251
252- MOCK_METHOD1(registerSurface, void(MirSurfaceInterface* surface));
253+ MOCK_METHOD1(prependSurface, void(MirSurfaceInterface* surface));
254 MOCK_METHOD1(removeSurface, void(MirSurfaceInterface* surface));
255
256 MOCK_METHOD1(setApplication, void(unity::shell::application::ApplicationInfoInterface* item));
257
258=== modified file 'tests/modules/Application/application_test.cpp'
259--- tests/modules/Application/application_test.cpp 2016-04-26 08:56:36 +0000
260+++ tests/modules/Application/application_test.cpp 2016-05-11 20:34:48 +0000
261@@ -285,7 +285,7 @@
262 QSignalSpy spyAppStopped(application.data(), SIGNAL(stopped()));
263
264 FakeMirSurface *surface = new FakeMirSurface;
265- session->registerSurface(surface);
266+ session->prependSurface(surface);
267 surface->drawFirstFrame();
268
269 ASSERT_EQ(Application::InternalState::Running, application->internalState());
270@@ -380,7 +380,7 @@
271 application->setSession(session);
272
273 FakeMirSurface *surface = new FakeMirSurface;
274- session->registerSurface(surface);
275+ session->prependSurface(surface);
276 surface->drawFirstFrame();
277
278 ASSERT_EQ(Application::InternalState::Running, application->internalState());
279@@ -388,7 +388,7 @@
280 // Add a second surface to ensure the application doesn't kill itself after it loses
281 // one surface.
282 FakeMirSurface *secondSurface = new FakeMirSurface;
283- session->registerSurface(secondSurface);
284+ session->prependSurface(secondSurface);
285 secondSurface->drawFirstFrame();
286
287 suspend(application.data());
288@@ -437,14 +437,14 @@
289 application->setSession(session);
290
291 FakeMirSurface *surface = new FakeMirSurface;
292- session->registerSurface(surface);
293+ session->prependSurface(surface);
294 surface->drawFirstFrame();
295
296 ASSERT_EQ(Application::InternalState::Running, application->internalState());
297 ASSERT_EQ(Session::Running, session->state());
298
299 FakeMirSurface *secondSurface = new FakeMirSurface;
300- session->registerSurface(secondSurface);
301+ session->prependSurface(secondSurface);
302 secondSurface->drawFirstFrame();
303
304 delete surface;
305@@ -488,7 +488,7 @@
306 application->setSession(session);
307
308 FakeMirSurface *surface = new FakeMirSurface;
309- session->registerSurface(surface);
310+ session->prependSurface(surface);
311 surface->drawFirstFrame();
312 ASSERT_EQ(Application::InternalState::Running, application->internalState());
313
314@@ -532,7 +532,7 @@
315 application->setSession(session);
316
317 FakeMirSurface *surface = new FakeMirSurface;
318- session->registerSurface(surface);
319+ session->prependSurface(surface);
320 surface->drawFirstFrame();
321 ASSERT_EQ(Application::InternalState::Running, application->internalState());
322
323@@ -570,7 +570,7 @@
324 application->setSession(session);
325
326 FakeMirSurface *surface = new FakeMirSurface;
327- session->registerSurface(surface);
328+ session->prependSurface(surface);
329 surface->drawFirstFrame();
330
331 ASSERT_EQ(Application::InternalState::Running, application->internalState());
332
333=== modified file 'tests/modules/ApplicationManager/application_manager_test.cpp'
334--- tests/modules/ApplicationManager/application_manager_test.cpp 2016-04-26 08:56:36 +0000
335+++ tests/modules/ApplicationManager/application_manager_test.cpp 2016-05-11 20:34:48 +0000
336@@ -55,7 +55,7 @@
337
338 SessionInterface* qmlSession = sessionManager.findSession(mirSession);
339 if (qmlSession) {
340- qmlSession->registerSurface(qmlSurface);
341+ qmlSession->prependSurface(qmlSurface);
342 }
343
344 // I assume that applicationManager ignores the mirSurface parameter, so sending
345
346=== modified file 'tests/modules/SessionManager/session_test.cpp'
347--- tests/modules/SessionManager/session_test.cpp 2016-03-28 18:02:26 +0000
348+++ tests/modules/SessionManager/session_test.cpp 2016-05-11 20:34:48 +0000
349@@ -43,7 +43,7 @@
350 }
351 };
352
353-TEST_F(SessionTests, FromStartingToRunningOnceSurfaceDrawsFirstFrame)
354+TEST_F(SessionTests, FromStartingToRunningOnceFirstSurfaceAppears)
355 {
356 using namespace testing;
357
358@@ -58,12 +58,8 @@
359 EXPECT_EQ(Session::Starting, session->state());
360
361 FakeMirSurface *surface = new FakeMirSurface;
362- session->registerSurface(surface);
363-
364- // Still on Starting as the surface hasn't drawn its first frame yet
365- EXPECT_EQ(Session::Starting, session->state());
366-
367- surface->drawFirstFrame();
368+ session->prependSurface(surface);
369+
370 EXPECT_EQ(Session::Running, session->state());
371 }
372
373@@ -221,7 +217,7 @@
374 auto session = std::make_shared<qtmir::Session>(mirSession, mirServer->the_prompt_session_manager());
375 {
376 FakeMirSurface *surface = new FakeMirSurface;
377- session->registerSurface(surface);
378+ session->prependSurface(surface);
379 surface->drawFirstFrame();
380 }
381 EXPECT_EQ(Session::Running, session->state());
382@@ -252,7 +248,7 @@
383 auto session = std::make_shared<qtmir::Session>(mirSession, promptSessionManager);
384 {
385 FakeMirSurface *surface = new FakeMirSurface;
386- session->registerSurface(surface);
387+ session->prependSurface(surface);
388 surface->drawFirstFrame();
389 }
390 EXPECT_EQ(Session::Running, session->state());
391@@ -297,7 +293,7 @@
392 auto session = std::make_shared<SessionTestClass>(mirSession, mirServer->the_prompt_session_manager());
393 {
394 FakeMirSurface *surface = new FakeMirSurface;
395- session->registerSurface(surface);
396+ session->prependSurface(surface);
397 surface->drawFirstFrame();
398 }
399 EXPECT_EQ(Session::Running, session->state());

Subscribers

People subscribed via source and target branches