Program Listing for File window_management_policy.h¶
↰ Return to documentation for file (include/miral/miral/window_management_policy.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_MANAGEMENT_POLICY_H
#define MIRAL_WINDOW_MANAGEMENT_POLICY_H
#include <mir/geometry/displacement.h>
#include <mir/geometry/rectangles.h>
#include <mir_toolkit/common.h>
struct MirKeyboardEvent;
struct MirTouchEvent;
struct MirPointerEvent;
struct MirInputEvent;
#include <memory>
namespace miral
{
class Window;
class WindowSpecification;
struct ApplicationInfo;
class Output;
class Zone;
struct WindowInfo;
class Workspace;
using namespace mir::geometry;
class WindowManagementPolicy
{
public:
virtual void advise_begin();
virtual void advise_end();
virtual auto place_new_window(
ApplicationInfo const& app_info,
WindowSpecification const& requested_specification) -> WindowSpecification = 0;
virtual void handle_window_ready(WindowInfo& window_info) = 0;
virtual void handle_modify_window(WindowInfo& window_info, WindowSpecification const& modifications) = 0;
virtual void handle_raise_window(WindowInfo& window_info) = 0;
virtual auto confirm_placement_on_display(
WindowInfo const& window_info,
MirWindowState new_state,
Rectangle const& new_placement) -> Rectangle = 0;
virtual bool handle_keyboard_event(MirKeyboardEvent const* event) = 0;
virtual bool handle_touch_event(MirTouchEvent const* event) = 0;
virtual bool handle_pointer_event(MirPointerEvent const* event) = 0;
virtual void advise_new_app(ApplicationInfo& application);
virtual void advise_delete_app(ApplicationInfo const& application);
virtual void advise_new_window(WindowInfo const& window_info);
virtual void advise_focus_lost(WindowInfo const& window_info);
virtual void advise_focus_gained(WindowInfo const& window_info);
virtual void advise_state_change(WindowInfo const& window_info, MirWindowState state);
virtual void advise_move_to(WindowInfo const& window_info, Point top_left);
virtual void advise_resize(WindowInfo const& window_info, Size const& new_size);
virtual void advise_delete_window(WindowInfo const& window_info);
virtual void advise_raise(std::vector<Window> const& windows);
virtual void advise_adding_to_workspace(
std::shared_ptr<Workspace> const& workspace,
std::vector<Window> const& windows);
virtual void advise_removing_from_workspace(
std::shared_ptr<Workspace> const& workspace,
std::vector<Window> const& windows);
virtual void handle_request_move(WindowInfo& window_info, MirInputEvent const* input_event) = 0;
virtual void handle_request_resize(WindowInfo& window_info, MirInputEvent const* input_event, MirResizeEdge edge) = 0;
virtual void advise_output_create(Output const& output);
virtual void advise_output_update(Output const& updated, Output const& original);
virtual void advise_output_delete(Output const& output);
virtual auto confirm_inherited_move(WindowInfo const& window_info, Displacement movement) -> Rectangle = 0;
virtual void advise_application_zone_create(Zone const& application_zone);
virtual void advise_application_zone_update(Zone const& updated, Zone const& original);
virtual void advise_application_zone_delete(Zone const& application_zone);
virtual ~WindowManagementPolicy() = default;
WindowManagementPolicy() = default;
WindowManagementPolicy(WindowManagementPolicy const&) = delete;
WindowManagementPolicy& operator=(WindowManagementPolicy const&) = delete;
};
class WindowManagerTools;
}
#endif //MIRAL_WINDOW_MANAGEMENT_POLICY_H