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
1=== modified file 'src/system_compositor.cpp'
2--- src/system_compositor.cpp 2014-03-11 03:37:11 +0000
3+++ src/system_compositor.cpp 2014-03-11 12:06:24 +0000
4@@ -117,35 +117,11 @@
5 std::string active_session;
6 };
7
8-class SystemCompositorConfiguration : public mo::DefaultConfiguration
9-{
10-public:
11- SystemCompositorConfiguration(int argc, char **argv)
12- : mo::DefaultConfiguration(argc, const_cast<const char **>(argv))
13- {
14- add_options()
15- ("from-dm-fd", po::value<int>(), "File descriptor of read end of pipe from display manager [int]")
16- ("to-dm-fd", po::value<int>(), "File descriptor of write end of pipe to display manager [int]")
17- ("blacklist", po::value<std::string>(), "Video blacklist regex to use")
18- ("version", "Show version of Unity System Compositor")
19- ("public-socket", po::value<bool>(), "Make the socket file publicly writable")
20- ("power-off-delay", po::value<int>(), "Delay in milliseconds before powering off screen [int]");
21- }
22-
23-private:
24- void parse_config_file(po::options_description& desc, mo::ProgramOption& options) const
25- {
26- setenv("MIR_SERVER_STANDALONE", "true", 0); // Default to standalone
27- options.parse_file(desc, "unity-system-compositor.conf");
28- }
29-};
30-
31 class SystemCompositorServerConfiguration : public mir::DefaultServerConfiguration
32 {
33 public:
34- SystemCompositorServerConfiguration(SystemCompositor *compositor, int argc, char **argv)
35- : mir::DefaultServerConfiguration(std::make_shared<SystemCompositorConfiguration>(argc, argv)),
36- compositor{compositor}
37+ SystemCompositorServerConfiguration(SystemCompositor *compositor, std::shared_ptr<mo::Configuration> options)
38+ : mir::DefaultServerConfiguration(options), compositor{compositor}
39 {
40 }
41
42@@ -244,6 +220,31 @@
43 SystemCompositor *compositor;
44 };
45
46+class SystemCompositorConfigurationOptions : public mo::DefaultConfiguration
47+{
48+public:
49+ SystemCompositorConfigurationOptions(int argc, char const* argv[]) :
50+ DefaultConfiguration(argc, argv)
51+ {
52+ add_options()
53+ ("from-dm-fd", po::value<int>(), "File descriptor of read end of pipe from display manager [int]")
54+ ("to-dm-fd", po::value<int>(), "File descriptor of write end of pipe to display manager [int]")
55+ ("blacklist", po::value<std::string>(), "Video blacklist regex to use")
56+ ("version", "Show version of Unity System Compositor")
57+ ("public-socket", po::value<bool>(), "Make the socket file publicly writable")
58+ ("power-off-delay", po::value<int>(), "Delay in milliseconds before powering off screen [int]");
59+
60+ setenv("MIR_SERVER_STANDALONE", "true", 0); // Default to standalone
61+ }
62+
63+ void parse_config_file(
64+ boost::program_options::options_description& options_description,
65+ mo::ProgramOption& options) const override
66+ {
67+ options.parse_file(options_description, "unity-system-compositor.conf");
68+ }
69+};
70+
71 bool check_blacklist(std::string blacklist, const char *vendor, const char *renderer, const char *version)
72 {
73 if (blacklist.empty())
74@@ -279,7 +280,8 @@
75
76 void SystemCompositor::run(int argc, char **argv)
77 {
78- config = std::make_shared<SystemCompositorServerConfiguration>(this, argc, argv);
79+ auto const options = std::make_shared<SystemCompositorConfigurationOptions>(argc, const_cast<char const **>(argv));
80+ config = std::make_shared<SystemCompositorServerConfiguration>(this, options);
81
82 if (config->show_version())
83 {

Subscribers

People subscribed via source and target branches