Class FloatingWindowManager

Inheritance Relationships

Base Type

Class Documentation

class FloatingWindowManager : public miral::WindowManagementPolicy

A minimal floating window management policy.

This policy provides the following features:

  • A stacking, floating window management policy

  • The ability to move and resize windows

  • Touchscreen support

  • Alt + F4 keybind to close windows

  • Focus stealing management

Compositor authors may elect to use this class as provided or subclass it in order to extend the base functionality.

This class is the successor to miral::MinimalWindowManager.

Remark

Since MirAL 5.6

Public Functions

explicit FloatingWindowManager(WindowManagerTools const &tools)
FloatingWindowManager(WindowManagerTools const &tools, FocusStealing focus_stealing, MirInputEventModifier pointer_drag_modifier)
~FloatingWindowManager() override
virtual auto place_new_window(ApplicationInfo const &app_info, WindowSpecification const &requested_specification) -> WindowSpecification override

Given the app_info and requested_specification, this method returns a new miral::WindowSpecification that defines how the new window should be placed.

This method is called before advise_new_window.

Parameters:
  • app_info – the application requesting a new window

  • requested_specification – the requested specification with a default position and size

Returns:

the customized placement

virtual void handle_window_ready(WindowInfo &window_info) override

Focuses the window if it can receive focus.

Parameters:

window_info – the ready window

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

Honors the modifications requested by the client.

Parameters:
  • window_info – the window being modified

  • modifications – the modifications to the window

virtual void handle_raise_window(WindowInfo &window_info) override

Gives focus to the window being raised.

Parameters:

window_info – the window being raised

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

Honors the requested placement of the window.

Parameters:
  • window_info – the window being placed

  • new_state – the new state of the window

  • new_placement – the new rectangle of the window

virtual bool handle_keyboard_event(MirKeyboardEvent const *event) override

Handles Alt-F4 to close the active window.

Parameters:

event – keyboard event

Returns:

true if the event was handled, otherwise false

virtual bool handle_touch_event(MirTouchEvent const *event) override

Handles touch to focus, resizing wndows with touch, and moving windows with touch.

Parameters:

event – touch event

Returns:

true if the event was handled, otherwise false

virtual bool handle_pointer_event(MirPointerEvent const *event) override

Handles focus selection, resizing windows with the pointer, and moving windows with the pointer.

Parameters:

event – pointer events

Returns:

true if the event was handled, otherwise false

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

Initiates a move gesture from the client.

This is only implemented for pointers.

Parameters:
  • window_info – the window being moved

  • input_event – the input event that caused the movement

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

Initiates a resize gesture from the client.

This is only implemented for pointers.

Parameters:
  • window_info – the window being resized

  • input_event – the input event that causes the resize

  • edge – the edge from which the resize happens

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

Honors the requested inherited move.

Parameters:
  • window_info – the window being moved

  • movement – the displacement of the window

virtual void advise_focus_gained(WindowInfo const &window_info) override

Raises the provided window on focus.

Parameters:

window_info – the window receiving focus

virtual void advise_new_window(WindowInfo const &window_info) override

Raises the window based on the miral::FocusStealing of the policy.

Parameters:

window_info – the new window

Protected Functions

bool begin_pointer_move(WindowInfo const &window_info, MirInputEvent const *input_event)
bool begin_pointer_resize(WindowInfo const &window_info, MirInputEvent const *input_event, MirResizeEdge const &edge)
bool begin_touch_move(WindowInfo const &window_info, MirInputEvent const *input_event)
bool begin_touch_resize(WindowInfo const &window_info, MirInputEvent const *input_event, MirResizeEdge const &edge)

Protected Attributes

WindowManagerTools tools