Mir
window_manager_tools.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2016-2017 Canonical Ltd.
3  *
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.
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  * Authored by: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 #ifndef MIRAL_WINDOW_MANAGER_TOOLS_H
20 #define MIRAL_WINDOW_MANAGER_TOOLS_H
21 
22 #include "miral/application.h"
23 #include "window_info.h"
24 
26 
27 #include <functional>
28 #include <memory>
29 
30 namespace mir
31 {
32 namespace scene { class Surface; }
33 }
34 
35 namespace miral
36 {
37 class Window;
38 struct WindowInfo;
39 struct ApplicationInfo;
40 class WindowSpecification;
41 
53 class Workspace;
54 
55 class WindowManagerToolsImplementation;
56 
59 {
60 public:
61  explicit WindowManagerTools(WindowManagerToolsImplementation* tools);
63  WindowManagerTools& operator=(WindowManagerTools const&);
65 
76  auto count_applications() const -> unsigned int;
77 
82  void for_each_application(std::function<void(ApplicationInfo& info)> const& functor);
83 
89  auto find_application(std::function<bool(ApplicationInfo const& info)> const& predicate)
90  -> Application;
91 
97  auto info_for(std::weak_ptr<mir::scene::Session> const& session) const -> ApplicationInfo&;
98 
104  auto info_for(std::weak_ptr<mir::scene::Surface> const& surface) const -> WindowInfo&;
105 
111  auto info_for(Window const& window) const -> WindowInfo&;
112 
119  auto info_for_window_id(std::string const& id) const -> WindowInfo&;
120 
126  auto id_for_window(Window const& window) const -> std::string;
127 
129  void ask_client_to_close(Window const& window);
130 
133  void force_close(Window const& window);
134 
136  auto active_window() const -> Window;
137 
143  auto select_active_window(Window const& hint) -> Window;
144 
146  void drag_active_window(mir::geometry::Displacement movement);
147 
149  void drag_window(Window const& window, mir::geometry::Displacement movement);
150 
152  void focus_next_application();
153 
156  void focus_prev_application();
157 
159  void focus_next_within_application();
160 
162  void focus_prev_within_application();
163 
165  auto window_at(mir::geometry::Point cursor) const -> Window;
166 
168  auto active_output() -> mir::geometry::Rectangle const;
169 
171  void raise_tree(Window const& root);
172 
180  void start_drag_and_drop(WindowInfo& window_info, std::vector<uint8_t> const& handle);
181 
183  void end_drag_and_drop();
184 
186  void modify_window(WindowInfo& window_info, WindowSpecification const& modifications);
187 
189  void modify_window(Window const& window, WindowSpecification const& modifications);
190 
192  void place_and_size_for_state(WindowSpecification& modifications, WindowInfo const& window_info) const;
193 
198  auto create_workspace() -> std::shared_ptr<Workspace>;
199 
205  void add_tree_to_workspace(Window const& window, std::shared_ptr<Workspace> const& workspace);
206 
212  void remove_tree_from_workspace(Window const& window, std::shared_ptr<Workspace> const& workspace);
213 
219  void move_workspace_content_to_workspace(
220  std::shared_ptr<Workspace> const& to_workspace,
221  std::shared_ptr<Workspace> const& from_workspace);
222 
229  void for_each_workspace_containing(
230  Window const& window,
231  std::function<void(std::shared_ptr<Workspace> const& workspace)> const& callback);
232 
239  void for_each_window_in_workspace(
240  std::shared_ptr<Workspace> const& workspace,
241  std::function<void(Window const& window)> const& callback);
242 
251  void invoke_under_lock(std::function<void()> const& callback);
252 
253 private:
254  WindowManagerToolsImplementation* tools;
255 };
256 }
257 
258 #endif //MIRAL_WINDOW_MANAGER_TOOLS_H
Definition: splash_session.h:24
Definition: point.h:30
Definition: application_info.h:31
Definition: window_info.h:32
Definition: window_specification.h:43
Handle class to manage a Mir surface. It may be null (e.g. default initialized)
Definition: window.h:37
std::shared_ptr< mir::scene::Session > Application
Definition: application.h:34
Definition: displacement.h:33
Window management functions for querying and updating MirAL&#39;s model.
Definition: window_manager_tools.h:58
Definition: rectangle.h:33
Mir Abstraction Layer.
Definition: floating_window_manager.h:29

Copyright © 2012-2022 Canonical Ltd.
Generated on Thu Jan 27 21:10:36 UTC 2022
This documentation is licensed under the GPL version 2 or 3.