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
=== modified file 'src/modules/Unity/Application/inputarea.cpp'
--- src/modules/Unity/Application/inputarea.cpp 2013-10-18 09:25:20 +0000
+++ src/modules/Unity/Application/inputarea.cpp 2013-10-30 17:46:58 +0000
@@ -28,7 +28,7 @@
28// unity-mir28// unity-mir
29#include "qmirserverapplication.h"29#include "qmirserverapplication.h"
30#include "shellserverconfiguration.h"30#include "shellserverconfiguration.h"
31#include "surfacesource.h"31#include "surfacefactory.h"
32#include "logging.h"32#include "logging.h"
3333
34InputArea::InputArea(QQuickItem *parent)34InputArea::InputArea(QQuickItem *parent)
3535
=== modified file 'src/modules/Unity/Application/mirsurfacemanager.cpp'
--- src/modules/Unity/Application/mirsurfacemanager.cpp 2013-10-18 09:25:20 +0000
+++ src/modules/Unity/Application/mirsurfacemanager.cpp 2013-10-30 17:46:58 +0000
@@ -27,7 +27,7 @@
27#include "shellserverconfiguration.h"27#include "shellserverconfiguration.h"
28#include "sessionlistener.h"28#include "sessionlistener.h"
29#include "surfaceconfigurator.h"29#include "surfaceconfigurator.h"
30#include "surfacesource.h"30#include "surfacefactory.h"
31#include "focussetter.h"31#include "focussetter.h"
32#include "logging.h"32#include "logging.h"
3333
@@ -57,7 +57,7 @@
57 }57 }
58 m_mirServer = mirServerApplication->server();58 m_mirServer = mirServerApplication->server();
5959
60 QObject::connect(m_mirServer->surfaceSource(), &SurfaceSource::shellSurfaceCreated,60 QObject::connect(m_mirServer->surfaceFactory(), &SurfaceFactory::shellSurfaceCreated,
61 this, &MirSurfaceManager::shellSurfaceCreated);61 this, &MirSurfaceManager::shellSurfaceCreated);
6262
63 QObject::connect(m_mirServer->sessionListener(), &SessionListener::sessionCreatedSurface,63 QObject::connect(m_mirServer->sessionListener(), &SessionListener::sessionCreatedSurface,
6464
=== modified file 'src/unity-mir/shellserverconfiguration.cpp'
--- src/unity-mir/shellserverconfiguration.cpp 2013-10-30 17:32:31 +0000
+++ src/unity-mir/shellserverconfiguration.cpp 2013-10-30 17:46:58 +0000
@@ -19,15 +19,12 @@
19#include "initialsurfaceplacementstrategy.h"19#include "initialsurfaceplacementstrategy.h"
20#include "sessionlistener.h"20#include "sessionlistener.h"
21#include "surfaceconfigurator.h"21#include "surfaceconfigurator.h"
22#include "surfacesource.h"22#include "surfacefactory.h"
23#include "sessionauthorizer.h"23#include "sessionauthorizer.h"
24#include "surfacebuilder.h"24#include "surfacebuilder.h"
25#include "focussetter.h"25#include "focussetter.h"
26#include "logging.h"26#include "logging.h"
2727
28// mir
29#include "mir/shell/organising_surface_factory.h"
30
31namespace msh = mir::shell;28namespace msh = mir::shell;
32namespace ms = mir::surfaces;29namespace ms = mir::surfaces;
3330
@@ -96,16 +93,13 @@
96std::shared_ptr<msh::SurfaceFactory>93std::shared_ptr<msh::SurfaceFactory>
97ShellServerConfiguration::the_shell_surface_factory()94ShellServerConfiguration::the_shell_surface_factory()
98{95{
99 return shell_surface_factory(96 if (!m_surfaceFactory)
100 [this]()97 {
101 {98 m_surfaceFactory = std::make_shared<SurfaceFactory>(
102 m_surfaceSource = std::make_shared<SurfaceSource>(99 DefaultServerConfiguration::the_shell_surface_factory());
103 the_surface_builder(), the_shell_surface_configurator());100 }
104101
105 return std::make_shared<msh::OrganisingSurfaceFactory>(102 return m_surfaceFactory;
106 m_surfaceSource,
107 the_shell_placement_strategy());
108 });
109}103}
110104
111std::shared_ptr<msh::FocusSetter>105std::shared_ptr<msh::FocusSetter>
@@ -156,9 +150,9 @@
156 return static_cast<SurfaceConfigurator*>(sharedPtr.get());150 return static_cast<SurfaceConfigurator*>(sharedPtr.get());
157}151}
158152
159SurfaceSource *ShellServerConfiguration::surfaceSource()153SurfaceFactory *ShellServerConfiguration::surfaceFactory()
160{154{
161 return m_surfaceSource.get();155 return m_surfaceFactory.get();
162}156}
163157
164FocusSetter *ShellServerConfiguration::focusSetter()158FocusSetter *ShellServerConfiguration::focusSetter()
165159
=== modified file 'src/unity-mir/shellserverconfiguration.h'
--- src/unity-mir/shellserverconfiguration.h 2013-10-30 16:19:59 +0000
+++ src/unity-mir/shellserverconfiguration.h 2013-10-30 17:46:58 +0000
@@ -24,7 +24,7 @@
24class FocusSetter;24class FocusSetter;
25class SessionListener;25class SessionListener;
26class SessionAuthorizer;26class SessionAuthorizer;
27class SurfaceSource;27class SurfaceFactory;
28class SurfaceConfigurator;28class SurfaceConfigurator;
2929
30class ShellServerConfiguration : public QObject, public mir::DefaultServerConfiguration30class ShellServerConfiguration : public QObject, public mir::DefaultServerConfiguration
@@ -34,7 +34,7 @@
34 Q_PROPERTY(SessionAuthorizer* sessionAuthorizer READ sessionAuthorizer CONSTANT)34 Q_PROPERTY(SessionAuthorizer* sessionAuthorizer READ sessionAuthorizer CONSTANT)
35 Q_PROPERTY(SessionListener* sessionListener READ sessionListener CONSTANT)35 Q_PROPERTY(SessionListener* sessionListener READ sessionListener CONSTANT)
36 Q_PROPERTY(SurfaceConfigurator* surfaceConfigurator READ surfaceConfigurator CONSTANT)36 Q_PROPERTY(SurfaceConfigurator* surfaceConfigurator READ surfaceConfigurator CONSTANT)
37 Q_PROPERTY(SurfaceSource* surfaceSource READ surfaceSource CONSTANT)37 Q_PROPERTY(SurfaceFactory* surfaceFactory READ surfaceFactory CONSTANT)
3838
39public:39public:
40 ShellServerConfiguration(int argc, char const* argv[], QObject* parent = 0);40 ShellServerConfiguration(int argc, char const* argv[], QObject* parent = 0);
@@ -54,11 +54,11 @@
54 SessionAuthorizer *sessionAuthorizer();54 SessionAuthorizer *sessionAuthorizer();
55 SessionListener *sessionListener();55 SessionListener *sessionListener();
56 SurfaceConfigurator *surfaceConfigurator();56 SurfaceConfigurator *surfaceConfigurator();
57 SurfaceSource *surfaceSource();57 SurfaceFactory *surfaceFactory();
58 FocusSetter *focusSetter();58 FocusSetter *focusSetter();
5959
60protected:60protected:
61 std::shared_ptr<SurfaceSource> m_surfaceSource;61 std::shared_ptr<SurfaceFactory> m_surfaceFactory;
6262
63private:63private:
64 mir::CachedPtr<mir::shell::SurfaceBuilder> m_surfaceBuilder;64 mir::CachedPtr<mir::shell::SurfaceBuilder> m_surfaceBuilder;
6565
=== renamed file 'src/unity-mir/surfacesource.cpp' => 'src/unity-mir/surfacefactory.cpp'
--- src/unity-mir/surfacesource.cpp 2013-08-12 11:12:48 +0000
+++ src/unity-mir/surfacefactory.cpp 2013-10-30 17:46:58 +0000
@@ -15,7 +15,7 @@
15 */15 */
1616
17// local17// local
18#include "surfacesource.h"18#include "surfacefactory.h"
19#include "logging.h"19#include "logging.h"
2020
21// mir21// mir
@@ -24,29 +24,27 @@
2424
25namespace msh = mir::shell;25namespace msh = mir::shell;
2626
27SurfaceSource::SurfaceSource(std::shared_ptr<msh::SurfaceBuilder> const& surfaceBuilder,27SurfaceFactory::SurfaceFactory(std::shared_ptr<mir::shell::SurfaceFactory> const& surfaceFactory,
28 std::shared_ptr<mir::shell::SurfaceConfigurator> const& surfaceConfigurator,
29 QObject *parent)28 QObject *parent)
30 : QObject(parent)29 : QObject(parent)
31 , msh::SurfaceSource(surfaceBuilder, surfaceConfigurator)30 , m_surfaceFactory(surfaceFactory)
32 , m_surfaceBuilder(surfaceBuilder)
33{31{
34 qRegisterMetaType<std::shared_ptr<msh::Surface>>("std::shared_ptr<mir::shell::Surface>");32 qRegisterMetaType<std::shared_ptr<msh::Surface>>("std::shared_ptr<mir::shell::Surface>");
35}33}
3634
37SurfaceSource::~SurfaceSource()35SurfaceFactory::~SurfaceFactory()
38{36{
39}37}
4038
41std::shared_ptr<msh::Surface>39std::shared_ptr<msh::Surface>
42SurfaceSource::create_surface(40SurfaceFactory::create_surface(
43 mir::shell::Session *session,41 mir::shell::Session *session,
44 msh::SurfaceCreationParameters const& params,42 msh::SurfaceCreationParameters const& params,
45 mir::frontend::SurfaceId id,43 mir::frontend::SurfaceId id,
46 std::shared_ptr<mir::frontend::EventSink> const& sink)44 std::shared_ptr<mir::frontend::EventSink> const& sink)
47{45{
48 DLOG("SurfaceSource::create_surface");46 DLOG("SurfaceFactory::create_surface");
49 std::shared_ptr<msh::Surface> mirSurface = msh::SurfaceSource::create_surface(session, params, id, sink);47 std::shared_ptr<msh::Surface> mirSurface = m_surfaceFactory->create_surface(session, params, id, sink);
5048
51 static bool shellSurfaceFound = false; //FIXME: Hack to work around fact unable to detect shell surface49 static bool shellSurfaceFound = false; //FIXME: Hack to work around fact unable to detect shell surface
52 if (!shellSurfaceFound) {50 if (!shellSurfaceFound) {
@@ -57,7 +55,7 @@
57 return mirSurface;55 return mirSurface;
58}56}
5957
60std::shared_ptr<mir::shell::Surface> SurfaceSource::shellSurface() const58std::shared_ptr<mir::shell::Surface> SurfaceFactory::shellSurface() const
61{59{
62 return m_shellSurface;60 return m_shellSurface;
63}61}
6462
=== renamed file 'src/unity-mir/surfacesource.h' => 'src/unity-mir/surfacefactory.h'
--- src/unity-mir/surfacesource.h 2013-08-12 11:12:48 +0000
+++ src/unity-mir/surfacefactory.h 2013-10-30 17:46:58 +0000
@@ -19,20 +19,18 @@
1919
20#include <QObject>20#include <QObject>
2121
22#include "mir/shell/surface.h"22#include "mir/shell/surface_factory.h"
23#include "mir/shell/surface_source.h"
2423
25Q_DECLARE_METATYPE(std::shared_ptr<mir::shell::Surface>)24Q_DECLARE_METATYPE(std::shared_ptr<mir::shell::Surface>)
2625
27class SurfaceSource : public QObject, public mir::shell::SurfaceSource26class SurfaceFactory : public QObject, public mir::shell::SurfaceFactory
28{27{
29 Q_OBJECT28 Q_OBJECT
3029
31public:30public:
32 SurfaceSource(std::shared_ptr<mir::shell::SurfaceBuilder> const& surfaceBuilder,31 SurfaceFactory(std::shared_ptr<mir::shell::SurfaceFactory> const& surfaceFactory,
33 std::shared_ptr<mir::shell::SurfaceConfigurator> const& surfaceConfigurator,
34 QObject *parent = 0);32 QObject *parent = 0);
35 ~SurfaceSource();33 ~SurfaceFactory();
3634
37 //Called by Mir server35 //Called by Mir server
38 std::shared_ptr<mir::shell::Surface> create_surface(36 std::shared_ptr<mir::shell::Surface> create_surface(
@@ -48,7 +46,7 @@
48 void shellSurfaceCreated(std::shared_ptr<mir::shell::Surface> const& surface);46 void shellSurfaceCreated(std::shared_ptr<mir::shell::Surface> const& surface);
4947
50private:48private:
51 const std::shared_ptr<mir::shell::SurfaceBuilder> m_surfaceBuilder;49 const std::shared_ptr<mir::shell::SurfaceFactory> m_surfaceFactory;
52 std::shared_ptr<mir::shell::Surface> m_shellSurface;50 std::shared_ptr<mir::shell::Surface> m_shellSurface;
53};51};
5452
5553
=== modified file 'src/unity-mir/unity-mir.pro'
--- src/unity-mir/unity-mir.pro 2013-10-28 12:59:18 +0000
+++ src/unity-mir/unity-mir.pro 2013-10-30 17:46:58 +0000
@@ -22,7 +22,7 @@
22 sessionlistener.cpp \22 sessionlistener.cpp \
23 shellserverconfiguration.cpp \23 shellserverconfiguration.cpp \
24 surfacebuilder.cpp \24 surfacebuilder.cpp \
25 surfacesource.cpp \25 surfacefactory.cpp \
26 surfaceconfigurator.cpp \26 surfaceconfigurator.cpp \
27 focussetter.cpp27 focussetter.cpp
2828
@@ -35,7 +35,7 @@
35 sessionlistener.h \35 sessionlistener.h \
36 shellserverconfiguration.h \36 shellserverconfiguration.h \
37 surfacebuilder.h \37 surfacebuilder.h \
38 surfacesource.h \38 surfacefactory.h \
39 surfaceconfigurator.h \39 surfaceconfigurator.h \
40 logging.h \40 logging.h \
41 focussetter.h41 focussetter.h
@@ -49,7 +49,7 @@
49 sessionlistener.h \49 sessionlistener.h \
50 shellserverconfiguration.h \50 shellserverconfiguration.h \
51 surfacebuilder.h \51 surfacebuilder.h \
52 surfacesource.h52 surfacefactory.h
53install_headers.path = /usr/include/unity-mir53install_headers.path = /usr/include/unity-mir
5454
55### Generate pkg-config file55### Generate pkg-config file

Subscribers

People subscribed via source and target branches