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
=== modified file 'src/modules/Unity/Application/application.cpp'
--- src/modules/Unity/Application/application.cpp 2013-09-27 10:20:47 +0000
+++ src/modules/Unity/Application/application.cpp 2013-11-20 14:40:05 +0000
@@ -24,7 +24,7 @@
24#include "logging.h"24#include "logging.h"
2525
26// mir26// mir
27#include <mir/shell/application_session.h>27#include <mir/shell/session.h>
2828
29Application::Application(const QString &appId, Application::State state,29Application::Application(const QString &appId, Application::State state,
30 const QStringList &arguments, QObject *parent)30 const QStringList &arguments, QObject *parent)
@@ -121,7 +121,7 @@
121 return m_fullscreen;121 return m_fullscreen;
122}122}
123123
124std::shared_ptr<mir::shell::ApplicationSession> Application::session() const124std::shared_ptr<mir::shell::Session> Application::session() const
125{125{
126 return m_session;126 return m_session;
127}127}
@@ -136,7 +136,7 @@
136 m_pid = pid;136 m_pid = pid;
137}137}
138138
139void Application::setSession(const std::shared_ptr<mir::shell::ApplicationSession>& session)139void Application::setSession(const std::shared_ptr<mir::shell::Session>& session)
140{140{
141 DLOG("Application::setSession (this=%p, session=%p)", this, session.get());141 DLOG("Application::setSession (this=%p, session=%p)", this, session.get());
142142
143143
=== modified file 'src/modules/Unity/Application/application.h'
--- src/modules/Unity/Application/application.h 2013-10-11 11:06:58 +0000
+++ src/modules/Unity/Application/application.h 2013-11-20 14:40:05 +0000
@@ -33,7 +33,7 @@
33class QImage;33class QImage;
34class DesktopFileReader;34class DesktopFileReader;
35class TaskController;35class TaskController;
36namespace mir { namespace shell { class ApplicationSession; }}36namespace mir { namespace shell { class Session; }}
3737
38class Application : public unity::shell::application::ApplicationInfoInterface {38class Application : public unity::shell::application::ApplicationInfoInterface {
39 Q_OBJECT39 Q_OBJECT
@@ -62,7 +62,7 @@
62 QString desktopFile() const;62 QString desktopFile() const;
63 QString exec() const;63 QString exec() const;
64 bool fullscreen() const;64 bool fullscreen() const;
65 std::shared_ptr<mir::shell::ApplicationSession> session() const;65 std::shared_ptr<mir::shell::Session> session() const;
6666
67public Q_SLOTS:67public Q_SLOTS:
68 void suspend();68 void suspend();
@@ -79,7 +79,7 @@
79 void setState(State state);79 void setState(State state);
80 void setFocused(bool focus);80 void setFocused(bool focus);
81 void setFullscreen(bool fullscreen);81 void setFullscreen(bool fullscreen);
82 void setSession(const std::shared_ptr<mir::shell::ApplicationSession>& session);82 void setSession(const std::shared_ptr<mir::shell::Session>& session);
83 void setSessionName(const QString& name);83 void setSessionName(const QString& name);
8484
85 DesktopFileReader* m_desktopData;85 DesktopFileReader* m_desktopData;
@@ -88,7 +88,7 @@
88 State m_state;88 State m_state;
89 bool m_focused;89 bool m_focused;
90 bool m_fullscreen;90 bool m_fullscreen;
91 std::shared_ptr<mir::shell::ApplicationSession> m_session;91 std::shared_ptr<mir::shell::Session> m_session;
92 QString m_sessionName;92 QString m_sessionName;
93 QStringList m_arguments;93 QStringList m_arguments;
94 QTimer* m_suspendTimer;94 QTimer* m_suspendTimer;
9595
=== modified file 'src/modules/Unity/Application/application_manager.cpp'
--- src/modules/Unity/Application/application_manager.cpp 2013-10-16 16:23:42 +0000
+++ src/modules/Unity/Application/application_manager.cpp 2013-11-20 14:40:05 +0000
@@ -29,7 +29,8 @@
29#include "logging.h"29#include "logging.h"
3030
31// mir31// mir
32#include <mir/shell/session_manager.h>32#include <mir/shell/session.h>
33#include <mir/shell/focus_controller.h>
33#include <mir/shell/surface.h>34#include <mir/shell/surface.h>
3435
35// Qt36// Qt
@@ -172,7 +173,7 @@
172 int from = m_applications.indexOf(application);173 int from = m_applications.indexOf(application);
173 move(from, m_applications.length()-1);174 move(from, m_applications.length()-1);
174 } else {175 } else {
175 m_mirServer->the_session_manager()->set_focus_to(application->session());176 m_mirServer->the_focus_controller()->set_focus_to(application->session());
176 }177 }
177178
178 // FIXME(dandrader): lying here. The operation is async. So we will only know whether179 // FIXME(dandrader): lying here. The operation is async. So we will only know whether
@@ -186,7 +187,7 @@
186 DLOG("ApplicationManager::unfocusCurrentApplication (this=%p)", this);187 DLOG("ApplicationManager::unfocusCurrentApplication (this=%p)", this);
187188
188 m_applicationToBeFocused = nullptr;189 m_applicationToBeFocused = nullptr;
189 m_mirServer->the_session_manager()->set_focus_to(NULL); //FIXME(greyback)190 m_mirServer->the_focus_controller()->set_focus_to(NULL); //FIXME(greyback)
190}191}
191192
192Application* ApplicationManager::startApplication(const QString &appId,193Application* ApplicationManager::startApplication(const QString &appId,
@@ -437,7 +438,7 @@
437 authorized = true;438 authorized = true;
438}439}
439440
440void ApplicationManager::onSessionStarting(std::shared_ptr<msh::ApplicationSession> const& session)441void ApplicationManager::onSessionStarting(std::shared_ptr<msh::Session> const& session)
441{442{
442 DLOG("ApplicationManager::onSessionStarting (this=%p, application=%s)", this, session->name().c_str());443 DLOG("ApplicationManager::onSessionStarting (this=%p, application=%s)", this, session->name().c_str());
443444
@@ -457,7 +458,7 @@
457 }458 }
458}459}
459460
460void ApplicationManager::onSessionStopping(std::shared_ptr<msh::ApplicationSession> const& session)461void ApplicationManager::onSessionStopping(std::shared_ptr<msh::Session> const& session)
461{462{
462 DLOG("ApplicationManager::onSessionStopping (this=%p, application=%s)", this, session->name().c_str());463 DLOG("ApplicationManager::onSessionStopping (this=%p, application=%s)", this, session->name().c_str());
463464
@@ -478,7 +479,7 @@
478 }479 }
479}480}
480481
481void ApplicationManager::onSessionFocused(std::shared_ptr<msh::ApplicationSession> const& session)482void ApplicationManager::onSessionFocused(std::shared_ptr<msh::Session> const& session)
482{483{
483 DLOG("ApplicationManager::onSessionFocused (this=%p, application=%s)", this, session->name().c_str());484 DLOG("ApplicationManager::onSessionFocused (this=%p, application=%s)", this, session->name().c_str());
484 Application* application = findApplicationWithSession(session);485 Application* application = findApplicationWithSession(session);
@@ -520,7 +521,7 @@
520 }521 }
521}522}
522523
523void ApplicationManager::onSessionCreatedSurface(msh::ApplicationSession const* session,524void ApplicationManager::onSessionCreatedSurface(msh::Session const* session,
524 std::shared_ptr<msh::Surface> const& surface)525 std::shared_ptr<msh::Surface> const& surface)
525{526{
526 DLOG("ApplicationManager::onSessionCreatedSurface (this=%p)", this);527 DLOG("ApplicationManager::onSessionCreatedSurface (this=%p)", this);
527528
=== modified file 'src/modules/Unity/Application/application_manager.h'
--- src/modules/Unity/Application/application_manager.h 2013-10-11 14:23:22 +0000
+++ src/modules/Unity/Application/application_manager.h 2013-11-20 14:40:05 +0000
@@ -37,7 +37,6 @@
3737
38namespace mir {38namespace mir {
39 namespace shell {39 namespace shell {
40 class ApplicationSession;
41 class Session;40 class Session;
42 class Surface;41 class Surface;
43 }42 }
@@ -84,12 +83,12 @@
84public Q_SLOTS:83public Q_SLOTS:
85 void authorizeSession(const quint64 pid, bool &authorized);84 void authorizeSession(const quint64 pid, bool &authorized);
8685
87 void onSessionStarting(std::shared_ptr<mir::shell::ApplicationSession> const& session);86 void onSessionStarting(std::shared_ptr<mir::shell::Session> const& session);
88 void onSessionStopping(std::shared_ptr<mir::shell::ApplicationSession> const& session);87 void onSessionStopping(std::shared_ptr<mir::shell::Session> const& session);
89 void onSessionFocused(std::shared_ptr<mir::shell::ApplicationSession> const& session);88 void onSessionFocused(std::shared_ptr<mir::shell::Session> const& session);
90 void onSessionUnfocused();89 void onSessionUnfocused();
9190
92 void onSessionCreatedSurface(mir::shell::ApplicationSession const*, std::shared_ptr<mir::shell::Surface> const&);91 void onSessionCreatedSurface(mir::shell::Session const*, std::shared_ptr<mir::shell::Surface> const&);
9392
94 void onProcessStartReportReceived(const QString& appId, const bool failure);93 void onProcessStartReportReceived(const QString& appId, const bool failure);
95 void onProcessStopped(const QString& appId, const bool unexpected);94 void onProcessStopped(const QString& appId, const bool unexpected);
9695
=== modified file 'src/modules/Unity/Application/mirsurfacemanager.cpp'
--- src/modules/Unity/Application/mirsurfacemanager.cpp 2013-10-30 16:40:38 +0000
+++ src/modules/Unity/Application/mirsurfacemanager.cpp 2013-11-20 14:40:05 +0000
@@ -31,6 +31,9 @@
31#include "focussetter.h"31#include "focussetter.h"
32#include "logging.h"32#include "logging.h"
3333
34// mir
35#include <mir/shell/session.h>
36
34namespace msh = mir::shell;37namespace msh = mir::shell;
3538
36MirSurfaceManager *MirSurfaceManager::the_surface_manager = nullptr;39MirSurfaceManager *MirSurfaceManager::the_surface_manager = nullptr;
@@ -96,7 +99,7 @@
96 }99 }
97}100}
98101
99void MirSurfaceManager::sessionCreatedSurface(mir::shell::ApplicationSession const* session, std::shared_ptr<mir::shell::Surface> const& surface)102void MirSurfaceManager::sessionCreatedSurface(mir::shell::Session const* session, std::shared_ptr<mir::shell::Surface> const& surface)
100{103{
101 DLOG("MirSurfaceManager::sessionCreatedSurface (this=%p) with surface name '%s'", this, surface->name().c_str());104 DLOG("MirSurfaceManager::sessionCreatedSurface (this=%p) with surface name '%s'", this, surface->name().c_str());
102 ApplicationManager* appMgr = static_cast<ApplicationManager*>(ApplicationManager::singleton());105 ApplicationManager* appMgr = static_cast<ApplicationManager*>(ApplicationManager::singleton());
@@ -107,7 +110,7 @@
107 Q_EMIT surfaceCreated(qmlSurface);110 Q_EMIT surfaceCreated(qmlSurface);
108}111}
109112
110void MirSurfaceManager::sessionDestroyingSurface(mir::shell::ApplicationSession const*, std::shared_ptr<mir::shell::Surface> const& surface)113void MirSurfaceManager::sessionDestroyingSurface(mir::shell::Session const*, std::shared_ptr<mir::shell::Surface> const& surface)
111{114{
112 DLOG("MirSurfaceManager::sessionDestroyingSurface (this=%p) with surface name '%s'", this, surface->name().c_str());115 DLOG("MirSurfaceManager::sessionDestroyingSurface (this=%p) with surface name '%s'", this, surface->name().c_str());
113116
114117
=== modified file 'src/modules/Unity/Application/mirsurfacemanager.h'
--- src/modules/Unity/Application/mirsurfacemanager.h 2013-10-18 09:25:20 +0000
+++ src/modules/Unity/Application/mirsurfacemanager.h 2013-11-20 14:40:05 +0000
@@ -30,7 +30,7 @@
30#include "mirsurface.h"30#include "mirsurface.h"
3131
32class ShellServerConfiguration;32class ShellServerConfiguration;
33namespace mir { namespace shell { class Surface; class ApplicationSession; }}33namespace mir { namespace shell { class Surface; class Session; }}
3434
35class MirSurfaceManager : public QObject35class MirSurfaceManager : public QObject
36{36{
@@ -54,8 +54,8 @@
54// void fullscreenSurfaceChanged();54// void fullscreenSurfaceChanged();
5555
56public Q_SLOTS:56public Q_SLOTS:
57 void sessionCreatedSurface(mir::shell::ApplicationSession const* session, std::shared_ptr<mir::shell::Surface> const&);57 void sessionCreatedSurface(mir::shell::Session const* session, std::shared_ptr<mir::shell::Surface> const&);
58 void sessionDestroyingSurface(mir::shell::ApplicationSession const*, std::shared_ptr<mir::shell::Surface> const&);58 void sessionDestroyingSurface(mir::shell::Session const*, std::shared_ptr<mir::shell::Surface> const&);
59 void shellSurfaceCreated(std::shared_ptr<mir::shell::Surface> const&);59 void shellSurfaceCreated(std::shared_ptr<mir::shell::Surface> const&);
6060
61 void surfaceAttributeChanged(mir::shell::Surface const*, MirSurfaceAttrib, int);61 void surfaceAttributeChanged(mir::shell::Surface const*, MirSurfaceAttrib, int);
6262
=== modified file 'src/unity-mir/sessionlistener.cpp'
--- src/unity-mir/sessionlistener.cpp 2013-08-09 13:16:13 +0000
+++ src/unity-mir/sessionlistener.cpp 2013-11-20 14:40:05 +0000
@@ -17,18 +17,16 @@
17#include "sessionlistener.h"17#include "sessionlistener.h"
18#include "logging.h"18#include "logging.h"
1919
20#include <mir/shell/application_session.h>
21
22namespace msh = mir::shell;20namespace msh = mir::shell;
2321
24Q_DECLARE_METATYPE(std::shared_ptr<msh::ApplicationSession>)22Q_DECLARE_METATYPE(std::shared_ptr<msh::Session>)
2523
26SessionListener::SessionListener(QObject *parent) :24SessionListener::SessionListener(QObject *parent) :
27 QObject(parent)25 QObject(parent)
28{26{
29 DLOG("SessionListener::SessionListener (this=%p)", this);27 DLOG("SessionListener::SessionListener (this=%p)", this);
30 // need to register type to send over threads with signal/slot28 // need to register type to send over threads with signal/slot
31 qRegisterMetaType<std::shared_ptr<msh::ApplicationSession>>("std::shared_ptr<mir::shell::ApplicationSession>");29 qRegisterMetaType<std::shared_ptr<msh::Session>>("std::shared_ptr<mir::shell::Session>");
32}30}
3331
34SessionListener::~SessionListener()32SessionListener::~SessionListener()
@@ -36,24 +34,24 @@
36 DLOG("SessionListener::~SessionListener (this=%p)", this);34 DLOG("SessionListener::~SessionListener (this=%p)", this);
37}35}
3836
39// Mir's default SurfaceManager calls these methods with instance of msh::ApplicationSession37// Mir's default SurfaceManager calls these methods with instance of msh::Session
40// it is not a plain msh::Session38// it is not a plain msh::Session
41void SessionListener::starting(std::shared_ptr<msh::Session> const& session)39void SessionListener::starting(std::shared_ptr<msh::Session> const& session)
42{40{
43 DLOG("SessionListener::starting (this=%p, session=%p)", this, (void*)session.get());41 DLOG("SessionListener::starting (this=%p, session=%p)", this, (void*)session.get());
44 Q_EMIT sessionStarting(std::static_pointer_cast<msh::ApplicationSession>(session));42 Q_EMIT sessionStarting(std::static_pointer_cast<msh::Session>(session));
45}43}
4644
47void SessionListener::stopping(std::shared_ptr<msh::Session> const& session)45void SessionListener::stopping(std::shared_ptr<msh::Session> const& session)
48{46{
49 DLOG("SessionListener::stopping (this=%p, session=%p)", this, (void*)session.get());47 DLOG("SessionListener::stopping (this=%p, session=%p)", this, (void*)session.get());
50 Q_EMIT sessionStopping(std::static_pointer_cast<msh::ApplicationSession>(session));48 Q_EMIT sessionStopping(std::static_pointer_cast<msh::Session>(session));
51}49}
5250
53void SessionListener::focused(std::shared_ptr<msh::Session> const& session)51void SessionListener::focused(std::shared_ptr<msh::Session> const& session)
54{52{
55 DLOG("SessionListener::focused (this=%p, session=%p)", this, (void*)session.get());53 DLOG("SessionListener::focused (this=%p, session=%p)", this, (void*)session.get());
56 Q_EMIT sessionFocused(std::static_pointer_cast<msh::ApplicationSession>(session));54 Q_EMIT sessionFocused(std::static_pointer_cast<msh::Session>(session));
57}55}
5856
59void SessionListener::unfocused()57void SessionListener::unfocused()
@@ -65,13 +63,11 @@
65void SessionListener::surface_created(msh::Session& session, std::shared_ptr<msh::Surface> const& surface)63void SessionListener::surface_created(msh::Session& session, std::shared_ptr<msh::Surface> const& surface)
66{64{
67 DLOG("SessionListener::surface_created (this=%p, session=%p, surface=%p)", this, &session, (void*)surface.get());65 DLOG("SessionListener::surface_created (this=%p, session=%p, surface=%p)", this, &session, (void*)surface.get());
68 msh::ApplicationSession &appSession = dynamic_cast<msh::ApplicationSession &>(session);66 Q_EMIT sessionCreatedSurface(&session, surface);
69 Q_EMIT sessionCreatedSurface(&appSession, surface);
70}67}
7168
72void SessionListener::destroying_surface(msh::Session& session, std::shared_ptr<mir::shell::Surface> const& surface)69void SessionListener::destroying_surface(msh::Session& session, std::shared_ptr<mir::shell::Surface> const& surface)
73{70{
74 DLOG("SessionListener::destroying_surface (this=%p, session=%p, surface=%p)", this, &session, (void*)surface.get());71 DLOG("SessionListener::destroying_surface (this=%p, session=%p, surface=%p)", this, &session, (void*)surface.get());
75 msh::ApplicationSession &appSession = dynamic_cast<msh::ApplicationSession &>(session);72 Q_EMIT sessionDestroyingSurface(&session, surface);
76 Q_EMIT sessionDestroyingSurface(&appSession, surface);
77}73}
7874
=== modified file 'src/unity-mir/sessionlistener.h'
--- src/unity-mir/sessionlistener.h 2013-08-09 13:16:13 +0000
+++ src/unity-mir/sessionlistener.h 2013-11-20 14:40:05 +0000
@@ -20,7 +20,6 @@
20#include <QObject>20#include <QObject>
2121
22#include "mir/shell/session_listener.h"22#include "mir/shell/session_listener.h"
23#include "mir/shell/application_session.h"
2423
25class SessionListener : public QObject, public mir::shell::SessionListener24class SessionListener : public QObject, public mir::shell::SessionListener
26{25{
@@ -38,13 +37,13 @@
38 void destroying_surface(mir::shell::Session&, std::shared_ptr<mir::shell::Surface> const&) override;37 void destroying_surface(mir::shell::Session&, std::shared_ptr<mir::shell::Surface> const&) override;
3938
40Q_SIGNALS:39Q_SIGNALS:
41 void sessionStarting(std::shared_ptr<mir::shell::ApplicationSession> const& session);40 void sessionStarting(std::shared_ptr<mir::shell::Session> const& session);
42 void sessionStopping(std::shared_ptr<mir::shell::ApplicationSession> const& session);41 void sessionStopping(std::shared_ptr<mir::shell::Session> const& session);
43 void sessionFocused(std::shared_ptr<mir::shell::ApplicationSession> const& session);42 void sessionFocused(std::shared_ptr<mir::shell::Session> const& session);
44 void sessionUnfocused();43 void sessionUnfocused();
4544
46 void sessionCreatedSurface(mir::shell::ApplicationSession const*, std::shared_ptr<mir::shell::Surface> const&);45 void sessionCreatedSurface(mir::shell::Session const*, std::shared_ptr<mir::shell::Surface> const&);
47 void sessionDestroyingSurface(mir::shell::ApplicationSession const*, std::shared_ptr<mir::shell::Surface> const&);46 void sessionDestroyingSurface(mir::shell::Session const*, std::shared_ptr<mir::shell::Surface> const&);
48};47};
4948
50#endif // SESSIONLISTENER_H49#endif // SESSIONLISTENER_H

Subscribers

People subscribed via source and target branches