Merge lp:~alan-griffiths/unity-mir/we-dont-need-SurfaceBuilder into lp:unity-mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Alan Griffiths
Approved revision: 144
Merged at revision: 143
Proposed branch: lp:~alan-griffiths/unity-mir/we-dont-need-SurfaceBuilder
Merge into: lp:unity-mir
Diff against target: 257 lines (+23/-148)
6 files modified
src/unity-mir/shellserverconfiguration.cpp (+0/-11)
src/unity-mir/shellserverconfiguration.h (+0/-4)
src/unity-mir/surfacebuilder.cpp (+0/-70)
src/unity-mir/surfacebuilder.h (+0/-53)
src/unity-mir/surfacefactory.cpp (+23/-8)
src/unity-mir/unity-mir.pro (+0/-2)
To merge this branch: bzr merge lp:~alan-griffiths/unity-mir/we-dont-need-SurfaceBuilder
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+194558@code.launchpad.net

Commit message

Do all the hacky surface creation customization in SurfaceFactory::create_surface() - and don't mention SurfaceBuilder at all. (That will allow Mir to get rid of that interface.)

Description of the change

Do all the hacky surface creation customization in SurfaceFactory::create_surface() - and don't mention SurfaceBuilder at all. (That will allow Mir to get rid of that interface.)

