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

Proposed by Alan Griffiths
Status: Merged
Approved by: Gerry Boland
Approved revision: 141
Merged at revision: 140
Proposed branch: lp:~alan-griffiths/unity-mir/dont-use-OrganisingSurfaceFactory
Merge into: lp:unity-mir
Diff against target: 253 lines (+32/-42)
7 files modified
src/modules/Unity/Application/inputarea.cpp (+1/-1)
src/modules/Unity/Application/mirsurfacemanager.cpp (+2/-2)
src/unity-mir/shellserverconfiguration.cpp (+9/-15)
src/unity-mir/shellserverconfiguration.h (+4/-4)
src/unity-mir/surfacefactory.cpp (+8/-10)
src/unity-mir/surfacefactory.h (+5/-7)
src/unity-mir/unity-mir.pro (+3/-3)
To merge this branch: bzr merge lp:~alan-griffiths/unity-mir/dont-use-OrganisingSurfaceFactory
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Alexandros Frantzis (community) Approve
Review via email: mp+192912@code.launchpad.net

Commit message

Remove dependency on msh::OrganisingSurfaceFactory

Description of the change

Remove dependency on msh::OrganisingSurfaceFactory

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) wrote :

Approved, thank you

review: Approve
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

Looks good.

review: Approve
Revision history for this message
Gerry Boland (gerboland) wrote :

Hang on, changed my mind about something.

