Merge lp:~gerboland/unity-mir/surface-notifications into lp:unity-mir

Proposed by Gerry Boland
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 25
Merged at revision: 23
Proposed branch: lp:~gerboland/unity-mir/surface-notifications
Merge into: lp:unity-mir
Diff against target: 595 lines (+147/-118)
12 files modified
src/modules/Unity/ApplicationManager/application_list_model.cpp (+9/-2)
src/modules/Unity/ApplicationManager/application_list_model.h (+1/-0)
src/modules/Unity/ApplicationManager/application_manager.cpp (+33/-14)
src/modules/Unity/ApplicationManager/application_manager.h (+8/-1)
src/modules/Unity/SurfaceManager/mirsurface.cpp (+45/-86)
src/modules/Unity/SurfaceManager/mirsurface.h (+4/-2)
src/modules/Unity/SurfaceManager/mirsurfacemanager.cpp (+23/-4)
src/modules/Unity/SurfaceManager/mirsurfacemanager.h (+4/-3)
src/unity-mir/sessionlistener.cpp (+14/-0)
src/unity-mir/sessionlistener.h (+6/-3)
src/unity-mir/surfacesource.cpp (+0/-2)
src/unity-mir/surfacesource.h (+0/-1)
To merge this branch: bzr merge lp:~gerboland/unity-mir/surface-notifications
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Approve
Review via email: mp+176719@code.launchpad.net

Commit message

Update SurfaceManager and ApplicationManager to make use of new MIR API, which notifies of surface creation and destruction per session/application.

Description of the change

Update SurfaceManager and ApplicationManager to make use of new MIR API, which notifies of surface creation and destruction per session/application.

To post a comment you must log in.
22. By Gerry Boland

Unset mainStageFocusedApplication if it is closed

23. By Gerry Boland

Merge trunk

24. By Gerry Boland

Reset mainStageFocusedApplication in stopProcess, fix crash on app close

25. By Gerry Boland

SurfaceManager: unable to keep msh::Surface as long as we want, so simplify API for now

Revision history for this message
Albert Astals Cid (aacid) wrote :

