Merge lp:~alan-griffiths/unity-mir/dont-use-ApplicationSession into lp:unity-mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Alan Griffiths
Approved revision: 144
Merged at revision: 147
Proposed branch: lp:~alan-griffiths/unity-mir/dont-use-ApplicationSession
Merge into: lp:unity-mir
Prerequisite: lp:~alan-griffiths/unity-mir/we-dont-need-SurfaceBuilder
Diff against target: 324 lines (+40/-42)
8 files modified
src/modules/Unity/Application/application.cpp (+3/-3)
src/modules/Unity/Application/application.h (+4/-4)
src/modules/Unity/Application/application_manager.cpp (+8/-7)
src/modules/Unity/Application/application_manager.h (+4/-5)
src/modules/Unity/Application/mirsurfacemanager.cpp (+5/-2)
src/modules/Unity/Application/mirsurfacemanager.h (+3/-3)
src/unity-mir/sessionlistener.cpp (+8/-12)
src/unity-mir/sessionlistener.h (+5/-6)
To merge this branch: bzr merge lp:~alan-griffiths/unity-mir/dont-use-ApplicationSession
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+195242@code.launchpad.net

Commit message

ApplicationSession is a Mir implementation class that shouldn't be used by unity-mir, use shell::session instead

Description of the change

ApplicationSession is a Mir implementation class that shouldn't be used by unity-mir, use shell::session instead

NB this change is dependent on pending Mir changes (libmirserver-dev >= 0.1.1)

To post a comment you must log in.
140. By Alan Griffiths

Don't use mir::shell::ApplicationSession

141. By Alan Griffiths

Don't use mir::shell::ApplicationSession or SessionManager

142. By Alan Griffiths

As in Rome...

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

I think you got everything :)

Please add explicit version dependence on libmirserver-dev to the debian/control file.

review: Needs Fixing
143. By Alan Griffiths

merge lp:unity-mir

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> I think you got everything :)
>
> Please add explicit version dependence on libmirserver-dev to the
> debian/control file.