+SurfaceSource::SurfaceSource(std::shared_ptr<mir::shell::SurfaceFactory> const& surfaceFactory,
In Mir, mir::shell::SurfaceSource is the implementation of the pure virtual class mir::surface::SurfaceFactory.

With this MR, Unity-mir now implements mir::surface::SurfaceFactory, instead of mir::shell::SurfaceSource. I'd like to maintain the pattern that the implementation is named after the class it inherits, when possible.

I'd prefer you rename the class SurfaceSource to SurfaceFactory here. Also I find the purpose of a class named "Factory" much more obvious than "Source" anyway, so I think it would be a readability win.

That does break the parallelism of naming with Mir however.

review: Needs Fixing
139. By Alan Griffiths

Rename SurfaceSource to SurfaceFactory

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
140. By Alan Griffiths

Rename SurfaceSource to SurfaceFactory

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

Text conflict in src/unity-mir/shellserverconfiguration.h
Text conflict in src/unity-mir/unity-mir.pro

review: Needs Fixing
141. By Alan Griffiths

merge lp:unity-mir

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

Works great, thank you

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/modules/Unity/Application/inputarea.cpp'
2--- src/modules/Unity/Application/inputarea.cpp 2013-10-18 09:25:20 +0000
3+++ src/modules/Unity/Application/inputarea.cpp 2013-10-30 17:46:58 +0000
4@@ -28,7 +28,7 @@
5 // unity-mir
6 #include "qmirserverapplication.h"
7 #include "shellserverconfiguration.h"
8-#include "surfacesource.h"
9+#include "surfacefactory.h"
10 #include "logging.h"
11
12 InputArea::InputArea(QQuickItem *parent)
13
14=== modified file 'src/modules/Unity/Application/mirsurfacemanager.cpp'
15--- src/modules/Unity/Application/mirsurfacemanager.cpp 2013-10-18 09:25:20 +0000
16+++ src/modules/Unity/Application/mirsurfacemanager.cpp 2013-10-30 17:46:58 +0000
17@@ -27,7 +27,7 @@
18 #include "shellserverconfiguration.h"
19 #include "sessionlistener.h"
20 #include "surfaceconfigurator.h"
21-#include "surfacesource.h"
22+#include "surfacefactory.h"
23 #include "focussetter.h"
24 #include "logging.h"
25
26@@ -57,7 +57,7 @@
27 }
28 m_mirServer = mirServerApplication->server();
29
30- QObject::connect(m_mirServer->surfaceSource(), &SurfaceSource::shellSurfaceCreated,
31+ QObject::connect(m_mirServer->surfaceFactory(), &SurfaceFactory::shellSurfaceCreated,
32 this, &MirSurfaceManager::shellSurfaceCreated);
33
34 QObject::connect(m_mirServer->sessionListener(), &SessionListener::sessionCreatedSurface,
35
36=== modified file 'src/unity-mir/shellserverconfiguration.cpp'
37--- src/unity-mir/shellserverconfiguration.cpp 2013-10-30 17:32:31 +0000
38+++ src/unity-mir/shellserverconfiguration.cpp 2013-10-30 17:46:58 +0000
39@@ -19,15 +19,12 @@
40 #include "initialsurfaceplacementstrategy.h"
41 #include "sessionlistener.h"
42 #include "surfaceconfigurator.h"
43-#include "surfacesource.h"
44+#include "surfacefactory.h"
45 #include "sessionauthorizer.h"
46 #include "surfacebuilder.h"
47 #include "focussetter.h"
48 #include "logging.h"
49
50-// mir
51-#include "mir/shell/organising_surface_factory.h"
52-
53 namespace msh = mir::shell;
54 namespace ms = mir::surfaces;
55
56@@ -96,16 +93,13 @@
57 std::shared_ptr<msh::SurfaceFactory>
58 ShellServerConfiguration::the_shell_surface_factory()
59 {
60- return shell_surface_factory(
61- [this]()
62- {
63- m_surfaceSource = std::make_shared<SurfaceSource>(
64- the_surface_builder(), the_shell_surface_configurator());
65+ if (!m_surfaceFactory)
66+ {
67+ m_surfaceFactory = std::make_shared<SurfaceFactory>(
68+ DefaultServerConfiguration::the_shell_surface_factory());
69+ }
70
71- return std::make_shared<msh::OrganisingSurfaceFactory>(
72- m_surfaceSource,
73- the_shell_placement_strategy());
74- });
75+ return m_surfaceFactory;
76 }
77
78 std::shared_ptr<msh::FocusSetter>
79@@ -156,9 +150,9 @@
80 return static_cast<SurfaceConfigurator*>(sharedPtr.get());
81 }
82
83-SurfaceSource *ShellServerConfiguration::surfaceSource()
84+SurfaceFactory *ShellServerConfiguration::surfaceFactory()
85 {
86- return m_surfaceSource.get();
87+ return m_surfaceFactory.get();
88 }
89
90 FocusSetter *ShellServerConfiguration::focusSetter()
91
92=== modified file 'src/unity-mir/shellserverconfiguration.h'
93--- src/unity-mir/shellserverconfiguration.h 2013-10-30 16:19:59 +0000
94+++ src/unity-mir/shellserverconfiguration.h 2013-10-30 17:46:58 +0000
95@@ -24,7 +24,7 @@
96 class FocusSetter;
97 class SessionListener;
98 class SessionAuthorizer;
99-class SurfaceSource;
100+class SurfaceFactory;
101 class SurfaceConfigurator;
102
103 class ShellServerConfiguration : public QObject, public mir::DefaultServerConfiguration
104@@ -34,7 +34,7 @@
105 Q_PROPERTY(SessionAuthorizer* sessionAuthorizer READ sessionAuthorizer CONSTANT)
106 Q_PROPERTY(SessionListener* sessionListener READ sessionListener CONSTANT)
107 Q_PROPERTY(SurfaceConfigurator* surfaceConfigurator READ surfaceConfigurator CONSTANT)
108- Q_PROPERTY(SurfaceSource* surfaceSource READ surfaceSource CONSTANT)
109+ Q_PROPERTY(SurfaceFactory* surfaceFactory READ surfaceFactory CONSTANT)
110
111 public:
112 ShellServerConfiguration(int argc, char const* argv[], QObject* parent = 0);
113@@ -54,11 +54,11 @@
114 SessionAuthorizer *sessionAuthorizer();
115 SessionListener *sessionListener();
116 SurfaceConfigurator *surfaceConfigurator();
117- SurfaceSource *surfaceSource();
118+ SurfaceFactory *surfaceFactory();
119 FocusSetter *focusSetter();
120
121 protected:
122- std::shared_ptr<SurfaceSource> m_surfaceSource;
123+ std::shared_ptr<SurfaceFactory> m_surfaceFactory;
124
125 private:
126 mir::CachedPtr<mir::shell::SurfaceBuilder> m_surfaceBuilder;
127
128=== renamed file 'src/unity-mir/surfacesource.cpp' => 'src/unity-mir/surfacefactory.cpp'
129--- src/unity-mir/surfacesource.cpp 2013-08-12 11:12:48 +0000
130+++ src/unity-mir/surfacefactory.cpp 2013-10-30 17:46:58 +0000
131@@ -15,7 +15,7 @@
132 */
133
134 // local
135-#include "surfacesource.h"
136+#include "surfacefactory.h"
137 #include "logging.h"
138
139 // mir
140@@ -24,29 +24,27 @@
141
142 namespace msh = mir::shell;
143
144-SurfaceSource::SurfaceSource(std::shared_ptr<msh::SurfaceBuilder> const& surfaceBuilder,
145- std::shared_ptr<mir::shell::SurfaceConfigurator> const& surfaceConfigurator,
146+SurfaceFactory::SurfaceFactory(std::shared_ptr<mir::shell::SurfaceFactory> const& surfaceFactory,
147 QObject *parent)
148 : QObject(parent)
149- , msh::SurfaceSource(surfaceBuilder, surfaceConfigurator)
150- , m_surfaceBuilder(surfaceBuilder)
151+ , m_surfaceFactory(surfaceFactory)
152 {
153 qRegisterMetaType<std::shared_ptr<msh::Surface>>("std::shared_ptr<mir::shell::Surface>");
154 }
155
156-SurfaceSource::~SurfaceSource()
157+SurfaceFactory::~SurfaceFactory()
158 {
159 }
160
161 std::shared_ptr<msh::Surface>
162-SurfaceSource::create_surface(
163+SurfaceFactory::create_surface(
164 mir::shell::Session *session,
165 msh::SurfaceCreationParameters const& params,
166 mir::frontend::SurfaceId id,
167 std::shared_ptr<mir::frontend::EventSink> const& sink)
168 {
169- DLOG("SurfaceSource::create_surface");
170- std::shared_ptr<msh::Surface> mirSurface = msh::SurfaceSource::create_surface(session, params, id, sink);
171+ DLOG("SurfaceFactory::create_surface");
172+ std::shared_ptr<msh::Surface> mirSurface = m_surfaceFactory->create_surface(session, params, id, sink);
173
174 static bool shellSurfaceFound = false; //FIXME: Hack to work around fact unable to detect shell surface
175 if (!shellSurfaceFound) {
176@@ -57,7 +55,7 @@
177 return mirSurface;
178 }
179
180-std::shared_ptr<mir::shell::Surface> SurfaceSource::shellSurface() const
181+std::shared_ptr<mir::shell::Surface> SurfaceFactory::shellSurface() const
182 {
183 return m_shellSurface;
184 }
185
186=== renamed file 'src/unity-mir/surfacesource.h' => 'src/unity-mir/surfacefactory.h'
187--- src/unity-mir/surfacesource.h 2013-08-12 11:12:48 +0000
188+++ src/unity-mir/surfacefactory.h 2013-10-30 17:46:58 +0000
189@@ -19,20 +19,18 @@
190
191 #include <QObject>
192
193-#include "mir/shell/surface.h"
194-#include "mir/shell/surface_source.h"
195+#include "mir/shell/surface_factory.h"
196
197 Q_DECLARE_METATYPE(std::shared_ptr<mir::shell::Surface>)
198
199-class SurfaceSource : public QObject, public mir::shell::SurfaceSource
200+class SurfaceFactory : public QObject, public mir::shell::SurfaceFactory
201 {
202 Q_OBJECT
203
204 public:
205- SurfaceSource(std::shared_ptr<mir::shell::SurfaceBuilder> const& surfaceBuilder,
206- std::shared_ptr<mir::shell::SurfaceConfigurator> const& surfaceConfigurator,
207+ SurfaceFactory(std::shared_ptr<mir::shell::SurfaceFactory> const& surfaceFactory,
208 QObject *parent = 0);
209- ~SurfaceSource();
210+ ~SurfaceFactory();
211
212 //Called by Mir server
213 std::shared_ptr<mir::shell::Surface> create_surface(
214@@ -48,7 +46,7 @@
215 void shellSurfaceCreated(std::shared_ptr<mir::shell::Surface> const& surface);
216
217 private:
218- const std::shared_ptr<mir::shell::SurfaceBuilder> m_surfaceBuilder;
219+ const std::shared_ptr<mir::shell::SurfaceFactory> m_surfaceFactory;
220 std::shared_ptr<mir::shell::Surface> m_shellSurface;
221 };
222
223
224=== modified file 'src/unity-mir/unity-mir.pro'
225--- src/unity-mir/unity-mir.pro 2013-10-28 12:59:18 +0000
226+++ src/unity-mir/unity-mir.pro 2013-10-30 17:46:58 +0000
227@@ -22,7 +22,7 @@
228 sessionlistener.cpp \
229 shellserverconfiguration.cpp \
230 surfacebuilder.cpp \
231- surfacesource.cpp \
232+ surfacefactory.cpp \
233 surfaceconfigurator.cpp \
234 focussetter.cpp
235
236@@ -35,7 +35,7 @@
237 sessionlistener.h \
238 shellserverconfiguration.h \
239 surfacebuilder.h \
240- surfacesource.h \
241+ surfacefactory.h \
242 surfaceconfigurator.h \
243 logging.h \
244 focussetter.h
245@@ -49,7 +49,7 @@
246 sessionlistener.h \
247 shellserverconfiguration.h \
248 surfacebuilder.h \
249- surfacesource.h
250+ surfacefactory.h
251 install_headers.path = /usr/include/unity-mir
252
253 ### Generate pkg-config file

Subscribers

People subscribed via source and target branches