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
25namespace mir
26{
27class Server;
28}
29
30namespace miral
31{
32class WindowManagerTools;
33class WindowManagementPolicy;
34
36{
37public:
38 SetWindowManagementPolicy(std::function<std::unique_ptr<WindowManagementPolicy>(WindowManagerTools const& tools)> const& builder);
40
41 void operator()(mir::Server& server) const;
42
43private:
44 std::function<std::unique_ptr<WindowManagementPolicy>(WindowManagerTools const& tools)> builder;
45};
46
47template<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
Definition: set_window_management_policy.h:36
void operator()(mir::Server &server) const
SetWindowManagementPolicy(std::function< std::unique_ptr< WindowManagementPolicy >(WindowManagerTools const &tools)> const &builder)
Window management functions for querying and updating MirAL's model.
Definition: window_manager_tools.h:59
Definition: splash_session.h:24
Mir Abstraction Layer.
Definition: floating_window_manager.h:29
auto set_window_management_policy(Args &... args) -> SetWindowManagementPolicy
Definition: set_window_management_policy.h:48

Copyright © 2012-2022 Canonical Ltd.
Generated on Sun Oct 9 06:13:38 UTC 2022
This documentation is licensed under the GPL version 2 or 3.