2
* Copyright © 2017 Canonical Ltd.
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.
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.
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/>.
16
* Authored by: Alan Griffiths <alan@octopull.co.uk>
19
#ifndef MIRAL_WORKSPACE_POLICY_H
20
#define MIRAL_WORKSPACE_POLICY_H
22
#include "miral/version.h"
32
* Workspace is intentionally opaque in the miral API. Its only purpose is to
33
* provide a shared_ptr which is used as an identifier.
38
* Advise changes to workspaces.
40
* \note This interface is intended to be implemented by a WindowManagementPolicy
41
* implementation, we can't add these functions directly to that interface without
42
* breaking ABI (the vtab could be incompatible).
43
* When initializing the window manager this interface will be detected by
44
* dynamic_cast and registered accordingly.
49
/** @name notification of WM events that the policy may need to track.
50
* These calls happen "under lock" and are wrapped by the usual
51
* WindowManagementPolicy::advise_begin(), advise_end() calls.
52
* They should not call WindowManagerTools::invoke_under_lock()
55
/** Notification that windows are being added to a workspace.
56
* These windows are ordered with parents before children,
57
* and form a single tree rooted at the first element.
59
* @param workspace the workspace
60
* @param windows the windows
62
virtual void advise_adding_to_workspace(
63
std::shared_ptr<Workspace> const& workspace,
64
std::vector<Window> const& windows);
66
/** Notification that windows are being removed from a workspace.
67
* These windows are ordered with parents before children,
68
* and form a single tree rooted at the first element.
70
* @param workspace the workspace
71
* @param windows the windows
73
virtual void advise_removing_from_workspace(
74
std::shared_ptr<Workspace> const& workspace,
75
std::vector<Window> const& windows);
79
virtual ~WorkspacePolicy() = default;
80
WorkspacePolicy() = default;
81
WorkspacePolicy(WorkspacePolicy const&) = delete;
82
WorkspacePolicy& operator=(WorkspacePolicy const&) = delete;
84
#if MIRAL_VERSION >= MIR_VERSION_NUMBER(2, 0, 0)
85
#error "We've presumably broken ABI - please roll this interface into WindowManagementPolicy"
88
#endif //MIRAL_WORKSPACE_POLICY_H