31 namespace compositor {
class Compositor;
class DisplayBufferCompositorFactory; }
32 namespace frontend {
class SessionAuthorizer;
class Session;
class SessionMediatorReport; }
33 namespace graphics {
class Cursor;
class Platform;
class Display;
class GLConfig;
class DisplayConfigurationPolicy;
class DisplayConfigurationReport; }
34 namespace input {
class CompositeEventFilter;
class InputDispatcher;
class CursorListener;
class CursorImages;
class TouchVisualizer;
class InputDeviceHub;}
35 namespace logging {
class Logger; }
36 namespace options {
class Option; }
39 using Secret = std::vector<uint8_t>;
44 class DisplayConfigurationController;
45 class FocusController;
46 class HostLifecycleEventListener;
52 class ApplicationNotRespondingDetector;
53 class BufferStreamFactory;
54 class PromptSessionListener;
55 class PromptSessionManager;
56 class SessionListener;
57 class SessionCoordinator;
58 class SurfaceCoordinator;
64 class ServerStatusListener;
138 char const* default_value);
164 std::function<
void(
int argc,
char const*
const* argv)>
const& command_line_hander);
175 auto get_options()
const -> std::shared_ptr<options::Option>;
220 template<
typename T>
using Builder = std::function<std::shared_ptr<T>()>;
280 template<
typename T>
using Wrapper = std::function<std::shared_ptr<T>(std::shared_ptr<T>
const&)>;
315 auto
the_cursor() const ->
std::shared_ptr<graphics::Cursor>;
356 auto
the_shell() const ->
std::shared_ptr<shell::Shell>;
378 std::shared_ptr<scene::ApplicationNotRespondingDetector>;
406 struct ServerConfiguration;
408 std::shared_ptr<Self> const self;
All things Mir.
Definition: atomic_callback.h:25
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:361
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:319
auto the_input_device_hub() const -> std::shared_ptr< input::InputDeviceHub >
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:345
Customise and run a Mir server.
Definition: server.h:75
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:280
void set_terminator(Terminator const &terminator)
Set handler for termination requests. terminator will be called following receipt of SIGTERM or SIGIN...
Definition: server.cpp:356
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:207
auto the_composite_event_filter() const -> std::shared_ptr< input::CompositeEventFilter >
void override_the_cookie_factory(mir::cookie::Secret const &secret)
creates the CookieFactory from the given secret This secret is used to generate timestamps that can b...
Definition: server.cpp:313
std::function< std::shared_ptr< T >()> Builder
Each of the override functions takes a builder functor of the same form.
Definition: server.h:222
void override_the_server_status_listener(Builder< ServerStatusListener > const &server_status_listener_builder)
Sets an override functor for creating the status listener.
auto the_application_not_responding_detector() const -> std::shared_ptr< scene::ApplicationNotRespondingDetector >
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:306
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 >
void override_the_application_not_responding_detector(Builder< scene::ApplicationNotRespondingDetector > const &anr_detector_builder)
Sets an override functor for creating the application not responding detector.
auto the_display_configuration_controller() const -> std::shared_ptr< shell::DisplayConfigurationController >
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:446
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:332
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 override_the_window_manager_builder(shell::WindowManagerBuilder const wmb)
Sets an override functor for creating the window manager.
Definition: server.cpp:484
void apply_settings()
Applies any configuration options, hooks, or custom implementations. Must be called before calling ru...
Definition: server.cpp:377
auto the_shell() const -> std::shared_ptr< shell::Shell >
auto the_buffer_stream_factory() const -> std::shared_ptr< scene::BufferStreamFactory >
void override_the_display_configuration_report(Builder< graphics::DisplayConfigurationReport > const &report_builder)
Sets an override functor for creating the display configuration report.
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:66
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:501
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 wrap_cursor(Wrapper< graphics::Cursor > const &cursor_builder)
Sets a wrapper functor for creating the cursor.
void override_the_shell(Builder< shell::Shell > const &wrapper)
Sets an override functor for creating the shell.
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:438
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:351
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:194
std::function< void(std::shared_ptr< frontend::Session > const &session)> ConnectHandler
Definition: server.h:386
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:420
bool exited_normally()
returns true if and only if server exited normally. Otherwise false.
Definition: server.cpp:433
void run()
Run the Mir server until it exits.
Definition: server.cpp:391
void stop()
Tell the Mir server to exit.
Definition: server.cpp:425
auto the_surface_factory() const -> std::shared_ptr< scene::SurfaceFactory >
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.
std::function< std::shared_ptr< WindowManager >(FocusController *focus_controller)> WindowManagerBuilder
WindowManagers are built while initializing an AbstractShell, so a builder functor is needed...
Definition: window_manager_builder.h:34
void override_the_prompt_session_manager(Builder< scene::PromptSessionManager > const &prompt_session_manager_builder)
Sets an override functor for creating the prompt session manager.
std::vector< uint8_t > Secret
Definition: cookie_factory.h:31
auto the_cursor() const -> std::shared_ptr< graphics::Cursor >
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:339
Server()
Definition: server.cpp:294
void override_the_cursor_images(Builder< input::CursorImages > const &cursor_images_builder)
Sets an override functor for creating the cursor images.