Class WindowManagementPolicy

Inheritance Relationships

Derived Types

Class Documentation

class WindowManagementPolicy

The interface through which the window management policy is determined.

Subclassed by TilingWindowManagerPolicy, miral::CanonicalWindowManagerPolicy, miral::MinimalWindowManager

handle events originating from the client

The policy is expected to update the model as appropriate

virtual void handle_window_ready(WindowInfo &window_info) = 0

notification that the first buffer has been posted

Parameters:

window_info – the window

virtual void handle_modify_window(WindowInfo &window_info, WindowSpecification const &modifications) = 0

request from client to modify the window specification.

Parameters:
  • window_info – the window

  • modifications – the requested changes

Note

the request has already been validated against the type definition

virtual void handle_raise_window(WindowInfo &window_info) = 0

request from client to raise the window

Parameters:

window_info – the window

Note

the request has already been validated against the requesting event

virtual auto confirm_placement_on_display(WindowInfo const &window_info, MirWindowState new_state, Rectangle const &new_placement) -> Rectangle = 0

Confirm (and optionally adjust) the placement of a window on the display.

Called when (re)placing fullscreen, maximized, horizontally maximised and vertically maximized windows to allow adjustment for decorations.

Parameters:
  • window_info – the window

  • new_state – the new state

  • new_placement – the suggested placement

Returns:

the confirmed placement of the window

handle events originating from user

The policy is expected to interpret (and optionally consume) the event

virtual bool handle_keyboard_event(MirKeyboardEvent const *event) = 0

keyboard event handler

Parameters:

event – the event

Returns:

whether the policy has consumed the event

virtual bool handle_touch_event(MirTouchEvent const *event) = 0

touch event handler

Parameters:

event – the event

Returns:

whether the policy has consumed the event

virtual bool handle_pointer_event(MirPointerEvent const *event) = 0

pointer event handler

Parameters:

event – the event

Returns:

whether the policy has consumed the event

notification of WM events that the policy may need to track.

virtual void advise_new_app(ApplicationInfo &application)

Notification that a new application has connected.

Parameters:

application – the application

virtual void advise_delete_app(ApplicationInfo const &application)

Notification that an application has disconnected.

Parameters:

application – the application

virtual void advise_new_window(WindowInfo const &window_info)

Notification that a window has been created.

Parameters:

window_info – the window

virtual void advise_focus_lost(WindowInfo const &window_info)

Notification that a window has lost focus.

Parameters:

window_info – the window

virtual void advise_focus_gained(WindowInfo const &window_info)

Notification that a window has gained focus.

Parameters:

window_info – the window

virtual void advise_state_change(WindowInfo const &window_info, MirWindowState state)

Notification that a window is about to change state.

Parameters:
  • window_info – the window

  • state – the new state

virtual void advise_move_to(WindowInfo const &window_info, Point top_left)

Notification that a window is about to move.

Parameters:
  • window_info – the window

  • top_left – the new position

virtual void advise_resize(WindowInfo const &window_info, Size const &new_size)

Notification that a window is about to resize.

Parameters:
  • window_info – the window

  • new_size – the new size

virtual void advise_delete_window(WindowInfo const &window_info)

Notification that a window is about to be destroyed.

Parameters:

window_info – the window

virtual void advise_raise(std::vector<Window> const &windows)

Notification that windows are being raised to the top.

These windows are ordered with parents before children, and form a single tree rooted at the first element.

Parameters:

windows – the windows

Note

The relative Z-order of these windows will be maintained, they will be raised en bloc.

virtual void advise_adding_to_workspace(std::shared_ptr<Workspace> const &workspace, std::vector<Window> const &windows)

Notification that windows are being added to a workspace.

These windows are ordered with parents before children, and form a single tree rooted at the first element.

Parameters:
  • workspace – the workspace

  • windows – the windows

virtual void advise_removing_from_workspace(std::shared_ptr<Workspace> const &workspace, std::vector<Window> const &windows)

Notification that windows are being removed from a workspace.

These windows are ordered with parents before children, and form a single tree rooted at the first element.

Parameters:
  • workspace – the workspace

  • windows – the windows

handle requests originating from the client

The policy is expected to update the model as appropriate

virtual void handle_request_move(WindowInfo &window_info, MirInputEvent const *input_event) = 0

request from client to initiate move

Parameters:
  • window_info – the window

  • input_event – the requesting event

Note

the request has already been validated against the requesting event

virtual void handle_request_resize(WindowInfo &window_info, MirInputEvent const *input_event, MirResizeEdge edge) = 0

request from client to initiate resize

Parameters:
  • window_info – the window

  • input_event – the requesting event

  • edge – the edge(s) being dragged

Note

the request has already been validated against the requesting event

notification of changes to the (connected, active) outputs.

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)

notification of changes to the current application zones

An application zone is the area a maximized application will fill.

There is often (but not necessarily) one zone per output. The areas normal applications windows should avoid (such as the areas covered by panels) will not be part of an application zone

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)

Public Functions

virtual void advise_begin()

before any related calls begin

virtual void advise_end()

after any related calls end

virtual auto place_new_window(ApplicationInfo const &app_info, WindowSpecification const &requested_specification) -> WindowSpecification = 0

Customize initial window placement.

Parameters:
  • app_info – the application requesting a new window

  • requested_specification – the requested specification (updated with default placement)

Returns:

the customized specification

virtual auto confirm_inherited_move(WindowInfo const &window_info, Displacement movement) -> Rectangle = 0

Confirm (and optionally adjust) the motion of a child window when the parent is moved.

Parameters:
  • window_info – the window

  • movement – the movement of the parent

Returns:

the confirmed placement of the window

virtual ~WindowManagementPolicy() = default
WindowManagementPolicy() = default
WindowManagementPolicy(WindowManagementPolicy const&) = delete
WindowManagementPolicy &operator=(WindowManagementPolicy const&) = delete