2 * Copyright (C) 2017 Canonical, Ltd.
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.
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/>.
17#include "WindowManagementPolicy.h"
19WindowManagementPolicy::WindowManagementPolicy(const miral::WindowManagerTools &tools, qtmir::WindowManagementPolicyPrivate &dd)
20 : qtmir::WindowManagementPolicy(tools, dd)
21 , m_dummyWorkspace(this->tools.create_workspace())
23 wmPolicyInterface = this;
25 // we must always have a active workspace.
26 m_activeWorkspace = m_dummyWorkspace;
29void WindowManagementPolicy::advise_new_window(miral::WindowInfo const& window_info)
31 qtmir::WindowManagementPolicy::advise_new_window(window_info);
33 auto const parent = window_info.parent();
35 auto activeWorkspace = m_activeWorkspace.lock();
36 if (!parent && activeWorkspace) {
37 tools.add_tree_to_workspace(window_info.window(), activeWorkspace);
41std::shared_ptr<miral::Workspace> WindowManagementPolicy::createWorkspace()
43 auto workspace = tools.create_workspace();
44 m_workspaces.insert(workspace);
46 if (m_activeWorkspace.lock() == m_dummyWorkspace) {
47 tools.move_workspace_content_to_workspace(workspace, m_dummyWorkspace);
48 m_activeWorkspace = workspace;
53void WindowManagementPolicy::releaseWorkspace(const std::shared_ptr<miral::Workspace> &workspace)
55 auto iter = m_workspaces.find(workspace);
56 if (iter != m_workspaces.end()) m_workspaces.erase(iter);
58 if (m_workspaces.size() == 0) {
59 m_activeWorkspace = m_dummyWorkspace;
60 tools.move_workspace_content_to_workspace(m_dummyWorkspace, workspace);
64void WindowManagementPolicy::setActiveWorkspace(const std::shared_ptr<miral::Workspace> &workspace)
66 if (m_activeWorkspace.lock() == workspace)
68 m_activeWorkspace = workspace ? workspace : m_dummyWorkspace;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list