Mir
minimal_window_manager.h
Go to the documentation of this file.
1/*
2 * Copyright © Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef MIRAL_MINIMAL_WINDOW_MANAGER_H
18#define MIRAL_MINIMAL_WINDOW_MANAGER_H
19
20#include <miral/window_management_policy.h>
21#include <miral/window_manager_tools.h>
22#include <mir_toolkit/events/enums.h>
23
24namespace miral
25{
26/// Minimal implementation of a floating window management policy
27/// \remark Since MirAL 2.5
29{
30public:
32
33 /// Allows shells to change the modifer used to identify a window drag gesture
34 /// The default is mir_input_event_modifier_alt
35 /// \remark Since MirAL 3.7
36 MinimalWindowManager(WindowManagerTools const& tools, MirInputEventModifier pointer_drag_modifier);
37
39
40 /// Honours the requested specification
42 ApplicationInfo const& app_info,
43 WindowSpecification const& requested_specification) -> WindowSpecification override;
44
45 /// If the window can have focus it is given focus
46 void handle_window_ready(WindowInfo& window_info) override;
47
48 /// Honours the requested modifications
49 void handle_modify_window(WindowInfo& window_info, WindowSpecification const& modifications) override;
50
51 /// Gives focus to the requesting window (tree)
52 void handle_raise_window(WindowInfo& window_info) override;
53
54 /// Honours the requested placement
56 WindowInfo const& window_info, MirWindowState new_state, Rectangle const& new_placement) -> Rectangle override;
57
58 /// Handles Alt-Tab, Alt-Grave and Alt-F4
59 bool handle_keyboard_event(MirKeyboardEvent const* event) override;
60
61 /// Handles touch to focus
62 bool handle_touch_event(MirTouchEvent const* event) override;
63
64 /// Handles pre-existing move & resize gestures, plus click to focus
65 bool handle_pointer_event(MirPointerEvent const* event) override;
66
67 /// Currently unimplemented
68 void handle_request_drag_and_drop(WindowInfo& window_info) override;
69
70 /// Initiates a move gesture (only implemented for pointers)
71 void handle_request_move(WindowInfo& window_info, MirInputEvent const* input_event) override;
72
73 /// Initiates a resize gesture (only implemented for pointers)
74 void handle_request_resize(WindowInfo& window_info, MirInputEvent const* input_event, MirResizeEdge edge) override;
75
76 /// Honours the requested movement
77 auto confirm_inherited_move(WindowInfo const& window_info, Displacement movement) -> Rectangle override;
78
79 /// Raises newly focused window
80 void advise_focus_gained(WindowInfo const& window_info) override;
81
82protected:
84
85 bool begin_pointer_move(WindowInfo const& window_info, MirInputEvent const* input_event);
86 bool begin_pointer_resize(WindowInfo const& window_info, MirInputEvent const* input_event, MirResizeEdge const& edge);
87
88 bool begin_touch_move(WindowInfo const& window_info, MirInputEvent const* input_event);
89 bool begin_touch_resize(WindowInfo const& window_info, MirInputEvent const* input_event, MirResizeEdge const& edge);
90
91private:
92 struct Impl;
93 Impl* const self;
94};
95}
96
97#endif //MIRAL_MINIMAL_WINDOW_MANAGER_H
Minimal implementation of a floating window management policy.
Definition: minimal_window_manager.h:29
void advise_focus_gained(WindowInfo const &window_info) override
Raises newly focused window.
auto place_new_window(ApplicationInfo const &app_info, WindowSpecification const &requested_specification) -> WindowSpecification override
Honours the requested specification.
bool handle_keyboard_event(MirKeyboardEvent const *event) override
Handles Alt-Tab, Alt-Grave and Alt-F4.
MinimalWindowManager(WindowManagerTools const &tools)
bool begin_touch_resize(WindowInfo const &window_info, MirInputEvent const *input_event, MirResizeEdge const &edge)
bool handle_pointer_event(MirPointerEvent const *event) override
Handles pre-existing move & resize gestures, plus click to focus.
void handle_window_ready(WindowInfo &window_info) override
If the window can have focus it is given focus.
auto confirm_inherited_move(WindowInfo const &window_info, Displacement movement) -> Rectangle override
Honours the requested movement.
void handle_request_move(WindowInfo &window_info, MirInputEvent const *input_event) override
Initiates a move gesture (only implemented for pointers)
void handle_request_drag_and_drop(WindowInfo &window_info) override
Currently unimplemented.
auto confirm_placement_on_display(WindowInfo const &window_info, MirWindowState new_state, Rectangle const &new_placement) -> Rectangle override
Honours the requested placement.
bool begin_pointer_move(WindowInfo const &window_info, MirInputEvent const *input_event)
void handle_modify_window(WindowInfo &window_info, WindowSpecification const &modifications) override
Honours the requested modifications.
void handle_raise_window(WindowInfo &window_info) override
Gives focus to the requesting window (tree)
bool begin_touch_move(WindowInfo const &window_info, MirInputEvent const *input_event)
void handle_request_resize(WindowInfo &window_info, MirInputEvent const *input_event, MirResizeEdge edge) override
Initiates a resize gesture (only implemented for pointers)
bool handle_touch_event(MirTouchEvent const *event) override
Handles touch to focus.
bool begin_pointer_resize(WindowInfo const &window_info, MirInputEvent const *input_event, MirResizeEdge const &edge)
MinimalWindowManager(WindowManagerTools const &tools, MirInputEventModifier pointer_drag_modifier)
Allows shells to change the modifer used to identify a window drag gesture The default is mir_input_e...
WindowManagerTools tools
Definition: minimal_window_manager.h:83
The interface through which the window management policy is determined.
Definition: window_management_policy.h:50
Window management functions for querying and updating MirAL's model.
Definition: window_manager_tools.h:58
Definition: window_specification.h:42
Mir Abstraction Layer.
Definition: runner.h:35
Definition: application_info.h:30
Definition: window_info.h:31

Copyright © 2012-2023 Canonical Ltd.
Generated on Tue 2 May 10:01:24 UTC 2023
This documentation is licensed under the GPL version 2 or 3.