Looks good

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/ApplicationManager/application_list_model.cpp'
2--- src/modules/Unity/ApplicationManager/application_list_model.cpp 2013-07-24 15:07:38 +0000
3+++ src/modules/Unity/ApplicationManager/application_list_model.cpp 2013-07-24 17:24:27 +0000
4@@ -19,6 +19,8 @@
5
6 #include <mir/shell/application_session.h>
7
8+namespace msh = mir::shell;
9+
10 ApplicationListModel::ApplicationListModel(QObject* parent)
11 : QAbstractListModel(parent)
12 , m_applications()
13@@ -100,11 +102,16 @@
14 }
15 }
16
17-Application* ApplicationListModel::getApplicationWithSession(const std::shared_ptr<mir::shell::Session> &session)
18+Application* ApplicationListModel::getApplicationWithSession(const std::shared_ptr<msh::Session> &session)
19+{
20+ return getApplicationWithSession(session.get());
21+}
22+
23+Application* ApplicationListModel::getApplicationWithSession(const msh::Session *session)
24 {
25 Application* app = NULL;
26 Q_FOREACH(app, m_applications) {
27- if (app->session().get() == session.get()) {
28+ if (app->session().get() == session) {
29 break;
30 }
31 }
32
33=== modified file 'src/modules/Unity/ApplicationManager/application_list_model.h'
34--- src/modules/Unity/ApplicationManager/application_list_model.h 2013-07-24 15:07:38 +0000
35+++ src/modules/Unity/ApplicationManager/application_list_model.h 2013-07-24 17:24:27 +0000
36@@ -49,6 +49,7 @@
37 void remove(Application* application);
38
39 Application* getApplicationWithSession(const std::shared_ptr<mir::shell::Session> &session);
40+ Application* getApplicationWithSession(const mir::shell::Session *session);
41 Application* getApplicationWithId(const int id);
42 Application* getApplicationWithPid(const int pid);
43 Application* getLastExecutedApplication();
44
45=== modified file 'src/modules/Unity/ApplicationManager/application_manager.cpp'
46--- src/modules/Unity/ApplicationManager/application_manager.cpp 2013-07-24 15:44:10 +0000
47+++ src/modules/Unity/ApplicationManager/application_manager.cpp 2013-07-24 17:24:27 +0000
48@@ -25,6 +25,8 @@
49 #include <pwd.h>
50 #endif
51
52+namespace msh = mir::shell;
53+
54 ApplicationManager::ApplicationManager(QObject *parent)
55 : QObject(parent)
56 , m_mainStageApplications(new ApplicationListModel())
57@@ -39,17 +41,16 @@
58 }
59 m_mirServer = mirServerApplication->server();
60
61- std::shared_ptr<SessionListener> sessionListener
62- = std::dynamic_pointer_cast<SessionListener>(m_mirServer->the_shell_session_listener());
63-
64- QObject::connect(sessionListener.get(), &SessionListener::sessionStarting,
65+ QObject::connect(m_mirServer->sessionListener(), &SessionListener::sessionStarting,
66 this, &ApplicationManager::sessionStarting);
67- QObject::connect(sessionListener.get(), &SessionListener::sessionStopping,
68+ QObject::connect(m_mirServer->sessionListener(), &SessionListener::sessionStopping,
69 this, &ApplicationManager::sessionStopping);
70- QObject::connect(sessionListener.get(), &SessionListener::sessionFocused,
71+ QObject::connect(m_mirServer->sessionListener(), &SessionListener::sessionFocused,
72 this, &ApplicationManager::sessionFocused);
73- QObject::connect(sessionListener.get(), &SessionListener::sessionUnfocused,
74+ QObject::connect(m_mirServer->sessionListener(), &SessionListener::sessionUnfocused,
75 this, &ApplicationManager::sessionUnfocused);
76+ QObject::connect(m_mirServer->sessionListener(), &SessionListener::sessionCreatedSurface,
77+ this, &ApplicationManager::sessionCreatedSurface);
78
79 std::shared_ptr<SessionAuthorizer> sessionAuthorizer
80 = std::dynamic_pointer_cast<SessionAuthorizer>(m_mirServer->the_session_authorizer());
81@@ -193,7 +194,13 @@
82 DLOG("ApplicationManager::stopProcess (this=%p, application=%p)", this, application);
83
84 if (application != NULL) {
85+ if (application == m_mainStageFocusedApplication) {
86+ // TODO(greyback) What to do?? Focus next app, or unfocus everything??
87+ m_mainStageFocusedApplication = NULL;
88+ Q_EMIT mainStageFocusedApplicationChanged();
89+ }
90 m_mainStageApplications->remove(application);
91+ m_dbusWindowStack->WindowDestroyed(0, application->name());
92
93 // Start process.
94 bool result;
95@@ -225,7 +232,7 @@
96 }
97 }
98
99-void ApplicationManager::sessionStarting(std::shared_ptr<mir::shell::ApplicationSession> const& session)
100+void ApplicationManager::sessionStarting(std::shared_ptr<msh::ApplicationSession> const& session)
101 {
102 DLOG("ApplicationManager::sessionStarting (this=%p, application=%s)", this, session->name().c_str());
103
104@@ -234,15 +241,12 @@
105 Application* application = m_mainStageApplications->getLastExecutedApplication();
106 if (application && application->state() != Application::Running) {
107 application->setSession(session);
108- application->setState(Application::Running);
109-
110- m_dbusWindowStack->WindowCreated(0, application->name());
111 } else {
112 DLOG("ApplicationManager::sessionStarting - unauthorized application!!");
113 }
114 }
115
116-void ApplicationManager::sessionStopping(std::shared_ptr<mir::shell::ApplicationSession> const& session)
117+void ApplicationManager::sessionStopping(std::shared_ptr<msh::ApplicationSession> const& session)
118 {
119 DLOG("ApplicationManager::sessionStopping (this=%p, application=%s)", this, session->name().c_str());
120
121@@ -250,14 +254,16 @@
122 Application* application = m_mainStageApplications->getApplicationWithSession(session);
123 if (application) {
124 if (application == m_mainStageFocusedApplication) {
125- // TODO(greyback) either focus next app, or unfocus everything
126+ // TODO(greyback) What to do?? Focus next app, or unfocus everything??
127+ m_mainStageFocusedApplication = NULL;
128+ Q_EMIT mainStageFocusedApplicationChanged();
129 }
130 m_mainStageApplications->remove(application);
131 m_dbusWindowStack->WindowDestroyed(0, application->name());
132 }
133 }
134
135-void ApplicationManager::sessionFocused(std::shared_ptr<mir::shell::ApplicationSession> const& session)
136+void ApplicationManager::sessionFocused(std::shared_ptr<msh::ApplicationSession> const& session)
137 {
138 DLOG("ApplicationManager::sessionFocused (this=%p, application=%s)", this, session->name().c_str());
139 Application* application = m_mainStageApplications->getApplicationWithSession(session);
140@@ -280,3 +286,16 @@
141 }
142 }
143
144+void ApplicationManager::sessionCreatedSurface(msh::ApplicationSession const* session,
145+ std::shared_ptr<msh::Surface> const& surface)
146+{
147+ DLOG("ApplicationManager::sessionCreatedSurface (this=%p)", this);
148+ Q_UNUSED(surface);
149+
150+ Application* application = m_mainStageApplications->getApplicationWithSession(session);
151+ if (application && application->state() == Application::Starting) {
152+ application->setState(Application::Running);
153+
154+ m_dbusWindowStack->WindowCreated(0, application->name());
155+ }
156+}
157
158=== modified file 'src/modules/Unity/ApplicationManager/application_manager.h'
159--- src/modules/Unity/ApplicationManager/application_manager.h 2013-07-24 15:07:38 +0000
160+++ src/modules/Unity/ApplicationManager/application_manager.h 2013-07-24 17:24:27 +0000
161@@ -14,7 +14,12 @@
162 class ShellServerConfiguration;
163 class DBusWindowStack;
164
165-namespace mir { namespace shell { class ApplicationSession; }}
166+namespace mir {
167+ namespace shell {
168+ class ApplicationSession;
169+ class Surface;
170+ }
171+}
172
173 class ApplicationManager : public QObject
174 {
175@@ -77,6 +82,8 @@
176 void sessionFocused(std::shared_ptr<mir::shell::ApplicationSession> const& session);
177 void sessionUnfocused();
178
179+ void sessionCreatedSurface(mir::shell::ApplicationSession const*, std::shared_ptr<mir::shell::Surface> const&);
180+
181 private:
182 ApplicationListModel* m_mainStageApplications;
183 Application* m_mainStageFocusedApplication; // remove as Mir has API for this
184
185=== modified file 'src/modules/Unity/SurfaceManager/mirsurface.cpp'
186--- src/modules/Unity/SurfaceManager/mirsurface.cpp 2013-07-19 17:29:44 +0000
187+++ src/modules/Unity/SurfaceManager/mirsurface.cpp 2013-07-24 17:24:27 +0000
188@@ -6,7 +6,7 @@
189
190 namespace mg = mir::geometry;
191
192-MirSurface::MirSurface(std::weak_ptr<mir::shell::Surface> surface, QQuickItem *parent)
193+MirSurface::MirSurface(std::shared_ptr<mir::shell::Surface> surface, QQuickItem *parent)
194 : QQuickItem(parent)
195 , m_surface(surface)
196 {
197@@ -25,22 +25,14 @@
198
199 qreal MirSurface::x() const
200 {
201- if (auto surface = m_surface.lock()) {
202- int xAbsolute = surface->top_left().x.as_int();
203- return mapFromScene((QPointF(xAbsolute, 0))).x();
204- } else {
205- return 0;
206- }
207+ int xAbsolute = m_surface->top_left().x.as_int();
208+ return mapFromScene((QPointF(xAbsolute, 0))).x();
209 }
210
211 qreal MirSurface::y() const
212 {
213- if (auto surface = m_surface.lock()) {
214- int yAbsolute = surface->top_left().y.as_int();
215- return mapFromScene((QPointF(0, yAbsolute))).y();
216- } else {
217- return 0;
218- }
219+ int yAbsolute = m_surface->top_left().y.as_int();
220+ return mapFromScene((QPointF(0, yAbsolute))).y();
221 }
222
223 void MirSurface::setX(qreal xValue)
224@@ -48,13 +40,11 @@
225 using namespace mir::geometry;
226 qreal xAbsolute = mapToScene(QPointF(xValue, 0)).x();
227
228- if (auto surface = m_surface.lock()) {
229- Point position = surface->top_left();
230- if (position.x.as_int() != (int) xAbsolute) {
231- position.x = X{xAbsolute};
232- surface->move_to(position);
233- Q_EMIT xChanged();
234- }
235+ Point position = m_surface->top_left();
236+ if (position.x.as_int() != (int) xAbsolute) {
237+ position.x = X{xAbsolute};
238+ m_surface->move_to(position);
239+ Q_EMIT xChanged();
240 }
241 }
242
243@@ -63,45 +53,33 @@
244 using namespace mir::geometry;
245 qreal yAbsolute = mapToScene(QPointF(0, yValue)).y();
246
247- if (auto surface = m_surface.lock()) {
248- Point position = surface->top_left();
249- if (position.y.as_int() != (int) yAbsolute) {
250- position.y = Y{yAbsolute};
251- surface->move_to(position);
252- Q_EMIT yChanged();
253- }
254+ Point position = m_surface->top_left();
255+ if (position.y.as_int() != (int) yAbsolute) {
256+ position.y = Y{yAbsolute};
257+ m_surface->move_to(position);
258+ Q_EMIT yChanged();
259 }
260 }
261
262 qreal MirSurface::width() const
263 {
264- if (auto surface = m_surface.lock()) {
265- return surface->size().width.as_int();
266- } else {
267- return 0;
268- }
269+ return m_surface->size().width.as_int();
270 }
271
272 qreal MirSurface::height() const
273 {
274- if (auto surface = m_surface.lock()) {
275- return surface->size().height.as_int();
276- } else {
277- return 0;
278- }
279+ return m_surface->size().height.as_int();
280 }
281
282 void MirSurface::setWidth(qreal widthValue)
283 {
284 using namespace mir::geometry;
285
286- if (auto surface = m_surface.lock()) {
287- Size size = surface->size();
288- if (size.width.as_int() != (int) widthValue) {
289- size.width = Width{widthValue};
290-// m_surface->set_size(size); //MISSING FROM API
291- Q_EMIT widthChanged();
292- }
293+ Size size = m_surface->size();
294+ if (size.width.as_int() != (int) widthValue) {
295+ size.width = Width{widthValue};
296+// m_surface->set_size(size); //MISSING FROM API
297+ Q_EMIT widthChanged();
298 }
299 }
300
301@@ -109,13 +87,11 @@
302 {
303 using namespace mir::geometry;
304
305- if (auto surface = m_surface.lock()) {
306- Size size = surface->size();
307- if (size.height.as_int() != (int) heightValue) {
308- size.height = Height{heightValue};
309-// m_surface->set_size(size); //MISSING FROM API
310- Q_EMIT heightChanged();
311- }
312+ Size size = m_surface->size();
313+ if (size.height.as_int() != (int) heightValue) {
314+ size.height = Height{heightValue};
315+// m_surface->set_size(size); //MISSING FROM API
316+ Q_EMIT heightChanged();
317 }
318 }
319
320@@ -128,51 +104,38 @@
321 {
322 if (visible == m_visible) return;
323
324- if (auto surface = m_surface.lock()) {
325- if (visible) {
326- surface->show();
327- } else {
328- surface->hide();
329- }
330- m_visible = visible;
331- Q_EMIT visibleChanged();
332+ if (visible) {
333+ m_surface->show();
334+ } else {
335+ m_surface->hide();
336 }
337+ m_visible = visible;
338+ Q_EMIT visibleChanged();
339 }
340
341
342 MirSurface::Type MirSurface::type() const
343-{ //FIXME - how to listen to change in this property
344- if (auto surface = m_surface.lock()) {
345- return static_cast<MirSurface::Type>(surface->type());
346- } else {
347- return Normal;
348- }
349+{
350+ //FIXME - how to listen to change in this property
351+ return static_cast<MirSurface::Type>(m_surface->type());
352 }
353
354 MirSurface::State MirSurface::state() const
355-{ //FIXME - how to listen to change in this property
356- if (auto surface = m_surface.lock()) {
357- return static_cast<MirSurface::State>(surface->state());
358- } else {
359- return Unknown;
360- }
361+{
362+ //FIXME - how to listen to change in this property
363+ return static_cast<MirSurface::State>(m_surface->state());
364 }
365
366 QString MirSurface::name() const
367-{ //FIXME - how to listen to change in this property
368- if (auto surface = m_surface.lock()) {
369- return QString::fromStdString(surface->name());
370- } else {
371- return QString();
372- }
373+{
374+ //FIXME - how to listen to change in this property
375+ return QString::fromStdString(m_surface->name());
376 }
377
378 void MirSurface::installInputArea(const InputArea* area)
379 {
380- if (auto surface = m_surface.lock()) {
381- if (!surface->supports_input()) {
382- DLOG("MirSurface::installInputArea - surface does not support input");
383- }
384+ if (!m_surface->supports_input()) {
385+ LOG("MirSurface::installInputArea - surface does not support input");
386 }
387
388 m_inputAreas.push_back(area);
389@@ -181,11 +144,7 @@
390 /* WARNING: by default, a surface has an input region covering the whole surface.
391 Once the surface input region is set, the default will *not* be restored when
392 all input regions are removed/disabled */
393- if (auto surface = m_surface.lock()) {
394- surface->set_input_region(m_mirInputAreas);
395- } else {
396- DLOG("MirSurface::installInputArea - unable to set surface input region");
397- }
398+ m_surface->set_input_region(m_mirInputAreas);
399 }
400
401 bool MirSurface::removeInputArea(const InputArea* area)
402
403=== modified file 'src/modules/Unity/SurfaceManager/mirsurface.h'
404--- src/modules/Unity/SurfaceManager/mirsurface.h 2013-07-19 17:29:44 +0000
405+++ src/modules/Unity/SurfaceManager/mirsurface.h 2013-07-24 17:24:27 +0000
406@@ -10,6 +10,7 @@
407
408
409 namespace mir { namespace geometry { struct Rectangle; }}
410+class MirSurfaceManager;
411 class InputArea;
412
413 class MirSurface : public QQuickItem
414@@ -29,7 +30,7 @@
415 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
416
417 public:
418- explicit MirSurface(std::weak_ptr<mir::shell::Surface> surface, QQuickItem *parent = 0);
419+ explicit MirSurface(std::shared_ptr<mir::shell::Surface> surface, QQuickItem *parent = 0);
420 ~MirSurface();
421
422 enum Type {
423@@ -81,7 +82,7 @@
424 void visibleChanged();
425
426 protected:
427- std::weak_ptr<mir::shell::Surface> m_surface;
428+ std::shared_ptr<mir::shell::Surface> m_surface;
429
430 private:
431 // start of methods used by InputFilter
432@@ -97,6 +98,7 @@
433
434 bool m_visible:true; //FIXME(greyback) state should be in Mir::Shell::Surface, not here
435
436+ friend class MirSurfaceManager;
437 friend class InputArea;
438 };
439
440
441=== modified file 'src/modules/Unity/SurfaceManager/mirsurfacemanager.cpp'
442--- src/modules/Unity/SurfaceManager/mirsurfacemanager.cpp 2013-07-19 17:29:44 +0000
443+++ src/modules/Unity/SurfaceManager/mirsurfacemanager.cpp 2013-07-24 17:24:27 +0000
444@@ -5,6 +5,7 @@
445 // local
446 #include "qmirserverapplication.h"
447 #include "shellserverconfiguration.h"
448+#include "sessionlistener.h"
449 #include "surfacesource.h"
450 #include "mirsurfacemanager.h"
451 #include "mirsurface.h"
452@@ -25,8 +26,10 @@
453 }
454 m_mirServer = mirServerApplication->server();
455
456- QObject::connect(m_mirServer->surfaceSource(), &SurfaceSource::surfaceCreated,
457- this, &MirSurfaceManager::mirSurfaceCreated);
458+ QObject::connect(m_mirServer->sessionListener(), &SessionListener::sessionCreatedSurface,
459+ this, &MirSurfaceManager::sessionCreatedSurface);
460+ QObject::connect(m_mirServer->sessionListener(), &SessionListener::sessionDestroyingSurface,
461+ this, &MirSurfaceManager::sessionDestroyingSurface);
462 }
463
464 MirSurfaceManager::~MirSurfaceManager()
465@@ -39,11 +42,27 @@
466 m_surfaces.clear();
467 }
468
469-void MirSurfaceManager::mirSurfaceCreated(const std::shared_ptr<msh::Surface> &surface)
470+void MirSurfaceManager::sessionCreatedSurface(mir::shell::ApplicationSession const*, std::shared_ptr<mir::shell::Surface> const& surface)
471 {
472- DLOG("MirSurfaceManager::surfaceCreated (this=%p) with surface name '%s'", this, surface->name().c_str());
473+ DLOG("MirSurfaceManager::sessionCreatedSurface (this=%p) with surface name '%s'", this, surface->name().c_str());
474 auto qmlSurface = new MirSurface(surface);
475
476 m_surfaces.prepend(qmlSurface);
477 Q_EMIT surfaceCreated(qmlSurface);
478 }
479+
480+void MirSurfaceManager::sessionDestroyingSurface(mir::shell::ApplicationSession const*, std::shared_ptr<mir::shell::Surface> const& surface)
481+{
482+ DLOG("MirSurfaceManager::sessionDestroyingSurface (this=%p) with surface name '%s'", this, surface->name().c_str());
483+
484+ Q_FOREACH(MirSurface* s, m_surfaces) {
485+ if (s->m_surface == surface) {
486+ m_surfaces.removeOne(s);
487+ Q_EMIT surfaceDestroyed(s);
488+ return;
489+ }
490+ }
491+
492+ DLOG("MirSurfaceManager::sessionDestroyingSurface: unable to find MirSurface corresponding to surface '%s'", surface->name().c_str());
493+}
494+
495
496=== modified file 'src/modules/Unity/SurfaceManager/mirsurfacemanager.h'
497--- src/modules/Unity/SurfaceManager/mirsurfacemanager.h 2013-07-19 17:29:44 +0000
498+++ src/modules/Unity/SurfaceManager/mirsurfacemanager.h 2013-07-24 17:24:27 +0000
499@@ -10,7 +10,7 @@
500 #include "mirsurface.h"
501
502 class ShellServerConfiguration;
503-namespace mir { namespace shell { class Surface; }}
504+namespace mir { namespace shell { class Surface; class ApplicationSession; }}
505
506 class MirSurfaceManager : public QObject
507 {
508@@ -24,12 +24,13 @@
509
510 Q_SIGNALS:
511 void surfaceCreated(MirSurface* surface);
512-// void surfaceDestroyed(MirSurface*);
513+ void surfaceDestroyed(MirSurface* surface);
514 // void surfaceResized(MirSurface*);
515 // void fullscreenSurfaceChanged();
516
517 public Q_SLOTS:
518- void mirSurfaceCreated(const std::shared_ptr<mir::shell::Surface>& surface);
519+ void sessionCreatedSurface(mir::shell::ApplicationSession const*, std::shared_ptr<mir::shell::Surface> const&);
520+ void sessionDestroyingSurface(mir::shell::ApplicationSession const*, std::shared_ptr<mir::shell::Surface> const&);
521
522 private:
523 QList<MirSurface*> m_surfaces;
524
525=== modified file 'src/unity-mir/sessionlistener.cpp'
526--- src/unity-mir/sessionlistener.cpp 2013-07-19 17:29:44 +0000
527+++ src/unity-mir/sessionlistener.cpp 2013-07-24 17:24:27 +0000
528@@ -45,3 +45,17 @@
529 DLOG("SessionListener::unfocused (this=%p)", this);
530 Q_EMIT sessionUnfocused();
531 }
532+
533+void SessionListener::surface_created(msh::Session& session, std::shared_ptr<msh::Surface> const& surface)
534+{
535+ DLOG("SessionListener::surface_created (this=%p, session=%p, surface=%p)", this, &session, (void*)surface.get());
536+ msh::ApplicationSession &appSession = dynamic_cast<msh::ApplicationSession &>(session);
537+ Q_EMIT sessionCreatedSurface(&appSession, surface);
538+}
539+
540+void SessionListener::destroying_surface(msh::Session& session, std::shared_ptr<mir::shell::Surface> const& surface)
541+{
542+ DLOG("SessionListener::destroying_surface (this=%p, session=%p, surface=%p)", this, &session, (void*)surface.get());
543+ msh::ApplicationSession &appSession = dynamic_cast<msh::ApplicationSession &>(session);
544+ Q_EMIT sessionDestroyingSurface(&appSession, surface);
545+}
546
547=== modified file 'src/unity-mir/sessionlistener.h'
548--- src/unity-mir/sessionlistener.h 2013-07-24 16:34:31 +0000
549+++ src/unity-mir/sessionlistener.h 2013-07-24 17:24:27 +0000
550@@ -18,14 +18,17 @@
551 void focused(std::shared_ptr<mir::shell::Session> const& session) override;
552 void unfocused() override;
553
554- void surface_created(mir::shell::Session&, std::shared_ptr<mir::shell::Surface> const&) override {}
555- void destroying_surface(mir::shell::Session&, std::shared_ptr<mir::shell::Surface> const&) override {}
556-
557+ void surface_created(mir::shell::Session&, std::shared_ptr<mir::shell::Surface> const&) override;
558+ void destroying_surface(mir::shell::Session&, std::shared_ptr<mir::shell::Surface> const&) override;
559+
560 Q_SIGNALS:
561 void sessionStarting(std::shared_ptr<mir::shell::ApplicationSession> const& session);
562 void sessionStopping(std::shared_ptr<mir::shell::ApplicationSession> const& session);
563 void sessionFocused(std::shared_ptr<mir::shell::ApplicationSession> const& session);
564 void sessionUnfocused();
565+
566+ void sessionCreatedSurface(mir::shell::ApplicationSession const*, std::shared_ptr<mir::shell::Surface> const&);
567+ void sessionDestroyingSurface(mir::shell::ApplicationSession const*, std::shared_ptr<mir::shell::Surface> const&);
568 };
569
570 #endif // SESSIONLISTENER_H
571
572=== modified file 'src/unity-mir/surfacesource.cpp'
573--- src/unity-mir/surfacesource.cpp 2013-07-19 17:29:44 +0000
574+++ src/unity-mir/surfacesource.cpp 2013-07-24 17:24:27 +0000
575@@ -30,8 +30,6 @@
576 m_shellSurface = mirSurface;
577 shellSurfaceFound = true;
578 Q_EMIT shellSurfaceCreated(mirSurface);
579- } else {
580- Q_EMIT surfaceCreated(mirSurface);
581 }
582 return mirSurface;
583 }
584
585=== modified file 'src/unity-mir/surfacesource.h'
586--- src/unity-mir/surfacesource.h 2013-07-19 17:29:44 +0000
587+++ src/unity-mir/surfacesource.h 2013-07-24 17:24:27 +0000
588@@ -27,7 +27,6 @@
589 std::shared_ptr<mir::shell::Surface> shellSurface() const;
590
591 Q_SIGNALS:
592- void surfaceCreated(std::shared_ptr<mir::shell::Surface> const& surface);
593 void shellSurfaceCreated(std::shared_ptr<mir::shell::Surface> const& surface);
594
595 private:

Subscribers

People subscribed via source and target branches