/*
* Copyright (C) 2017 Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef MOCKWINDOMANAGEMENTPOLICY_H
#define MOCKWINDOMANAGEMENTPOLICY_H
#include "wmpolicyinterface.h"
#include
#include
#include
#include
#include
#include
namespace miral {
class Workspace {};
}
// A Fake window management policy for the mock.
class Q_DECL_EXPORT WindowManagementPolicy : public QObject,
public WMPolicyInterface
{
Q_OBJECT
public:
WindowManagementPolicy();
// for use in mocks
static WindowManagementPolicy *instance();
// From WMPolicyInterface
std::shared_ptr createWorkspace() override;
void releaseWorkspace(const std::shared_ptr& workspace) override;
void setActiveWorkspace(const std::shared_ptr& workspace) override;
void addWindow(const miral::Window& window);
void forEachWindowInWorkspace(std::shared_ptr const& workspace,
std::function const& callback);
void moveWindowToWorkspace(const miral::Window &window, const std::shared_ptr &workspace);
void moveWorkspaceContentToWorkspace(const std::shared_ptr& to,
const std::shared_ptr& from);
Q_SIGNALS:
void windowAdded(const miral::Window& window);
void windowsAddedToWorkspace(const std::shared_ptr &workspace, const std::vector &windows);
void windowsAboutToBeRemovedFromWorkspace(const std::shared_ptr &workspace, const std::vector &windows);
private:
std::weak_ptr m_activeWorkspace;
std::shared_ptr m_dummyWorkspace;
std::unordered_set> m_workspaces;
typedef QMultiMap, miral::Window> WorkspaceWindows;
WorkspaceWindows m_windows;
};
#endif // UNITY_WINDOWMANAGEMENTPOLICY_H