Mir
window_specification.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 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
17#ifndef MIRAL_WINDOW_SPECIFICATION_H
18#define MIRAL_WINDOW_SPECIFICATION_H
19
20#include <mir_toolkit/common.h>
21
22#include <mir/geometry/displacement.h>
23#include <mir/geometry/rectangles.h>
24#include <mir/optional_value.h>
25#include <mir/int_wrapper.h>
26
27#include <memory>
28
29namespace mir
30{
31namespace scene { class Surface; }
32namespace shell { struct SurfaceSpecification; }
33}
34
35namespace miral
36{
37using namespace mir::geometry;
38namespace detail { struct SessionsBufferStreamIdTag; }
39typedef mir::IntWrapper<detail::SessionsBufferStreamIdTag> BufferStreamId;
40
42{
43public:
45 {
46 normal,
48 };
49
50 struct AspectRatio { unsigned width; unsigned height; };
51
55
56 WindowSpecification(mir::shell::SurfaceSpecification const& spec);
57
59
60 auto top_left() const -> mir::optional_value<Point> const&;
61 auto size() const -> mir::optional_value<Size> const&;
62 auto name() const -> mir::optional_value<std::string> const&;
63 auto output_id() const -> mir::optional_value<int> const&;
64 auto type() const -> mir::optional_value<MirWindowType> const&;
65 auto state() const -> mir::optional_value<MirWindowState> const&;
66 auto preferred_orientation() const -> mir::optional_value<MirOrientationMode> const&;
67 auto aux_rect() const -> mir::optional_value<Rectangle> const&;
68 auto placement_hints() const -> mir::optional_value<MirPlacementHints> const&;
69 auto window_placement_gravity() const -> mir::optional_value<MirPlacementGravity> const&;
70 auto aux_rect_placement_gravity() const -> mir::optional_value<MirPlacementGravity> const&;
71 auto aux_rect_placement_offset() const -> mir::optional_value<Displacement> const&;
72 auto min_width() const -> mir::optional_value<Width> const&;
73 auto min_height() const -> mir::optional_value<Height> const&;
74 auto max_width() const -> mir::optional_value<Width> const&;
75 auto max_height() const -> mir::optional_value<Height> const&;
76 auto width_inc() const -> mir::optional_value<DeltaX> const&;
77 auto height_inc() const -> mir::optional_value<DeltaY> const&;
78 auto min_aspect() const -> mir::optional_value<AspectRatio> const&;
79 auto max_aspect() const -> mir::optional_value<AspectRatio> const&;
80
81 auto parent() const -> mir::optional_value<std::weak_ptr<mir::scene::Surface>> const&;
82 auto input_shape() const -> mir::optional_value<std::vector<Rectangle>> const&;
84 auto shell_chrome() const -> mir::optional_value<MirShellChrome> const&;
85 auto confine_pointer() const -> mir::optional_value<MirPointerConfinementState> const&;
86 auto userdata() const -> mir::optional_value<std::shared_ptr<void>> const&;
87
88 auto top_left() -> mir::optional_value<Point>&;
89 /// The new size of the window frame (including any decorations). Will be adjusted based on min_width(),
90 /// WindowInfo::max_width(), WindowInfo::min_height(), WindowInfo::max_height(), WindowInfo::min_aspect(),
91 /// WindowInfo::max_aspect(), WindowInfo::width_inc() and WindowInfo::height_inc(). Set these to properties to their
92 /// default values if they should be ignored.
93 auto size() -> mir::optional_value<Size>&;
94 auto name() -> mir::optional_value<std::string>&;
95 auto output_id() -> mir::optional_value<int>&;
96 auto type() -> mir::optional_value<MirWindowType>&;
97 auto state() -> mir::optional_value<MirWindowState>&;
98 auto preferred_orientation() -> mir::optional_value<MirOrientationMode>&;
99 /// Relative to window's surface's CONTENT offset and size
100 /// (not equal to the top_left and size exposed by this interface if server-side decorations are in use)
101 auto aux_rect() -> mir::optional_value<Rectangle>&;
102 auto placement_hints() -> mir::optional_value<MirPlacementHints>&;
103 auto window_placement_gravity() -> mir::optional_value<MirPlacementGravity>&;
104 auto aux_rect_placement_gravity() -> mir::optional_value<MirPlacementGravity>&;
106
107 /// Constrains how a window can be resized, see the corresponding properties on WindowInfo for details.
108 /// @{
109 auto min_width() -> mir::optional_value<Width>&;
110 auto min_height() -> mir::optional_value<Height>&;
111 auto max_width() -> mir::optional_value<Width>&;
112 auto max_height() -> mir::optional_value<Height>&;
113 auto width_inc() -> mir::optional_value<DeltaX>&;
114 auto height_inc() -> mir::optional_value<DeltaY>&;
117 /// @}
118
119 auto parent() -> mir::optional_value<std::weak_ptr<mir::scene::Surface>>&;
120 auto input_shape() -> mir::optional_value<std::vector<Rectangle>>&;
122 auto shell_chrome() -> mir::optional_value<MirShellChrome>&;
123 auto confine_pointer() -> mir::optional_value<MirPointerConfinementState>&;
124 auto userdata() -> mir::optional_value<std::shared_ptr<void>>&;
125
126 /// The depth layer of a child window is updated with the depth layer of its parent, but can be overridden
127 ///@{
128 auto depth_layer() const -> mir::optional_value<MirDepthLayer> const&;
129 auto depth_layer() -> mir::optional_value<MirDepthLayer>&;
130 ///@}
131
132 /// The set of window eges that are attched to edges of the output
133 /// If attached to perpendicular edges, it is attached to the corner where the two edges intersect
134 /// If attached to oposite edges (eg left and right), it is stretched across the output in that direction
135 /// If all edges are specified, it takes up the entire output
136 ///@{
137 auto attached_edges() const -> mir::optional_value<MirPlacementGravity> const&;
138 auto attached_edges() -> mir::optional_value<MirPlacementGravity>&;
139 ///@}
140
141 /// The area over which the window should not be occluded
142 /// Only meaningful for windows attached to an edge
143 /// If the outer optional is unset (the default), the window's exclusive rect is not changed by this spec
144 /// If the outer optional is set but the inner is not, the window's exclusive rect is cleared
145 ///@{
146 auto exclusive_rect() const -> mir::optional_value<mir::optional_value<mir::geometry::Rectangle>> const&;
148 ///@}
149
150 /// The D-bus service name and basename of the app's .desktop file
151 /// See http://standards.freedesktop.org/desktop-entry-spec/
152 ///@{
153 auto application_id() const -> mir::optional_value<std::string> const&;
154 auto application_id() -> mir::optional_value<std::string>&;
155 ///@}
156
157 /// If this window should have server-side decorations provided by Mir
158 /// Currently, Mir only respects this value during surface construction
159 ///@{
160 auto server_side_decorated() const -> mir::optional_value<bool> const&;
162 ///@}
163
164 /// How the window should gain and lose focus
165 /// \remark Since MirAL 3.3
166 ///@{
167 auto focus_mode() const -> mir::optional_value<MirFocusMode> const&;
168 auto focus_mode() -> mir::optional_value<MirFocusMode>&;
169 ///@}
170
171private:
172 friend auto make_surface_spec(WindowSpecification const& miral_spec) -> mir::shell::SurfaceSpecification;
173 struct Self;
174 std::unique_ptr<Self> self;
175};
176}
177
178#endif //MIRAL_WINDOW_SPECIFICATION_H
Definition: int_wrapper.h:26
Definition: optional_value.h:27
Definition: window_specification.h:42
auto max_aspect() -> mir::optional_value< AspectRatio > &
auto size() -> mir::optional_value< Size > &
The new size of the window frame (including any decorations). Will be adjusted based on min_width(),...
auto placement_hints() const -> mir::optional_value< MirPlacementHints > const &
auto name() const -> mir::optional_value< std::string > const &
auto focus_mode() -> mir::optional_value< MirFocusMode > &
auto attached_edges() -> mir::optional_value< MirPlacementGravity > &
auto application_id() -> mir::optional_value< std::string > &
InputReceptionMode
Definition: window_specification.h:45
auto min_height() -> mir::optional_value< Height > &
auto preferred_orientation() -> mir::optional_value< MirOrientationMode > &
auto min_aspect() const -> mir::optional_value< AspectRatio > const &
auto max_aspect() const -> mir::optional_value< AspectRatio > const &
auto server_side_decorated() const -> mir::optional_value< bool > const &
If this window should have server-side decorations provided by Mir Currently, Mir only respects this ...
auto preferred_orientation() const -> mir::optional_value< MirOrientationMode > const &
auto depth_layer() const -> mir::optional_value< MirDepthLayer > const &
The depth layer of a child window is updated with the depth layer of its parent, but can be overridde...
auto state() -> mir::optional_value< MirWindowState > &
auto server_side_decorated() -> mir::optional_value< bool > &
auto width_inc() -> mir::optional_value< DeltaX > &
auto aux_rect_placement_gravity() -> mir::optional_value< MirPlacementGravity > &
auto shell_chrome() -> mir::optional_value< MirShellChrome > &
auto attached_edges() const -> mir::optional_value< MirPlacementGravity > const &
The set of window eges that are attched to edges of the output If attached to perpendicular edges,...
auto max_width() const -> mir::optional_value< Width > const &
auto min_height() const -> mir::optional_value< Height > const &
auto aux_rect_placement_offset() -> mir::optional_value< Displacement > &
auto height_inc() const -> mir::optional_value< DeltaY > const &
auto type() -> mir::optional_value< MirWindowType > &
auto min_width() -> mir::optional_value< Width > &
Constrains how a window can be resized, see the corresponding properties on WindowInfo for details.
auto parent() const -> mir::optional_value< std::weak_ptr< mir::scene::Surface > > const &
auto output_id() -> mir::optional_value< int > &
WindowSpecification(WindowSpecification const &that)
auto placement_hints() -> mir::optional_value< MirPlacementHints > &
auto input_shape() const -> mir::optional_value< std::vector< Rectangle > > const &
auto userdata() -> mir::optional_value< std::shared_ptr< void > > &
WindowSpecification(mir::shell::SurfaceSpecification const &spec)
auto shell_chrome() const -> mir::optional_value< MirShellChrome > const &
auto width_inc() const -> mir::optional_value< DeltaX > const &
auto window_placement_gravity() const -> mir::optional_value< MirPlacementGravity > const &
auto confine_pointer() const -> mir::optional_value< MirPointerConfinementState > const &
auto input_shape() -> mir::optional_value< std::vector< Rectangle > > &
auto parent() -> mir::optional_value< std::weak_ptr< mir::scene::Surface > > &
auto max_height() -> mir::optional_value< Height > &
auto focus_mode() const -> mir::optional_value< MirFocusMode > const &
How the window should gain and lose focus.
auto input_mode() const -> mir::optional_value< InputReceptionMode > const &
auto top_left() -> mir::optional_value< Point > &
auto size() const -> mir::optional_value< Size > const &
auto operator=(WindowSpecification const &that) -> WindowSpecification &
auto type() const -> mir::optional_value< MirWindowType > const &
auto aux_rect() -> mir::optional_value< Rectangle > &
Relative to window's surface's CONTENT offset and size (not equal to the top_left and size exposed by...
auto name() -> mir::optional_value< std::string > &
auto top_left() const -> mir::optional_value< Point > const &
auto aux_rect_placement_gravity() const -> mir::optional_value< MirPlacementGravity > const &
auto height_inc() -> mir::optional_value< DeltaY > &
auto max_height() const -> mir::optional_value< Height > const &
auto max_width() -> mir::optional_value< Width > &
auto window_placement_gravity() -> mir::optional_value< MirPlacementGravity > &
auto application_id() const -> mir::optional_value< std::string > const &
The D-bus service name and basename of the app's .desktop file See http://standards....
auto min_width() const -> mir::optional_value< Width > const &
auto input_mode() -> mir::optional_value< InputReceptionMode > &
friend auto make_surface_spec(WindowSpecification const &miral_spec) -> mir::shell::SurfaceSpecification
auto confine_pointer() -> mir::optional_value< MirPointerConfinementState > &
auto min_aspect() -> mir::optional_value< AspectRatio > &
auto depth_layer() -> mir::optional_value< MirDepthLayer > &
auto exclusive_rect() const -> mir::optional_value< mir::optional_value< mir::geometry::Rectangle > > const &
The area over which the window should not be occluded Only meaningful for windows attached to an edge...
auto output_id() const -> mir::optional_value< int > const &
auto exclusive_rect() -> mir::optional_value< mir::optional_value< mir::geometry::Rectangle > > &
auto userdata() const -> mir::optional_value< std::shared_ptr< void > > const &
auto aux_rect() const -> mir::optional_value< Rectangle > const &
auto state() const -> mir::optional_value< MirWindowState > const &
auto aux_rect_placement_offset() const -> mir::optional_value< Displacement > const &
Basic geometry types. Types for dimensions, displacements, etc. and the operations that they support.
Definition: size.h:27
Definition: internal_client.h:24
Definition: window_specification.h:32
Definition: runner.h:27
Definition: window_specification.h:38
Mir Abstraction Layer.
Definition: runner.h:35
mir::IntWrapper< detail::SessionsBufferStreamIdTag > BufferStreamId
Definition: window_specification.h:39
Definition: window_specification.h:50
unsigned height
Definition: window_specification.h:50
unsigned width
Definition: window_specification.h:50

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.