Program Listing for File window_manager_tools.h¶
↰ Return to documentation for file (include/miral/miral/window_manager_tools.h
)
/*
* Copyright © Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 or 3 as
* published by the Free Software Foundation.
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef MIRAL_WINDOW_MANAGER_TOOLS_H
#define MIRAL_WINDOW_MANAGER_TOOLS_H
#include "miral/application.h"
#include "window_info.h"
#include <mir/geometry/displacement.h>
#include <functional>
#include <memory>
#include <optional>
namespace mir
{
namespace scene { class Surface; }
}
namespace miral
{
class Window;
struct WindowInfo;
struct ApplicationInfo;
class WindowSpecification;
class Zone;
class Workspace;
class WindowManagerToolsImplementation;
class WindowManagerTools
{
public:
explicit WindowManagerTools(WindowManagerToolsImplementation* tools);
WindowManagerTools(WindowManagerTools const&);
WindowManagerTools& operator=(WindowManagerTools const&);
~WindowManagerTools();
auto count_applications() const -> unsigned int;
void for_each_application(std::function<void(ApplicationInfo& info)> const& functor);
auto find_application(std::function<bool(ApplicationInfo const& info)> const& predicate)
-> Application;
auto info_for(std::weak_ptr<mir::scene::Session> const& session) const -> ApplicationInfo&;
auto info_for(std::weak_ptr<mir::scene::Surface> const& surface) const -> WindowInfo&;
auto info_for(Window const& window) const -> WindowInfo&;
auto info_for_window_id(std::string const& id) const -> WindowInfo&;
auto id_for_window(Window const& window) const -> std::string;
void ask_client_to_close(Window const& window);
auto active_window() const -> Window;
auto select_active_window(Window const& hint) -> Window;
void drag_active_window(mir::geometry::Displacement movement);
void drag_window(Window const& window, mir::geometry::Displacement movement);
void focus_next_application();
void focus_prev_application();
void focus_next_within_application();
void focus_prev_within_application();
auto window_to_select_application(const Application) const -> std::optional<Window>;
auto window_at(mir::geometry::Point cursor) const -> Window;
auto active_output() -> mir::geometry::Rectangle const;
auto active_application_zone() const -> Zone;
void raise_tree(Window const& root);
void swap_tree_order(Window const& first, Window const& second);
void send_tree_to_back(Window const& root);
void modify_window(WindowInfo& window_info, WindowSpecification const& modifications);
void modify_window(Window const& window, WindowSpecification const& modifications);
void place_and_size_for_state(WindowSpecification& modifications, WindowInfo const& window_info) const;
auto create_workspace() -> std::shared_ptr<Workspace>;
void add_tree_to_workspace(Window const& window, std::shared_ptr<Workspace> const& workspace);
void remove_tree_from_workspace(Window const& window, std::shared_ptr<Workspace> const& workspace);
void move_workspace_content_to_workspace(
std::shared_ptr<Workspace> const& to_workspace,
std::shared_ptr<Workspace> const& from_workspace);
void for_each_workspace_containing(
Window const& window,
std::function<void(std::shared_ptr<Workspace> const& workspace)> const& callback);
void for_each_window_in_workspace(
std::shared_ptr<Workspace> const& workspace,
std::function<void(Window const& window)> const& callback);
void invoke_under_lock(std::function<void()> const& callback);
private:
WindowManagerToolsImplementation* tools;
};
}
#endif //MIRAL_WINDOW_MANAGER_TOOLS_H