Mir
runner.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2016 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 <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);
42  ~MirRunner();
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 
80 private:
81  MirRunner(MirRunner const&) = delete;
82  MirRunner& operator=(MirRunner const&) = delete;
83  struct Self;
84  std::unique_ptr<Self> const self;
85 };
86 }
87 
88 #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:37
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...
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 Wed Aug 28 00:46:47 UTC 2019
This documentation is licensed under the GPL version 2 or 3.