I'm not entirely sure how to test this does everything needed - so please double check.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/unity-mir/shellserverconfiguration.cpp'
2--- src/unity-mir/shellserverconfiguration.cpp 2013-10-30 17:46:50 +0000
3+++ src/unity-mir/shellserverconfiguration.cpp 2013-11-14 14:02:07 +0000
4@@ -21,7 +21,6 @@
5 #include "surfaceconfigurator.h"
6 #include "surfacefactory.h"
7 #include "sessionauthorizer.h"
8-#include "surfacebuilder.h"
9 #include "focussetter.h"
10 #include "logging.h"
11
12@@ -69,16 +68,6 @@
13 });
14 }
15
16-std::shared_ptr<msh::SurfaceBuilder>
17-ShellServerConfiguration::the_surface_builder()
18-{
19- return m_surfaceBuilder(
20- [this]()
21- {
22- return std::make_shared<SurfaceBuilder>(DefaultServerConfiguration::the_surface_builder());
23- });
24-}
25-
26 std::shared_ptr<mir::frontend::SessionAuthorizer>
27 ShellServerConfiguration::the_session_authorizer()
28 {
29
30=== modified file 'src/unity-mir/shellserverconfiguration.h'
31--- src/unity-mir/shellserverconfiguration.h 2013-10-30 17:46:50 +0000
32+++ src/unity-mir/shellserverconfiguration.h 2013-11-14 14:02:07 +0000
33@@ -47,7 +47,6 @@
34 std::shared_ptr<mir::shell::SurfaceFactory> the_shell_surface_factory() override;
35 std::shared_ptr<mir::shell::FocusSetter> the_shell_focus_setter() override;
36 std::shared_ptr<mir::frontend::SessionAuthorizer> the_session_authorizer() override;
37- std::shared_ptr<mir::shell::SurfaceBuilder> the_surface_builder() override;
38
39 /* qt specific */
40 // getters
41@@ -59,9 +58,6 @@
42
43 protected:
44 std::shared_ptr<SurfaceFactory> m_surfaceFactory;
45-
46-private:
47- mir::CachedPtr<mir::shell::SurfaceBuilder> m_surfaceBuilder;
48 };
49
50 #endif // SHELLSERVERCONFIGURATION_H
51
52=== removed file 'src/unity-mir/surfacebuilder.cpp'
53--- src/unity-mir/surfacebuilder.cpp 2013-11-08 10:09:33 +0000
54+++ src/unity-mir/surfacebuilder.cpp 1970-01-01 00:00:00 +0000
55@@ -1,70 +0,0 @@
56-/*
57- * Copyright (C) 2013 Canonical, Ltd.
58- *
59- * This program is free software: you can redistribute it and/or modify it under
60- * the terms of the GNU Lesser General Public License version 3, as published by
61- * the Free Software Foundation.
62- *
63- * This program is distributed in the hope that it will be useful, but WITHOUT
64- * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
65- * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
66- * Lesser General Public License for more details.
67- *
68- * You should have received a copy of the GNU Lesser General Public License
69- * along with this program. If not, see <http://www.gnu.org/licenses/>.
70- */
71-
72-#include <mir/shell/surface_creation_parameters.h> // TODO: Remove ~racarr
73-
74-#include "surfacebuilder.h"
75-
76-#include "logging.h"
77-
78-namespace msh = mir::shell;
79-namespace ms = mir::surfaces;
80-
81-SurfaceBuilder::SurfaceBuilder(const std::shared_ptr<mir::shell::SurfaceBuilder>& surfaceBuilder, QObject *parent) :
82- QObject(parent),
83- m_surfaceBuilder(surfaceBuilder)
84-{
85- DLOG("SurfaceBuilder::SurfaceBuilder (this=%p)", this);
86-}
87-
88-SurfaceBuilder::~SurfaceBuilder()
89-{
90- DLOG("SurfaceBuilder::~SurfaceBuilder (this=%p)", this);
91-}
92-
93-void SurfaceBuilder::destroy_surface(SurfacePtr const& surface)
94-{
95- return m_surfaceBuilder->destroy_surface(surface);
96-}
97-
98-
99-SurfaceBuilder::SurfacePtr SurfaceBuilder::create_surface(msh::Session *session, const msh::SurfaceCreationParameters& params)
100-{
101- DLOG("SurfaceBuilder::~create_surface (this=%p)", this);
102- Q_UNUSED(session)
103-
104- static const ms::DepthId shellSurfaceDepth{1};
105- static const ms::DepthId oskSurfaceDepth{2};
106- static bool shellSurfaceFound = false;
107-
108- if (params.name == "Qml Phone Shell" && !shellSurfaceFound) { //TODO(greyback) Need to identify shell surface more securely
109- DLOG("Shell depth");
110- auto newParams = params;
111- newParams.depth = shellSurfaceDepth;
112- newParams.input_mode = mir::input::InputReceptionMode::receives_all_input;
113- shellSurfaceFound = true;
114- return m_surfaceBuilder->create_surface(session, newParams);
115- } else if (params.name == "MaliitOnScreenKeyboard") { // FIXME: string hardcoded into maliit
116- DLOG("OSK depth");
117- auto newParams = params;
118- newParams.depth = oskSurfaceDepth;
119- return m_surfaceBuilder->create_surface(session, newParams);
120- } else {
121- DLOG("Default depth");
122- return m_surfaceBuilder->create_surface(session, params);
123- }
124-}
125-
126
127=== removed file 'src/unity-mir/surfacebuilder.h'
128--- src/unity-mir/surfacebuilder.h 2013-11-08 10:09:33 +0000
129+++ src/unity-mir/surfacebuilder.h 1970-01-01 00:00:00 +0000
130@@ -1,53 +0,0 @@
131-/*
132- * Copyright (C) 2013 Canonical, Ltd.
133- *
134- * This program is free software: you can redistribute it and/or modify it under
135- * the terms of the GNU Lesser General Public License version 3, as published by
136- * the Free Software Foundation.
137- *
138- * This program is distributed in the hope that it will be useful, but WITHOUT
139- * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
140- * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
141- * Lesser General Public License for more details.
142- *
143- * You should have received a copy of the GNU Lesser General Public License
144- * along with this program. If not, see <http://www.gnu.org/licenses/>.
145- */
146-
147-#ifndef SURFACECONTROLLER_H
148-#define SURFACECONTROLLER_H
149-
150-#include <QObject>
151-
152-#include "mir/shell/surface_builder.h"
153-
154-#include <type_traits>
155-
156-namespace mir { namespace surfaces { class SurfaceStackModel; }}
157-
158-class SurfaceBuilder : public QObject, public mir::shell::SurfaceBuilder
159-{
160- Q_OBJECT
161-
162-public:
163-
164- // A bit ugly, but makes code portable across some Mir refactoring
165- // I will come back and tidy up! - alan_g
166- using SurfacePtr = std::result_of<
167- decltype(&mir::shell::SurfaceBuilder::create_surface)
168- (mir::shell::SurfaceBuilder*, mir::shell::Session*, mir::shell::SurfaceCreationParameters const&)>::type;
169-
170- explicit SurfaceBuilder(const std::shared_ptr<mir::shell::SurfaceBuilder>& surfaceBuilder, QObject *parent = 0);
171- ~SurfaceBuilder();
172-
173- virtual void destroy_surface(SurfacePtr const& surface) override;
174-
175- virtual SurfacePtr create_surface(
176- mir::shell::Session* session,
177- const mir::shell::SurfaceCreationParameters &params) override;
178-
179-private:
180- const std::shared_ptr<mir::shell::SurfaceBuilder> m_surfaceBuilder;
181-};
182-
183-#endif // SURFACECONTROLLER_H
184
185=== modified file 'src/unity-mir/surfacefactory.cpp'
186--- src/unity-mir/surfacefactory.cpp 2013-10-30 16:40:38 +0000
187+++ src/unity-mir/surfacefactory.cpp 2013-11-14 14:02:07 +0000
188@@ -19,10 +19,10 @@
189 #include "logging.h"
190
191 // mir
192-#include "mir/shell/surface_builder.h"
193-#include "mir/shell/surface_configurator.h"
194+#include <mir/shell/surface_creation_parameters.h>
195
196 namespace msh = mir::shell;
197+namespace ms = mir::surfaces;
198
199 SurfaceFactory::SurfaceFactory(std::shared_ptr<mir::shell::SurfaceFactory> const& surfaceFactory,
200 QObject *parent)
201@@ -44,15 +44,30 @@
202 std::shared_ptr<mir::frontend::EventSink> const& sink)
203 {
204 DLOG("SurfaceFactory::create_surface");
205- std::shared_ptr<msh::Surface> mirSurface = m_surfaceFactory->create_surface(session, params, id, sink);
206-
207+ static const ms::DepthId shellSurfaceDepth{1};
208+ static const ms::DepthId oskSurfaceDepth{2};
209 static bool shellSurfaceFound = false; //FIXME: Hack to work around fact unable to detect shell surface
210- if (!shellSurfaceFound) {
211- m_shellSurface = mirSurface;
212+
213+ std::shared_ptr<msh::Surface> mirSurface;
214+
215+ if (params.name == "Qml Phone Shell" && !shellSurfaceFound) { //TODO(greyback) Need to identify shell surface more securely
216+ DLOG("Shell depth");
217+ auto newParams = params;
218+ newParams.depth = shellSurfaceDepth;
219+ newParams.input_mode = mir::input::InputReceptionMode::receives_all_input;
220+ m_shellSurface = m_surfaceFactory->create_surface(session, newParams, id, sink);
221 shellSurfaceFound = true;
222- Q_EMIT shellSurfaceCreated(mirSurface);
223+ Q_EMIT shellSurfaceCreated(m_shellSurface);
224+ return m_shellSurface;
225+ } else if (params.name == "MaliitOnScreenKeyboard") { // FIXME: string hardcoded into maliit
226+ DLOG("OSK depth");
227+ auto newParams = params;
228+ newParams.depth = oskSurfaceDepth;
229+ return m_surfaceFactory->create_surface(session, newParams, id, sink);
230+ } else {
231+ DLOG("Default depth");
232+ return m_surfaceFactory->create_surface(session, params, id, sink);
233 }
234- return mirSurface;
235 }
236
237 std::shared_ptr<mir::shell::Surface> SurfaceFactory::shellSurface() const
238
239=== modified file 'src/unity-mir/unity-mir.pro'
240--- src/unity-mir/unity-mir.pro 2013-10-30 17:46:50 +0000
241+++ src/unity-mir/unity-mir.pro 2013-11-14 14:02:07 +0000
242@@ -21,7 +21,6 @@
243 sessionauthorizer.cpp \
244 sessionlistener.cpp \
245 shellserverconfiguration.cpp \
246- surfacebuilder.cpp \
247 surfacefactory.cpp \
248 surfaceconfigurator.cpp \
249 focussetter.cpp
250@@ -34,7 +33,6 @@
251 sessionauthorizer.h \
252 sessionlistener.h \
253 shellserverconfiguration.h \
254- surfacebuilder.h \
255 surfacefactory.h \
256 surfaceconfigurator.h \
257 logging.h \

Subscribers

People subscribed via source and target branches