Mir
minimal_window_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2019 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 
23 namespace miral
24 {
25 /// Minimal implementation of a floating window management policy
26 /// \remark Since MirAL 2.5
28 {
29 public:
30  explicit MinimalWindowManager(WindowManagerTools const& tools);
32 
33  /// Honours the requested specification
35  ApplicationInfo const& app_info,
36  WindowSpecification const& requested_specification) -> WindowSpecification override;
37 
38  /// If the window can have focus it is given focus
39  void handle_window_ready(WindowInfo& window_info) override;
40 
41  /// Honours the requested modifications
42  void handle_modify_window(WindowInfo& window_info, WindowSpecification const& modifications) override;
43 
44  /// Gives focus to the requesting window (tree)
45  void handle_raise_window(WindowInfo& window_info) override;
46 
47  /// Honours the requested placement
49  WindowInfo const& window_info, MirWindowState new_state, Rectangle const& new_placement) -> Rectangle override;
50 
51  /// Handles Alt-Tab, Alt-Grave and Alt-F4
52  bool handle_keyboard_event(MirKeyboardEvent const* event) override;
53 
54  /// Handles touch to focus
55  bool handle_touch_event(MirTouchEvent const* event) override;
56 
57  /// Handles pre-existing move & resize gestures, plus click to focus
58  bool handle_pointer_event(MirPointerEvent const* event) override;
59 
60  /// Currently unimplemented
61  void handle_request_drag_and_drop(WindowInfo& window_info) override;
62 
63  /// Initiates a move gesture (only implemented for pointers)
64  void handle_request_move(WindowInfo& window_info, MirInputEvent const* input_event) override;
65 
66  /// Initiates a resize gesture (only implemented for pointers)
67  void handle_request_resize(WindowInfo& window_info, MirInputEvent const* input_event, MirResizeEdge edge) override;
68 
69  /// Honours the requested movement
70  auto confirm_inherited_move(WindowInfo const& window_info, Displacement movement) -> Rectangle override;
71 
72  /// Raises newly focused window
73  void advise_focus_gained(WindowInfo const& window_info) override;
74 
75 protected:
77 
78  bool begin_pointer_move(WindowInfo const& window_info, MirInputEvent const* input_event);
79  bool begin_pointer_resize(WindowInfo const& window_info, MirInputEvent const* input_event, MirResizeEdge const& edge);
80 
81  bool begin_touch_move(WindowInfo const& window_info, MirInputEvent const* input_event);
82  bool begin_touch_resize(WindowInfo const& window_info, MirInputEvent const* input_event, MirResizeEdge const& edge);
83 
84 private:
85  struct Impl;
86  Impl* const self;
87 };
88 }
89 
90 #endif //MIRAL_MINIMAL_WINDOW_MANAGER_H

Copyright © 2012-2022 Canonical Ltd.
Generated on Tue Sep 13 03:20:30 UTC 2022
This documentation is licensed under the GPL version 2 or 3.