I was relying on something like (it didn't exist when I proposed this) https://code.launchpad.net/~kgunn72/unity-mir/bump-mir-dep-0.1.1/+merge/193521 landing first - which it has. ;)

Merging current trunk in should address that.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

Missed stuff:

src/unity-mir/sessionlistener.cpp:
qRegisterMetaType<std::shared_ptr<msh::Session>>("std::shared_ptr<mir::shell::ApplicationSession>");
would be best to keep the Qt Metatype name matching the actual type.

src/modules/Unity/Application/application_manager.h:
you could remove the "class ApplicationSession;" here too. I don't see it being referred to anywhere.

review: Needs Fixing
144. By Alan Griffiths

tidy up stuff Gerry spotted in review

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> Missed stuff:

sorted, thanks

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

Works! Thanks

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/application.cpp'
2--- src/modules/Unity/Application/application.cpp 2013-09-27 10:20:47 +0000
3+++ src/modules/Unity/Application/application.cpp 2013-11-20 14:40:05 +0000
4@@ -24,7 +24,7 @@
5 #include "logging.h"
6
7 // mir
8-#include <mir/shell/application_session.h>
9+#include <mir/shell/session.h>
10
11 Application::Application(const QString &appId, Application::State state,
12 const QStringList &arguments, QObject *parent)
13@@ -121,7 +121,7 @@
14 return m_fullscreen;
15 }
16
17-std::shared_ptr<mir::shell::ApplicationSession> Application::session() const
18+std::shared_ptr<mir::shell::Session> Application::session() const
19 {
20 return m_session;
21 }
22@@ -136,7 +136,7 @@
23 m_pid = pid;
24 }
25
26-void Application::setSession(const std::shared_ptr<mir::shell::ApplicationSession>& session)
27+void Application::setSession(const std::shared_ptr<mir::shell::Session>& session)
28 {
29 DLOG("Application::setSession (this=%p, session=%p)", this, session.get());
30
31
32=== modified file 'src/modules/Unity/Application/application.h'
33--- src/modules/Unity/Application/application.h 2013-10-11 11:06:58 +0000
34+++ src/modules/Unity/Application/application.h 2013-11-20 14:40:05 +0000
35@@ -33,7 +33,7 @@
36 class QImage;
37 class DesktopFileReader;
38 class TaskController;
39-namespace mir { namespace shell { class ApplicationSession; }}
40+namespace mir { namespace shell { class Session; }}
41
42 class Application : public unity::shell::application::ApplicationInfoInterface {
43 Q_OBJECT
44@@ -62,7 +62,7 @@
45 QString desktopFile() const;
46 QString exec() const;
47 bool fullscreen() const;
48- std::shared_ptr<mir::shell::ApplicationSession> session() const;
49+ std::shared_ptr<mir::shell::Session> session() const;
50
51 public Q_SLOTS:
52 void suspend();
53@@ -79,7 +79,7 @@
54 void setState(State state);
55 void setFocused(bool focus);
56 void setFullscreen(bool fullscreen);
57- void setSession(const std::shared_ptr<mir::shell::ApplicationSession>& session);
58+ void setSession(const std::shared_ptr<mir::shell::Session>& session);
59 void setSessionName(const QString& name);
60
61 DesktopFileReader* m_desktopData;
62@@ -88,7 +88,7 @@
63 State m_state;
64 bool m_focused;
65 bool m_fullscreen;
66- std::shared_ptr<mir::shell::ApplicationSession> m_session;
67+ std::shared_ptr<mir::shell::Session> m_session;
68 QString m_sessionName;
69 QStringList m_arguments;
70 QTimer* m_suspendTimer;
71
72=== modified file 'src/modules/Unity/Application/application_manager.cpp'
73--- src/modules/Unity/Application/application_manager.cpp 2013-10-16 16:23:42 +0000
74+++ src/modules/Unity/Application/application_manager.cpp 2013-11-20 14:40:05 +0000
75@@ -29,7 +29,8 @@
76 #include "logging.h"
77
78 // mir
79-#include <mir/shell/session_manager.h>
80+#include <mir/shell/session.h>
81+#include <mir/shell/focus_controller.h>
82 #include <mir/shell/surface.h>
83
84 // Qt
85@@ -172,7 +173,7 @@
86 int from = m_applications.indexOf(application);
87 move(from, m_applications.length()-1);
88 } else {
89- m_mirServer->the_session_manager()->set_focus_to(application->session());
90+ m_mirServer->the_focus_controller()->set_focus_to(application->session());
91 }
92
93 // FIXME(dandrader): lying here. The operation is async. So we will only know whether
94@@ -186,7 +187,7 @@
95 DLOG("ApplicationManager::unfocusCurrentApplication (this=%p)", this);
96
97 m_applicationToBeFocused = nullptr;
98- m_mirServer->the_session_manager()->set_focus_to(NULL); //FIXME(greyback)
99+ m_mirServer->the_focus_controller()->set_focus_to(NULL); //FIXME(greyback)
100 }
101
102 Application* ApplicationManager::startApplication(const QString &appId,
103@@ -437,7 +438,7 @@
104 authorized = true;
105 }
106
107-void ApplicationManager::onSessionStarting(std::shared_ptr<msh::ApplicationSession> const& session)
108+void ApplicationManager::onSessionStarting(std::shared_ptr<msh::Session> const& session)
109 {
110 DLOG("ApplicationManager::onSessionStarting (this=%p, application=%s)", this, session->name().c_str());
111
112@@ -457,7 +458,7 @@
113 }
114 }
115
116-void ApplicationManager::onSessionStopping(std::shared_ptr<msh::ApplicationSession> const& session)
117+void ApplicationManager::onSessionStopping(std::shared_ptr<msh::Session> const& session)
118 {
119 DLOG("ApplicationManager::onSessionStopping (this=%p, application=%s)", this, session->name().c_str());
120
121@@ -478,7 +479,7 @@
122 }
123 }
124
125-void ApplicationManager::onSessionFocused(std::shared_ptr<msh::ApplicationSession> const& session)
126+void ApplicationManager::onSessionFocused(std::shared_ptr<msh::Session> const& session)
127 {
128 DLOG("ApplicationManager::onSessionFocused (this=%p, application=%s)", this, session->name().c_str());
129 Application* application = findApplicationWithSession(session);
130@@ -520,7 +521,7 @@
131 }
132 }
133
134-void ApplicationManager::onSessionCreatedSurface(msh::ApplicationSession const* session,
135+void ApplicationManager::onSessionCreatedSurface(msh::Session const* session,
136 std::shared_ptr<msh::Surface> const& surface)
137 {
138 DLOG("ApplicationManager::onSessionCreatedSurface (this=%p)", this);
139
140=== modified file 'src/modules/Unity/Application/application_manager.h'
141--- src/modules/Unity/Application/application_manager.h 2013-10-11 14:23:22 +0000
142+++ src/modules/Unity/Application/application_manager.h 2013-11-20 14:40:05 +0000
143@@ -37,7 +37,6 @@
144
145 namespace mir {
146 namespace shell {
147- class ApplicationSession;
148 class Session;
149 class Surface;
150 }
151@@ -84,12 +83,12 @@
152 public Q_SLOTS:
153 void authorizeSession(const quint64 pid, bool &authorized);
154
155- void onSessionStarting(std::shared_ptr<mir::shell::ApplicationSession> const& session);
156- void onSessionStopping(std::shared_ptr<mir::shell::ApplicationSession> const& session);
157- void onSessionFocused(std::shared_ptr<mir::shell::ApplicationSession> const& session);
158+ void onSessionStarting(std::shared_ptr<mir::shell::Session> const& session);
159+ void onSessionStopping(std::shared_ptr<mir::shell::Session> const& session);
160+ void onSessionFocused(std::shared_ptr<mir::shell::Session> const& session);
161 void onSessionUnfocused();
162
163- void onSessionCreatedSurface(mir::shell::ApplicationSession const*, std::shared_ptr<mir::shell::Surface> const&);
164+ void onSessionCreatedSurface(mir::shell::Session const*, std::shared_ptr<mir::shell::Surface> const&);
165
166 void onProcessStartReportReceived(const QString& appId, const bool failure);
167 void onProcessStopped(const QString& appId, const bool unexpected);
168
169=== modified file 'src/modules/Unity/Application/mirsurfacemanager.cpp'
170--- src/modules/Unity/Application/mirsurfacemanager.cpp 2013-10-30 16:40:38 +0000
171+++ src/modules/Unity/Application/mirsurfacemanager.cpp 2013-11-20 14:40:05 +0000
172@@ -31,6 +31,9 @@
173 #include "focussetter.h"
174 #include "logging.h"
175
176+// mir
177+#include <mir/shell/session.h>
178+
179 namespace msh = mir::shell;
180
181 MirSurfaceManager *MirSurfaceManager::the_surface_manager = nullptr;
182@@ -96,7 +99,7 @@
183 }
184 }
185
186-void MirSurfaceManager::sessionCreatedSurface(mir::shell::ApplicationSession const* session, std::shared_ptr<mir::shell::Surface> const& surface)
187+void MirSurfaceManager::sessionCreatedSurface(mir::shell::Session const* session, std::shared_ptr<mir::shell::Surface> const& surface)
188 {
189 DLOG("MirSurfaceManager::sessionCreatedSurface (this=%p) with surface name '%s'", this, surface->name().c_str());
190 ApplicationManager* appMgr = static_cast<ApplicationManager*>(ApplicationManager::singleton());
191@@ -107,7 +110,7 @@
192 Q_EMIT surfaceCreated(qmlSurface);
193 }
194
195-void MirSurfaceManager::sessionDestroyingSurface(mir::shell::ApplicationSession const*, std::shared_ptr<mir::shell::Surface> const& surface)
196+void MirSurfaceManager::sessionDestroyingSurface(mir::shell::Session const*, std::shared_ptr<mir::shell::Surface> const& surface)
197 {
198 DLOG("MirSurfaceManager::sessionDestroyingSurface (this=%p) with surface name '%s'", this, surface->name().c_str());
199
200
201=== modified file 'src/modules/Unity/Application/mirsurfacemanager.h'
202--- src/modules/Unity/Application/mirsurfacemanager.h 2013-10-18 09:25:20 +0000
203+++ src/modules/Unity/Application/mirsurfacemanager.h 2013-11-20 14:40:05 +0000
204@@ -30,7 +30,7 @@
205 #include "mirsurface.h"
206
207 class ShellServerConfiguration;
208-namespace mir { namespace shell { class Surface; class ApplicationSession; }}
209+namespace mir { namespace shell { class Surface; class Session; }}
210
211 class MirSurfaceManager : public QObject
212 {
213@@ -54,8 +54,8 @@
214 // void fullscreenSurfaceChanged();
215
216 public Q_SLOTS:
217- void sessionCreatedSurface(mir::shell::ApplicationSession const* session, std::shared_ptr<mir::shell::Surface> const&);
218- void sessionDestroyingSurface(mir::shell::ApplicationSession const*, std::shared_ptr<mir::shell::Surface> const&);
219+ void sessionCreatedSurface(mir::shell::Session const* session, std::shared_ptr<mir::shell::Surface> const&);
220+ void sessionDestroyingSurface(mir::shell::Session const*, std::shared_ptr<mir::shell::Surface> const&);
221 void shellSurfaceCreated(std::shared_ptr<mir::shell::Surface> const&);
222
223 void surfaceAttributeChanged(mir::shell::Surface const*, MirSurfaceAttrib, int);
224
225=== modified file 'src/unity-mir/sessionlistener.cpp'
226--- src/unity-mir/sessionlistener.cpp 2013-08-09 13:16:13 +0000
227+++ src/unity-mir/sessionlistener.cpp 2013-11-20 14:40:05 +0000
228@@ -17,18 +17,16 @@
229 #include "sessionlistener.h"
230 #include "logging.h"
231
232-#include <mir/shell/application_session.h>
233-
234 namespace msh = mir::shell;
235
236-Q_DECLARE_METATYPE(std::shared_ptr<msh::ApplicationSession>)
237+Q_DECLARE_METATYPE(std::shared_ptr<msh::Session>)
238
239 SessionListener::SessionListener(QObject *parent) :
240 QObject(parent)
241 {
242 DLOG("SessionListener::SessionListener (this=%p)", this);
243 // need to register type to send over threads with signal/slot
244- qRegisterMetaType<std::shared_ptr<msh::ApplicationSession>>("std::shared_ptr<mir::shell::ApplicationSession>");
245+ qRegisterMetaType<std::shared_ptr<msh::Session>>("std::shared_ptr<mir::shell::Session>");
246 }
247
248 SessionListener::~SessionListener()
249@@ -36,24 +34,24 @@
250 DLOG("SessionListener::~SessionListener (this=%p)", this);
251 }
252
253-// Mir's default SurfaceManager calls these methods with instance of msh::ApplicationSession
254+// Mir's default SurfaceManager calls these methods with instance of msh::Session
255 // it is not a plain msh::Session
256 void SessionListener::starting(std::shared_ptr<msh::Session> const& session)
257 {
258 DLOG("SessionListener::starting (this=%p, session=%p)", this, (void*)session.get());
259- Q_EMIT sessionStarting(std::static_pointer_cast<msh::ApplicationSession>(session));
260+ Q_EMIT sessionStarting(std::static_pointer_cast<msh::Session>(session));
261 }
262
263 void SessionListener::stopping(std::shared_ptr<msh::Session> const& session)
264 {
265 DLOG("SessionListener::stopping (this=%p, session=%p)", this, (void*)session.get());
266- Q_EMIT sessionStopping(std::static_pointer_cast<msh::ApplicationSession>(session));
267+ Q_EMIT sessionStopping(std::static_pointer_cast<msh::Session>(session));
268 }
269
270 void SessionListener::focused(std::shared_ptr<msh::Session> const& session)
271 {
272 DLOG("SessionListener::focused (this=%p, session=%p)", this, (void*)session.get());
273- Q_EMIT sessionFocused(std::static_pointer_cast<msh::ApplicationSession>(session));
274+ Q_EMIT sessionFocused(std::static_pointer_cast<msh::Session>(session));
275 }
276
277 void SessionListener::unfocused()
278@@ -65,13 +63,11 @@
279 void SessionListener::surface_created(msh::Session& session, std::shared_ptr<msh::Surface> const& surface)
280 {
281 DLOG("SessionListener::surface_created (this=%p, session=%p, surface=%p)", this, &session, (void*)surface.get());
282- msh::ApplicationSession &appSession = dynamic_cast<msh::ApplicationSession &>(session);
283- Q_EMIT sessionCreatedSurface(&appSession, surface);
284+ Q_EMIT sessionCreatedSurface(&session, surface);
285 }
286
287 void SessionListener::destroying_surface(msh::Session& session, std::shared_ptr<mir::shell::Surface> const& surface)
288 {
289 DLOG("SessionListener::destroying_surface (this=%p, session=%p, surface=%p)", this, &session, (void*)surface.get());
290- msh::ApplicationSession &appSession = dynamic_cast<msh::ApplicationSession &>(session);
291- Q_EMIT sessionDestroyingSurface(&appSession, surface);
292+ Q_EMIT sessionDestroyingSurface(&session, surface);
293 }
294
295=== modified file 'src/unity-mir/sessionlistener.h'
296--- src/unity-mir/sessionlistener.h 2013-08-09 13:16:13 +0000
297+++ src/unity-mir/sessionlistener.h 2013-11-20 14:40:05 +0000
298@@ -20,7 +20,6 @@
299 #include <QObject>
300
301 #include "mir/shell/session_listener.h"
302-#include "mir/shell/application_session.h"
303
304 class SessionListener : public QObject, public mir::shell::SessionListener
305 {
306@@ -38,13 +37,13 @@
307 void destroying_surface(mir::shell::Session&, std::shared_ptr<mir::shell::Surface> const&) override;
308
309 Q_SIGNALS:
310- void sessionStarting(std::shared_ptr<mir::shell::ApplicationSession> const& session);
311- void sessionStopping(std::shared_ptr<mir::shell::ApplicationSession> const& session);
312- void sessionFocused(std::shared_ptr<mir::shell::ApplicationSession> const& session);
313+ void sessionStarting(std::shared_ptr<mir::shell::Session> const& session);
314+ void sessionStopping(std::shared_ptr<mir::shell::Session> const& session);
315+ void sessionFocused(std::shared_ptr<mir::shell::Session> const& session);
316 void sessionUnfocused();
317
318- void sessionCreatedSurface(mir::shell::ApplicationSession const*, std::shared_ptr<mir::shell::Surface> const&);
319- void sessionDestroyingSurface(mir::shell::ApplicationSession const*, std::shared_ptr<mir::shell::Surface> const&);
320+ void sessionCreatedSurface(mir::shell::Session const*, std::shared_ptr<mir::shell::Surface> const&);
321+ void sessionDestroyingSurface(mir::shell::Session const*, std::shared_ptr<mir::shell::Surface> const&);
322 };
323
324 #endif // SESSIONLISTENER_H

Subscribers

People subscribed via source and target branches