Merge lp:~gerboland/unity-mir/fix-compatibility-with-mir-0.1.8 into lp:unity-mir

Proposed by Gerry Boland
Status: Superseded
Proposed branch: lp:~gerboland/unity-mir/fix-compatibility-with-mir-0.1.8
Merge into: lp:unity-mir
Diff against target: 573 lines (+72/-181)
17 files modified
debian/control (+4/-4)
src/modules/Unity/Application/application_manager.cpp (+0/-1)
src/modules/Unity/Application/inputarea.cpp (+0/-1)
src/modules/Unity/Application/mirsurfacemanager.cpp (+4/-3)
src/modules/Unity/Application/mirsurfacemanager.h (+2/-1)
src/unity-mir/CMakeLists.txt (+0/-2)
src/unity-mir/initialsurfaceplacementstrategy.cpp (+27/-2)
src/unity-mir/sessionauthorizer.cpp (+8/-0)
src/unity-mir/sessionauthorizer.h (+1/-0)
src/unity-mir/sessionlistener.cpp (+10/-1)
src/unity-mir/sessionlistener.h (+2/-0)
src/unity-mir/shellserverconfiguration.cpp (+5/-23)
src/unity-mir/shellserverconfiguration.h (+1/-6)
src/unity-mir/surfaceconfigurator.cpp (+3/-3)
src/unity-mir/surfaceconfigurator.h (+5/-5)
src/unity-mir/surfacefactory.cpp (+0/-76)
src/unity-mir/surfacefactory.h (+0/-53)
To merge this branch: bzr merge lp:~gerboland/unity-mir/fix-compatibility-with-mir-0.1.8
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Mir development team Pending
Review via email: mp+215259@code.launchpad.net

This proposal has been superseded by a proposal from 2014-04-11.

Commit message

Mir 0.1.8 refactoring allows removal of custom SurfaceFactory and instead use InitialSurfacePlacementStrategy to set surface depth and other properties. The shell surface notification now comes via SessionListener

Description of the change

* Are there any related MPs required for this MP to build/function as expected? https://code.launchpad.net/~gerboland/platform-api/fix-compatibility-with-mir-0.1.8/+merge/215257

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Y
 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
212. By Gerry Boland

