Merge lp:~alan-griffiths/unity-system-compositor/migrate-to-mir-Server-API into lp:unity-system-compositor

Proposed by Alan Griffiths
Status: Merged
Approved by: Alan Griffiths
Approved revision: 195
Merged at revision: 190
Proposed branch: lp:~alan-griffiths/unity-system-compositor/migrate-to-mir-Server-API
Merge into: lp:unity-system-compositor
Diff against target: 630 lines (+171/-185)
9 files modified
src/CMakeLists.txt (+1/-1)
src/main.cpp (+2/-2)
src/powerkey_handler.h (+0/-1)
src/screen_state_handler.cpp (+8/-8)
src/screen_state_handler.h (+3/-3)
src/server.cpp (+107/-125)
src/server.h (+19/-12)
src/system_compositor.cpp (+27/-28)
src/system_compositor.h (+4/-5)
To merge this branch: bzr merge lp:~alan-griffiths/unity-system-compositor/migrate-to-mir-Server-API
Reviewer Review Type Date Requested Status
Alberto Aguirre (community) Approve
Alexandros Frantzis (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+240566@code.launchpad.net

Commit message

Migration of unity-system-compositor from the legacy Mir API

Description of the change

Migration of unity-system-compositor from the legacy Mir API

To post a comment you must log in.
195. By Alan Griffiths

Restore lifetme of dm_connection

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

Works fine on krillin/15.04(r39)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

Looks good.

review: Approve
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

LGTM. Tested on mako vivid #33

Revision history for this message
Alberto Aguirre (albaguirre) :
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 2014-09-16 00:20:05 +0000
3+++ src/CMakeLists.txt 2014-11-28 13:19:40 +0000
4@@ -21,7 +21,7 @@
5 powerd_mediator.cpp
6 powerkey_handler.cpp
7 screen_state_handler.cpp
8- server_configuration.cpp
9+ server.cpp
10 session_coordinator.cpp
11 session_switcher.cpp
12 surface_coordinator.cpp
13
14=== modified file 'src/main.cpp'
15--- src/main.cpp 2014-07-09 06:58:05 +0000
16+++ src/main.cpp 2014-11-28 13:19:40 +0000
17@@ -18,7 +18,7 @@
18 */
19
20 #include "system_compositor.h"
21-#include "server_configuration.h"
22+#include "server.h"
23
24 #include <mir/report_exception.h>
25 #include <iostream>
26@@ -26,7 +26,7 @@
27 int main(int argc, char *argv[])
28 try
29 {
30- auto const config = std::make_shared<usc::ServerConfiguration>(argc, argv);
31+ auto const config = std::make_shared<usc::Server>(argc, argv);
32
33 usc::SystemCompositor system_compositor{config};
34 system_compositor.run();
35
36=== modified file 'src/powerkey_handler.h'
37--- src/powerkey_handler.h 2014-07-21 21:33:35 +0000
38+++ src/powerkey_handler.h 2014-11-28 13:19:40 +0000
39@@ -26,7 +26,6 @@
40
41 namespace mir
42 {
43-class DefaultServerConfiguration;
44 namespace time
45 {
46 class Alarm;
47
48=== modified file 'src/screen_state_handler.cpp'
49--- src/screen_state_handler.cpp 2014-09-22 17:19:52 +0000
50+++ src/screen_state_handler.cpp 2014-11-28 13:19:40 +0000
51@@ -19,7 +19,6 @@
52 #include <mir/main_loop.h>
53 #include <mir/time/timer.h>
54 #include <mir/compositor/compositor.h>
55-#include <mir/default_server_configuration.h>
56 #include <mir/graphics/display.h>
57 #include <mir/graphics/display_configuration.h>
58 #include <mir/input/touch_visualizer.h>
59@@ -29,12 +28,13 @@
60 #include "dbus_screen_observer.h"
61 #include "powerd_mediator.h"
62 #include "power_state_change_reason.h"
63+#include "server.h"
64
65 namespace mi = mir::input;
66 namespace mc = mir::compositor;
67 namespace mg = mir::graphics;
68
69-ScreenStateHandler::ScreenStateHandler(std::shared_ptr<mir::DefaultServerConfiguration> const& config,
70+ScreenStateHandler::ScreenStateHandler(std::shared_ptr<usc::Server> const& server,
71 std::chrono::milliseconds poweroff_timeout,
72 std::chrono::milliseconds dimmer_timeout)
73 : current_power_mode{MirPowerMode::mir_power_mode_on},
74@@ -42,10 +42,10 @@
75 power_off_timeout{poweroff_timeout},
76 dimming_timeout{dimmer_timeout},
77 powerd_mediator{new PowerdMediator()},
78- config{config},
79- power_off_alarm{config->the_main_loop()->create_alarm(
80+ server{server},
81+ power_off_alarm{server->the_main_loop()->create_alarm(
82 std::bind(&ScreenStateHandler::power_off_alarm_notification, this))},
83- dimmer_alarm{config->the_main_loop()->create_alarm(
84+ dimmer_alarm{server->the_main_loop()->create_alarm(
85 std::bind(&ScreenStateHandler::dimmer_alarm_notification, this))},
86 dbus_screen{new DBusScreen(*this)}
87 {
88@@ -148,9 +148,9 @@
89 if (current_power_mode == mode)
90 return;
91
92- std::shared_ptr<mg::Display> display = config->the_display();
93+ std::shared_ptr<mg::Display> display = server->the_display();
94 std::shared_ptr<mg::DisplayConfiguration> displayConfig = display->configuration();
95- std::shared_ptr<mc::Compositor> compositor = config->the_compositor();
96+ std::shared_ptr<mc::Compositor> compositor = server->the_compositor();
97
98 displayConfig->for_each_output(
99 [&](const mg::UserDisplayConfigurationOutput displayConfigOutput) {
100@@ -229,7 +229,7 @@
101 {
102 std::lock_guard<std::mutex> lock{guard};
103
104- auto visualizer = config->the_touch_visualizer();
105+ auto visualizer = server->the_touch_visualizer();
106 if (enabled)
107 visualizer->enable();
108 else
109
110=== modified file 'src/screen_state_handler.h'
111--- src/screen_state_handler.h 2014-09-04 22:30:24 +0000
112+++ src/screen_state_handler.h 2014-11-28 13:19:40 +0000
113@@ -27,10 +27,10 @@
114 class DBusScreen;
115 class PowerdMediator;
116 enum class PowerStateChangeReason;
117+namespace usc { class Server; }
118
119 namespace mir
120 {
121-class DefaultServerConfiguration;
122 namespace time
123 {
124 class Alarm;
125@@ -41,7 +41,7 @@
126 class ScreenStateHandler: public mir::input::EventFilter, public DBusScreenObserver
127 {
128 public:
129- ScreenStateHandler(std::shared_ptr<mir::DefaultServerConfiguration> const& config,
130+ ScreenStateHandler(std::shared_ptr<usc::Server> const& server,
131 std::chrono::milliseconds power_off_timeout,
132 std::chrono::milliseconds dimmer_timeout);
133 virtual ~ScreenStateHandler();
134@@ -81,7 +81,7 @@
135 std::chrono::milliseconds dimming_timeout;
136
137 std::unique_ptr<PowerdMediator> powerd_mediator;
138- std::shared_ptr<mir::DefaultServerConfiguration> config;
139+ std::shared_ptr<usc::Server> server;
140
141 std::unique_ptr<mir::time::Alarm> power_off_alarm;
142 std::unique_ptr<mir::time::Alarm> dimmer_alarm;
143
144=== renamed file 'src/server_configuration.cpp' => 'src/server.cpp'
145--- src/server_configuration.cpp 2014-10-22 19:31:57 +0000
146+++ src/server.cpp 2014-11-28 13:19:40 +0000
147@@ -16,28 +16,24 @@
148 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
149 */
150
151-#include "server_configuration.h"
152+#include "server.h"
153 #include "external_spinner.h"
154 #include "session_coordinator.h"
155 #include "surface_coordinator.h"
156 #include "asio_dm_connection.h"
157 #include "session_switcher.h"
158
159-#include <mir/options/default_configuration.h>
160 #include <mir/input/cursor_listener.h>
161 #include <mir/server_status_listener.h>
162 #include <mir/shell/focus_controller.h>
163 #include <mir/scene/session.h>
164
165-#include <boost/program_options.hpp>
166 #include <iostream>
167
168 namespace msh = mir::shell;
169 namespace ms = mir::scene;
170 namespace mf = mir::frontend;
171 namespace mi = mir::input;
172-namespace mo = mir::options;
173-namespace po = boost::program_options;
174
175 namespace
176 {
177@@ -50,123 +46,109 @@
178 std::cout << std::endl;
179 }
180
181-class ConfigurationOptions : public mo::DefaultConfiguration
182-{
183-public:
184- ConfigurationOptions(int argc, char const* argv[]) :
185- DefaultConfiguration(argc, argv, &ignore_unknown_arguments)
186- {
187- add_options()
188- ("from-dm-fd", po::value<int>(), "File descriptor of read end of pipe from display manager [int]")
189- ("to-dm-fd", po::value<int>(), "File descriptor of write end of pipe to display manager [int]")
190- ("blacklist", po::value<std::string>(), "Video blacklist regex to use")
191- ("version", "Show version of Unity System Compositor")
192- ("spinner", po::value<std::string>(), "Path to spinner executable")
193- ("public-socket", po::value<bool>(), "Make the socket file publicly writable")
194- ("enable-hardware-cursor", po::value<bool>(), "Enable the hardware cursor (disabled by default)")
195- ("inactivity-display-off-timeout", po::value<int>(), "The time in seconds before the screen is turned off when there are no active sessions")
196- ("inactivity-display-dim-timeout", po::value<int>(), "The time in seconds before the screen is dimmed when there are no active sessions")
197- ("shutdown-timeout", po::value<int>(), "The time in milli-seconds the power key must be held to initiate a clean system shutdown")
198- ("power-key-ignore-timeout", po::value<int>(), "The time in milli-seconds the power key must be held to ignore - must be less than shutdown-timeout")
199- ("disable-inactivity-policy", po::value<bool>(), "Disables handling user inactivity and power key");
200- }
201-
202- void parse_config_file(
203- boost::program_options::options_description& options_description,
204- mo::ProgramOption& options) const override
205- {
206- options.parse_file(options_description, "unity-system-compositor.conf");
207- }
208-};
209-
210-}
211-
212-usc::ServerConfiguration::ServerConfiguration(int argc, char** argv)
213- : mir::DefaultServerConfiguration(
214- std::make_shared<ConfigurationOptions>(argc, const_cast<char const **>(argv)))
215-{
216-}
217-
218-std::shared_ptr<mi::CursorListener>
219-usc::ServerConfiguration::the_cursor_listener()
220-{
221- struct NullCursorListener : public mi::CursorListener
222- {
223- void cursor_moved_to(float, float) override
224- {
225- }
226- };
227-
228- // This is a workaround for u8 desktop preview in 14.04 for the lack of client cursor API.
229- // We need to disable the cursor for XMir but leave it on for the desktop preview.
230- // Luckily as it stands they run inside seperate instances of USC. ~racarr
231- if (enable_hardware_cursor())
232- return mir::DefaultServerConfiguration::the_cursor_listener();
233- else
234- return std::make_shared<NullCursorListener>();
235-}
236-
237-std::shared_ptr<mir::ServerStatusListener>
238-usc::ServerConfiguration::the_server_status_listener()
239-{
240- struct ServerStatusListener : public mir::ServerStatusListener
241- {
242- explicit ServerStatusListener(
243- std::shared_ptr<msh::FocusController> const& focus_controller)
244- : focus_controller{focus_controller}
245- {
246- }
247-
248- void paused() override
249- {
250- std::cerr << "pause" << std::endl;
251-
252- if (auto active_session = weak_active_session().lock())
253- active_session->set_lifecycle_state(mir_lifecycle_state_will_suspend);
254- }
255-
256- void resumed() override
257- {
258- std::cerr << "resume" << std::endl;
259-
260- if (auto active_session = weak_active_session().lock())
261- active_session->set_lifecycle_state(mir_lifecycle_state_resumed);
262- }
263-
264- void started() override
265- {
266- }
267-
268- std::weak_ptr<ms::Session> weak_active_session()
269- {
270- return focus_controller->focussed_application();
271- }
272-
273- std::shared_ptr<msh::FocusController> const focus_controller;
274- };
275-
276- return std::make_shared<ServerStatusListener>(the_focus_controller());
277-}
278-
279-std::shared_ptr<mir::scene::SessionCoordinator>
280-usc::ServerConfiguration::wrap_session_coordinator(
281- std::shared_ptr<ms::SessionCoordinator> const& wrapped)
282-{
283- return std::make_shared<SessionCoordinator>(
284- wrapped,
285- the_session_switcher());
286-}
287-
288-std::shared_ptr<mir::scene::SurfaceCoordinator>
289-usc::ServerConfiguration::wrap_surface_coordinator(
290- std::shared_ptr<ms::SurfaceCoordinator> const& wrapped)
291-{
292- return std::make_shared<SurfaceCoordinator>(
293- wrapped,
294- the_session_switcher());
295-}
296-
297-std::shared_ptr<usc::Spinner> usc::ServerConfiguration::the_spinner()
298+struct NullCursorListener : public mi::CursorListener
299+{
300+ void cursor_moved_to(float, float) override
301+ {
302+ }
303+};
304+
305+struct ServerStatusListener : public mir::ServerStatusListener
306+{
307+ explicit ServerStatusListener(
308+ std::shared_ptr<msh::FocusController> const& focus_controller)
309+ : focus_controller{focus_controller}
310+ {
311+ }
312+
313+ void paused() override
314+ {
315+ std::cerr << "pause" << std::endl;
316+
317+ if (auto active_session = weak_active_session().lock())
318+ active_session->set_lifecycle_state(mir_lifecycle_state_will_suspend);
319+ }
320+
321+ void resumed() override
322+ {
323+ std::cerr << "resume" << std::endl;
324+
325+ if (auto active_session = weak_active_session().lock())
326+ active_session->set_lifecycle_state(mir_lifecycle_state_resumed);
327+ }
328+
329+ void started() override
330+ {
331+ }
332+
333+ std::weak_ptr<ms::Session> weak_active_session()
334+ {
335+ return focus_controller->focussed_application();
336+ }
337+
338+ std::shared_ptr<msh::FocusController> const focus_controller;
339+};
340+}
341+
342+usc::Server::Server(int argc, char** argv)
343+{
344+ add_configuration_option("from-dm-fd", "File descriptor of read end of pipe from display manager [int]", mir::OptionType::integer);
345+ add_configuration_option("to-dm-fd", "File descriptor of write end of pipe to display manager [int]", mir::OptionType::integer);
346+ add_configuration_option("blacklist", "Video blacklist regex to use", mir::OptionType::string);
347+ add_configuration_option("version", "Show version of Unity System Compositor", mir::OptionType::null);
348+ add_configuration_option("spinner", "Path to spinner executable", mir::OptionType::string);
349+ add_configuration_option("public-socket", "Make the socket file publicly writable", mir::OptionType::boolean);
350+ add_configuration_option("enable-hardware-cursor", "Enable the hardware cursor (disabled by default)", mir::OptionType::boolean);
351+ add_configuration_option("inactivity-display-off-timeout", "The time in seconds before the screen is turned off when there are no active sessions", mir::OptionType::integer);
352+ add_configuration_option("inactivity-display-dim-timeout", "The time in seconds before the screen is dimmed when there are no active sessions", mir::OptionType::integer);
353+ 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);
354+ 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);
355+ add_configuration_option("disable-inactivity-policy", "Disables handling user inactivity and power key", mir::OptionType::boolean);
356+
357+ set_command_line(argc, const_cast<char const **>(argv));
358+
359+ set_command_line_handler(&ignore_unknown_arguments);
360+
361+ wrap_cursor_listener([this](std::shared_ptr<mir::input::CursorListener> const& default_)
362+ -> std::shared_ptr<mir::input::CursorListener>
363+ {
364+ // This is a workaround for u8 desktop preview in 14.04 for the lack of client cursor API.
365+ // We need to disable the cursor for XMir but leave it on for the desktop preview.
366+ // Luckily as it stands they run inside seperate instances of USC. ~racarr
367+ if (enable_hardware_cursor())
368+ return default_;
369+ else
370+ return std::make_shared<NullCursorListener>();
371+ });
372+
373+ override_the_server_status_listener([this]()
374+ -> std::shared_ptr<mir::ServerStatusListener>
375+ {
376+ return std::make_shared<ServerStatusListener>(the_focus_controller());
377+ });
378+
379+ wrap_session_coordinator([this](std::shared_ptr<ms::SessionCoordinator> const& wrapped)
380+ -> std::shared_ptr<ms::SessionCoordinator>
381+ {
382+ return std::make_shared<SessionCoordinator>(
383+ wrapped,
384+ the_session_switcher());
385+ });
386+
387+ wrap_surface_coordinator([this](std::shared_ptr<ms::SurfaceCoordinator> const& wrapped)
388+ -> std::shared_ptr<mir::scene::SurfaceCoordinator>
389+ {
390+ return std::make_shared<SurfaceCoordinator>(
391+ wrapped,
392+ the_session_switcher());
393+ });
394+
395+ set_config_filename("unity-system-compositor.conf");
396+
397+ apply_settings();
398+}
399+
400+std::shared_ptr<usc::Spinner> usc::Server::the_spinner()
401 {
402 return spinner(
403 [this]
404@@ -177,7 +159,7 @@
405 });
406 }
407
408-std::shared_ptr<usc::SessionSwitcher> usc::ServerConfiguration::the_session_switcher()
409+std::shared_ptr<usc::SessionSwitcher> usc::Server::the_session_switcher()
410 {
411 return session_switcher(
412 [this]
413@@ -187,12 +169,12 @@
414 });
415 }
416
417-std::shared_ptr<usc::DMMessageHandler> usc::ServerConfiguration::the_dm_message_handler()
418+std::shared_ptr<usc::DMMessageHandler> usc::Server::the_dm_message_handler()
419 {
420 return the_session_switcher();
421 }
422
423-std::shared_ptr<usc::DMConnection> usc::ServerConfiguration::the_dm_connection()
424+std::shared_ptr<usc::DMConnection> usc::Server::the_dm_connection()
425 {
426 return dm_connection(
427 [this]
428
429=== renamed file 'src/server_configuration.h' => 'src/server.h'
430--- src/server_configuration.h 2014-10-22 19:31:57 +0000
431+++ src/server.h 2014-11-28 13:19:40 +0000
432@@ -16,10 +16,11 @@
433 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
434 */
435
436-#ifndef USC_SERVER_CONFIGURATION_H_
437-#define USC_SERVER_CONFIGURATION_H_
438+#ifndef USC_SERVER_H_
439+#define USC_SERVER_H_
440
441-#include <mir/default_server_configuration.h>
442+#include <mir/server.h>
443+#include <mir/cached_ptr.h>
444 #include <mir/options/option.h>
445
446 namespace usc
447@@ -29,10 +30,18 @@
448 class DMMessageHandler;
449 class DMConnection;
450
451-class ServerConfiguration : public mir::DefaultServerConfiguration
452+class Server : private mir::Server
453 {
454 public:
455- explicit ServerConfiguration(int argc, char** argv);
456+ explicit Server(int argc, char** argv);
457+
458+ using mir::Server::add_init_callback;
459+ using mir::Server::run;
460+ using mir::Server::the_main_loop;
461+ using mir::Server::the_composite_event_filter;
462+ using mir::Server::the_display;
463+ using mir::Server::the_compositor;
464+ using mir::Server::the_touch_visualizer;
465
466 virtual std::shared_ptr<Spinner> the_spinner();
467 virtual std::shared_ptr<DMMessageHandler> the_dm_message_handler();
468@@ -100,14 +109,12 @@
469 return the_options()->get("file", "/tmp/mir_socket");
470 }
471
472-protected:
473+private:
474+ inline auto the_options()
475+ -> decltype(mir::Server::get_options())
476+ { return mir::Server::get_options(); }
477+
478 virtual std::shared_ptr<SessionSwitcher> the_session_switcher();
479- std::shared_ptr<mir::input::CursorListener> the_cursor_listener() override;
480- std::shared_ptr<mir::ServerStatusListener> the_server_status_listener() override;
481- std::shared_ptr<mir::scene::SessionCoordinator> wrap_session_coordinator(
482- std::shared_ptr<mir::scene::SessionCoordinator> const& wrapped) override;
483- std::shared_ptr<mir::scene::SurfaceCoordinator> wrap_surface_coordinator(
484- std::shared_ptr<mir::scene::SurfaceCoordinator> const& wrapped) override;
485
486 mir::CachedPtr<Spinner> spinner;
487 mir::CachedPtr<DMConnection> dm_connection;
488
489=== modified file 'src/system_compositor.cpp'
490--- src/system_compositor.cpp 2014-10-22 18:23:08 +0000
491+++ src/system_compositor.cpp 2014-11-28 13:19:40 +0000
492@@ -19,7 +19,7 @@
493
494
495 #include "system_compositor.h"
496-#include "server_configuration.h"
497+#include "server.h"
498 #include "dm_connection.h"
499 #include "spinner.h"
500 #include "screen_state_handler.h"
501@@ -86,16 +86,15 @@
502 }
503
504 usc::SystemCompositor::SystemCompositor(
505- std::shared_ptr<ServerConfiguration> const& config)
506- : config{config},
507- dm_connection{config->the_dm_connection()},
508- spinner{config->the_spinner()}
509+ std::shared_ptr<Server> const& server)
510+ : server{server},
511+ spinner{server->the_spinner()}
512 {
513 }
514
515 void usc::SystemCompositor::run()
516 {
517- if (config->show_version())
518+ if (server->show_version())
519 {
520 std::cerr << "unity-system-compositor " << USC_VERSION << std::endl;
521 return;
522@@ -115,7 +114,7 @@
523 std::thread qt_thread;
524 } guard;
525
526- mir::run_mir(*config, [&](mir::DisplayServer&)
527+ server->add_init_callback([&]
528 {
529 auto vendor = (char *) glGetString(GL_VENDOR);
530 auto renderer = (char *) glGetString (GL_RENDERER);
531@@ -124,23 +123,23 @@
532 std::cerr << "GL_RENDERER = " << renderer << std::endl;
533 std::cerr << "GL_VERSION = " << version << std::endl;
534
535- if (!check_blacklist(config->blacklist(), vendor, renderer, version))
536+ if (!check_blacklist(server->blacklist(), vendor, renderer, version))
537 throw mir::AbnormalExit ("Video driver is blacklisted, exiting");
538
539- main();
540+ dm_connection = server->the_dm_connection();
541+
542+ // Make socket world-writable, since users need to talk to us. No worries
543+ // about race condition, since we are adding permissions, not restricting
544+ // them.
545+ if (server->public_socket() && chmod(server->get_socket_file().c_str(), 0777) == -1)
546+ std::cerr << "Unable to chmod socket file " << server->get_socket_file() << ": " << strerror(errno) << std::endl;
547+
548+ dm_connection->start();
549+
550 guard.qt_thread = std::thread(&SystemCompositor::qt_main, this);
551 });
552-}
553-
554-void usc::SystemCompositor::main()
555-{
556- // Make socket world-writable, since users need to talk to us. No worries
557- // about race condition, since we are adding permissions, not restricting
558- // them.
559- if (config->public_socket() && chmod(config->get_socket_file().c_str(), 0777) == -1)
560- std::cerr << "Unable to chmod socket file " << config->get_socket_file() << ": " << strerror(errno) << std::endl;
561-
562- dm_connection->start();
563+
564+ server->run();
565 }
566
567 void usc::SystemCompositor::qt_main()
568@@ -148,23 +147,23 @@
569 int argc{0};
570 QCoreApplication app(argc, nullptr);
571
572- if (!config->disable_inactivity_policy())
573+ if (!server->disable_inactivity_policy())
574 {
575- std::chrono::seconds inactivity_display_off_timeout{config->inactivity_display_off_timeout()};
576- std::chrono::seconds inactivity_display_dim_timeout{config->inactivity_display_dim_timeout()};
577- std::chrono::milliseconds power_key_ignore_timeout{config->power_key_ignore_timeout()};
578- std::chrono::milliseconds shutdown_timeout{config->shutdown_timeout()};
579+ std::chrono::seconds inactivity_display_off_timeout{server->inactivity_display_off_timeout()};
580+ std::chrono::seconds inactivity_display_dim_timeout{server->inactivity_display_dim_timeout()};
581+ std::chrono::milliseconds power_key_ignore_timeout{server->power_key_ignore_timeout()};
582+ std::chrono::milliseconds shutdown_timeout{server->shutdown_timeout()};
583
584- screen_state_handler = std::make_shared<ScreenStateHandler>(config,
585+ screen_state_handler = std::make_shared<ScreenStateHandler>(server,
586 std::chrono::duration_cast<std::chrono::milliseconds>(inactivity_display_off_timeout),
587 std::chrono::duration_cast<std::chrono::milliseconds>(inactivity_display_dim_timeout));
588
589- power_key_handler = std::make_shared<PowerKeyHandler>(*(config->the_main_loop()),
590+ power_key_handler = std::make_shared<PowerKeyHandler>(*(server->the_main_loop()),
591 power_key_ignore_timeout,
592 shutdown_timeout,
593 *screen_state_handler);
594
595- auto composite_filter = config->the_composite_event_filter();
596+ auto composite_filter = server->the_composite_event_filter();
597 composite_filter->append(screen_state_handler);
598 composite_filter->append(power_key_handler);
599 }
600
601=== modified file 'src/system_compositor.h'
602--- src/system_compositor.h 2014-10-22 19:31:57 +0000
603+++ src/system_compositor.h 2014-11-28 13:19:40 +0000
604@@ -28,22 +28,21 @@
605 namespace usc
606 {
607
608-class ServerConfiguration;
609+class Server;
610 class DMConnection;
611 class Spinner;
612
613 class SystemCompositor
614 {
615 public:
616- explicit SystemCompositor(std::shared_ptr<ServerConfiguration> const& config);
617+ explicit SystemCompositor(std::shared_ptr<Server> const& server);
618 void run();
619
620 private:
621- void main();
622 void qt_main();
623
624- std::shared_ptr<ServerConfiguration> const config;
625- std::shared_ptr<DMConnection> const dm_connection;
626+ std::shared_ptr<Server> const server;
627+ std::shared_ptr<DMConnection> dm_connection;
628 std::shared_ptr<Spinner> const spinner;
629 std::shared_ptr<ScreenStateHandler> screen_state_handler;
630 std::shared_ptr<PowerKeyHandler> power_key_handler;

Subscribers

People subscribed via source and target branches