MirAL
Public Member Functions | List of all members
miral::WindowManagerTools Class Reference

Window management functions for querying and updating MirAL's model. More...

#include <miral/window_manager_tools.h>

Public Member Functions

 WindowManagerTools (WindowManagerToolsImplementation *tools)
 
 WindowManagerTools (WindowManagerTools const &)
 
WindowManagerToolsoperator= (WindowManagerTools const &)
 
 ~WindowManagerTools ()
 
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 "Update Model" member functions. More...
 
Query & Update Model

These functions assume that the BasicWindowManager data structures can be accessed freely.

I.e. they should only be used by a thread that has called the WindowManagementPolicy methods (where any necessary locks are held) or via a invoke_under_lock() callback.

auto count_applications () const -> unsigned int
 count the applications More...
 
void for_each_application (std::function< void(ApplicationInfo &info)> const &functor)
 execute functor for each application More...
 
auto find_application (std::function< bool(ApplicationInfo const &info)> const &predicate) -> Application
 find an application meeting the predicate More...
 
auto info_for (std::weak_ptr< mir::scene::Session > const &session) const -> ApplicationInfo &
 retrieve metadata for an application More...
 
auto info_for (std::weak_ptr< mir::scene::Surface > const &surface) const -> WindowInfo &
 retrieve metadata for a window More...
 
auto info_for (Window const &window) const -> WindowInfo &
 retrieve metadata for a window More...
 
auto info_for_window_id (std::string const &id) const -> WindowInfo &
 retrieve metadata for a persistent surface id More...
 
auto id_for_window (Window const &window) const -> std::string
 retrieve the persistent surface id for a window More...
 
void ask_client_to_close (Window const &window)
 Send close request to the window. More...
 
void force_close (Window const &window)
 Close the window by force. More...
 
auto active_window () const -> Window
 retrieve the active window More...
 
auto select_active_window (Window const &hint) -> Window
 select a new active window based on the hint More...
 
void drag_active_window (mir::geometry::Displacement movement)
 move the active window More...
 
void focus_next_application ()
 make the next application active More...
 
void focus_next_within_application ()
 make the next surface active within the active application More...
 
auto window_at (mir::geometry::Point cursor) const -> Window
 Find the topmost window at the cursor. More...
 
auto active_display () -> mir::geometry::Rectangle const
 Find the active display area. More...
 
void raise_tree (Window const &root)
 Raise window and all its children. More...
 
void modify_window (WindowInfo &window_info, WindowSpecification const &modifications)
 Apply modifications to a window. More...
 
void modify_window (Window const &window, WindowSpecification const &modifications)
 Apply modifications to a window. More...
 
void place_and_size_for_state (WindowSpecification &modifications, WindowInfo const &window_info) const
 Set a default size and position to reflect state change. More...
 

Detailed Description

Window management functions for querying and updating MirAL's model.

Constructor & Destructor Documentation

§ WindowManagerTools() [1/2]

miral::WindowManagerTools::WindowManagerTools ( WindowManagerToolsImplementation *  tools)
explicit

§ WindowManagerTools() [2/2]

miral::WindowManagerTools::WindowManagerTools ( WindowManagerTools const &  )

§ ~WindowManagerTools()

miral::WindowManagerTools::~WindowManagerTools ( )

Member Function Documentation

§ active_display()

auto miral::WindowManagerTools::active_display ( ) -> mir::geometry::Rectangle const

Find the active display area.

§ active_window()

auto miral::WindowManagerTools::active_window ( ) const -> Window

retrieve the active window

§ ask_client_to_close()

void miral::WindowManagerTools::ask_client_to_close ( Window const &  window)

Send close request to the window.

§ count_applications()

auto miral::WindowManagerTools::count_applications ( ) const -> unsigned int

count the applications

Returns
number of applications

§ drag_active_window()

void miral::WindowManagerTools::drag_active_window ( mir::geometry::Displacement  movement)

move the active window

§ find_application()

auto miral::WindowManagerTools::find_application ( std::function< bool(ApplicationInfo const &info)> const &  predicate) -> Application

find an application meeting the predicate

Parameters
predicatethe predicate
Returns
the application

§ focus_next_application()

void miral::WindowManagerTools::focus_next_application ( )

make the next application active

§ focus_next_within_application()

void miral::WindowManagerTools::focus_next_within_application ( )

make the next surface active within the active application

§ for_each_application()

void miral::WindowManagerTools::for_each_application ( std::function< void(ApplicationInfo &info)> const &  functor)

execute functor for each application

Parameters
functorthe functor

§ force_close()

void miral::WindowManagerTools::force_close ( Window const &  window)

Close the window by force.

Note
ask_client_to_close() is the polite way

§ id_for_window()

auto miral::WindowManagerTools::id_for_window ( Window const &  window) const -> std::string

retrieve the persistent surface id for a window

Parameters
idthe window
Returns
the persistent surface id

§ info_for() [1/3]

auto miral::WindowManagerTools::info_for ( std::weak_ptr< mir::scene::Session > const &  session) const -> ApplicationInfo &

retrieve metadata for an application

Parameters
sessionthe application session
Returns
the metadata

§ info_for() [2/3]

auto miral::WindowManagerTools::info_for ( std::weak_ptr< mir::scene::Surface > const &  surface) const -> WindowInfo &

retrieve metadata for a window

Parameters
surfacethe window surface
Returns
the metadata

§ info_for() [3/3]

auto miral::WindowManagerTools::info_for ( Window const &  window) const -> WindowInfo &

retrieve metadata for a window

Parameters
windowthe window
Returns
the metadata

§ info_for_window_id()

auto miral::WindowManagerTools::info_for_window_id ( std::string const &  id) const -> WindowInfo &

retrieve metadata for a persistent surface id

Parameters
idthe persistent surface id
Returns
the metadata
Exceptions
invalid_argumentor runtime_error if the id is badly formatted/doesn't identify a current window

§ invoke_under_lock()

void miral::WindowManagerTools::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 "Update Model" member functions.

This should NOT be used by a thread that has called the WindowManagementPolicy methods (and already holds the lock).

§ modify_window() [1/2]

void miral::WindowManagerTools::modify_window ( WindowInfo window_info,
WindowSpecification const &  modifications 
)

Apply modifications to a window.

§ modify_window() [2/2]

void miral::WindowManagerTools::modify_window ( Window const &  window,
WindowSpecification const &  modifications 
)

Apply modifications to a window.

§ operator=()

WindowManagerTools& miral::WindowManagerTools::operator= ( WindowManagerTools const &  )

§ place_and_size_for_state()

void miral::WindowManagerTools::place_and_size_for_state ( WindowSpecification modifications,
WindowInfo const &  window_info 
) const

Set a default size and position to reflect state change.

§ raise_tree()

void miral::WindowManagerTools::raise_tree ( Window const &  root)

Raise window and all its children.

§ select_active_window()

auto miral::WindowManagerTools::select_active_window ( Window const &  hint) -> Window

select a new active window based on the hint

Parameters
hintthe hint
Returns
the new active window

§ window_at()

auto miral::WindowManagerTools::window_at ( mir::geometry::Point  cursor) const -> Window

Find the topmost window at the cursor.


The documentation for this class was generated from the following file:

Copyright © 2016 Canonical Ltd.
Generated on Tue Dec 20 16:03:55 UTC 2016