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 
28 namespace mir { class Server; }
29 
35 namespace miral
36 {
37 
39 class MirRunner
40 {
41 public:
42  MirRunner(int argc, char const* argv[]);
43  MirRunner(int argc, char const* argv[], char const* config_file);
44  ~MirRunner();
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 
85 
89 
90 private:
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
Definition: splash_session.h:24
MirRunner(int argc, char const *argv[])
void stop()
Tell the Mir server to exit.
auto config_file() const -> std::string
Name of the .config file. The .config file is located via the XDG Base Directory Specification: $XDG_...
Runner for applying initialization options to Mir.
Definition: runner.h:39
auto wayland_display() const -> mir::optional_value< std::string >
Get the Wayland endpoint name (if any) usable as a $WAYLAND_DISPLAY value.
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.
Definition: optional_value.h:28
auto x11_display() const -> mir::optional_value< std::string >
Get the X11 socket name (if any) usable as a $DISPLAY value.
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...
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 display_config_file() const -> std::string
Name of the .display configuration file. The .display file is located via the XDG Base Directory Spec...
Mir Abstraction Layer.
Definition: floating_window_manager.h:29

Copyright © 2012-2019 Canonical Ltd.
Generated on Fri Dec 6 02:26:37 UTC 2019
This documentation is licensed under the GPL version 2 or 3.