on 53904db help sign in
unity8/src/WindowManagementPolicy.h
54 lines 2.1 kB history raw
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 */
17#ifndef UNITY_WINDOWMANAGEMENTPOLICY_H
18#define UNITY_WINDOWMANAGEMENTPOLICY_H
20#include <qtmir/windowmanagementpolicy.h>
21#include "wmpolicyinterface.h"
23#include <unordered_set>
25class Q_DECL_EXPORT WindowManagementPolicy : public qtmir::WindowManagementPolicy,
26 public WMPolicyInterface
28public:
29 WindowManagementPolicy(const miral::WindowManagerTools &tools, qtmir::WindowManagementPolicyPrivate& dd);
31 void advise_new_window(miral::WindowInfo const& window_info) override;
33 // From WMPolicyInterface
34 std::shared_ptr<miral::Workspace> createWorkspace() override;
36 void releaseWorkspace(const std::shared_ptr<miral::Workspace> &workspace) override;
38 void forEachWindowInWorkspace(
39 std::shared_ptr<miral::Workspace> const& workspace,
40 std::function<void(miral::Window const& window)> const& callback) override;
42 void moveWorkspaceContentToWorkspace(const std::shared_ptr<miral::Workspace> &toWorkspace,
43 const std::shared_ptr<miral::Workspace> &fromWorkspace) override;
45 void setActiveWorkspace(const std::shared_ptr<miral::Workspace>& workspace) override;
47private:
48 std::weak_ptr<miral::Workspace> m_activeWorkspace;
50 std::unordered_set<std::shared_ptr<miral::Workspace>> m_workspaces;
51 const std::shared_ptr<miral::Workspace> m_dummyWorkspace;
52};
54#endif // UNITY_WINDOWMANAGEMENTPOLICY_H