Mir
set_window_management_policy.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_SET_WINDOW_MANAGEMENT_POLICY_H
20 #define MIRAL_SET_WINDOW_MANAGEMENT_POLICY_H
21 
22 #include <functional>
23 #include <memory>
24 
25 namespace mir
26 {
27 class Server;
28 }
29 
30 namespace miral
31 {
32 class WindowManagerTools;
33 class WindowManagementPolicy;
34 
36 {
37 public:
38  SetWindowManagementPolicy(std::function<std::unique_ptr<WindowManagementPolicy>(WindowManagerTools const& tools)> const& builder);
40 
41  void operator()(mir::Server& server) const;
42 
43 private:
44  std::function<std::unique_ptr<WindowManagementPolicy>(WindowManagerTools const& tools)> builder;
45 };
46 
47 template<typename Policy, typename ...Args>
49 {
50  return SetWindowManagementPolicy{[&args...](WindowManagerTools const& tools) -> std::unique_ptr<WindowManagementPolicy>
51  { return std::make_unique<Policy>(tools, args...); }};
52 }
53 }
54 
55 #endif //MIRAL_SET_WINDOW_MANAGEMENT_POLICY_H
AutoUnblockThread is a helper thread class that can gracefully shutdown at destruction time...
Definition: blob.h:26
SetWindowManagementPolicy(std::function< std::unique_ptr< WindowManagementPolicy >(WindowManagerTools const &tools)> const &builder)
Definition: set_window_management_policy.h:35
Window management functions for querying and updating MirAL&#39;s model.
Definition: window_manager_tools.h:58
auto set_window_management_policy(Args &... args) -> SetWindowManagementPolicy
Definition: set_window_management_policy.h:48
void operator()(mir::Server &server) const
Mir Abstraction Layer.
Definition: add_init_callback.h:26

Copyright © 2012-2018 Canonical Ltd.
Generated on Thu Mar 15 13:06:27 UTC 2018