Unity 8
WindowManagementPolicy.h
1 /*
2  * Copyright (C) 2017 Canonical, Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 3.
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 UNITY_WINDOWMANAGEMENTPOLICY_H
18 #define UNITY_WINDOWMANAGEMENTPOLICY_H
19 
20 #include <qtmir/windowmanagementpolicy.h>
21 #include "wmpolicyinterface.h"
22 
23 #include <unordered_set>
24 
25 class Q_DECL_EXPORT WindowManagementPolicy : public qtmir::WindowManagementPolicy,
26  public WMPolicyInterface
27 {
28 public:
29  WindowManagementPolicy(const miral::WindowManagerTools &tools, std::shared_ptr<qtmir::WindowManagementPolicyPrivate> dd);
30 
31  void advise_new_window(miral::WindowInfo const& window_info) override;
32 
33  // From WMPolicyInterface
34  std::shared_ptr<miral::Workspace> createWorkspace() override;
35 
36  void releaseWorkspace(const std::shared_ptr<miral::Workspace> &workspace) override;
37 
38  void setActiveWorkspace(const std::shared_ptr<miral::Workspace> &workspace) override;
39 
40 private:
41  std::weak_ptr<miral::Workspace> m_activeWorkspace;
42 
43  std::unordered_set<std::shared_ptr<miral::Workspace>> m_workspaces;
44  const std::shared_ptr<miral::Workspace> m_dummyWorkspace;
45 };
46 
47 #endif // UNITY_WINDOWMANAGEMENTPOLICY_H