Merge lp:~alan-griffiths/unity-system-compositor/add-display-config-option into lp:unity-system-compositor

Proposed by Alan Griffiths on 2015-06-16
Status: Merged
Approved by: Gerry Boland on 2015-08-26
Approved revision: 227
Merged at revision: 250
Proposed branch: lp:~alan-griffiths/unity-system-compositor/add-display-config-option
Merge into: lp:unity-system-compositor
Diff against target: 122 lines (+85/-0)
4 files modified
src/CMakeLists.txt (+1/-0)
src/display_configuration_policy.cpp (+56/-0)
src/display_configuration_policy.h (+26/-0)
src/server.cpp (+2/-0)
To merge this branch: bzr merge lp:~alan-griffiths/unity-system-compositor/add-display-config-option
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve on 2015-08-26
Gerry Boland Approve on 2015-08-26
Alexandros Frantzis (community) 2015-06-16 Approve on 2015-07-20
Review via email: mp+262110@code.launchpad.net

Commit Message

Add conf option: --display-config arg (=sidebyside) [{clone,sidebyside,single}]

Description of the Change

Add conf option: --display-config arg (=sidebyside) [{clone,sidebyside,single}]

PS Don't try to publish ahead of Mir-0.15: it depends on -c 2713 in lp:mir (which happened after 0.14 was forked).

To post a comment you must log in.
223. By Alan Griffiths on 2015-07-20

Update to use mir0.14 support

224. By Alan Griffiths on 2015-07-20

merge lp:unity-system-compositor

Alexandros Frantzis (afrantzis) wrote :

OK.

review: Approve
Gerry Boland (gerboland) wrote :

Why are you trying to select a DisplayConfig with an alpha channel? I didn't think USC needed that, and would be more efficient without.

Rest looks fine

review: Needs Information
Alan Griffiths (alan-griffiths) wrote :

> Why are you trying to select a DisplayConfig with an alpha channel? I didn't
> think USC needed that, and would be more efficient without.
>
> Rest looks fine

I guess it isn't needed. Was just blindly copied from mir_demo_server.

Will fix

225. By Alan Griffiths on 2015-07-20

Remove pointless alpha option

Gerry Boland (gerboland) wrote :

Code looks fine, but I'm holding off testing until Mir0.14 lands, as mir/graphics/default_display_configuration_policy.h not in 0.13

Gerry Boland (gerboland) wrote :

You must've missed my ping yesterday. If I merge this into USC trunk, I get a conflict.

review: Needs Fixing
226. By Alan Griffiths on 2015-07-29

merge lp:unity-system-compositor

227. By Alan Griffiths on 2015-08-26

