Merge lp:~nick-dedekind/unity-mir/unity-mir.trusted_sessions into lp:unity-mir
- unity-mir.trusted_sessions
- Merge into trunk
Proposed by
Nick Dedekind
Status: | Merged |
---|---|
Merged at revision: | 241 |
Proposed branch: | lp:~nick-dedekind/unity-mir/unity-mir.trusted_sessions |
Merge into: | lp:unity-mir |
Diff against target: |
1073 lines (+438/-123) 14 files modified
src/modules/Unity/Application/ApplicationImage.qml (+8/-0) src/modules/Unity/Application/CMakeLists.txt (+4/-2) src/modules/Unity/Application/application.cpp (+33/-11) src/modules/Unity/Application/application.h (+18/-4) src/modules/Unity/Application/application_manager.cpp (+196/-86) src/modules/Unity/Application/application_manager.h (+11/-6) src/modules/Unity/Application/applicationscreenshotprovider.cpp (+4/-2) src/modules/Unity/Application/dbuswindowstack.cpp (+1/-1) src/modules/Unity/Application/mirsurfacemanager.cpp (+13/-10) src/modules/Unity/Application/session.cpp (+70/-0) src/modules/Unity/Application/session.h (+60/-0) src/unity-mir/sessionlistener.cpp (+13/-0) src/unity-mir/sessionlistener.h (+6/-0) src/unity-mir/shellserverconfiguration.cpp (+1/-1) |
To merge this branch: | bzr merge lp:~nick-dedekind/unity-mir/unity-mir.trusted_sessions |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir development team | Pending | ||
Review via email: mp+208324@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/modules/Unity/Application/ApplicationImage.qml' | |||
2 | --- src/modules/Unity/Application/ApplicationImage.qml 2013-10-01 17:45:26 +0000 | |||
3 | +++ src/modules/Unity/Application/ApplicationImage.qml 2014-02-26 10:27:46 +0000 | |||
4 | @@ -40,4 +40,12 @@ | |||
5 | 40 | source: (root.source) ? "image://screenshot/" + root.source.appId : "" | 40 | source: (root.source) ? "image://screenshot/" + root.source.appId : "" |
6 | 41 | cache: false | 41 | cache: false |
7 | 42 | } | 42 | } |
8 | 43 | |||
9 | 44 | Connections { | ||
10 | 45 | target: source | ||
11 | 46 | onSessionChanged: { | ||
12 | 47 | console.log("SESSION CHANGED"); | ||
13 | 48 | scheduleUpdate(); | ||
14 | 49 | } | ||
15 | 50 | } | ||
16 | 43 | } | 51 | } |
17 | 44 | 52 | ||
18 | === modified file 'src/modules/Unity/Application/CMakeLists.txt' | |||
19 | --- src/modules/Unity/Application/CMakeLists.txt 2014-01-27 11:29:44 +0000 | |||
20 | +++ src/modules/Unity/Application/CMakeLists.txt 2014-02-26 10:27:46 +0000 | |||
21 | @@ -32,6 +32,7 @@ | |||
22 | 32 | processcontroller.h | 32 | processcontroller.h |
23 | 33 | processcontroller.cpp | 33 | processcontroller.cpp |
24 | 34 | shellinputarea.cpp | 34 | shellinputarea.cpp |
25 | 35 | session.cpp | ||
26 | 35 | ubuntukeyboardinfo.cpp | 36 | ubuntukeyboardinfo.cpp |
27 | 36 | 37 | ||
28 | 37 | upstart/applicationcontroller.h | 38 | upstart/applicationcontroller.h |
29 | @@ -47,10 +48,11 @@ | |||
30 | 47 | mirsurface.h | 48 | mirsurface.h |
31 | 48 | mirsurfacemanager.h | 49 | mirsurfacemanager.h |
32 | 49 | shellinputarea.h | 50 | shellinputarea.h |
33 | 51 | session.h | ||
34 | 50 | inputarea.h | 52 | inputarea.h |
35 | 51 | inputfilterarea.h | 53 | inputfilterarea.h |
36 | 52 | ubuntukeyboardinfo.h | 54 | ubuntukeyboardinfo.h |
38 | 53 | 55 | ||
39 | 54 | # We need to pull in some external header files | 56 | # We need to pull in some external header files |
40 | 55 | /usr/include/unity/shell/application/ApplicationManagerInterface.h | 57 | /usr/include/unity/shell/application/ApplicationManagerInterface.h |
41 | 56 | /usr/include/unity/shell/application/ApplicationInfoInterface.h | 58 | /usr/include/unity/shell/application/ApplicationInfoInterface.h |
42 | @@ -62,7 +64,7 @@ | |||
43 | 62 | 64 | ||
44 | 63 | target_link_libraries( | 65 | target_link_libraries( |
45 | 64 | unityapplicationplugin | 66 | unityapplicationplugin |
47 | 65 | 67 | ||
48 | 66 | unity-mir | 68 | unity-mir |
49 | 67 | 69 | ||
50 | 68 | ubuntu_application_api_mirserver | 70 | ubuntu_application_api_mirserver |
51 | 69 | 71 | ||
52 | === modified file 'src/modules/Unity/Application/application.cpp' | |||
53 | --- src/modules/Unity/Application/application.cpp 2014-01-27 11:29:44 +0000 | |||
54 | +++ src/modules/Unity/Application/application.cpp 2014-02-26 10:27:46 +0000 | |||
55 | @@ -22,11 +22,13 @@ | |||
56 | 22 | 22 | ||
57 | 23 | // unity-mir | 23 | // unity-mir |
58 | 24 | #include "logging.h" | 24 | #include "logging.h" |
59 | 25 | #include "session.h" | ||
60 | 25 | 26 | ||
61 | 26 | // mir | 27 | // mir |
62 | 27 | #include <mir/shell/session.h> | ||
63 | 28 | #include <mir/shell/snapshot.h> | 28 | #include <mir/shell/snapshot.h> |
64 | 29 | 29 | ||
65 | 30 | #include <QDebug> | ||
66 | 31 | |||
67 | 30 | Application::Application(const QSharedPointer<TaskController>& taskController, | 32 | Application::Application(const QSharedPointer<TaskController>& taskController, |
68 | 31 | DesktopFileReader *desktopFileReader, | 33 | DesktopFileReader *desktopFileReader, |
69 | 32 | State state, | 34 | State state, |
70 | @@ -120,9 +122,16 @@ | |||
71 | 120 | return m_fullscreen; | 122 | return m_fullscreen; |
72 | 121 | } | 123 | } |
73 | 122 | 124 | ||
77 | 123 | std::shared_ptr<mir::shell::Session> Application::session() const | 125 | QSharedPointer<Session> Application::session() const |
78 | 124 | { | 126 | { |
79 | 125 | return m_session; | 127 | if (!m_overrideSession.isNull()) |
80 | 128 | return m_overrideSession; | ||
81 | 129 | return m_session.toStrongRef(); | ||
82 | 130 | } | ||
83 | 131 | |||
84 | 132 | QSharedPointer<Session> Application::overrideSession() const | ||
85 | 133 | { | ||
86 | 134 | return m_overrideSession; | ||
87 | 126 | } | 135 | } |
88 | 127 | 136 | ||
89 | 128 | pid_t Application::pid() const | 137 | pid_t Application::pid() const |
90 | @@ -135,12 +144,25 @@ | |||
91 | 135 | m_pid = pid; | 144 | m_pid = pid; |
92 | 136 | } | 145 | } |
93 | 137 | 146 | ||
95 | 138 | void Application::setSession(const std::shared_ptr<mir::shell::Session>& session) | 147 | void Application::setSession(const QSharedPointer<Session>& new_session) |
96 | 139 | { | 148 | { |
98 | 140 | DLOG("Application::setSession (this=%p, session=%p)", this, session.get()); | 149 | DLOG("Application::setSession (this=%p, session=%p)", this, new_session ? new_session->mirSession().get() : nullptr); |
99 | 141 | 150 | ||
100 | 142 | // TODO(greyback) what if called with new surface? | 151 | // TODO(greyback) what if called with new surface? |
102 | 143 | m_session = session; | 152 | m_session = new_session.toWeakRef(); |
103 | 153 | if (session()) { | ||
104 | 154 | Q_EMIT sessionChanged(); | ||
105 | 155 | } | ||
106 | 156 | } | ||
107 | 157 | |||
108 | 158 | void Application::setOverrideSession(const QSharedPointer<Session>& override_session) | ||
109 | 159 | { | ||
110 | 160 | DLOG("Application::setOverrideSession (this=%p, session=%p)", this, override_session ? override_session->mirSession().get() : nullptr); | ||
111 | 161 | |||
112 | 162 | m_overrideSession = override_session; | ||
113 | 163 | if (session()) { | ||
114 | 164 | Q_EMIT sessionChanged(); | ||
115 | 165 | } | ||
116 | 144 | } | 166 | } |
117 | 145 | 167 | ||
118 | 146 | void Application::setSessionName(const QString& name) | 168 | void Application::setSessionName(const QString& name) |
119 | @@ -169,8 +191,8 @@ | |||
120 | 169 | switch (state) | 191 | switch (state) |
121 | 170 | { | 192 | { |
122 | 171 | case Application::Suspended: | 193 | case Application::Suspended: |
125 | 172 | if (m_state == Application::Running) { | 194 | if (session() && m_state == Application::Running) { |
126 | 173 | session()->set_lifecycle_state(mir_lifecycle_state_will_suspend); | 195 | session()->setLifecycleState(mir_lifecycle_state_will_suspend); |
127 | 174 | m_suspendTimer->start(3000); | 196 | m_suspendTimer->start(3000); |
128 | 175 | } | 197 | } |
129 | 176 | break; | 198 | break; |
130 | @@ -178,9 +200,9 @@ | |||
131 | 178 | if (m_suspendTimer->isActive()) | 200 | if (m_suspendTimer->isActive()) |
132 | 179 | m_suspendTimer->stop(); | 201 | m_suspendTimer->stop(); |
133 | 180 | 202 | ||
135 | 181 | if (m_state == Application::Suspended) { | 203 | if (session() && m_state == Application::Suspended) { |
136 | 182 | resume(); | 204 | resume(); |
138 | 183 | session()->set_lifecycle_state(mir_lifecycle_state_resumed); | 205 | session()->setLifecycleState(mir_lifecycle_state_resumed); |
139 | 184 | } else if (m_state == Application::Stopped) { | 206 | } else if (m_state == Application::Stopped) { |
140 | 185 | respawn(); | 207 | respawn(); |
141 | 186 | state = Application::Starting; | 208 | state = Application::Starting; |
142 | 187 | 209 | ||
143 | === modified file 'src/modules/Unity/Application/application.h' | |||
144 | --- src/modules/Unity/Application/application.h 2014-01-27 11:29:44 +0000 | |||
145 | +++ src/modules/Unity/Application/application.h 2014-02-26 10:27:46 +0000 | |||
146 | @@ -31,7 +31,14 @@ | |||
147 | 31 | class QImage; | 31 | class QImage; |
148 | 32 | class DesktopFileReader; | 32 | class DesktopFileReader; |
149 | 33 | class TaskController; | 33 | class TaskController; |
151 | 34 | namespace mir { namespace shell { class Session; }} | 34 | class Session; |
152 | 35 | namespace mir | ||
153 | 36 | { | ||
154 | 37 | namespace shell | ||
155 | 38 | { | ||
156 | 39 | class TrustedSession; | ||
157 | 40 | } | ||
158 | 41 | } | ||
159 | 35 | 42 | ||
160 | 36 | class Application : public unity::shell::application::ApplicationInfoInterface { | 43 | class Application : public unity::shell::application::ApplicationInfoInterface { |
161 | 37 | Q_OBJECT | 44 | Q_OBJECT |
162 | @@ -63,9 +70,11 @@ | |||
163 | 63 | QString desktopFile() const; | 70 | QString desktopFile() const; |
164 | 64 | QString exec() const; | 71 | QString exec() const; |
165 | 65 | bool fullscreen() const; | 72 | bool fullscreen() const; |
166 | 66 | std::shared_ptr<mir::shell::Session> session() const; | ||
167 | 67 | pid_t pid() const; | 73 | pid_t pid() const; |
168 | 68 | 74 | ||
169 | 75 | QSharedPointer<Session> session() const; | ||
170 | 76 | QSharedPointer<Session> overrideSession() const; | ||
171 | 77 | |||
172 | 69 | public Q_SLOTS: | 78 | public Q_SLOTS: |
173 | 70 | void suspend(); | 79 | void suspend(); |
174 | 71 | void resume(); | 80 | void resume(); |
175 | @@ -74,15 +83,18 @@ | |||
176 | 74 | Q_SIGNALS: | 83 | Q_SIGNALS: |
177 | 75 | void fullscreenChanged(); | 84 | void fullscreenChanged(); |
178 | 76 | void stageChanged(Stage stage); | 85 | void stageChanged(Stage stage); |
179 | 86 | void sessionChanged(); | ||
180 | 77 | 87 | ||
181 | 78 | private: | 88 | private: |
182 | 79 | void setPid(pid_t pid); | 89 | void setPid(pid_t pid); |
183 | 80 | void setState(State state); | 90 | void setState(State state); |
184 | 81 | void setFocused(bool focus); | 91 | void setFocused(bool focus); |
185 | 82 | void setFullscreen(bool fullscreen); | 92 | void setFullscreen(bool fullscreen); |
186 | 83 | void setSession(const std::shared_ptr<mir::shell::Session>& session); | ||
187 | 84 | void setSessionName(const QString& name); | 93 | void setSessionName(const QString& name); |
188 | 85 | 94 | ||
189 | 95 | void setSession(const QSharedPointer<Session>& session); | ||
190 | 96 | void setOverrideSession(const QSharedPointer<Session>& session); | ||
191 | 97 | |||
192 | 86 | QSharedPointer<TaskController> m_taskController; | 98 | QSharedPointer<TaskController> m_taskController; |
193 | 87 | DesktopFileReader* m_desktopData; | 99 | DesktopFileReader* m_desktopData; |
194 | 88 | qint64 m_pid; | 100 | qint64 m_pid; |
195 | @@ -90,7 +102,9 @@ | |||
196 | 90 | State m_state; | 102 | State m_state; |
197 | 91 | bool m_focused; | 103 | bool m_focused; |
198 | 92 | bool m_fullscreen; | 104 | bool m_fullscreen; |
200 | 93 | std::shared_ptr<mir::shell::Session> m_session; | 105 | QWeakPointer<Session> m_session; |
201 | 106 | QSharedPointer<Session> m_overrideSession; | ||
202 | 107 | |||
203 | 94 | QString m_sessionName; | 108 | QString m_sessionName; |
204 | 95 | QStringList m_arguments; | 109 | QStringList m_arguments; |
205 | 96 | QTimer* m_suspendTimer; | 110 | QTimer* m_suspendTimer; |
206 | 97 | 111 | ||
207 | === modified file 'src/modules/Unity/Application/application_manager.cpp' | |||
208 | --- src/modules/Unity/Application/application_manager.cpp 2014-02-11 09:47:56 +0000 | |||
209 | +++ src/modules/Unity/Application/application_manager.cpp 2014-02-26 10:27:46 +0000 | |||
210 | @@ -31,15 +31,18 @@ | |||
211 | 31 | #include "surfacefactory.h" | 31 | #include "surfacefactory.h" |
212 | 32 | #include "taskcontroller.h" | 32 | #include "taskcontroller.h" |
213 | 33 | #include "logging.h" | 33 | #include "logging.h" |
214 | 34 | #include "session.h" | ||
215 | 34 | 35 | ||
216 | 35 | // mir | 36 | // mir |
217 | 36 | #include <mir/scene/depth_id.h> | 37 | #include <mir/scene/depth_id.h> |
218 | 37 | #include <mir/shell/session.h> | 38 | #include <mir/shell/session.h> |
219 | 38 | #include <mir/shell/focus_controller.h> | 39 | #include <mir/shell/focus_controller.h> |
220 | 39 | #include <mir/shell/surface.h> | 40 | #include <mir/shell/surface.h> |
221 | 41 | #include <mir/shell/trusted_session.h> | ||
222 | 40 | #include <mir/graphics/display.h> | 42 | #include <mir/graphics/display.h> |
223 | 41 | #include <mir/graphics/display_buffer.h> | 43 | #include <mir/graphics/display_buffer.h> |
224 | 42 | #include <mircommon/mir/geometry/rectangles.h> | 44 | #include <mircommon/mir/geometry/rectangles.h> |
225 | 45 | #include <mir/frontend/shell.h> | ||
226 | 43 | 46 | ||
227 | 44 | // Qt | 47 | // Qt |
228 | 45 | #include <QCoreApplication> | 48 | #include <QCoreApplication> |
229 | @@ -53,6 +56,11 @@ | |||
230 | 53 | 56 | ||
231 | 54 | ApplicationManager *ApplicationManager::the_application_manager = nullptr; | 57 | ApplicationManager *ApplicationManager::the_application_manager = nullptr; |
232 | 55 | 58 | ||
233 | 59 | QList<QByteArray> ApplicationManager::whiteListApps({ "maliit-server", | ||
234 | 60 | "/usr/lib/arm-linux-gnueabihf/qt5/libexec/QtWebProcess", | ||
235 | 61 | "/usr/bin/signon-ui", | ||
236 | 62 | "/usr/bin/mir_demo_client_trusted_session_trusted" }); | ||
237 | 63 | |||
238 | 56 | ApplicationManager* ApplicationManager::singleton() | 64 | ApplicationManager* ApplicationManager::singleton() |
239 | 57 | { | 65 | { |
240 | 58 | if (!the_application_manager) { | 66 | if (!the_application_manager) { |
241 | @@ -82,7 +90,6 @@ | |||
242 | 82 | , m_taskController(taskController) | 90 | , m_taskController(taskController) |
243 | 83 | , m_desktopFileReaderFactory(desktopFileReaderFactory) | 91 | , m_desktopFileReaderFactory(desktopFileReaderFactory) |
244 | 84 | , m_gridUnitPx(8) | 92 | , m_gridUnitPx(8) |
245 | 85 | , m_fenceNext(false) | ||
246 | 86 | , m_panelHeight(54) | 93 | , m_panelHeight(54) |
247 | 87 | { | 94 | { |
248 | 88 | DLOG("ApplicationManager::ApplicationManager (this=%p)", this); | 95 | DLOG("ApplicationManager::ApplicationManager (this=%p)", this); |
249 | @@ -105,6 +112,10 @@ | |||
250 | 105 | this, &ApplicationManager::onSessionUnfocused); | 112 | this, &ApplicationManager::onSessionUnfocused); |
251 | 106 | QObject::connect(m_mirServer->sessionListener(), &SessionListener::sessionCreatedSurface, | 113 | QObject::connect(m_mirServer->sessionListener(), &SessionListener::sessionCreatedSurface, |
252 | 107 | this, &ApplicationManager::onSessionCreatedSurface); | 114 | this, &ApplicationManager::onSessionCreatedSurface); |
253 | 115 | QObject::connect(m_mirServer->sessionListener(), &SessionListener::trustedSessionStarted, | ||
254 | 116 | this, &ApplicationManager::onTrustedSessionStarted); | ||
255 | 117 | QObject::connect(m_mirServer->sessionListener(), &SessionListener::trustedSessionStopped, | ||
256 | 118 | this, &ApplicationManager::onTrustedSessionStopped); | ||
257 | 108 | QObject::connect(m_mirServer->sessionAuthorizer(), &SessionAuthorizer::requestAuthorizationForSession, | 119 | QObject::connect(m_mirServer->sessionAuthorizer(), &SessionAuthorizer::requestAuthorizationForSession, |
258 | 109 | this, &ApplicationManager::authorizeSession, Qt::BlockingQueuedConnection); | 120 | this, &ApplicationManager::authorizeSession, Qt::BlockingQueuedConnection); |
259 | 110 | QObject::connect(m_mirServer->placementStrategy(), &InitialSurfacePlacementStrategy::requestPlacementForSession, | 121 | QObject::connect(m_mirServer->placementStrategy(), &InitialSurfacePlacementStrategy::requestPlacementForSession, |
260 | @@ -130,7 +141,7 @@ | |||
261 | 130 | { | 141 | { |
262 | 131 | view_area.add(db.view_area()); | 142 | view_area.add(db.view_area()); |
263 | 132 | }); | 143 | }); |
265 | 133 | 144 | ||
266 | 134 | m_displaySize = QSize( | 145 | m_displaySize = QSize( |
267 | 135 | view_area.bounding_rectangle().size.width.as_uint32_t(), | 146 | view_area.bounding_rectangle().size.width.as_uint32_t(), |
268 | 136 | view_area.bounding_rectangle().size.height.as_uint32_t() | 147 | view_area.bounding_rectangle().size.height.as_uint32_t() |
269 | @@ -239,15 +250,15 @@ | |||
270 | 239 | DLOG("No such running application '%s'", qPrintable(appId)); | 250 | DLOG("No such running application '%s'", qPrintable(appId)); |
271 | 240 | return false; | 251 | return false; |
272 | 241 | } | 252 | } |
274 | 242 | 253 | ||
275 | 243 | if (application->stage() == Application::MainStage && m_sideStageApplication) | 254 | if (application->stage() == Application::MainStage && m_sideStageApplication) |
276 | 244 | suspendApplication(m_sideStageApplication); | 255 | suspendApplication(m_sideStageApplication); |
278 | 245 | 256 | ||
279 | 246 | if (application->stage() == Application::MainStage) | 257 | if (application->stage() == Application::MainStage) |
280 | 247 | m_msApplicationToBeFocused = application; | 258 | m_msApplicationToBeFocused = application; |
281 | 248 | else | 259 | else |
282 | 249 | m_ssApplicationToBeFocused = application; | 260 | m_ssApplicationToBeFocused = application; |
284 | 250 | 261 | ||
285 | 251 | if (application->state() == Application::Stopped) { | 262 | if (application->state() == Application::Stopped) { |
286 | 252 | // Respawning this app, move to end of application list so onSessionStarting works ok | 263 | // Respawning this app, move to end of application list so onSessionStarting works ok |
287 | 253 | // FIXME: this happens pretty late, shell could request respawn earlier | 264 | // FIXME: this happens pretty late, shell could request respawn earlier |
288 | @@ -255,8 +266,9 @@ | |||
289 | 255 | int from = m_applications.indexOf(application); | 266 | int from = m_applications.indexOf(application); |
290 | 256 | move(from, m_applications.length()-1); | 267 | move(from, m_applications.length()-1); |
291 | 257 | } else { | 268 | } else { |
294 | 258 | if (application->session()) | 269 | if (application->session()) { |
295 | 259 | m_mirServer->the_focus_controller()->set_focus_to(application->session()); | 270 | m_mirServer->the_focus_controller()->set_focus_to(application->session()->mirSession()); |
296 | 271 | } | ||
297 | 260 | } | 272 | } |
298 | 261 | 273 | ||
299 | 262 | // FIXME(dandrader): lying here. The operation is async. So we will only know whether | 274 | // FIXME(dandrader): lying here. The operation is async. So we will only know whether |
300 | @@ -353,15 +365,24 @@ | |||
301 | 353 | 365 | ||
302 | 354 | if (application == m_focusedApplication) { | 366 | if (application == m_focusedApplication) { |
303 | 355 | // TODO(greyback) What to do?? Focus next app, or unfocus everything?? | 367 | // TODO(greyback) What to do?? Focus next app, or unfocus everything?? |
304 | 368 | auto lastFocusedApp = m_focusedApplication; | ||
305 | 356 | m_focusedApplication = NULL; | 369 | m_focusedApplication = NULL; |
306 | 357 | Q_EMIT focusedApplicationIdChanged(); | 370 | Q_EMIT focusedApplicationIdChanged(); |
307 | 371 | |||
308 | 372 | // stop trusted session when focus changes. | ||
309 | 373 | if (lastFocusedApp && lastFocusedApp->overrideSession()) { | ||
310 | 374 | auto overrideMirSession = lastFocusedApp->overrideSession()->mirSession(); | ||
311 | 375 | if (overrideMirSession->get_trusted_session()) { | ||
312 | 376 | m_mirServer->the_frontend_shell()->stop_trusted_session(overrideMirSession->get_trusted_session()->id()); | ||
313 | 377 | } | ||
314 | 378 | } | ||
315 | 358 | } | 379 | } |
316 | 359 | 380 | ||
317 | 360 | if (application == m_mainStageApplication) | 381 | if (application == m_mainStageApplication) |
318 | 361 | m_mainStageApplication = nullptr; | 382 | m_mainStageApplication = nullptr; |
319 | 362 | if (application == m_sideStageApplication) | 383 | if (application == m_sideStageApplication) |
320 | 363 | m_sideStageApplication = nullptr; | 384 | m_sideStageApplication = nullptr; |
322 | 364 | 385 | ||
323 | 365 | remove(application); | 386 | remove(application); |
324 | 366 | m_dbusWindowStack->WindowDestroyed(0, application->appId()); | 387 | m_dbusWindowStack->WindowDestroyed(0, application->appId()); |
325 | 367 | 388 | ||
326 | @@ -388,9 +409,18 @@ | |||
327 | 388 | 409 | ||
328 | 389 | if (application == m_focusedApplication) { | 410 | if (application == m_focusedApplication) { |
329 | 390 | // Very bad case where focused application dies. Remove from list. Should give error message | 411 | // Very bad case where focused application dies. Remove from list. Should give error message |
330 | 412 | auto lastFocusedApp = m_focusedApplication; | ||
331 | 391 | m_focusedApplication = nullptr; | 413 | m_focusedApplication = nullptr; |
332 | 392 | Q_EMIT focusedApplicationIdChanged(); | 414 | Q_EMIT focusedApplicationIdChanged(); |
333 | 393 | removeApplication = true; | 415 | removeApplication = true; |
334 | 416 | |||
335 | 417 | // stop trusted session when focus changes. | ||
336 | 418 | if (lastFocusedApp && lastFocusedApp->overrideSession()) { | ||
337 | 419 | auto overrideMirSession = lastFocusedApp->overrideSession()->mirSession(); | ||
338 | 420 | if (overrideMirSession->get_trusted_session()) { | ||
339 | 421 | m_mirServer->the_frontend_shell()->stop_trusted_session(overrideMirSession->get_trusted_session()->id()); | ||
340 | 422 | } | ||
341 | 423 | } | ||
342 | 394 | } | 424 | } |
343 | 395 | 425 | ||
344 | 396 | if (application->state() == Application::Running || application->state() == Application::Starting) { | 426 | if (application->state() == Application::Running || application->state() == Application::Starting) { |
345 | @@ -399,7 +429,7 @@ | |||
346 | 399 | removeApplication = true; | 429 | removeApplication = true; |
347 | 400 | } else if (application->state() == Application::Suspended) { | 430 | } else if (application->state() == Application::Suspended) { |
348 | 401 | application->setState(Application::Stopped); | 431 | application->setState(Application::Stopped); |
350 | 402 | application->setSession(nullptr); | 432 | application->setSession(QSharedPointer<Session>()); |
351 | 403 | } | 433 | } |
352 | 404 | 434 | ||
353 | 405 | if (removeApplication) { | 435 | if (removeApplication) { |
354 | @@ -471,12 +501,14 @@ | |||
355 | 471 | 501 | ||
356 | 472 | QByteArray command = cmdline.readLine().replace('\0', ' '); | 502 | QByteArray command = cmdline.readLine().replace('\0', ' '); |
357 | 473 | 503 | ||
364 | 474 | // FIXME: special exception for the OSK - maliit-server - not very secure | 504 | // FIXME: special exceptions - not very secure |
365 | 475 | if (command.startsWith("maliit-server") || command.startsWith("/usr/lib/arm-linux-gnueabihf/qt5/libexec/QtWebProcess") | 505 | for( auto const& whiteListApp : whiteListApps) { |
366 | 476 | || command.startsWith("/usr/bin/signon-ui")) { | 506 | if (command.startsWith(whiteListApp)) { |
367 | 477 | authorized = true; | 507 | DLOG("ApplicationManager ACCEPTED connection from white-list app with pid %lld", pid); |
368 | 478 | m_fenceNext = true; | 508 | authorized = true; |
369 | 479 | return; | 509 | m_fencePIDs << pid; |
370 | 510 | return; | ||
371 | 511 | } | ||
372 | 480 | } | 512 | } |
373 | 481 | 513 | ||
374 | 482 | QString pattern = QRegularExpression::escape("--desktop_file_hint=") + "(\\S+)"; | 514 | QString pattern = QRegularExpression::escape("--desktop_file_hint=") + "(\\S+)"; |
375 | @@ -484,7 +516,7 @@ | |||
376 | 484 | QRegularExpressionMatch regExpMatch = regExp.match(command); | 516 | QRegularExpressionMatch regExpMatch = regExp.match(command); |
377 | 485 | 517 | ||
378 | 486 | if (!regExpMatch.hasMatch()) { | 518 | if (!regExpMatch.hasMatch()) { |
380 | 487 | LOG("ApplicationManager REJECTED connection from app with pid %lld as no desktop_file_hint specified", pid); | 519 | LOG("ApplicationManager REJECTED connection from app with pid %lld (%s) as no desktop_file_hint specified", pid, command.data()); |
381 | 488 | return; | 520 | return; |
382 | 489 | } | 521 | } |
383 | 490 | 522 | ||
384 | @@ -543,10 +575,10 @@ | |||
385 | 543 | void ApplicationManager::placeSession(msh::Session const* session, uint32_t &x, uint32_t &y) | 575 | void ApplicationManager::placeSession(msh::Session const* session, uint32_t &x, uint32_t &y) |
386 | 544 | { | 576 | { |
387 | 545 | DLOG("ApplicationManager::placeSession (this=%p, session=%p)", this, session); | 577 | DLOG("ApplicationManager::placeSession (this=%p, session=%p)", this, session); |
392 | 546 | 578 | ||
393 | 547 | Application* application = findApplicationWithSession(session); | 579 | Application* application = findApplicationWithSession(session, true); |
394 | 548 | 580 | ||
395 | 549 | // Application defaults | 581 | // Application defaults |
396 | 550 | x = 0; | 582 | x = 0; |
397 | 551 | y = m_panelHeight; | 583 | y = m_panelHeight; |
398 | 552 | 584 | ||
399 | @@ -563,7 +595,7 @@ | |||
400 | 563 | // SideStage override | 595 | // SideStage override |
401 | 564 | if (application && application->stage() == Application::SideStage) | 596 | if (application && application->stage() == Application::SideStage) |
402 | 565 | x = m_displaySize.width() - (SIDE_STAGE_WIDTH_GU * m_gridUnitPx); | 597 | x = m_displaySize.width() - (SIDE_STAGE_WIDTH_GU * m_gridUnitPx); |
404 | 566 | 598 | ||
405 | 567 | DLOG("ApplicationManager::placeSession (x=%d, y=%d)", x, y); | 599 | DLOG("ApplicationManager::placeSession (x=%d, y=%d)", x, y); |
406 | 568 | } | 600 | } |
407 | 569 | 601 | ||
408 | @@ -571,21 +603,22 @@ | |||
409 | 571 | { | 603 | { |
410 | 572 | DLOG("ApplicationManager::onSessionStarting (this=%p, application=%s)", this, session->name().c_str()); | 604 | DLOG("ApplicationManager::onSessionStarting (this=%p, application=%s)", this, session->name().c_str()); |
411 | 573 | 605 | ||
420 | 574 | if (m_fenceNext) { | 606 | pid_t pid = session->process_id(); |
421 | 575 | m_fenceNext = false; | 607 | |
422 | 576 | return; | 608 | QSharedPointer<Session> new_session(new Session(session)); |
423 | 577 | } | 609 | m_sessions[pid] = new_session; |
424 | 578 | 610 | ||
425 | 579 | //FIXME(greyback) Mir not supplying any identifier that we can use to link the PID to the session | 611 | Application* application = findApplicationWithPid(session->process_id(), false); |
418 | 580 | // so am assuming that the *most recently* launched application session is the one that connects | ||
419 | 581 | Application* application = findLastExecutedApplication(); | ||
426 | 582 | if (application && application->state() != Application::Running) { | 612 | if (application && application->state() != Application::Running) { |
428 | 583 | application->setSession(session); | 613 | application->setSession(new_session); |
429 | 584 | if (application->stage() == Application::MainStage) | 614 | if (application->stage() == Application::MainStage) |
430 | 585 | m_msApplicationToBeFocused = application; | 615 | m_msApplicationToBeFocused = application; |
431 | 586 | else | 616 | else |
432 | 587 | m_ssApplicationToBeFocused = application; | 617 | m_ssApplicationToBeFocused = application; |
433 | 588 | } else { | 618 | } else { |
434 | 619 | if (m_fencePIDs.contains(pid)) { | ||
435 | 620 | return; | ||
436 | 621 | } | ||
437 | 589 | DLOG("ApplicationManager::onSessionStarting - unauthorized application!!"); | 622 | DLOG("ApplicationManager::onSessionStarting - unauthorized application!!"); |
438 | 590 | } | 623 | } |
439 | 591 | } | 624 | } |
440 | @@ -594,44 +627,56 @@ | |||
441 | 594 | { | 627 | { |
442 | 595 | DLOG("ApplicationManager::onSessionStopping (this=%p, application=%s)", this, session->name().c_str()); | 628 | DLOG("ApplicationManager::onSessionStopping (this=%p, application=%s)", this, session->name().c_str()); |
443 | 596 | 629 | ||
471 | 597 | // in case application closed not by hand of shell, check again here: | 630 | auto sit = m_sessions.find(session->process_id()); |
472 | 598 | Application* application = findApplicationWithSession(session); | 631 | if (sit != m_sessions.end()) { |
473 | 599 | if (application) { | 632 | QSharedPointer<Session> localSession = sit.value(); |
474 | 600 | bool removeApplication = true; | 633 | |
475 | 601 | 634 | // in case application closed not by hand of shell, check again here: | |
476 | 602 | if (application->state() != Application::Starting) { | 635 | Application* application = findApplicationWithSession(session, false); // only check app sessions |
477 | 603 | application->setState(Application::Stopped); | 636 | if (application) { |
478 | 604 | application->setSession(nullptr); | 637 | |
479 | 605 | m_dbusWindowStack->WindowDestroyed(0, application->appId()); | 638 | if (session->get_trusted_session()) { |
480 | 606 | if (application != m_focusedApplication) { | 639 | m_mirServer->the_frontend_shell()->stop_trusted_session(session->get_trusted_session()->id()); |
481 | 607 | removeApplication = false; | 640 | } |
482 | 608 | } | 641 | |
483 | 609 | } | 642 | bool removeApplication = true; |
484 | 610 | 643 | if (application->state() != Application::Starting) { | |
485 | 611 | if (m_mainStageApplication == application) | 644 | application->setState(Application::Stopped); |
486 | 612 | m_mainStageApplication = nullptr; | 645 | application->setSession(QSharedPointer<Session>()); |
487 | 613 | 646 | m_dbusWindowStack->WindowDestroyed(0, application->appId()); | |
488 | 614 | if (m_sideStageApplication == application) | 647 | if (application != m_focusedApplication) { |
489 | 615 | m_sideStageApplication = nullptr; | 648 | removeApplication = false; |
490 | 616 | 649 | } | |
491 | 617 | if (removeApplication) { | 650 | } |
492 | 618 | // TODO(greyback) What to do?? Focus next app, or unfocus everything?? | 651 | |
493 | 619 | m_focusedApplication = NULL; | 652 | if (m_mainStageApplication == application) |
494 | 620 | remove(application); | 653 | m_mainStageApplication = nullptr; |
495 | 621 | delete application; | 654 | |
496 | 622 | Q_EMIT focusedApplicationIdChanged(); | 655 | if (m_sideStageApplication == application) |
497 | 623 | } | 656 | m_sideStageApplication = nullptr; |
498 | 657 | |||
499 | 658 | if (removeApplication) { | ||
500 | 659 | // TODO(greyback) What to do?? Focus next app, or unfocus everything?? | ||
501 | 660 | m_focusedApplication = NULL; | ||
502 | 661 | remove(application); | ||
503 | 662 | delete application; | ||
504 | 663 | Q_EMIT focusedApplicationIdChanged(); | ||
505 | 664 | } | ||
506 | 665 | } | ||
507 | 666 | |||
508 | 667 | m_sessions.erase(sit); | ||
509 | 668 | m_fencePIDs.removeAll(session->process_id()); | ||
510 | 624 | } | 669 | } |
511 | 625 | } | 670 | } |
512 | 626 | 671 | ||
513 | 627 | void ApplicationManager::onSessionFocused(std::shared_ptr<msh::Session> const& session) | 672 | void ApplicationManager::onSessionFocused(std::shared_ptr<msh::Session> const& session) |
514 | 628 | { | 673 | { |
517 | 629 | DLOG("ApplicationManager::onSessionFocused (this=%p, session=%p)", this, session.get()); | 674 | DLOG("ApplicationManager::onSessionFocused (this=%p, application=%s)", this, session->name().c_str()); |
518 | 630 | Application* application = findApplicationWithSession(session); | 675 | Application* application = findApplicationWithSession(session, true); |
519 | 631 | 676 | ||
520 | 632 | // Don't give application focus until it has created it's surface, when it is set as state "Running" | 677 | // Don't give application focus until it has created it's surface, when it is set as state "Running" |
521 | 633 | // and only notify shell of focus changes that it actually expects | 678 | // and only notify shell of focus changes that it actually expects |
523 | 634 | if (application && application->state() != Application::Starting && | 679 | if (application && application->state() != Application::Starting && |
524 | 635 | (application == m_msApplicationToBeFocused || | 680 | (application == m_msApplicationToBeFocused || |
525 | 636 | application == m_ssApplicationToBeFocused) | 681 | application == m_ssApplicationToBeFocused) |
526 | 637 | && application != m_focusedApplication) { | 682 | && application != m_focusedApplication) { |
527 | @@ -640,9 +685,10 @@ | |||
528 | 640 | Q_EMIT dataChanged(appIndex, appIndex, QVector<int>() << RoleFocused); | 685 | Q_EMIT dataChanged(appIndex, appIndex, QVector<int>() << RoleFocused); |
529 | 641 | } else { | 686 | } else { |
530 | 642 | if (application == nullptr) { | 687 | if (application == nullptr) { |
533 | 643 | DLOG("Invalid application focused, discarding the event"); | 688 | DLOG("Invalid application focused, discarding the event (m_focusedApplication=%p)", m_focusedApplication); |
534 | 644 | if (NULL != m_focusedApplication) | 689 | if (NULL != m_focusedApplication) { |
535 | 645 | focusApplication(m_focusedApplication->appId()); | 690 | focusApplication(m_focusedApplication->appId()); |
536 | 691 | } | ||
537 | 646 | } | 692 | } |
538 | 647 | } | 693 | } |
539 | 648 | } | 694 | } |
540 | @@ -653,7 +699,8 @@ | |||
541 | 653 | if (NULL != m_focusedApplication) { | 699 | if (NULL != m_focusedApplication) { |
542 | 654 | Q_ASSERT(m_focusedApplication->focused()); | 700 | Q_ASSERT(m_focusedApplication->focused()); |
543 | 655 | m_focusedApplication->setFocused(false); | 701 | m_focusedApplication->setFocused(false); |
545 | 656 | 702 | ||
546 | 703 | auto lastFocusedApp = m_focusedApplication; | ||
547 | 657 | suspendApplication(m_focusedApplication); | 704 | suspendApplication(m_focusedApplication); |
548 | 658 | 705 | ||
549 | 659 | m_focusedApplication = NULL; | 706 | m_focusedApplication = NULL; |
550 | @@ -662,16 +709,23 @@ | |||
551 | 662 | 709 | ||
552 | 663 | QModelIndex appIndex = findIndex(m_focusedApplication); | 710 | QModelIndex appIndex = findIndex(m_focusedApplication); |
553 | 664 | Q_EMIT dataChanged(appIndex, appIndex, QVector<int>() << RoleFocused << RoleState); | 711 | Q_EMIT dataChanged(appIndex, appIndex, QVector<int>() << RoleFocused << RoleState); |
554 | 712 | |||
555 | 713 | if (lastFocusedApp->overrideSession()) { | ||
556 | 714 | auto overrideMirSession = lastFocusedApp->overrideSession()->mirSession(); | ||
557 | 715 | if (overrideMirSession->get_trusted_session()) { | ||
558 | 716 | m_mirServer->the_frontend_shell()->stop_trusted_session(overrideMirSession->get_trusted_session()->id()); | ||
559 | 717 | } | ||
560 | 718 | } | ||
561 | 665 | } | 719 | } |
562 | 666 | } | 720 | } |
563 | 667 | 721 | ||
564 | 668 | void ApplicationManager::onSessionCreatedSurface(msh::Session const* session, | 722 | void ApplicationManager::onSessionCreatedSurface(msh::Session const* session, |
565 | 669 | std::shared_ptr<msh::Surface> const& surface) | 723 | std::shared_ptr<msh::Surface> const& surface) |
566 | 670 | { | 724 | { |
568 | 671 | DLOG("ApplicationManager::onSessionCreatedSurface (this=%p)", this); | 725 | DLOG("ApplicationManager::onSessionCreatedSurface (this=%p, application=%p)", this, session->name().c_str()); |
569 | 672 | Q_UNUSED(surface); | 726 | Q_UNUSED(surface); |
570 | 673 | 727 | ||
572 | 674 | Application* application = findApplicationWithSession(session); | 728 | Application* application = findApplicationWithSession(session, true); |
573 | 675 | if (application && application->state() == Application::Starting) { | 729 | if (application && application->state() == Application::Starting) { |
574 | 676 | m_dbusWindowStack->WindowCreated(0, application->appId()); | 730 | m_dbusWindowStack->WindowCreated(0, application->appId()); |
575 | 677 | // only when Session creates a Surface will we actually mark it focused | 731 | // only when Session creates a Surface will we actually mark it focused |
576 | @@ -681,6 +735,51 @@ | |||
577 | 681 | } | 735 | } |
578 | 682 | } | 736 | } |
579 | 683 | 737 | ||
580 | 738 | void ApplicationManager::onTrustedSessionStarted(std::shared_ptr<mir::shell::TrustedSession> const& mir_trusted_session) | ||
581 | 739 | { | ||
582 | 740 | DLOG("ApplicationManager::onTrustedSessionStarted (this=%p, application=%p)", this, mir_trusted_session->name().c_str()); | ||
583 | 741 | |||
584 | 742 | QSharedPointer<Session> trusted_session(new Session(mir_trusted_session)); | ||
585 | 743 | |||
586 | 744 | bool overrideSet = false; | ||
587 | 745 | std::vector<pid_t> trusted_apps = mir_trusted_session->get_applications(); | ||
588 | 746 | for (pid_t pid : trusted_apps) { | ||
589 | 747 | Application* app = findApplicationWithPid(pid, false); | ||
590 | 748 | if (!app) { | ||
591 | 749 | continue; | ||
592 | 750 | } | ||
593 | 751 | |||
594 | 752 | overrideSet = true; | ||
595 | 753 | app->setOverrideSession(trusted_session); | ||
596 | 754 | |||
597 | 755 | if (m_focusedApplication == app) { | ||
598 | 756 | focusApplication(app->appId()); | ||
599 | 757 | } | ||
600 | 758 | } | ||
601 | 759 | |||
602 | 760 | if (!overrideSet) { | ||
603 | 761 | DLOG("ApplicationManager::onTrustedSessionStarted - no trusted helper to start"); | ||
604 | 762 | } | ||
605 | 763 | } | ||
606 | 764 | |||
607 | 765 | void ApplicationManager::onTrustedSessionStopped(std::shared_ptr<mir::shell::TrustedSession> const& trusted_session) | ||
608 | 766 | { | ||
609 | 767 | auto trusted_helper = trusted_session->get_trusted_helper(); | ||
610 | 768 | DLOG("ApplicationManager::onTrustedSessionStopped (this=%p, application=%s)", this, trusted_helper->name().c_str()); | ||
611 | 769 | |||
612 | 770 | for (Application *app : m_applications) { | ||
613 | 771 | |||
614 | 772 | if (app->overrideSession() && app->overrideSession()->mirSession() == trusted_session) { | ||
615 | 773 | app->setOverrideSession(QSharedPointer<Session>()); | ||
616 | 774 | } | ||
617 | 775 | |||
618 | 776 | if (m_focusedApplication == app) { | ||
619 | 777 | focusApplication(app->appId()); | ||
620 | 778 | } | ||
621 | 779 | } | ||
622 | 780 | } | ||
623 | 781 | |||
624 | 782 | |||
625 | 684 | void ApplicationManager::setFocused(Application *application) | 783 | void ApplicationManager::setFocused(Application *application) |
626 | 685 | { | 784 | { |
627 | 686 | DLOG("ApplicationManager::setFocused (appId=%s)", qPrintable(application->appId())); | 785 | DLOG("ApplicationManager::setFocused (appId=%s)", qPrintable(application->appId())); |
628 | @@ -699,29 +798,34 @@ | |||
629 | 699 | else | 798 | else |
630 | 700 | m_sideStageApplication = application; | 799 | m_sideStageApplication = application; |
631 | 701 | 800 | ||
632 | 801 | auto lastFocusedApp = m_focusedApplication; | ||
633 | 702 | m_focusedApplication = application; | 802 | m_focusedApplication = application; |
634 | 703 | m_focusedApplication->setFocused(true); | 803 | m_focusedApplication->setFocused(true); |
635 | 704 | m_focusedApplication->setState(Application::Running); | 804 | m_focusedApplication->setState(Application::Running); |
636 | 705 | Q_EMIT focusedApplicationIdChanged(); | 805 | Q_EMIT focusedApplicationIdChanged(); |
637 | 706 | m_dbusWindowStack->FocusedWindowChanged(0, application->appId(), application->stage()); | 806 | m_dbusWindowStack->FocusedWindowChanged(0, application->appId(), application->stage()); |
650 | 707 | } | 807 | |
651 | 708 | 808 | // stop trusted session when focus changes. | |
652 | 709 | Application* ApplicationManager::findApplicationWithSession(const std::shared_ptr<msh::Session> &session) | 809 | if (lastFocusedApp && lastFocusedApp->overrideSession()) { |
653 | 710 | { | 810 | auto overrideMirSession = lastFocusedApp->overrideSession()->mirSession(); |
654 | 711 | return findApplicationWithSession(session.get()); | 811 | if (overrideMirSession->get_trusted_session()) { |
655 | 712 | } | 812 | m_mirServer->the_frontend_shell()->stop_trusted_session(overrideMirSession->get_trusted_session()->id()); |
644 | 713 | |||
645 | 714 | Application* ApplicationManager::findApplicationWithSession(const msh::Session *session) | ||
646 | 715 | { | ||
647 | 716 | for (Application *app : m_applications) { | ||
648 | 717 | if (app->session().get() == session) { | ||
649 | 718 | return app; | ||
656 | 719 | } | 813 | } |
657 | 720 | } | 814 | } |
662 | 721 | return nullptr; | 815 | } |
663 | 722 | } | 816 | |
664 | 723 | 817 | Application* ApplicationManager::findApplicationWithSession(const std::shared_ptr<msh::Session> &session, bool checkSessions) | |
665 | 724 | Application* ApplicationManager::findApplicationWithPid(const qint64 pid) | 818 | { |
666 | 819 | return findApplicationWithSession(session.get(), checkSessions); | ||
667 | 820 | } | ||
668 | 821 | |||
669 | 822 | Application* ApplicationManager::findApplicationWithSession(const msh::Session *session, bool checkSessions) | ||
670 | 823 | { | ||
671 | 824 | if (!session) { return NULL; } | ||
672 | 825 | return findApplicationWithPid(session->process_id(), checkSessions); | ||
673 | 826 | } | ||
674 | 827 | |||
675 | 828 | Application* ApplicationManager::findApplicationWithPid(const qint64 pid, bool checkSessions) | ||
676 | 725 | { | 829 | { |
677 | 726 | if (pid <= 0) | 830 | if (pid <= 0) |
678 | 727 | return nullptr; | 831 | return nullptr; |
679 | @@ -730,17 +834,23 @@ | |||
680 | 730 | if (app->m_pid == pid) { | 834 | if (app->m_pid == pid) { |
681 | 731 | return app; | 835 | return app; |
682 | 732 | } | 836 | } |
683 | 837 | |||
684 | 838 | if (checkSessions && app->session()) { | ||
685 | 839 | if (app->session()->hasProcess(pid)) { | ||
686 | 840 | return app; | ||
687 | 841 | } | ||
688 | 842 | } | ||
689 | 733 | } | 843 | } |
690 | 734 | return nullptr; | 844 | return nullptr; |
691 | 735 | } | 845 | } |
692 | 736 | 846 | ||
694 | 737 | Application* ApplicationManager::findLastExecutedApplication() | 847 | QSharedPointer<Session> ApplicationManager::findSessionForPid(pid_t pid) |
695 | 738 | { | 848 | { |
700 | 739 | if (m_applications.length() > 0) { | 849 | auto iter = m_sessions.find(pid); |
701 | 740 | return m_applications.last(); | 850 | if (iter != m_sessions.end()) { |
702 | 741 | } else { | 851 | return *iter; |
699 | 742 | return NULL; | ||
703 | 743 | } | 852 | } |
704 | 853 | return QSharedPointer<Session>(); | ||
705 | 744 | } | 854 | } |
706 | 745 | 855 | ||
707 | 746 | Application* ApplicationManager::applicationForStage(Application::Stage stage) | 856 | Application* ApplicationManager::applicationForStage(Application::Stage stage) |
708 | 747 | 857 | ||
709 | === modified file 'src/modules/Unity/Application/application_manager.h' | |||
710 | --- src/modules/Unity/Application/application_manager.h 2014-01-27 11:29:44 +0000 | |||
711 | +++ src/modules/Unity/Application/application_manager.h 2014-02-26 10:27:46 +0000 | |||
712 | @@ -46,6 +46,7 @@ | |||
713 | 46 | namespace shell { | 46 | namespace shell { |
714 | 47 | class Session; | 47 | class Session; |
715 | 48 | class Surface; | 48 | class Surface; |
716 | 49 | class TrustedSession; | ||
717 | 49 | } | 50 | } |
718 | 50 | } | 51 | } |
719 | 51 | 52 | ||
720 | @@ -87,7 +88,7 @@ | |||
721 | 87 | Q_INVOKABLE void move(int from, int to); | 88 | Q_INVOKABLE void move(int from, int to); |
722 | 88 | 89 | ||
723 | 89 | const QList<Application*> &list() const { return m_applications; } | 90 | const QList<Application*> &list() const { return m_applications; } |
725 | 90 | Application* findApplicationWithPid(const qint64 pid); | 91 | Application* findApplicationWithPid(const qint64 pid, bool checkSessions); |
726 | 91 | 92 | ||
727 | 92 | // Internal helpers | 93 | // Internal helpers |
728 | 93 | void suspendApplication(Application *application); | 94 | void suspendApplication(Application *application); |
729 | @@ -97,11 +98,13 @@ | |||
730 | 97 | public Q_SLOTS: | 98 | public Q_SLOTS: |
731 | 98 | void authorizeSession(const quint64 pid, bool &authorized); | 99 | void authorizeSession(const quint64 pid, bool &authorized); |
732 | 99 | void placeSession(mir::shell::Session const*, uint32_t &x, uint32_t &y); | 100 | void placeSession(mir::shell::Session const*, uint32_t &x, uint32_t &y); |
734 | 100 | 101 | ||
735 | 101 | void onSessionStarting(std::shared_ptr<mir::shell::Session> const& session); | 102 | void onSessionStarting(std::shared_ptr<mir::shell::Session> const& session); |
736 | 102 | void onSessionStopping(std::shared_ptr<mir::shell::Session> const& session); | 103 | void onSessionStopping(std::shared_ptr<mir::shell::Session> const& session); |
737 | 103 | void onSessionFocused(std::shared_ptr<mir::shell::Session> const& session); | 104 | void onSessionFocused(std::shared_ptr<mir::shell::Session> const& session); |
738 | 104 | void onSessionUnfocused(); | 105 | void onSessionUnfocused(); |
739 | 106 | void onTrustedSessionStarted(std::shared_ptr<mir::shell::TrustedSession> const& trusted_session); | ||
740 | 107 | void onTrustedSessionStopped(std::shared_ptr<mir::shell::TrustedSession> const& trusted_session); | ||
741 | 105 | 108 | ||
742 | 106 | void onSessionCreatedSurface(mir::shell::Session const*, std::shared_ptr<mir::shell::Surface> const&); | 109 | void onSessionCreatedSurface(mir::shell::Session const*, std::shared_ptr<mir::shell::Surface> const&); |
743 | 107 | 110 | ||
744 | @@ -117,11 +120,11 @@ | |||
745 | 117 | void setFocused(Application *application); | 120 | void setFocused(Application *application); |
746 | 118 | void add(Application *application); | 121 | void add(Application *application); |
747 | 119 | void remove(Application* application); | 122 | void remove(Application* application); |
751 | 120 | Application* findApplicationWithSession(const std::shared_ptr<mir::shell::Session> &session); | 123 | Application* findApplicationWithSession(const std::shared_ptr<mir::shell::Session> &session, bool checkSessions); |
752 | 121 | Application* findApplicationWithSession(const mir::shell::Session *session); | 124 | Application* findApplicationWithSession(const mir::shell::Session *session, bool checkSessions); |
750 | 122 | Application* findLastExecutedApplication(); | ||
753 | 123 | Application* applicationForStage(Application::Stage stage); | 125 | Application* applicationForStage(Application::Stage stage); |
754 | 124 | QModelIndex findIndex(Application* application); | 126 | QModelIndex findIndex(Application* application); |
755 | 127 | QSharedPointer<Session> findSessionForPid(pid_t pid); | ||
756 | 125 | 128 | ||
757 | 126 | QList<Application*> m_applications; | 129 | QList<Application*> m_applications; |
758 | 127 | Application* m_focusedApplication; // remove as Mir has API for this | 130 | Application* m_focusedApplication; // remove as Mir has API for this |
759 | @@ -135,8 +138,10 @@ | |||
760 | 135 | QSharedPointer<TaskController> m_taskController; | 138 | QSharedPointer<TaskController> m_taskController; |
761 | 136 | QSharedPointer<DesktopFileReader::Factory> m_desktopFileReaderFactory; | 139 | QSharedPointer<DesktopFileReader::Factory> m_desktopFileReaderFactory; |
762 | 137 | static ApplicationManager* the_application_manager; | 140 | static ApplicationManager* the_application_manager; |
763 | 141 | static QList<QByteArray> whiteListApps; | ||
764 | 138 | int m_gridUnitPx; | 142 | int m_gridUnitPx; |
766 | 139 | bool m_fenceNext; | 143 | QList<pid_t> m_fencePIDs; |
767 | 144 | QMap<pid_t, QSharedPointer<Session>> m_sessions; | ||
768 | 140 | QSize m_displaySize; | 145 | QSize m_displaySize; |
769 | 141 | int m_panelHeight; | 146 | int m_panelHeight; |
770 | 142 | 147 | ||
771 | 143 | 148 | ||
772 | === modified file 'src/modules/Unity/Application/applicationscreenshotprovider.cpp' | |||
773 | --- src/modules/Unity/Application/applicationscreenshotprovider.cpp 2013-12-20 03:38:43 +0000 | |||
774 | +++ src/modules/Unity/Application/applicationscreenshotprovider.cpp 2014-02-26 10:27:46 +0000 | |||
775 | @@ -20,6 +20,7 @@ | |||
776 | 20 | #include "application.h" | 20 | #include "application.h" |
777 | 21 | 21 | ||
778 | 22 | // unity-mir | 22 | // unity-mir |
779 | 23 | #include "session.h" | ||
780 | 23 | #include "logging.h" | 24 | #include "logging.h" |
781 | 24 | 25 | ||
782 | 25 | // mir | 26 | // mir |
783 | @@ -51,7 +52,8 @@ | |||
784 | 51 | 52 | ||
785 | 52 | // TODO: if app not ready, return an app-provided splash image. If app has been stopped with saved state | 53 | // TODO: if app not ready, return an app-provided splash image. If app has been stopped with saved state |
786 | 53 | // return the screenshot that was saved to disk. | 54 | // return the screenshot that was saved to disk. |
788 | 54 | if (!app->session() || !app->session()->default_surface()) { | 55 | QSharedPointer<Session> session = app->session(); |
789 | 56 | if (!session || !session->mirSession() || !session->mirSession()->default_surface()) { | ||
790 | 55 | LOG("ApplicationScreenshotProvider - app session not found - taking screenshot too early"); | 57 | LOG("ApplicationScreenshotProvider - app session not found - taking screenshot too early"); |
791 | 56 | return QImage(); | 58 | return QImage(); |
792 | 57 | } | 59 | } |
793 | @@ -67,7 +69,7 @@ | |||
794 | 67 | 69 | ||
795 | 68 | QImage image; | 70 | QImage image; |
796 | 69 | 71 | ||
798 | 70 | app->session()->take_snapshot( | 72 | session->mirSession()->take_snapshot( |
799 | 71 | [&](mir::shell::Snapshot const& snapshot) | 73 | [&](mir::shell::Snapshot const& snapshot) |
800 | 72 | { | 74 | { |
801 | 73 | DLOG("ApplicationScreenshotProvider - Mir snapshot ready with size %d x %d", | 75 | DLOG("ApplicationScreenshotProvider - Mir snapshot ready with size %d x %d", |
802 | 74 | 76 | ||
803 | === modified file 'src/modules/Unity/Application/dbuswindowstack.cpp' | |||
804 | --- src/modules/Unity/Application/dbuswindowstack.cpp 2013-10-09 09:02:23 +0000 | |||
805 | +++ src/modules/Unity/Application/dbuswindowstack.cpp 2014-02-26 10:27:46 +0000 | |||
806 | @@ -44,7 +44,7 @@ | |||
807 | 44 | { | 44 | { |
808 | 45 | AppIdDesktopFile res; | 45 | AppIdDesktopFile res; |
809 | 46 | ApplicationManager *appMgr = static_cast<ApplicationManager*>(parent()); | 46 | ApplicationManager *appMgr = static_cast<ApplicationManager*>(parent()); |
811 | 47 | const Application* app = static_cast<Application*>(appMgr->findApplicationWithPid(pid)); | 47 | const Application* app = static_cast<Application*>(appMgr->findApplicationWithPid(pid, false)); |
812 | 48 | if (app) { | 48 | if (app) { |
813 | 49 | res.app_id = app->appId(); | 49 | res.app_id = app->appId(); |
814 | 50 | res.desktop_file = app->desktopFile(); | 50 | res.desktop_file = app->desktopFile(); |
815 | 51 | 51 | ||
816 | === modified file 'src/modules/Unity/Application/mirsurfacemanager.cpp' | |||
817 | --- src/modules/Unity/Application/mirsurfacemanager.cpp 2013-12-20 03:38:43 +0000 | |||
818 | +++ src/modules/Unity/Application/mirsurfacemanager.cpp 2014-02-26 10:27:46 +0000 | |||
819 | @@ -103,8 +103,8 @@ | |||
820 | 103 | { | 103 | { |
821 | 104 | 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()); |
822 | 105 | ApplicationManager* appMgr = static_cast<ApplicationManager*>(ApplicationManager::singleton()); | 105 | ApplicationManager* appMgr = static_cast<ApplicationManager*>(ApplicationManager::singleton()); |
825 | 106 | Application* application = appMgr->findApplicationWithSession(session); | 106 | Application* application = appMgr->findApplicationWithSession(session, true); |
826 | 107 | 107 | ||
827 | 108 | auto qmlSurface = new MirSurface(surface, application); | 108 | auto qmlSurface = new MirSurface(surface, application); |
828 | 109 | m_surfaces.insert(surface.get(), qmlSurface); | 109 | m_surfaces.insert(surface.get(), qmlSurface); |
829 | 110 | Q_EMIT surfaceCreated(qmlSurface); | 110 | Q_EMIT surfaceCreated(qmlSurface); |
830 | @@ -134,7 +134,7 @@ | |||
831 | 134 | if (fs) { | 134 | if (fs) { |
832 | 135 | fs->set_default_keyboard_target(surface); | 135 | fs->set_default_keyboard_target(surface); |
833 | 136 | } | 136 | } |
835 | 137 | 137 | ||
836 | 138 | Q_EMIT shellSurfaceChanged(m_shellSurface); | 138 | Q_EMIT shellSurfaceChanged(m_shellSurface); |
837 | 139 | } | 139 | } |
838 | 140 | 140 | ||
839 | @@ -145,18 +145,21 @@ | |||
840 | 145 | 145 | ||
841 | 146 | auto it = m_surfaces.find(surface); | 146 | auto it = m_surfaces.find(surface); |
842 | 147 | if (it != m_surfaces.end()) { | 147 | if (it != m_surfaces.end()) { |
844 | 148 | it.value()->setAttribute(attribute, value); | 148 | auto const& surface = it.value(); |
845 | 149 | |||
846 | 150 | surface->setAttribute(attribute, value); | ||
847 | 149 | if (attribute == mir_surface_attrib_state && | 151 | if (attribute == mir_surface_attrib_state && |
848 | 150 | value == mir_surface_state_fullscreen) { | 152 | value == mir_surface_state_fullscreen) { |
849 | 153 | |||
850 | 151 | // Only screen-wide applications are allowed to go fullscreen | 154 | // Only screen-wide applications are allowed to go fullscreen |
853 | 152 | if (it.value()->application()->stage() == Application::MainStage) { | 155 | if (surface->application() && surface->application()->stage() == Application::MainStage) { |
854 | 153 | it.value()->application()->setFullscreen(static_cast<bool>(value)); | 156 | surface->application()->setFullscreen(static_cast<bool>(value)); |
855 | 154 | ApplicationManager* appMgr = static_cast<ApplicationManager*>(ApplicationManager::singleton()); | 157 | ApplicationManager* appMgr = static_cast<ApplicationManager*>(ApplicationManager::singleton()); |
856 | 155 | QSize displaySize = appMgr->displaySize(); | 158 | QSize displaySize = appMgr->displaySize(); |
861 | 156 | it.value()->setWidth(displaySize.width()); | 159 | surface->setWidth(displaySize.width()); |
862 | 157 | it.value()->setHeight(displaySize.height()); | 160 | surface->setHeight(displaySize.height()); |
863 | 158 | it.value()->setX(0); | 161 | surface->setX(0); |
864 | 159 | it.value()->setY(0); | 162 | surface->setY(0); |
865 | 160 | } | 163 | } |
866 | 161 | } | 164 | } |
867 | 162 | } | 165 | } |
868 | 163 | 166 | ||
869 | === added file 'src/modules/Unity/Application/session.cpp' | |||
870 | --- src/modules/Unity/Application/session.cpp 1970-01-01 00:00:00 +0000 | |||
871 | +++ src/modules/Unity/Application/session.cpp 2014-02-26 10:27:46 +0000 | |||
872 | @@ -0,0 +1,70 @@ | |||
873 | 1 | /* | ||
874 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
875 | 3 | * | ||
876 | 4 | * This program is free software: you can redistribute it and/or modify it under | ||
877 | 5 | * the terms of the GNU Lesser General Public License version 3, as published by | ||
878 | 6 | * the Free Software Foundation. | ||
879 | 7 | * | ||
880 | 8 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
881 | 9 | * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, | ||
882 | 10 | * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
883 | 11 | * Lesser General Public License for more details. | ||
884 | 12 | * | ||
885 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
886 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
887 | 15 | */ | ||
888 | 16 | |||
889 | 17 | #include "session.h" | ||
890 | 18 | |||
891 | 19 | // mir | ||
892 | 20 | #include <mir/shell/session.h> | ||
893 | 21 | #include <mir/shell/trusted_session.h> | ||
894 | 22 | |||
895 | 23 | Session::Session(const std::shared_ptr<mir::shell::Session>& session) | ||
896 | 24 | : m_session(session) | ||
897 | 25 | , m_application(NULL) | ||
898 | 26 | { | ||
899 | 27 | } | ||
900 | 28 | |||
901 | 29 | Session::~Session() | ||
902 | 30 | { | ||
903 | 31 | } | ||
904 | 32 | |||
905 | 33 | std::shared_ptr<mir::shell::Session> Session::mirSession() const | ||
906 | 34 | { | ||
907 | 35 | return m_session; | ||
908 | 36 | } | ||
909 | 37 | |||
910 | 38 | void Session::setLifecycleState(MirLifecycleState state) | ||
911 | 39 | { | ||
912 | 40 | m_session->set_lifecycle_state(state); | ||
913 | 41 | } | ||
914 | 42 | |||
915 | 43 | void Session::setApplication(Application* application) | ||
916 | 44 | { | ||
917 | 45 | m_application = application; | ||
918 | 46 | } | ||
919 | 47 | |||
920 | 48 | Application* Session::application() const | ||
921 | 49 | { | ||
922 | 50 | return m_application; | ||
923 | 51 | } | ||
924 | 52 | |||
925 | 53 | bool Session::hasProcess(pid_t pid) const | ||
926 | 54 | { | ||
927 | 55 | if (mirSession()->process_id() == pid) { | ||
928 | 56 | return true; | ||
929 | 57 | } | ||
930 | 58 | auto trusted_session = mirSession()->get_trusted_session(); | ||
931 | 59 | if (trusted_session) { | ||
932 | 60 | if (trusted_session->get_trusted_helper()->process_id() == pid) { | ||
933 | 61 | return true; | ||
934 | 62 | } | ||
935 | 63 | for (pid_t application_pid : trusted_session->get_applications()) { | ||
936 | 64 | if (application_pid == pid) { | ||
937 | 65 | return true; | ||
938 | 66 | } | ||
939 | 67 | } | ||
940 | 68 | } | ||
941 | 69 | return false; | ||
942 | 70 | } | ||
943 | 0 | \ No newline at end of file | 71 | \ No newline at end of file |
944 | 1 | 72 | ||
945 | === added file 'src/modules/Unity/Application/session.h' | |||
946 | --- src/modules/Unity/Application/session.h 1970-01-01 00:00:00 +0000 | |||
947 | +++ src/modules/Unity/Application/session.h 2014-02-26 10:27:46 +0000 | |||
948 | @@ -0,0 +1,60 @@ | |||
949 | 1 | /* | ||
950 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
951 | 3 | * | ||
952 | 4 | * This program is free software: you can redistribute it and/or modify it under | ||
953 | 5 | * the terms of the GNU Lesser General Public License version 3, as published by | ||
954 | 6 | * the Free Software Foundation. | ||
955 | 7 | * | ||
956 | 8 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
957 | 9 | * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, | ||
958 | 10 | * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
959 | 11 | * Lesser General Public License for more details. | ||
960 | 12 | * | ||
961 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
962 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
963 | 15 | */ | ||
964 | 16 | |||
965 | 17 | #ifndef SESSION_H | ||
966 | 18 | #define SESSION_H | ||
967 | 19 | |||
968 | 20 | // std | ||
969 | 21 | #include <memory> | ||
970 | 22 | |||
971 | 23 | // Mir | ||
972 | 24 | #include <mir_toolkit/common.h> | ||
973 | 25 | |||
974 | 26 | // Qt | ||
975 | 27 | #include <QSharedPointer> | ||
976 | 28 | |||
977 | 29 | class Application; | ||
978 | 30 | namespace mir | ||
979 | 31 | { | ||
980 | 32 | namespace shell | ||
981 | 33 | { | ||
982 | 34 | class Session; | ||
983 | 35 | } | ||
984 | 36 | } | ||
985 | 37 | |||
986 | 38 | class Session { | ||
987 | 39 | public: | ||
988 | 40 | Session(const std::shared_ptr<mir::shell::Session>& session); | ||
989 | 41 | virtual ~Session(); | ||
990 | 42 | |||
991 | 43 | std::shared_ptr<mir::shell::Session> mirSession() const; | ||
992 | 44 | |||
993 | 45 | void setLifecycleState(MirLifecycleState state); | ||
994 | 46 | |||
995 | 47 | void setApplication(Application* application); | ||
996 | 48 | Application* application() const; | ||
997 | 49 | |||
998 | 50 | bool hasProcess(pid_t pid) const; | ||
999 | 51 | |||
1000 | 52 | protected: | ||
1001 | 53 | void setParent(const QSharedPointer<Session>& parent); | ||
1002 | 54 | |||
1003 | 55 | private: | ||
1004 | 56 | std::shared_ptr<mir::shell::Session> m_session; | ||
1005 | 57 | Application* m_application; | ||
1006 | 58 | }; | ||
1007 | 59 | |||
1008 | 60 | #endif // SESSION_H | ||
1009 | 0 | 61 | ||
1010 | === modified file 'src/unity-mir/sessionlistener.cpp' | |||
1011 | --- src/unity-mir/sessionlistener.cpp 2013-11-20 14:39:50 +0000 | |||
1012 | +++ src/unity-mir/sessionlistener.cpp 2014-02-26 10:27:46 +0000 | |||
1013 | @@ -27,6 +27,7 @@ | |||
1014 | 27 | DLOG("SessionListener::SessionListener (this=%p)", this); | 27 | DLOG("SessionListener::SessionListener (this=%p)", this); |
1015 | 28 | // need to register type to send over threads with signal/slot | 28 | // need to register type to send over threads with signal/slot |
1016 | 29 | qRegisterMetaType<std::shared_ptr<msh::Session>>("std::shared_ptr<mir::shell::Session>"); | 29 | qRegisterMetaType<std::shared_ptr<msh::Session>>("std::shared_ptr<mir::shell::Session>"); |
1017 | 30 | qRegisterMetaType<std::shared_ptr<msh::TrustedSession>>("std::shared_ptr<mir::shell::TrustedSession>"); | ||
1018 | 30 | } | 31 | } |
1019 | 31 | 32 | ||
1020 | 32 | SessionListener::~SessionListener() | 33 | SessionListener::~SessionListener() |
1021 | @@ -71,3 +72,15 @@ | |||
1022 | 71 | DLOG("SessionListener::destroying_surface (this=%p, session=%p, surface=%p)", this, &session, (void*)surface.get()); | 72 | DLOG("SessionListener::destroying_surface (this=%p, session=%p, surface=%p)", this, &session, (void*)surface.get()); |
1023 | 72 | Q_EMIT sessionDestroyingSurface(&session, surface); | 73 | Q_EMIT sessionDestroyingSurface(&session, surface); |
1024 | 73 | } | 74 | } |
1025 | 75 | |||
1026 | 76 | void SessionListener::trusted_session_started(std::shared_ptr<mir::shell::TrustedSession> const& trusted_session) | ||
1027 | 77 | { | ||
1028 | 78 | DLOG("SessionListener::trusted_session_started (this=%p, trusted_session=%p)", this, (void*)trusted_session.get()); | ||
1029 | 79 | Q_EMIT trustedSessionStarted(trusted_session); | ||
1030 | 80 | } | ||
1031 | 81 | |||
1032 | 82 | void SessionListener::trusted_session_stopped(std::shared_ptr<mir::shell::TrustedSession> const& trusted_session) | ||
1033 | 83 | { | ||
1034 | 84 | DLOG("SessionListener::trusted_session_stopped (this=%p, session=%p)", this, (void*)trusted_session.get()); | ||
1035 | 85 | Q_EMIT trustedSessionStopped(trusted_session); | ||
1036 | 86 | } | ||
1037 | 74 | 87 | ||
1038 | === modified file 'src/unity-mir/sessionlistener.h' | |||
1039 | --- src/unity-mir/sessionlistener.h 2013-11-15 17:40:27 +0000 | |||
1040 | +++ src/unity-mir/sessionlistener.h 2014-02-26 10:27:46 +0000 | |||
1041 | @@ -36,6 +36,9 @@ | |||
1042 | 36 | void surface_created(mir::shell::Session&, std::shared_ptr<mir::shell::Surface> const&) override; | 36 | void surface_created(mir::shell::Session&, std::shared_ptr<mir::shell::Surface> const&) override; |
1043 | 37 | 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; |
1044 | 38 | 38 | ||
1045 | 39 | void trusted_session_started(std::shared_ptr<mir::shell::TrustedSession> const& trusted_session) override; | ||
1046 | 40 | void trusted_session_stopped(std::shared_ptr<mir::shell::TrustedSession> const& trusted_session) override; | ||
1047 | 41 | |||
1048 | 39 | Q_SIGNALS: | 42 | Q_SIGNALS: |
1049 | 40 | void sessionStarting(std::shared_ptr<mir::shell::Session> const& session); | 43 | void sessionStarting(std::shared_ptr<mir::shell::Session> const& session); |
1050 | 41 | void sessionStopping(std::shared_ptr<mir::shell::Session> const& session); | 44 | void sessionStopping(std::shared_ptr<mir::shell::Session> const& session); |
1051 | @@ -44,6 +47,9 @@ | |||
1052 | 44 | 47 | ||
1053 | 45 | void sessionCreatedSurface(mir::shell::Session const*, std::shared_ptr<mir::shell::Surface> const&); | 48 | void sessionCreatedSurface(mir::shell::Session const*, std::shared_ptr<mir::shell::Surface> const&); |
1054 | 46 | void sessionDestroyingSurface(mir::shell::Session const*, std::shared_ptr<mir::shell::Surface> const&); | 49 | void sessionDestroyingSurface(mir::shell::Session const*, std::shared_ptr<mir::shell::Surface> const&); |
1055 | 50 | |||
1056 | 51 | void trustedSessionStarted(std::shared_ptr<mir::shell::TrustedSession> const&); | ||
1057 | 52 | void trustedSessionStopped(std::shared_ptr<mir::shell::TrustedSession> const&); | ||
1058 | 47 | }; | 53 | }; |
1059 | 48 | 54 | ||
1060 | 49 | #endif // SESSIONLISTENER_H | 55 | #endif // SESSIONLISTENER_H |
1061 | 50 | 56 | ||
1062 | === modified file 'src/unity-mir/shellserverconfiguration.cpp' | |||
1063 | --- src/unity-mir/shellserverconfiguration.cpp 2014-02-07 16:10:12 +0000 | |||
1064 | +++ src/unity-mir/shellserverconfiguration.cpp 2014-02-26 10:27:46 +0000 | |||
1065 | @@ -136,7 +136,7 @@ | |||
1066 | 136 | // The rationale is that if when you do | 136 | // The rationale is that if when you do |
1067 | 137 | // the_session_authorizer() | 137 | // the_session_authorizer() |
1068 | 138 | // get a pointer that is unique means that Mir is not | 138 | // get a pointer that is unique means that Mir is not |
1070 | 139 | // holding the pointer and thus when we return from the | 139 | // holding the pointer and thus when we return from the |
1071 | 140 | // sessionAuthorizer() | 140 | // sessionAuthorizer() |
1072 | 141 | // scope the unique pointer will be destroyed so we return 0 | 141 | // scope the unique pointer will be destroyed so we return 0 |
1073 | 142 | // | 142 | // |