30 namespace compositor {
class Compositor;
class DisplayBufferCompositorFactory; }
31 namespace frontend {
class SessionAuthorizer;
class Session;
class SessionMediatorReport; }
32 namespace graphics {
class Platform;
class Display;
class GLConfig;
class DisplayConfigurationPolicy; }
33 namespace input {
class CompositeEventFilter;
class InputDispatcher;
class CursorListener;
class TouchVisualizer; }
34 namespace logging {
class Logger; }
35 namespace options {
class Option; }
39 class FocusController;
40 class HostLifecycleEventListener;
46 class PlacementStrategy;
47 class PromptSessionListener;
48 class PromptSessionManager;
49 class SessionListener;
50 class SessionCoordinator;
51 class SurfaceConfigurator;
52 class SurfaceCoordinator;
57 class ServerStatusListener;
124 char const* default_value);
150 std::function<
void(
int argc,
char const*
const* argv)>
const& command_line_hander);
161 auto get_options()
const -> std::shared_ptr<options::Option>;
206 template<
typename T>
using Builder = std::function<std::shared_ptr<T>()>;
258 template<
typename T>
using Wrapper = std::function<std::shared_ptr<T>(std::shared_ptr<T>
const&)>;
326 auto
the_shell() const ->
std::shared_ptr<shell::Shell>;
365 struct ServerConfiguration;
367 std::shared_ptr<Self> const self;
All things Mir.
Definition: buffer_stream.h:37
void add_emergency_cleanup(EmergencyCleanupHandler const &handler)
Add cleanup for abnormal terminations. handler will be called on receipt of a fatal signal after whic...
Definition: server.cpp:329
void wrap_shell(Wrapper< shell::Shell > const &wrapper)
Sets a wrapper functor for creating the shell.
auto the_session_authorizer() const -> std::shared_ptr< frontend::SessionAuthorizer >
void override_the_compositor(Builder< compositor::Compositor > const &compositor_builder)
Sets an override functor for creating the compositor.
void add_init_callback(std::function< void()> const &init_callback)
Add a callback to be invoked when the server has been initialized, but before it starts. This allows client code to get access Mir objects. If multiple callbacks are added they will be invoked in the sequence added.
Definition: server.cpp:287
auto get_options() const -> std::shared_ptr< options::Option >
Returns the configuration options. This will be null before initialization starts. It will be available when the init_callback has been invoked (and thereafter until the server exits).
Definition: server.cpp:313
Customise and run a Mir server.
Definition: server.h:68
void override_the_gl_config(Builder< graphics::GLConfig > const &gl_config_builder)
Sets an override functor for creating the gl config.
auto the_gl_config() const -> std::shared_ptr< graphics::GLConfig >
auto the_graphics_platform() const -> std::shared_ptr< graphics::Platform >
void override_the_session_mediator_report(Builder< frontend::SessionMediatorReport > const &session_mediator_builder)
Sets an override functor for creating the session mediator report.
std::function< std::shared_ptr< T >(std::shared_ptr< T > const &)> Wrapper
Each of the wrap functions takes a wrapper functor of the same form.
Definition: server.h:258
void set_terminator(Terminator const &terminator)
Set handler for termination requests. terminator will be called following receipt of SIGTERM or SIGIN...
Definition: server.cpp:324
auto the_display() const -> std::shared_ptr< graphics::Display >
void wrap_display_buffer_compositor_factory(Wrapper< compositor::DisplayBufferCompositorFactory > const &wrapper)
Sets a wrapper functor for creating the per-display rendering code.
void override_the_session_listener(Builder< scene::SessionListener > const &session_listener_builder)
Sets an override functor for creating the session listener.
std::function< void()> EmergencyCleanupHandler
Functor for processing fatal signals for any "emergency cleanup". That is: SIGQUIT, SIGABRT, SIGFPE, SIGSEGV & SIGBUS.
Definition: server.h:193
auto the_composite_event_filter() const -> std::shared_ptr< input::CompositeEventFilter >
std::function< std::shared_ptr< T >()> Builder
Each of the override functions takes a builder functor of the same form.
Definition: server.h:208
void override_the_server_status_listener(Builder< ServerStatusListener > const &server_status_listener_builder)
Sets an override functor for creating the status listener.
auto the_touch_visualizer() const -> std::shared_ptr< input::TouchVisualizer >
void set_command_line(int argc, char const *argv[])
set the command line. This must remain valid while apply_settings() and run() are called...
Definition: server.cpp:280
auto the_main_loop() const -> std::shared_ptr< MainLoop >
void override_the_prompt_session_listener(Builder< scene::PromptSessionListener > const &prompt_session_listener_builder)
Sets an override functor for creating the prompt session listener.
auto the_session_listener() const -> std::shared_ptr< scene::SessionListener >
auto open_prompt_socket() -> Fd
Get a file descriptor that can be used to connect a prompt provider It can be passed to another proce...
Definition: server.cpp:414
void set_command_line_handler(std::function< void(int argc, char const *const *argv)> const &command_line_hander)
Set a handler for any command line options Mir does not recognise. This will be invoked if any unreco...
Definition: server.cpp:300
void override_the_host_lifecycle_event_listener(Builder< shell::HostLifecycleEventListener > const &host_lifecycle_event_listener_builder)
Sets an override functor for creating the host lifecycle event listener.
void apply_settings()
Applies any configuration options, hooks, or custom implementations. Must be called before calling ru...
Definition: server.cpp:345
auto the_shell() const -> std::shared_ptr< shell::Shell >
void override_the_logger(Builder< logging::Logger > const &logger_builder)
Sets an override functor for creating the logger.
auto the_shell_display_layout() const -> std::shared_ptr< shell::DisplayLayout >
auto the_prompt_session_manager() const -> std::shared_ptr< scene::PromptSessionManager >
auto the_logger() const -> std::shared_ptr< logging::Logger >
Definition: main_loop.h:29
OptionType
Definition: server.h:59
auto the_compositor() const -> std::shared_ptr< compositor::Compositor >
void add_configuration_option(std::string const &option, std::string const &description, int default_value)
Add user configuration option(s) to Mir's option handling. These will be resolved during initialisati...
Definition: server.cpp:463
auto the_session_coordinator() const -> std::shared_ptr< scene::SessionCoordinator >
auto the_prompt_session_listener() const -> std::shared_ptr< scene::PromptSessionListener >
auto the_input_targeter() const -> std::shared_ptr< shell::InputTargeter >
void wrap_cursor_listener(Wrapper< input::CursorListener > const &wrapper)
Sets a wrapper functor for creating the cursor listener.
void wrap_display_configuration_policy(Wrapper< graphics::DisplayConfigurationPolicy > const &wrapper)
Sets a wrapper functor for creating the display configuration policy.
void override_the_shell(Builder< shell::Shell > const &wrapper)
Sets an override functor for creating the shell.
void override_the_surface_configurator(Builder< scene::SurfaceConfigurator > const &surface_configurator_builder)
Sets an override functor for creating the surface configurator.
auto open_client_socket() -> Fd
Get a file descriptor that can be used to connect a client It can be passed to another process...
Definition: server.cpp:406
void override_the_session_authorizer(Builder< frontend::SessionAuthorizer > const &session_authorizer_builder)
Sets an override functor for creating the session authorizer.
void set_exception_handler(std::function< void()> const &exception_handler)
Set a handler for exceptions. This is invoked in a catch (...) block and the exception can be re-thro...
Definition: server.cpp:319
auto the_cursor_listener() const -> std::shared_ptr< input::CursorListener >
std::function< void(int signal)> Terminator
Functor for processing SIGTERM or SIGINT This will not be called directly by a signal handler: arbitr...
Definition: server.h:180
std::function< void(std::shared_ptr< frontend::Session > const &session)> ConnectHandler
Definition: server.h:346
auto the_surface_coordinator() const -> std::shared_ptr< scene::SurfaceCoordinator >
auto supported_pixel_formats() const -> std::vector< MirPixelFormat >
The pixel formats that may be used when creating surfaces.
Definition: server.cpp:388
bool exited_normally()
returns true if and only if server exited normally. Otherwise false.
Definition: server.cpp:401
void run()
Run the Mir server until it exits.
Definition: server.cpp:359
void stop()
Tell the Mir server to exit.
Definition: server.cpp:393
auto the_focus_controller() const -> std::shared_ptr< shell::FocusController >
void override_the_display_buffer_compositor_factory(Builder< compositor::DisplayBufferCompositorFactory > const &compositor_builder)
Sets an override functor for creating the per-display rendering code.
void override_the_input_dispatcher(Builder< input::InputDispatcher > const &input_dispatcher_builder)
Sets an override functor for creating the input dispatcher.
void override_the_prompt_session_manager(Builder< scene::PromptSessionManager > const &prompt_session_manager_builder)
Sets an override functor for creating the prompt session manager.
auto the_surface_configurator() const -> std::shared_ptr< scene::SurfaceConfigurator >
void set_config_filename(std::string const &config_file)
Set the configuration filename. This will be searched for and parsed in the standard locations...
Definition: server.cpp:307
void override_the_placement_strategy(Builder< scene::PlacementStrategy > const &placement_strategy_builder)
Sets an override functor for creating the placement strategy.
Server()
Definition: server.cpp:268