merge lp:unity-system-compositor

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/CMakeLists.txt'
2--- src/CMakeLists.txt 2015-07-15 13:48:30 +0000
3+++ src/CMakeLists.txt 2015-08-26 10:12:50 +0000
4@@ -19,6 +19,7 @@
5 dbus_connection_handle.cpp
6 dbus_event_loop.cpp
7 dbus_message_handle.cpp
8+ display_configuration_policy.cpp
9 external_spinner.cpp
10 mir_screen.cpp
11 powerd_mediator.cpp
12
13=== added file 'src/display_configuration_policy.cpp'
14--- src/display_configuration_policy.cpp 1970-01-01 00:00:00 +0000
15+++ src/display_configuration_policy.cpp 2015-08-26 10:12:50 +0000
16@@ -0,0 +1,56 @@
17+/*
18+ * Copyright © 2014-2015 Canonical Ltd.
19+ *
20+ * This program is free software: you can redistribute it and/or modify it
21+ * under the terms of the GNU General Public License version 3,
22+ * as published by the Free Software Foundation.
23+ *
24+ * This program is distributed in the hope that it will be useful,
25+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
26+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27+ * GNU General Public License for more details.
28+ *
29+ * You should have received a copy of the GNU General Public License
30+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
31+ *
32+ * Authored By: Alan Griffiths <alan@octopull.co.uk>
33+ */
34+
35+#include "display_configuration_policy.h"
36+
37+#include <mir/graphics/default_display_configuration_policy.h>
38+#include <mir/graphics/display_configuration.h>
39+#include <mir/server.h>
40+#include <mir/options/option.h>
41+
42+namespace mg = mir::graphics;
43+
44+void add_display_configuration_options_to(mir::Server& server)
45+{
46+ static char const* const display_config_opt = "display-config";
47+ static char const* const display_config_descr = "Display configuration [{clone,sidebyside,single}]";
48+
49+ static char const* const sidebyside_opt_val = "sidebyside";
50+ static char const* const single_opt_val = "single";
51+
52+ // Add choice of monitor configuration
53+ server.add_configuration_option(
54+ display_config_opt, display_config_descr, sidebyside_opt_val);
55+
56+ server.wrap_display_configuration_policy(
57+ [&](std::shared_ptr<mg::DisplayConfigurationPolicy> const& wrapped)
58+ -> std::shared_ptr<mg::DisplayConfigurationPolicy>
59+ {
60+ auto const options = server.get_options();
61+ auto display_layout = options->get<std::string>(display_config_opt);
62+
63+ auto layout_selector = wrapped;
64+
65+ if (display_layout == sidebyside_opt_val)
66+ layout_selector = std::make_shared<mg::SideBySideDisplayConfigurationPolicy>();
67+ else if (display_layout == single_opt_val)
68+ layout_selector = std::make_shared<mg::SingleDisplayConfigurationPolicy>();
69+
70+ return layout_selector;
71+ });
72+}
73
74=== added file 'src/display_configuration_policy.h'
75--- src/display_configuration_policy.h 1970-01-01 00:00:00 +0000
76+++ src/display_configuration_policy.h 2015-08-26 10:12:50 +0000
77@@ -0,0 +1,26 @@
78+/*
79+ * Copyright © 2015 Canonical Ltd.
80+ *
81+ * This program is free software: you can redistribute it and/or modify it
82+ * under the terms of the GNU General Public License version 3,
83+ * as published by the Free Software Foundation.
84+ *
85+ * This program is distributed in the hope that it will be useful,
86+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
87+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
88+ * GNU General Public License for more details.
89+ *
90+ * You should have received a copy of the GNU General Public License
91+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
92+ *
93+ * Authored By: Alan Griffiths <alan@octopull.co.uk>
94+ */
95+
96+#ifndef MIR_EXAMPLE_DISPLAY_CONFIGURATION_POLICY_H_
97+#define MIR_EXAMPLE_DISPLAY_CONFIGURATION_POLICY_H_
98+
99+namespace mir { class Server; }
100+
101+void add_display_configuration_options_to(mir::Server& server);
102+
103+#endif /* MIR_EXAMPLE_DISPLAY_CONFIGURATION_POLICY_H_ */
104
105=== modified file 'src/server.cpp'
106--- src/server.cpp 2015-07-15 13:48:31 +0000
107+++ src/server.cpp 2015-08-26 10:12:50 +0000
108@@ -25,6 +25,7 @@
109 #include "screen_event_handler.h"
110 #include "powerd_mediator.h"
111 #include "unity_screen_service.h"
112+#include "display_configuration_policy.h"
113 #include "steady_clock.h"
114
115 #include <mir/input/cursor_listener.h>
116@@ -118,6 +119,7 @@
117 add_configuration_option("shutdown-timeout", "The time in milli-seconds the power key must be held to initiate a clean system shutdown", mir::OptionType::integer);
118 add_configuration_option("power-key-ignore-timeout", "The time in milli-seconds the power key must be held to ignore - must be less than shutdown-timeout", mir::OptionType::integer);
119 add_configuration_option("disable-inactivity-policy", "Disables handling user inactivity and power key", mir::OptionType::boolean);
120+ add_display_configuration_options_to(*this);
121 add_configuration_option("notification-display-off-timeout", "The time in seconds before the screen is turned off after a notification arrives", mir::OptionType::integer);
122 add_configuration_option("notification-display-dim-timeout", "The time in seconds before the screen is dimmed after a notification arrives", mir::OptionType::integer);
123

Subscribers

People subscribed via source and target branches