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 
17 #ifndef MIRAL_RUNNER_H
18 #define MIRAL_RUNNER_H
19 
20 #include "mir/optional_value.h"
21 
22 #include <functional>
23 #include <initializer_list>
24 #include <memory>
25 
26 namespace mir { class Server; }
27 
33 namespace miral
34 {
35 
37 class MirRunner
38 {
39 public:
40  MirRunner(int argc, char const* argv[]);
41  MirRunner(int argc, char const* argv[], char const* config_file);
43 
46  void add_start_callback(std::function<void()> const& start_callback);
47 
50  void add_stop_callback(std::function<void()> const& stop_callback);
51 
56  void set_exception_handler(std::function<void()> const& handler);
57 
61  auto run_with(std::initializer_list<std::function<void(::mir::Server&)>> options) -> int;
62 
64  void stop();
65 
71  auto config_file() const -> std::string;
72 
78  auto display_config_file() const -> std::string;
79 
82  auto wayland_display() const -> mir::optional_value<std::string>;
83 
86  auto x11_display() const -> mir::optional_value<std::string>;
87 
88 private:
89  MirRunner(MirRunner const&) = delete;
90  MirRunner& operator=(MirRunner const&) = delete;
91  struct Self;
92  std::unique_ptr<Self> const self;
93 };
94 }
95 
96 #endif //MIRAL_RUNNER_H
Runner for applying initialization options to Mir.
Definition: runner.h:38
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...
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 run_with(std::initializer_list< std::function< void(::mir::Server &)>> options) -> int
Apply the supplied initialization options and run the Mir server.
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:22
Mir Abstraction Layer.
Definition: floating_window_manager.h:29

Copyright © 2012-2022 Canonical Ltd.
Generated on śro, 1 cze 2022, 16:52:55 UTC
This documentation is licensed under the GPL version 2 or 3.