Mir
window_info.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2016 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 
36  WindowInfo();
37  WindowInfo(Window const& window, WindowSpecification const& params);
38  ~WindowInfo();
39  explicit WindowInfo(WindowInfo const& that);
40  WindowInfo& operator=(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 
52  static bool needs_titlebar(MirWindowType type);
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  void name(std::string const& name);
60 
61  auto type() const -> MirWindowType;
62  void type(MirWindowType type);
63 
64  auto state() const -> MirWindowState;
66 
67  auto restore_rect() const -> mir::geometry::Rectangle;
68  void restore_rect(mir::geometry::Rectangle const& restore_rect);
69 
70  auto parent() const -> Window;
71  void parent(Window const& parent);
72 
73  auto children() const -> std::vector <Window> const&;
74  void add_child(Window const& child);
75  void remove_child(Window const& child);
76 
77  auto min_width() const -> mir::geometry::Width;
78  void min_width(mir::geometry::Width min_width);
79 
80  auto min_height() const -> mir::geometry::Height;
81  void min_height(mir::geometry::Height min_height);
82 
83  auto max_width() const -> mir::geometry::Width;
84  void max_width(mir::geometry::Width max_width);
85 
86  auto max_height() const -> mir::geometry::Height;
87  void max_height(mir::geometry::Height max_height);
88 
89  auto width_inc() const -> mir::geometry::DeltaX;
90  void width_inc(mir::geometry::DeltaX width_inc);
91 
92  auto height_inc() const -> mir::geometry::DeltaY;
93  void height_inc(mir::geometry::DeltaY height_inc);
94 
95  auto min_aspect() const -> AspectRatio;
97 
98  auto max_aspect() const -> AspectRatio;
100 
101  bool has_output_id() const;
102  auto output_id() const -> int;
103  void output_id(mir::optional_value<int> output_id);
104 
107 
110 
111  auto shell_chrome() const -> MirShellChrome;
112  void shell_chrome(MirShellChrome chrome);
113 
115  auto userdata() const -> std::shared_ptr<void>;
116  void userdata(std::shared_ptr<void> userdata);
117 
118  void swap(WindowInfo& rhs) { std::swap(self, rhs.self); }
119 
120  auto depth_layer() const -> MirDepthLayer;
122 
125  auto attached_edges() const -> MirPlacementGravity;
129 
132  auto exclusive_rect() const -> mir::optional_value<mir::geometry::Rectangle>;
135  void exclusive_rect(mir::optional_value<mir::geometry::Rectangle> const& rect);
136 
138  auto clip_area() const -> mir::optional_value<mir::geometry::Rectangle>;
139  void clip_area(mir::optional_value<mir::geometry::Rectangle> const& area);
140 
145  auto application_id() const -> std::string;
146  void application_id(std::string const& application_id);
148 
149 private:
150  struct Self;
151  std::unique_ptr<Self> self;
152 };
153 }
154 
155 namespace std
156 {
157 template<> inline void swap(miral::WindowInfo& lhs, miral::WindowInfo& rhs) { lhs.swap(rhs); }
158 }
159 
160 #endif //MIRAL_WINDOW_INFO_H
Definition: size.h:31
Definition: splash_session.h:24
auto max_height() const -> mir::geometry::Height
void constrain_resize(mir::geometry::Point &requested_pos, mir::geometry::Size &requested_size) const
auto preferred_orientation() const -> MirOrientationMode
auto max_width() const -> mir::geometry::Width
auto depth_layer() const -> MirDepthLayer
auto state() const -> MirWindowState
bool must_not_have_parent() const
bool can_morph_to(MirWindowType new_type) const
Definition: point.h:30
auto confine_pointer() const -> MirPointerConfinementState
auto window() const -> Window &
auto output_id() const -> int
static bool needs_titlebar(MirWindowType type)
void remove_child(Window const &child)
MirPointerConfinementState
Pointer Confinement.
Definition: common.h:469
bool can_be_active() const
void swap(WindowInfo &rhs)
Definition: window_info.h:118
Definition: window_specification.h:61
auto max_aspect() const -> AspectRatio
Definition: window_info.h:32
auto application_id() const -> std::string
The D-bus service name and basename of the app's .desktop file See http://standards....
auto clip_area() const -> mir::optional_value< mir::geometry::Rectangle >
Mir will not render anything outside this rectangle.
auto shell_chrome() const -> MirShellChrome
Definition: window_specification.h:43
Handle class to manage a Mir surface. It may be null (e.g. default initialized)
Definition: window.h:37
auto min_width() const -> mir::geometry::Width
auto width_inc() const -> mir::geometry::DeltaX
bool has_output_id() const
auto restore_rect() const -> mir::geometry::Rectangle
bool is_visible() const
MirWindowType
Definition: common.h:109
auto min_aspect() const -> AspectRatio
auto height_inc() const -> mir::geometry::DeltaY
MirDepthLayer
Depth layer controls Z ordering of surfaces.
Definition: common.h:493
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...
bool must_have_parent() const
auto parent() const -> Window
WindowInfo & operator=(WindowInfo const &that)
auto type() const -> MirWindowType
auto children() const -> std::vector< Window > const &
MirShellChrome
Shell chrome.
Definition: common.h:457
auto min_height() const -> mir::geometry::Height
auto userdata() const -> std::shared_ptr< void >
This can be used by client code to store window manager specific information.
Definition: rectangle.h:33
MirOrientationMode
Definition: common.h:290
MirWindowState
Definition: common.h:141
auto name() const -> std::string
Mir Abstraction Layer.
Definition: floating_window_manager.h:29
auto attached_edges() const -> MirPlacementGravity
Get the edges of the output that the window is attached to (only meaningful for windows in state mir_...
void add_child(Window const &child)
MirPlacementGravity
Reference point for aligning a surface relative to a rectangle.
Definition: common.h:317

Copyright © 2012-2020 Canonical Ltd.
Generated on Sun Jul 12 13:42:43 UTC 2020
This documentation is licensed under the GPL version 2 or 3.