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  * Authored by: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 #ifndef MIRAL_OUTPUT_H
20 #define MIRAL_OUTPUT_H
21 
22 #include <mir_toolkit/common.h>
23 
24 #include <mir/geometry/rectangle.h>
25 #include <mir/int_wrapper.h>
26 
27 #include <memory>
28 
29 namespace mir { namespace graphics { struct DisplayConfigurationOutput; } }
30 
31 namespace miral
32 {
33 using namespace mir::geometry;
34 
35 class Output
36 {
37 public:
38 
39  struct PhysicalSizeMM { int width; int height; };
40 
41  enum class Type
42  {
43  unknown,
44  vga,
45  dvii,
46  dvid,
47  dvia,
48  composite,
49  svideo,
50  lvds,
51  component,
52  ninepindin,
53  displayport,
54  hdmia,
55  hdmib,
56  tv,
57  edp,
58  virt,
59  dsi,
60  dpi
61  };
62 
63  explicit Output(const mir::graphics::DisplayConfigurationOutput &output);
64  Output(Output const&);
65  Output& operator=(Output const&);
66  ~Output();
67 
69  auto type() const -> Type;
70 
72  auto physical_size_mm() const -> PhysicalSizeMM;
73 
75  auto connected() const -> bool;
76 
78  auto used() const -> bool;
79 
81  auto pixel_format() const -> MirPixelFormat;
82 
84  auto refresh_rate() const -> double;
85 
87  auto power_mode() const -> MirPowerMode;
88 
89  auto orientation() const -> MirOrientation;
90 
92  auto scale() const -> float;
93 
95  auto form_factor() const -> MirFormFactor;
96 
99  auto extents() const -> Rectangle;
100 
103  auto id() const -> int;
104 
105  auto valid() const -> bool;
106 
107  auto is_same_output(Output const& other) const -> bool;
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
miral::Output::PhysicalSizeMM::width
int width
Definition: output.h:39
miral
Mir Abstraction Layer.
Definition: floating_window_manager.h:29
miral::Output::Type
Type
Definition: output.h:41
int_wrapper.h
pixel_format
MirPixelFormat pixel_format
Definition: client_types.h:180
MirPixelFormat
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:244
miral::Output::PhysicalSizeMM
Definition: output.h:39
mir::geometry::Rectangle
Definition: rectangle.h:33
miral::equivalent_display_area
auto equivalent_display_area(Output const &lhs, Output const &rhs) -> bool
height
int height
Definition: client_types.h:179
MirPowerMode
MirPowerMode
Definition: common.h:189
mir
Definition: splash_session.h:24
MirFormFactor
MirFormFactor
Form factor associated with a physical output.
Definition: common.h:429
rectangle.h
miral::Output
Definition: output.h:35
mir::geometry
Basic geometry types. Types for dimensions, displacements, etc. and the operations that they support.
Definition: dimensions.h:30
MirOrientation
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:275
common.h
Output
Definition: wayland_helpers.h:36

Copyright © 2012-2024 Canonical Ltd.
Generated on Tue May 7 06:11:54 UTC 2024
This documentation is licensed under the GPL version 2 or 3.