/* * Copyright © 2014 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Alexandros Frantzis */ #ifndef USC_SERVER_H_ #define USC_SERVER_H_ #include #include #include #include namespace mir { namespace input { class EventFilter; } } namespace usc { class Spinner; class SessionSwitcher; class DMMessageHandler; class DMConnection; class Screen; class UnityDisplayService; class PowerButtonEventSink; class UserActivityEventSink; class InputConfiguration; class UnityInputService; class DBusConnectionThread; class DBusEventLoop; class Clock; class Server : private mir::Server { public: explicit Server(int argc, char** argv); using mir::Server::add_init_callback; using mir::Server::run; using mir::Server::the_main_loop; using mir::Server::the_composite_event_filter; using mir::Server::the_display; using mir::Server::the_compositor; using mir::Server::the_touch_visualizer; virtual std::shared_ptr the_spinner(); virtual std::shared_ptr the_dm_message_handler(); virtual std::shared_ptr the_dm_connection(); virtual std::shared_ptr the_screen(); virtual std::shared_ptr the_input_configuration(); virtual std::shared_ptr the_screen_event_handler(); virtual std::shared_ptr the_unity_display_service(); virtual std::shared_ptr the_unity_input_service(); virtual std::shared_ptr the_power_button_event_sink(); virtual std::shared_ptr the_user_activity_event_sink(); virtual std::shared_ptr the_dbus_event_loop(); virtual std::shared_ptr the_dbus_connection_thread(); virtual std::shared_ptr the_clock(); bool show_version() { return the_options()->is_set("version"); } std::string blacklist() { auto x = the_options()->get("blacklist", ""); return x; } bool public_socket() { return !the_options()->is_set("no-file") && the_options()->get("public-socket", true); } std::string get_socket_file() { // the_socket_file is private, so we have to re-implement it here return the_options()->get("file", "/tmp/mir_socket"); } private: inline auto the_options() -> decltype(mir::Server::get_options()) { return mir::Server::get_options(); } bool enable_hardware_cursor() { return the_options()->get("enable-hardware-cursor", false); } std::string spinner_executable() { // TODO: once our default spinner is ready for use everywhere, replace // default value with DEFAULT_SPINNER instead of the empty string. auto x = the_options()->get("spinner", ""); return x; } virtual std::shared_ptr the_session_switcher(); std::string dbus_bus_address(); mir::CachedPtr spinner; mir::CachedPtr dm_connection; mir::CachedPtr session_switcher; mir::CachedPtr screen; mir::CachedPtr input_configuration; mir::CachedPtr screen_event_handler; mir::CachedPtr dbus_thread; mir::CachedPtr dbus_loop; mir::CachedPtr unity_display_service; mir::CachedPtr power_button_event_sink; mir::CachedPtr user_activity_event_sink; mir::CachedPtr unity_input_service; mir::CachedPtr clock; }; } #endif