Mir
window_management_options.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2014-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_WINDOW_MANAGEMENT_OPTIONS_H_
20 #define MIRAL_WINDOW_MANAGEMENT_OPTIONS_H_
21 
22 #include <functional>
23 #include <memory>
24 #include <string>
25 #include <vector>
26 
27 namespace mir
28 {
29 class Server;
30 }
31 
32 namespace miral
33 {
34 class WindowManagerTools;
35 class WindowManagementPolicy;
36 
38  std::function<std::unique_ptr<miral::WindowManagementPolicy>(WindowManagerTools const& tools)>;
39 
41 {
42  std::string const name;
44 };
45 
46 template<typename Policy, typename ...Args>
47 inline auto add_window_manager_policy(std::string const& name, Args&... args) -> WindowManagerOption
48 {
49  return {name, [&args...](WindowManagerTools const& tools) -> std::unique_ptr<miral::WindowManagementPolicy>
50  { return std::make_unique<Policy>(tools, args...); }};
51 }
52 
54 {
55 public:
57  explicit WindowManagerOptions(std::initializer_list<WindowManagerOption> const& policies) : policies(policies) {}
58 
59  void operator()(mir::Server& server) const;
60 
61  std::vector<WindowManagerOption> const policies;
62 };
63 }
64 
65 #endif // MIRAL_WINDOW_MANAGEMENT_OPTIONS_H_
Definition: window_management_options.h:54
WindowManagerOptions(std::initializer_list< WindowManagerOption > const &policies)
Definition: window_management_options.h:57
std::vector< WindowManagerOption > const policies
Definition: window_management_options.h:61
void operator()(mir::Server &server) const
Window management functions for querying and updating MirAL's model.
Definition: window_manager_tools.h:60
Definition: splash_session.h:24
Mir Abstraction Layer.
Definition: floating_window_manager.h:31
auto add_window_manager_policy(std::string const &name, Args &... args) -> WindowManagerOption
Definition: window_management_options.h:47
std::function< std::unique_ptr< miral::WindowManagementPolicy >(WindowManagerTools const &tools)> WindowManagementPolicyBuilder
Definition: window_management_options.h:38
Definition: window_management_options.h:41
WindowManagementPolicyBuilder const build
Definition: window_management_options.h:43
std::string const name
Definition: window_management_options.h:42

Copyright © 2012-2022 Canonical Ltd.
Generated on Thu Mar 3 22:46:49 UTC 2022
This documentation is licensed under the GPL version 2 or 3.