Mir
window_info.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2016-2020 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 2 or 3 as
6  * 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  * Authored by: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 #ifndef MIRAL_WINDOW_INFO_H
20 #define MIRAL_WINDOW_INFO_H
21 
22 #include "miral/window.h"
24 
26 #include <mir/optional_value.h>
27 
28 #include <algorithm>
29 
30 namespace miral
31 {
32 struct WindowInfo
33 {
35 
37  WindowInfo(Window const& window, WindowSpecification const& params);
39  explicit WindowInfo(WindowInfo const& that);
41 
42  bool can_be_active() const;
43 
44  bool can_morph_to(MirWindowType new_type) const;
45 
46  bool must_have_parent() const;
47 
48  bool must_not_have_parent() const;
49 
50  bool is_visible() const;
51 
53 
54  void constrain_resize(mir::geometry::Point& requested_pos, mir::geometry::Size& requested_size) const;
55 
56  auto window() const -> Window&;
57 
58  auto name() const -> std::string;
59 
60  auto type() const -> MirWindowType;
61 
62  auto state() const -> MirWindowState;
63 
64  auto restore_rect() const -> mir::geometry::Rectangle;
65 
66  auto parent() const -> Window;
67 
68  auto children() const -> std::vector <Window> const&;
69 
70  auto min_width() const -> mir::geometry::Width;
71 
72  auto min_height() const -> mir::geometry::Height;
73 
74  auto max_width() const -> mir::geometry::Width;
75 
76  auto max_height() const -> mir::geometry::Height;
77 
78  auto width_inc() const -> mir::geometry::DeltaX;
79 
80  auto height_inc() const -> mir::geometry::DeltaY;
81 
82  auto min_aspect() const -> AspectRatio;
83 
84  auto max_aspect() const -> AspectRatio;
85 
86  bool has_output_id() const;
87  auto output_id() const -> int;
88 
90 
92 
93  auto shell_chrome() const -> MirShellChrome;
94 
96  auto userdata() const -> std::shared_ptr<void>;
97  void userdata(std::shared_ptr<void> userdata);
98 
99  void swap(WindowInfo& rhs) { std::swap(self, rhs.self); }
100 
101  auto depth_layer() const -> MirDepthLayer;
102 
106 
109  auto exclusive_rect() const -> mir::optional_value<mir::geometry::Rectangle>;
110 
112  auto clip_area() const -> mir::optional_value<mir::geometry::Rectangle>;
113  void clip_area(mir::optional_value<mir::geometry::Rectangle> const& area);
114 
119  auto application_id() const -> std::string;
121 
122 private:
123  friend class BasicWindowManager;
124  void name(std::string const& name);
125  void type(MirWindowType type);
126  void state(MirWindowState state);
127  void restore_rect(mir::geometry::Rectangle const& restore_rect);
128  void parent(Window const& parent);
129  void add_child(Window const& child);
130  void remove_child(Window const& child);
131  void min_width(mir::geometry::Width min_width);
132  void min_height(mir::geometry::Height min_height);
133  void max_width(mir::geometry::Width max_width);
134  void max_height(mir::geometry::Height max_height);
135  void width_inc(mir::geometry::DeltaX width_inc);
136  void height_inc(mir::geometry::DeltaY height_inc);
139  void output_id(mir::optional_value<int> output_id);
142  void shell_chrome(MirShellChrome chrome);
145  void exclusive_rect(mir::optional_value<mir::geometry::Rectangle> const& rect);
146  void application_id(std::string const& application_id);
147 
148  struct Self;
149  std::unique_ptr<Self> self;
150 };
151 }
152 
153 namespace std
154 {
155 template<> inline void swap(miral::WindowInfo& lhs, miral::WindowInfo& rhs) { lhs.swap(rhs); }
156 }
157 
158 #endif //MIRAL_WINDOW_INFO_H
miral::WindowInfo::max_width
auto max_width() const -> mir::geometry::Width
optional_value.h
miral::WindowInfo::name
auto name() const -> std::string
rectangles.h
miral::WindowInfo::preferred_orientation
auto preferred_orientation() const -> MirOrientationMode
MirPlacementGravity
MirPlacementGravity
Reference point for aligning a surface relative to a rectangle.
Definition: common.h:252
miral
Mir Abstraction Layer.
Definition: floating_window_manager.h:31
miral::WindowInfo::must_not_have_parent
bool must_not_have_parent() const
miral::WindowInfo::constrain_resize
void constrain_resize(mir::geometry::Point &requested_pos, mir::geometry::Size &requested_size) const
miral::WindowInfo::max_height
auto max_height() const -> mir::geometry::Height
miral::WindowInfo::can_morph_to
bool can_morph_to(MirWindowType new_type) const
miral::WindowInfo::can_be_active
bool can_be_active() const
mir::geometry::detail::IntWrapper< struct WidthTag >
MirPointerConfinementState
MirPointerConfinementState
Pointer Confinement.
Definition: common.h:404
miral::WindowInfo::window
auto window() const -> Window &
miral::WindowInfo::application_id
auto application_id() const -> std::string
The D-bus service name and basename of the app's .desktop file See http://standards....
miral::WindowInfo::confine_pointer
auto confine_pointer() const -> MirPointerConfinementState
miral::WindowInfo::swap
void swap(WindowInfo &rhs)
Definition: window_info.h:99
window.h
miral::WindowInfo::output_id
auto output_id() const -> int
miral::WindowInfo::~WindowInfo
~WindowInfo()
miral::WindowSpecification::AspectRatio
Definition: window_specification.h:52
miral::WindowSpecification
Definition: window_specification.h:44
miral::WindowInfo::shell_chrome
auto shell_chrome() const -> MirShellChrome
mir::geometry::Rectangle
Definition: rectangle.h:34
window_specification.h
miral::WindowInfo::max_aspect
auto max_aspect() const -> AspectRatio
miral::WindowInfo::depth_layer
auto depth_layer() const -> MirDepthLayer
miral::WindowInfo::restore_rect
auto restore_rect() const -> mir::geometry::Rectangle
miral::Window
Handle class to manage a Mir surface. It may be null (e.g. default initialized)
Definition: window.h:38
miral::WindowInfo::WindowInfo
WindowInfo(WindowInfo const &that)
mir
Definition: splash_session.h:24
miral::WindowInfo::is_visible
bool is_visible() const
miral::WindowInfo::width_inc
auto width_inc() const -> mir::geometry::DeltaX
miral::WindowInfo::needs_titlebar
static bool needs_titlebar(MirWindowType type)
miral::WindowInfo::parent
auto parent() const -> Window
miral::WindowInfo::height_inc
auto height_inc() const -> mir::geometry::DeltaY
miral::WindowInfo::children
auto children() const -> std::vector< Window > const &
MirWindowState
MirWindowState
Definition: common.h:88
miral::WindowInfo::WindowInfo
WindowInfo(Window const &window, WindowSpecification const &params)
miral::WindowInfo::min_width
auto min_width() const -> mir::geometry::Width
miral::WindowInfo::min_aspect
auto min_aspect() const -> AspectRatio
miral::WindowInfo::has_output_id
bool has_output_id() const
miral::WindowInfo::BasicWindowManager
friend class BasicWindowManager
Definition: window_info.h:123
miral::WindowInfo::clip_area
auto clip_area() const -> mir::optional_value< mir::geometry::Rectangle >
Mir will not render anything outside this rectangle.
MirShellChrome
MirShellChrome
Shell chrome.
Definition: common.h:392
miral::WindowInfo::exclusive_rect
auto exclusive_rect() const -> mir::optional_value< mir::geometry::Rectangle >
Mir will try to avoid occluding the area covered by this rectangle (relative to the window) (only mea...
miral::WindowInfo
Definition: window_info.h:33
miral::WindowInfo::must_have_parent
bool must_have_parent() const
miral::WindowInfo::type
auto type() const -> MirWindowType
miral::WindowInfo::operator=
WindowInfo & operator=(WindowInfo const &that)
miral::WindowInfo::min_height
auto min_height() const -> mir::geometry::Height
mir::geometry::Point
Definition: point.h:31
miral::WindowInfo::userdata
auto userdata() const -> std::shared_ptr< void >
This can be used by client code to store window manager specific information.
miral::WindowInfo::state
auto state() const -> MirWindowState
miral::WindowInfo::attached_edges
auto attached_edges() const -> MirPlacementGravity
Get the edges of the output that the window is attached to (only meaningful for windows in state mir_...
MirWindowType
MirWindowType
Definition: common.h:73
MirDepthLayer
MirDepthLayer
Depth layer controls Z ordering of surfaces.
Definition: common.h:428
mir::geometry::Size
Definition: size.h:32
MirOrientationMode
MirOrientationMode
Definition: common.h:225
miral::WindowInfo::WindowInfo
WindowInfo()

Copyright © 2012-2020 Canonical Ltd.
Generated on Sun Oct 4 22:38:34 UTC 2020
This documentation is licensed under the GPL version 2 or 3.