place() can be called by several threads, so use locking around mainShellSurfaceFound. Standardize code style.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-03-31 15:12:18 +0000
3+++ debian/control 2014-04-10 17:06:34 +0000
4@@ -9,8 +9,8 @@
5 libboost-dev,
6 libboost-system-dev,
7 libplatform-api1-dev,
8- libmirserver-dev (>= 0.1.7),
9- libmirclient-dev (>= 0.1.7),
10+ libmirserver-dev (>= 0.1.8),
11+ libmirclient-dev (>= 0.1.8),
12 libprocess-cpp-dev,
13 libunity-api-dev (>= 7.80.6),
14 libupstart-app-launch2-dev,
15@@ -49,8 +49,8 @@
16 ${shlibs:Depends},
17 libunity-mir1 (= ${binary:Version}),
18 libupstart-app-launch2-dev,
19- libmirserver-dev (>= 0.0.11),
20- libmirclient-dev (>= 0.0.11),
21+ libmirserver-dev (>= 0.1.8),
22+ libmirclient-dev (>= 0.1.8),
23 libplatform-api1-dev,
24 qtbase5-dev,
25 Description: Qt plugins for Unity specific Mir APIs - development files
26
27=== modified file 'src/modules/Unity/Application/application_manager.cpp'
28--- src/modules/Unity/Application/application_manager.cpp 2014-04-01 22:49:46 +0000
29+++ src/modules/Unity/Application/application_manager.cpp 2014-04-10 17:06:34 +0000
30@@ -29,7 +29,6 @@
31 #include "sessionlistener.h"
32 #include "sessionauthorizer.h"
33 #include "initialsurfaceplacementstrategy.h"
34-#include "surfacefactory.h"
35 #include "taskcontroller.h"
36 #include "logging.h"
37
38
39=== modified file 'src/modules/Unity/Application/inputarea.cpp'
40--- src/modules/Unity/Application/inputarea.cpp 2014-02-28 16:51:31 +0000
41+++ src/modules/Unity/Application/inputarea.cpp 2014-04-10 17:06:34 +0000
42@@ -28,7 +28,6 @@
43 // unity-mir
44 #include "qmirserverapplication.h"
45 #include "shellserverconfiguration.h"
46-#include "surfacefactory.h"
47 #include "logging.h"
48
49 namespace unitymir
50
51=== modified file 'src/modules/Unity/Application/mirsurfacemanager.cpp'
52--- src/modules/Unity/Application/mirsurfacemanager.cpp 2014-02-28 16:51:31 +0000
53+++ src/modules/Unity/Application/mirsurfacemanager.cpp 2014-04-10 17:06:34 +0000
54@@ -27,14 +27,15 @@
55 #include "shellserverconfiguration.h"
56 #include "sessionlistener.h"
57 #include "surfaceconfigurator.h"
58-#include "surfacefactory.h"
59 #include "focussetter.h"
60 #include "logging.h"
61
62 // mir
63 #include <mir/shell/session.h>
64+#include <mir/scene/surface.h>
65
66 namespace msh = mir::shell;
67+namespace ms = mir::scene;
68
69 namespace unitymir
70 {
71@@ -63,7 +64,7 @@
72 }
73 m_mirServer = mirServerApplication->server();
74
75- QObject::connect(m_mirServer->surfaceFactory(), &SurfaceFactory::shellSurfaceCreated,
76+ QObject::connect(m_mirServer->sessionListener(), &SessionListener::shellSurfaceCreated,
77 this, &MirSurfaceManager::shellSurfaceCreated);
78
79 QObject::connect(m_mirServer->sessionListener(), &SessionListener::sessionCreatedSurface,
80@@ -141,7 +142,7 @@
81 Q_EMIT shellSurfaceChanged(m_shellSurface);
82 }
83
84-void MirSurfaceManager::surfaceAttributeChanged(const msh::Surface *surface, const MirSurfaceAttrib attribute, const int value)
85+void MirSurfaceManager::surfaceAttributeChanged(const ms::Surface *surface, const MirSurfaceAttrib attribute, const int value)
86 {
87 DLOG("MirSurfaceManager::surfaceAttributeChanged (this=%p, attrib=%d, value=%d)",
88 this, static_cast<int>(attribute), value);
89
90=== modified file 'src/modules/Unity/Application/mirsurfacemanager.h'
91--- src/modules/Unity/Application/mirsurfacemanager.h 2014-02-28 16:51:31 +0000
92+++ src/modules/Unity/Application/mirsurfacemanager.h 2014-04-10 17:06:34 +0000
93@@ -29,6 +29,7 @@
94 // local
95 #include "mirsurface.h"
96
97+namespace mir { namespace scene { class Surface; }}
98 namespace mir { namespace shell { class Surface; class Session; }}
99 class ShellServerConfiguration;
100
101@@ -61,7 +62,7 @@
102 void sessionDestroyingSurface(mir::shell::Session const*, std::shared_ptr<mir::shell::Surface> const&);
103 void shellSurfaceCreated(std::shared_ptr<mir::shell::Surface> const&);
104
105- void surfaceAttributeChanged(mir::shell::Surface const*, MirSurfaceAttrib, int);
106+ void surfaceAttributeChanged(mir::scene::Surface const*, MirSurfaceAttrib, int);
107
108 private:
109 QHash<const mir::shell::Surface *, MirSurface *> m_surfaces;
110
111=== modified file 'src/unity-mir/CMakeLists.txt'
112--- src/unity-mir/CMakeLists.txt 2014-03-11 03:40:33 +0000
113+++ src/unity-mir/CMakeLists.txt 2014-04-10 17:06:34 +0000
114@@ -23,7 +23,6 @@
115 sessioncreator.h
116 sessionlistener.h
117 shellserverconfiguration.h
118- surfacefactory.h
119 surfaceconfigurator.h
120 unityprotobufservice.h
121 logging.h
122@@ -44,7 +43,6 @@
123 sessioncreator.cpp
124 sessionlistener.cpp
125 shellserverconfiguration.cpp
126- surfacefactory.cpp
127 surfaceconfigurator.cpp
128 unityprotobufservice.cpp
129 focussetter.cpp
130
131=== modified file 'src/unity-mir/initialsurfaceplacementstrategy.cpp'
132--- src/unity-mir/initialsurfaceplacementstrategy.cpp 2014-01-14 06:01:40 +0000
133+++ src/unity-mir/initialsurfaceplacementstrategy.cpp 2014-04-10 17:06:34 +0000
134@@ -23,11 +23,14 @@
135 #include "mir/geometry/rectangle.h"
136
137 namespace msh = mir::shell;
138+namespace msc = mir::scene;
139
140-InitialSurfacePlacementStrategy::InitialSurfacePlacementStrategy(std::shared_ptr<msh::DisplayLayout> const& displayLayout, QObject *parent)
141+InitialSurfacePlacementStrategy::InitialSurfacePlacementStrategy(
142+ std::shared_ptr<msh::DisplayLayout> const& displayLayout, QObject *parent)
143 : QObject(parent),
144 m_displayLayout(displayLayout)
145 {
146+ DLOG("InitialSurfacePlacementStrategy::InitialSurfacePlacementStrategy (%p)", this);
147 }
148
149 InitialSurfacePlacementStrategy::~InitialSurfacePlacementStrategy()
150@@ -35,10 +38,32 @@
151 }
152
153 msh::SurfaceCreationParameters
154-InitialSurfacePlacementStrategy::place(msh::Session const& session, msh::SurfaceCreationParameters const& requestParameters)
155+InitialSurfacePlacementStrategy::place(msh::Session const& session,
156+ msh::SurfaceCreationParameters const& requestParameters)
157 {
158+ DLOG("InitialSurfacePlacementStrategy::place (%p, %s, %d)", this, session.name().c_str(), session.process_id());
159 using namespace mir::geometry;
160 auto placedParameters = requestParameters;
161+
162+ // decide surface depth
163+ static const msc::DepthId shellSurfaceDepth{1};
164+ static const msc::DepthId oskSurfaceDepth{2};
165+ static bool mainShellSurfaceFound = false;
166+
167+ if (session.process_id() == 0 && !mainShellSurfaceFound) {
168+ DLOG("Shell main surface found, placed at shell depth");
169+ placedParameters.depth = shellSurfaceDepth;
170+ placedParameters.input_mode = mir::input::InputReceptionMode::receives_all_input;
171+ mainShellSurfaceFound = true;
172+ return placedParameters;
173+ } else if (placedParameters.name == "MaliitOnScreenKeyboard") { // FIXME: string hardcoded into maliit
174+ DLOG("OSK depth");
175+ placedParameters.depth = oskSurfaceDepth;
176+ } else {
177+ DLOG("Default depth");
178+ }
179+
180+ // determine x,y position of the surface by asking shell, if it is up
181 uint32_t x = 0;
182 uint32_t y = 0;
183
184
185=== modified file 'src/unity-mir/sessionauthorizer.cpp'
186--- src/unity-mir/sessionauthorizer.cpp 2013-10-29 10:12:40 +0000
187+++ src/unity-mir/sessionauthorizer.cpp 2014-04-10 17:06:34 +0000
188@@ -43,3 +43,11 @@
189 Q_UNUSED(pid)
190 return true;
191 }
192+
193+bool SessionAuthorizer::screencast_is_allowed(pid_t pid)
194+{
195+ DLOG("SessionAuthorizer::screencast_is_allowed (this=%p, pid=%d)", this, pid);
196+ Q_UNUSED(pid)
197+ return true;
198+}
199+
200
201=== modified file 'src/unity-mir/sessionauthorizer.h'
202--- src/unity-mir/sessionauthorizer.h 2013-10-29 10:12:40 +0000
203+++ src/unity-mir/sessionauthorizer.h 2014-04-10 17:06:34 +0000
204@@ -36,6 +36,7 @@
205
206 virtual bool connection_is_allowed(pid_t pid) override;
207 virtual bool configure_display_is_allowed(pid_t pid) override;
208+ virtual bool screencast_is_allowed(pid_t pid) override;
209
210 Q_SIGNALS:
211 // needs to be blocked queued signal which returns value for authorized
212
213=== modified file 'src/unity-mir/sessionlistener.cpp'
214--- src/unity-mir/sessionlistener.cpp 2013-11-20 14:39:50 +0000
215+++ src/unity-mir/sessionlistener.cpp 2014-04-10 17:06:34 +0000
216@@ -17,6 +17,8 @@
217 #include "sessionlistener.h"
218 #include "logging.h"
219
220+#include <mir/shell/session.h>
221+
222 namespace msh = mir::shell;
223
224 Q_DECLARE_METATYPE(std::shared_ptr<msh::Session>)
225@@ -27,6 +29,7 @@
226 DLOG("SessionListener::SessionListener (this=%p)", this);
227 // need to register type to send over threads with signal/slot
228 qRegisterMetaType<std::shared_ptr<msh::Session>>("std::shared_ptr<mir::shell::Session>");
229+ qRegisterMetaType<std::shared_ptr<msh::Surface>>("std::shared_ptr<mir::shell::Surface>");
230 }
231
232 SessionListener::~SessionListener()
233@@ -63,7 +66,13 @@
234 void SessionListener::surface_created(msh::Session& session, std::shared_ptr<msh::Surface> const& surface)
235 {
236 DLOG("SessionListener::surface_created (this=%p, session=%p, surface=%p)", this, &session, (void*)surface.get());
237- Q_EMIT sessionCreatedSurface(&session, surface);
238+ static bool mainShellSurfaceFound = false;
239+ if (session.process_id() == 0 && !mainShellSurfaceFound) {
240+ Q_EMIT shellSurfaceCreated(surface);
241+ mainShellSurfaceFound = true;
242+ } else {
243+ Q_EMIT sessionCreatedSurface(&session, surface);
244+ }
245 }
246
247 void SessionListener::destroying_surface(msh::Session& session, std::shared_ptr<mir::shell::Surface> const& surface)
248
249=== modified file 'src/unity-mir/sessionlistener.h'
250--- src/unity-mir/sessionlistener.h 2013-11-15 17:40:27 +0000
251+++ src/unity-mir/sessionlistener.h 2014-04-10 17:06:34 +0000
252@@ -44,6 +44,8 @@
253
254 void sessionCreatedSurface(mir::shell::Session const*, std::shared_ptr<mir::shell::Surface> const&);
255 void sessionDestroyingSurface(mir::shell::Session const*, std::shared_ptr<mir::shell::Surface> const&);
256+
257+ void shellSurfaceCreated(std::shared_ptr<mir::shell::Surface> const&);
258 };
259
260 #endif // SESSIONLISTENER_H
261
262=== modified file 'src/unity-mir/shellserverconfiguration.cpp'
263--- src/unity-mir/shellserverconfiguration.cpp 2014-02-19 23:28:21 +0000
264+++ src/unity-mir/shellserverconfiguration.cpp 2014-04-10 17:06:34 +0000
265@@ -23,13 +23,13 @@
266 #include "sessioncreator.h"
267 #include "sessionlistener.h"
268 #include "surfaceconfigurator.h"
269-#include "surfacefactory.h"
270 #include "sessionauthorizer.h"
271 #include "focussetter.h"
272 #include "logging.h"
273
274 namespace mg = mir::graphics;
275 namespace msh = mir::shell;
276+namespace ms = mir::scene;
277
278 ShellServerConfiguration::ShellServerConfiguration(int argc, char const* argv[], QObject* parent)
279 : QObject(parent)
280@@ -74,10 +74,10 @@
281 });
282 }
283
284-std::shared_ptr<msh::SurfaceConfigurator>
285-ShellServerConfiguration::the_shell_surface_configurator()
286+std::shared_ptr<ms::SurfaceConfigurator>
287+ShellServerConfiguration::the_surface_configurator()
288 {
289- return shell_surface_configurator(
290+ return surface_configurator(
291 [this]()
292 {
293 return std::make_shared<SurfaceConfigurator>();
294@@ -107,19 +107,6 @@
295 });
296 }
297
298-// FIXME: Needed to detect the shell's surface - there must be a better way
299-std::shared_ptr<msh::SurfaceFactory>
300-ShellServerConfiguration::the_shell_surface_factory()
301-{
302- if (!m_surfaceFactory)
303- {
304- m_surfaceFactory = std::make_shared<SurfaceFactory>(
305- DefaultServerConfiguration::the_shell_surface_factory());
306- }
307-
308- return m_surfaceFactory;
309-}
310-
311 std::shared_ptr<msh::FocusSetter>
312 ShellServerConfiguration::the_shell_focus_setter()
313 {
314@@ -180,17 +167,12 @@
315
316 SurfaceConfigurator *ShellServerConfiguration::surfaceConfigurator()
317 {
318- auto sharedPtr = the_shell_surface_configurator();
319+ auto sharedPtr = the_surface_configurator();
320 if (sharedPtr.unique()) return 0;
321
322 return static_cast<SurfaceConfigurator*>(sharedPtr.get());
323 }
324
325-SurfaceFactory *ShellServerConfiguration::surfaceFactory()
326-{
327- return m_surfaceFactory.get();
328-}
329-
330 FocusSetter *ShellServerConfiguration::focusSetter()
331 {
332 auto sharedPtr = the_shell_focus_setter();
333
334=== modified file 'src/unity-mir/shellserverconfiguration.h'
335--- src/unity-mir/shellserverconfiguration.h 2014-02-19 23:28:21 +0000
336+++ src/unity-mir/shellserverconfiguration.h 2014-04-10 17:06:34 +0000
337@@ -29,7 +29,6 @@
338 class FocusSetter;
339 class SessionListener;
340 class SessionAuthorizer;
341-class SurfaceFactory;
342 class SurfaceConfigurator;
343 class InitialSurfacePlacementStrategy;
344
345@@ -40,7 +39,6 @@
346 Q_PROPERTY(SessionAuthorizer* sessionAuthorizer READ sessionAuthorizer CONSTANT)
347 Q_PROPERTY(SessionListener* sessionListener READ sessionListener CONSTANT)
348 Q_PROPERTY(SurfaceConfigurator* surfaceConfigurator READ surfaceConfigurator CONSTANT)
349- Q_PROPERTY(SurfaceFactory* surfaceFactory READ surfaceFactory CONSTANT)
350
351 public:
352 ShellServerConfiguration(int argc, char const* argv[], QObject* parent = 0);
353@@ -50,8 +48,7 @@
354 std::shared_ptr<mir::graphics::DisplayConfigurationPolicy> the_display_configuration_policy() override;
355 std::shared_ptr<mir::shell::PlacementStrategy> the_shell_placement_strategy() override;
356 std::shared_ptr<mir::shell::SessionListener> the_shell_session_listener() override;
357- std::shared_ptr<mir::shell::SurfaceConfigurator> the_shell_surface_configurator() override;
358- std::shared_ptr<mir::shell::SurfaceFactory> the_shell_surface_factory() override;
359+ std::shared_ptr<mir::scene::SurfaceConfigurator> the_surface_configurator() override;
360 std::shared_ptr<mir::shell::FocusSetter> the_shell_focus_setter() override;
361 std::shared_ptr<mir::ServerStatusListener> the_server_status_listener() override;
362 std::shared_ptr<mir::frontend::SessionAuthorizer> the_session_authorizer() override;
363@@ -63,11 +60,9 @@
364 SessionAuthorizer *sessionAuthorizer();
365 SessionListener *sessionListener();
366 SurfaceConfigurator *surfaceConfigurator();
367- SurfaceFactory *surfaceFactory();
368 FocusSetter *focusSetter();
369
370 protected:
371- std::shared_ptr<SurfaceFactory> m_surfaceFactory;
372 std::shared_ptr<unity::protobuf::UnityService> m_unityService;
373 };
374
375
376=== modified file 'src/unity-mir/surfaceconfigurator.cpp'
377--- src/unity-mir/surfaceconfigurator.cpp 2013-08-20 11:46:07 +0000
378+++ src/unity-mir/surfaceconfigurator.cpp 2014-04-10 17:06:34 +0000
379@@ -16,19 +16,19 @@
380
381 #include "surfaceconfigurator.h"
382
383-namespace msh = mir::shell;
384+namespace ms = mir::scene;
385
386 SurfaceConfigurator::SurfaceConfigurator()
387 {
388 qRegisterMetaType<MirSurfaceAttrib>("MirSurfaceAttrib");
389 }
390
391-int SurfaceConfigurator::select_attribute_value(msh::Surface const&, MirSurfaceAttrib, int requested_value)
392+int SurfaceConfigurator::select_attribute_value(ms::Surface const&, MirSurfaceAttrib, int requested_value)
393 {
394 return requested_value;
395 }
396
397-void SurfaceConfigurator::attribute_set(msh::Surface const& surface, MirSurfaceAttrib attrib, int value)
398+void SurfaceConfigurator::attribute_set(ms::Surface const& surface, MirSurfaceAttrib attrib, int value)
399 {
400 Q_EMIT surfaceAttributeChanged(&surface, attrib, value);
401 }
402
403=== modified file 'src/unity-mir/surfaceconfigurator.h'
404--- src/unity-mir/surfaceconfigurator.h 2013-08-20 11:46:07 +0000
405+++ src/unity-mir/surfaceconfigurator.h 2014-04-10 17:06:34 +0000
406@@ -19,23 +19,23 @@
407
408 #include <QObject>
409
410-#include <mir/shell/surface_configurator.h>
411+#include <mir/scene/surface_configurator.h>
412 #include <mir_toolkit/common.h>
413
414 namespace mir { namespace shell { class Surface; }}
415
416-class SurfaceConfigurator : public QObject, public mir::shell::SurfaceConfigurator
417+class SurfaceConfigurator : public QObject, public mir::scene::SurfaceConfigurator
418 {
419 Q_OBJECT
420
421 public:
422 SurfaceConfigurator();
423
424- int select_attribute_value(mir::shell::Surface const&, MirSurfaceAttrib, int) override;
425- void attribute_set(mir::shell::Surface const&, MirSurfaceAttrib, int) override;
426+ int select_attribute_value(mir::scene::Surface const&, MirSurfaceAttrib, int) override;
427+ void attribute_set(mir::scene::Surface const&, MirSurfaceAttrib, int) override;
428
429 Q_SIGNALS:
430- void surfaceAttributeChanged(mir::shell::Surface const*, const MirSurfaceAttrib, const int);
431+ void surfaceAttributeChanged(mir::scene::Surface const*, const MirSurfaceAttrib, const int);
432 };
433
434 #endif // SURFACECONFIGURATOR_H
435
436=== removed file 'src/unity-mir/surfacefactory.cpp'
437--- src/unity-mir/surfacefactory.cpp 2014-01-09 16:09:10 +0000
438+++ src/unity-mir/surfacefactory.cpp 1970-01-01 00:00:00 +0000
439@@ -1,76 +0,0 @@
440-/*
441- * Copyright (C) 2013 Canonical, Ltd.
442- *
443- * This program is free software: you can redistribute it and/or modify it under
444- * the terms of the GNU Lesser General Public License version 3, as published by
445- * the Free Software Foundation.
446- *
447- * This program is distributed in the hope that it will be useful, but WITHOUT
448- * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
449- * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
450- * Lesser General Public License for more details.
451- *
452- * You should have received a copy of the GNU Lesser General Public License
453- * along with this program. If not, see <http://www.gnu.org/licenses/>.
454- */
455-
456-// local
457-#include "surfacefactory.h"
458-#include "logging.h"
459-
460-// mir
461-#include <mir/shell/surface_creation_parameters.h>
462-
463-namespace msh = mir::shell;
464-namespace msc = mir::scene;
465-
466-SurfaceFactory::SurfaceFactory(std::shared_ptr<mir::shell::SurfaceFactory> const& surfaceFactory,
467- QObject *parent)
468- : QObject(parent)
469- , m_surfaceFactory(surfaceFactory)
470-{
471- qRegisterMetaType<std::shared_ptr<msh::Surface>>("std::shared_ptr<mir::shell::Surface>");
472-}
473-
474-SurfaceFactory::~SurfaceFactory()
475-{
476-}
477-
478-std::shared_ptr<msh::Surface>
479-SurfaceFactory::create_surface(
480- mir::shell::Session *session,
481- msh::SurfaceCreationParameters const& params,
482- mir::frontend::SurfaceId id,
483- std::shared_ptr<mir::frontend::EventSink> const& sink)
484-{
485- DLOG("SurfaceFactory::create_surface");
486- static const msc::DepthId shellSurfaceDepth{1};
487- static const msc::DepthId oskSurfaceDepth{2};
488- static bool shellSurfaceFound = false; //FIXME: Hack to work around fact unable to detect shell surface
489-
490- std::shared_ptr<msh::Surface> mirSurface;
491-
492- if (params.name == "Qml Phone Shell" && !shellSurfaceFound) { //TODO(greyback) Need to identify shell surface more securely
493- DLOG("Shell depth");
494- auto newParams = params;
495- newParams.depth = shellSurfaceDepth;
496- newParams.input_mode = mir::input::InputReceptionMode::receives_all_input;
497- m_shellSurface = m_surfaceFactory->create_surface(session, newParams, id, sink);
498- shellSurfaceFound = true;
499- Q_EMIT shellSurfaceCreated(m_shellSurface);
500- return m_shellSurface;
501- } else if (params.name == "MaliitOnScreenKeyboard") { // FIXME: string hardcoded into maliit
502- DLOG("OSK depth");
503- auto newParams = params;
504- newParams.depth = oskSurfaceDepth;
505- return m_surfaceFactory->create_surface(session, newParams, id, sink);
506- } else {
507- DLOG("Default depth");
508- return m_surfaceFactory->create_surface(session, params, id, sink);
509- }
510-}
511-
512-std::shared_ptr<mir::shell::Surface> SurfaceFactory::shellSurface() const
513-{
514- return m_shellSurface;
515-}
516
517=== removed file 'src/unity-mir/surfacefactory.h'
518--- src/unity-mir/surfacefactory.h 2014-01-09 16:09:10 +0000
519+++ src/unity-mir/surfacefactory.h 1970-01-01 00:00:00 +0000
520@@ -1,53 +0,0 @@
521-/*
522- * Copyright (C) 2013 Canonical, Ltd.
523- *
524- * This program is free software: you can redistribute it and/or modify it under
525- * the terms of the GNU Lesser General Public License version 3, as published by
526- * the Free Software Foundation.
527- *
528- * This program is distributed in the hope that it will be useful, but WITHOUT
529- * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
530- * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
531- * Lesser General Public License for more details.
532- *
533- * You should have received a copy of the GNU Lesser General Public License
534- * along with this program. If not, see <http://www.gnu.org/licenses/>.
535- */
536-
537-#ifndef SURFACESOURCE_H
538-#define SURFACESOURCE_H
539-
540-#include <QObject>
541-
542-#include "mir/shell/surface_factory.h"
543-
544-Q_DECLARE_METATYPE(std::shared_ptr<mir::shell::Surface>)
545-
546-class SurfaceFactory : public QObject, public mir::shell::SurfaceFactory
547-{
548- Q_OBJECT
549-
550-public:
551- SurfaceFactory(std::shared_ptr<mir::shell::SurfaceFactory> const& surfaceFactory,
552- QObject *parent = 0);
553- ~SurfaceFactory();
554-
555- //Called by Mir server
556- std::shared_ptr<mir::shell::Surface> create_surface(
557- mir::shell::Session* session,
558- mir::shell::SurfaceCreationParameters const& params,
559- mir::frontend::SurfaceId id,
560- std::shared_ptr<mir::frontend::EventSink> const& sink) override;
561-
562- // Called by shell
563- std::shared_ptr<mir::shell::Surface> shellSurface() const;
564-
565-Q_SIGNALS:
566- void shellSurfaceCreated(std::shared_ptr<mir::shell::Surface> const& surface);
567-
568-private:
569- const std::shared_ptr<mir::shell::SurfaceFactory> m_surfaceFactory;
570- std::shared_ptr<mir::shell::Surface> m_shellSurface;
571-};
572-
573-#endif // SURFACESOURCE_H

Subscribers

People subscribed via source and target branches