Mir
output.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 
17 #ifndef MIRAL_OUTPUT_H
18 #define MIRAL_OUTPUT_H
19 
20 #include <mir_toolkit/common.h>
21 
22 #include <mir/geometry/rectangle.h>
23 #include <mir/int_wrapper.h>
24 
25 #include <memory>
26 
27 namespace mir { namespace graphics { struct DisplayConfigurationOutput; } }
28 
29 namespace miral
30 {
31 using namespace mir::geometry;
32 
33 class Output
34 {
35 public:
36 
37  struct PhysicalSizeMM { int width; int height; };
38 
39  enum class Type
40  {
41  unknown,
42  vga,
43  dvii,
44  dvid,
45  dvia,
46  composite,
47  svideo,
48  lvds,
49  component,
50  ninepindin,
51  displayport,
52  hdmia,
53  hdmib,
54  tv,
55  edp
56  };
57 
58  explicit Output(const mir::graphics::DisplayConfigurationOutput &output);
59  Output(Output const&);
62 
64  auto type() const -> Type;
65 
67  auto physical_size_mm() const -> PhysicalSizeMM;
68 
70  auto connected() const -> bool;
71 
73  auto used() const -> bool;
74 
76  auto pixel_format() const -> MirPixelFormat;
77 
79  auto refresh_rate() const -> double;
80 
82  auto power_mode() const -> MirPowerMode;
83 
84  auto orientation() const -> MirOrientation;
85 
87  auto scale() const -> float;
88 
90  auto form_factor() const -> MirFormFactor;
91 
94  auto extents() const -> Rectangle;
95 
98  auto id() const -> int;
99 
100  auto valid() const -> bool;
101 
102  auto is_same_output(Output const& other) const -> bool;
103 
107  auto logical_group_id() const -> int;
108 
109 private:
110  std::shared_ptr<mir::graphics::DisplayConfigurationOutput> self;
111 };
112 
113 bool operator==(Output::PhysicalSizeMM const& lhs, Output::PhysicalSizeMM const& rhs);
114 inline bool operator!=(Output::PhysicalSizeMM const& lhs, Output::PhysicalSizeMM const& rhs)
115 { return !(lhs == rhs); }
116 
117 auto equivalent_display_area(Output const& lhs, Output const& rhs) -> bool;
118 }
119 
120 #endif //MIRAL_OUTPUT_H
Definition: output.h:34
Output(Output const &)
Type
Definition: output.h:40
Output(const mir::graphics::DisplayConfigurationOutput &output)
auto type() const -> Type
The type of the output.
Output & operator=(Output const &)
MirFormFactor
Form factor associated with a physical output.
Definition: common.h:347
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:193
MirPowerMode
Definition: common.h:108
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:163
Basic geometry types. Types for dimensions, displacements, etc. and the operations that they support.
Definition: dimensions.h:29
Definition: splash_session.h:22
Mir Abstraction Layer.
Definition: floating_window_manager.h:29
auto equivalent_display_area(Output const &lhs, Output const &rhs) -> bool
Definition: rectangle.h:31
Definition: output.h:37
int height
Definition: output.h:37

Copyright © 2012-2022 Canonical Ltd.
Generated on Tue May 24 14:35:34 UTC 2022
This documentation is licensed under the GPL version 2 or 3.