Mir
Loading...
Searching...
No Matches
window_manager_tools.h
Go to the documentation of this file.
1/*
2 * Copyright © 2016-2020 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
17#ifndef MIRAL_WINDOW_MANAGER_TOOLS_H
18#define MIRAL_WINDOW_MANAGER_TOOLS_H
19
20#include "miral/application.h"
21#include "window_info.h"
22
24
25#include <functional>
26#include <memory>
27
28namespace mir
29{
30namespace scene { class Surface; }
31}
32
33namespace miral
34{
35class Window;
36struct WindowInfo;
37struct ApplicationInfo;
38class WindowSpecification;
39class Zone;
40
52class Workspace;
53
54class WindowManagerToolsImplementation;
55
58{
59public:
60 explicit WindowManagerTools(WindowManagerToolsImplementation* tools);
64
75 auto count_applications() const -> unsigned int;
76
81 void for_each_application(std::function<void(ApplicationInfo& info)> const& functor);
82
88 auto find_application(std::function<bool(ApplicationInfo const& info)> const& predicate)
89 -> Application;
90
96 auto info_for(std::weak_ptr<mir::scene::Session> const& session) const -> ApplicationInfo&;
97
103 auto info_for(std::weak_ptr<mir::scene::Surface> const& surface) const -> WindowInfo&;
104
110 auto info_for(Window const& window) const -> WindowInfo&;
111
118 auto info_for_window_id(std::string const& id) const -> WindowInfo&;
119
125 auto id_for_window(Window const& window) const -> std::string;
126
128 void ask_client_to_close(Window const& window);
129
131 auto active_window() const -> Window;
132
138 auto select_active_window(Window const& hint) -> Window;
139
141 void drag_active_window(mir::geometry::Displacement movement);
142
144 void drag_window(Window const& window, mir::geometry::Displacement movement);
145
148
152
155
158
160 auto window_at(mir::geometry::Point cursor) const -> Window;
161
163 auto active_output() -> mir::geometry::Rectangle const;
164
168
170 void raise_tree(Window const& root);
171
179 void start_drag_and_drop(WindowInfo& window_info, std::vector<uint8_t> const& handle);
180
183
185 void modify_window(WindowInfo& window_info, WindowSpecification const& modifications);
186
188 void modify_window(Window const& window, WindowSpecification const& modifications);
189
191 void place_and_size_for_state(WindowSpecification& modifications, WindowInfo const& window_info) const;
192
197 auto create_workspace() -> std::shared_ptr<Workspace>;
198
204 void add_tree_to_workspace(Window const& window, std::shared_ptr<Workspace> const& workspace);
205
211 void remove_tree_from_workspace(Window const& window, std::shared_ptr<Workspace> const& workspace);
212
219 std::shared_ptr<Workspace> const& to_workspace,
220 std::shared_ptr<Workspace> const& from_workspace);
221
229 Window const& window,
230 std::function<void(std::shared_ptr<Workspace> const& workspace)> const& callback);
231
239 std::shared_ptr<Workspace> const& workspace,
240 std::function<void(Window const& window)> const& callback);
241
250 void invoke_under_lock(std::function<void()> const& callback);
251
252private:
253 WindowManagerToolsImplementation* tools;
254};
255}
256
257#endif //MIRAL_WINDOW_MANAGER_TOOLS_H
Handle class to manage a Mir surface. It may be null (e.g. default initialized)
Definition: window.h:36
Window management functions for querying and updating MirAL's model.
Definition: window_manager_tools.h:58
void drag_window(Window const &window, mir::geometry::Displacement movement)
move the window
void focus_prev_application()
make the previous application active
auto active_application_zone() const -> Zone
Find the active zone area.
WindowManagerTools(WindowManagerToolsImplementation *tools)
void focus_next_within_application()
make the next surface active within the active application
void ask_client_to_close(Window const &window)
Send close request to the window.
auto select_active_window(Window const &hint) -> Window
select a new active window based on the hint
auto active_output() -> mir::geometry::Rectangle const
Find the active output area.
WindowManagerTools & operator=(WindowManagerTools const &)
void move_workspace_content_to_workspace(std::shared_ptr< Workspace > const &to_workspace, std::shared_ptr< Workspace > const &from_workspace)
Moves all the content from one workspace to another.
auto create_workspace() -> std::shared_ptr< Workspace >
Create a workspace.
void invoke_under_lock(std::function< void()> const &callback)
Multi-thread support Allows threads that don't hold a lock on the model to acquire one and call the "...
void focus_next_application()
make the next application active
void modify_window(WindowInfo &window_info, WindowSpecification const &modifications)
Apply modifications to a window.
WindowManagerTools(WindowManagerTools const &)
void end_drag_and_drop()
End drag and drop.
void for_each_workspace_containing(Window const &window, std::function< void(std::shared_ptr< Workspace > const &workspace)> const &callback)
invoke callback with each workspace containing window
void drag_active_window(mir::geometry::Displacement movement)
move the active window
void raise_tree(Window const &root)
Raise window and all its children.
void for_each_window_in_workspace(std::shared_ptr< Workspace > const &workspace, std::function< void(Window const &window)> const &callback)
invoke callback with each window contained in workspace
auto id_for_window(Window const &window) const -> std::string
retrieve the persistent surface id for a window
void focus_prev_within_application()
make the prev surface active within the active application
auto find_application(std::function< bool(ApplicationInfo const &info)> const &predicate) -> Application
find an application meeting the predicate
void start_drag_and_drop(WindowInfo &window_info, std::vector< uint8_t > const &handle)
Start drag and drop.
auto info_for_window_id(std::string const &id) const -> WindowInfo &
retrieve metadata for a persistent surface id
void remove_tree_from_workspace(Window const &window, std::shared_ptr< Workspace > const &workspace)
Remove the tree containing window from a workspace.
auto count_applications() const -> unsigned int
count the applications
void for_each_application(std::function< void(ApplicationInfo &info)> const &functor)
execute functor for each application
void place_and_size_for_state(WindowSpecification &modifications, WindowInfo const &window_info) const
Set a default size and position to reflect state change.
auto info_for(std::weak_ptr< mir::scene::Session > const &session) const -> ApplicationInfo &
retrieve metadata for an application
auto window_at(mir::geometry::Point cursor) const -> Window
Find the topmost window at the cursor.
void add_tree_to_workspace(Window const &window, std::shared_ptr< Workspace > const &workspace)
Add the tree containing window to a workspace.
auto active_window() const -> Window
retrieve the active window
Definition: window_specification.h:42
A rectangular area of the display. Not tied to a specific output.
Definition: zone.h:34
Definition: splash_session.h:22
Mir Abstraction Layer.
Definition: floating_window_manager.h:29
std::shared_ptr< mir::scene::Session > Application
Definition: application.h:32
STL namespace.
Definition: displacement.h:30
Definition: point.h:30
Definition: rectangle.h:31
Definition: application_info.h:30
Definition: window_info.h:31

Copyright © 2012-2022 Canonical Ltd.
Generated on Tue Nov 8 21:37:30 UTC 2022
This documentation is licensed under the GPL version 2 or 3.