Merge lp:~alan-griffiths/unity-system-compositor/tidy-config-options into lp:unity-system-compositor

Proposed by Alan Griffiths
Status: Merged
Approved by: Alan Griffiths
Approved revision: 123
Merged at revision: 124
Proposed branch: lp:~alan-griffiths/unity-system-compositor/tidy-config-options
Merge into: lp:unity-system-compositor
Diff against target: 83 lines (+29/-27)
1 file modified
src/system_compositor.cpp (+29/-27)
To merge this branch: bzr merge lp:~alan-griffiths/unity-system-compositor/tidy-config-options
Reviewer Review Type Date Requested Status
Andreas Pokorny (community) Approve
Alexandros Frantzis (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+210381@code.launchpad.net

Commit message

Tidy up of SystemCompositorConfigurationOptions

Description of the change

Set $MIR_SERVER_STANDALONE before parsing the environment variables to restore established behavior.

Remove coupling between SystemCompositorServerConfiguration and SystemCompositorConfigurationOptions

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
Alexandros Frantzis (afrantzis) wrote :

60 + setenv("MIR_SERVER_STANDALONE", "true", 0); // Default to standalone

Do we want to keep this for compatibility (the 'standalone' option doesn't exist any more)?

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> 60 + setenv("MIR_SERVER_STANDALONE", "true", 0); // Default to standalone
>
> Do we want to keep this for compatibility (the 'standalone' option doesn't
> exist any more)?

It needs removing for 0.1.7 - but there are other changes needed for that too.

Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/system_compositor.cpp'
--- src/system_compositor.cpp 2014-03-11 03:37:11 +0000
+++ src/system_compositor.cpp 2014-03-11 12:06:24 +0000
@@ -117,35 +117,11 @@
117 std::string active_session;117 std::string active_session;
118};118};
119119
120class SystemCompositorConfiguration : public mo::DefaultConfiguration
121{
122public:
123 SystemCompositorConfiguration(int argc, char **argv)
124 : mo::DefaultConfiguration(argc, const_cast<const char **>(argv))
125 {
126 add_options()
127 ("from-dm-fd", po::value<int>(), "File descriptor of read end of pipe from display manager [int]")
128 ("to-dm-fd", po::value<int>(), "File descriptor of write end of pipe to display manager [int]")
129 ("blacklist", po::value<std::string>(), "Video blacklist regex to use")
130 ("version", "Show version of Unity System Compositor")
131 ("public-socket", po::value<bool>(), "Make the socket file publicly writable")
132 ("power-off-delay", po::value<int>(), "Delay in milliseconds before powering off screen [int]");
133 }
134
135private:
136 void parse_config_file(po::options_description& desc, mo::ProgramOption& options) const
137 {
138 setenv("MIR_SERVER_STANDALONE", "true", 0); // Default to standalone
139 options.parse_file(desc, "unity-system-compositor.conf");
140 }
141};
142
143class SystemCompositorServerConfiguration : public mir::DefaultServerConfiguration120class SystemCompositorServerConfiguration : public mir::DefaultServerConfiguration
144{121{
145public:122public:
146 SystemCompositorServerConfiguration(SystemCompositor *compositor, int argc, char **argv)123 SystemCompositorServerConfiguration(SystemCompositor *compositor, std::shared_ptr<mo::Configuration> options)
147 : mir::DefaultServerConfiguration(std::make_shared<SystemCompositorConfiguration>(argc, argv)),124 : mir::DefaultServerConfiguration(options), compositor{compositor}
148 compositor{compositor}
149 {125 {
150 }126 }
151127
@@ -244,6 +220,31 @@
244 SystemCompositor *compositor;220 SystemCompositor *compositor;
245};221};
246222
223class SystemCompositorConfigurationOptions : public mo::DefaultConfiguration
224{
225public:
226 SystemCompositorConfigurationOptions(int argc, char const* argv[]) :
227 DefaultConfiguration(argc, argv)
228 {
229 add_options()
230 ("from-dm-fd", po::value<int>(), "File descriptor of read end of pipe from display manager [int]")
231 ("to-dm-fd", po::value<int>(), "File descriptor of write end of pipe to display manager [int]")
232 ("blacklist", po::value<std::string>(), "Video blacklist regex to use")
233 ("version", "Show version of Unity System Compositor")
234 ("public-socket", po::value<bool>(), "Make the socket file publicly writable")
235 ("power-off-delay", po::value<int>(), "Delay in milliseconds before powering off screen [int]");
236
237 setenv("MIR_SERVER_STANDALONE", "true", 0); // Default to standalone
238 }
239
240 void parse_config_file(
241 boost::program_options::options_description& options_description,
242 mo::ProgramOption& options) const override
243 {
244 options.parse_file(options_description, "unity-system-compositor.conf");
245 }
246};
247
247bool check_blacklist(std::string blacklist, const char *vendor, const char *renderer, const char *version)248bool check_blacklist(std::string blacklist, const char *vendor, const char *renderer, const char *version)
248{249{
249 if (blacklist.empty())250 if (blacklist.empty())
@@ -279,7 +280,8 @@
279280
280void SystemCompositor::run(int argc, char **argv)281void SystemCompositor::run(int argc, char **argv)
281{282{
282 config = std::make_shared<SystemCompositorServerConfiguration>(this, argc, argv);283 auto const options = std::make_shared<SystemCompositorConfigurationOptions>(argc, const_cast<char const **>(argv));
284 config = std::make_shared<SystemCompositorServerConfiguration>(this, options);
283285
284 if (config->show_version())286 if (config->show_version())
285 {287 {

Subscribers

People subscribed via source and target branches