Mir
runner.h
Go to the documentation of this file.
1/*
2 * Copyright © 2016-2019 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 or 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alan Griffiths <alan@octopull.co.uk>
17 */
18
19#ifndef MIRAL_RUNNER_H
20#define MIRAL_RUNNER_H
21
22#include "mir/optional_value.h"
23
24#include <functional>
25#include <initializer_list>
26#include <memory>
27
28namespace mir { class Server; }
29
35namespace miral
36{
37
40{
41public:
42 MirRunner(int argc, char const* argv[]);
43 MirRunner(int argc, char const* argv[], char const* config_file);
45
48 void add_start_callback(std::function<void()> const& start_callback);
49
52 void add_stop_callback(std::function<void()> const& stop_callback);
53
58 void set_exception_handler(std::function<void()> const& handler);
59
63 auto run_with(std::initializer_list<std::function<void(::mir::Server&)>> options) -> int;
64
66 void stop();
67
73 auto config_file() const -> std::string;
74
80 auto display_config_file() const -> std::string;
81
84 auto wayland_display() const -> mir::optional_value<std::string>;
85
88 auto x11_display() const -> mir::optional_value<std::string>;
89
90private:
91 MirRunner(MirRunner const&) = delete;
92 MirRunner& operator=(MirRunner const&) = delete;
93 struct Self;
94 std::unique_ptr<Self> const self;
95};
96}
97
98#endif //MIRAL_RUNNER_H
Runner for applying initialization options to Mir.
Definition: runner.h:40
MirRunner(int argc, char const *argv[])
void add_stop_callback(std::function< void()> const &stop_callback)
Add a callback to be invoked when the server is about to stop, If multiple callbacks are added they w...
auto run_with(std::initializer_list< std::function< void(::mir::Server &)> > options) -> int
Apply the supplied initialization options and run the Mir server.
void add_start_callback(std::function< void()> const &start_callback)
Add a callback to be invoked when the server has started, If multiple callbacks are added they will b...
auto config_file() const -> std::string
Name of the .config file. The .config file is located via the XDG Base Directory Specification: $XDG_...
auto x11_display() const -> mir::optional_value< std::string >
Get the X11 socket name (if any) usable as a $DISPLAY value.
MirRunner(int argc, char const *argv[], char const *config_file)
void stop()
Tell the Mir server to exit.
void set_exception_handler(std::function< void()> const &handler)
Set a handler for exceptions caught in run_with(). run_with() invokes handler() in catch (....
auto wayland_display() const -> mir::optional_value< std::string >
Get the Wayland endpoint name (if any) usable as a $WAYLAND_DISPLAY value.
auto display_config_file() const -> std::string
Name of the .display configuration file. The .display file is located via the XDG Base Directory Spec...
Definition: splash_session.h:24
Mir Abstraction Layer.
Definition: floating_window_manager.h:29
STL namespace.

Copyright © 2012-2022 Canonical Ltd.
Generated on Sat 3 Dec 14:36:51 UTC 2022
This documentation is licensed under the GPL version 2 or 3.