Mir
output.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_OUTPUT_H
18#define MIRAL_OUTPUT_H
19
20#include <mir_toolkit/common.h>
21
22#include <mir/geometry/rectangle.h>
23
24#include <map>
25#include <memory>
26#include <optional>
27
28namespace mir { namespace graphics { struct DisplayConfigurationOutput; } }
29
30namespace miral
31{
32using namespace mir::geometry;
33
34class Output
35{
36public:
37
38 struct PhysicalSizeMM { int width; int height; };
39
40 enum class Type
41 {
42 unknown,
43 vga,
44 dvii,
45 dvid,
46 dvia,
48 svideo,
49 lvds,
53 hdmia,
54 hdmib,
55 tv,
56 edp
57 };
58
59 explicit Output(const mir::graphics::DisplayConfigurationOutput &output);
60 Output(Output const&);
63
64 /// The type of the output.
65 auto type() const -> Type;
66
67 /// The physical size of the output.
69
70 /// Whether the output is connected.
71 auto connected() const -> bool;
72
73 /// Whether the output is used in the configuration.
74 auto used() const -> bool;
75
76 /// The current output pixel format.
77 auto pixel_format() const -> MirPixelFormat;
78
79 /// refresh_rate in Hz
80 auto refresh_rate() const -> double;
81
82 /// Current power mode
83 auto power_mode() const -> MirPowerMode;
84
85 auto orientation() const -> MirOrientation;
86
87 /// Requested scale factor for this output, for HiDPI support
88 auto scale() const -> float;
89
90 /// Form factor of this output; phone display, tablet, monitor, TV, projector...
91 auto form_factor() const -> MirFormFactor;
92
93 /// The logical rectangle occupied by the output, based on its position,
94 /// current mode and orientation (rotation)
95 auto extents() const -> Rectangle;
96
97 /// Mir's internal output ID
98 /// mostly useful for matching against a miral::WindowInfo::output_id
99 auto id() const -> int;
100
101 /// The output name. This matches that suppled to clients through wl_output
102 /// \remark Since MirAL 3.8
103 auto name() const -> std::string;
104
105 /// A custom attribute value
106 /// \remark Since MirAL 3.8
107 auto attribute(std::string const& key) const -> std::optional<std::string>;
108
109 /// A custom attribute map
110 /// \remark Since MirAL 3.8
111 auto attributes_map() const -> std::map<std::string const, std::optional<std::string>>;
112
113 auto valid() const -> bool;
114
115 auto is_same_output(Output const& other) const -> bool;
116
117 /// A positive number if this output is part of a logical output group (aka a display wall)
118 /// A single display area will stretch across all outputs in a group
119 /// Zero if this output is not part of a logical group
120 auto logical_group_id() const -> int;
121
122private:
123 std::shared_ptr<mir::graphics::DisplayConfigurationOutput> self;
124};
125
126bool operator==(Output::PhysicalSizeMM const& lhs, Output::PhysicalSizeMM const& rhs);
127inline bool operator!=(Output::PhysicalSizeMM const& lhs, Output::PhysicalSizeMM const& rhs)
128{ return !(lhs == rhs); }
129
130auto equivalent_display_area(Output const& lhs, Output const& rhs) -> bool;
131}
132
133#endif //MIRAL_OUTPUT_H
Definition: output.h:35
auto name() const -> std::string
The output name. This matches that suppled to clients through wl_output.
Output(Output const &)
auto connected() const -> bool
Whether the output is connected.
Type
Definition: output.h:41
Output(const mir::graphics::DisplayConfigurationOutput &output)
auto type() const -> Type
The type of the output.
auto form_factor() const -> MirFormFactor
Form factor of this output; phone display, tablet, monitor, TV, projector...
auto attributes_map() const -> std::map< std::string const, std::optional< std::string > >
A custom attribute map.
Output & operator=(Output const &)
auto pixel_format() const -> MirPixelFormat
The current output pixel format.
auto refresh_rate() const -> double
refresh_rate in Hz
auto orientation() const -> MirOrientation
auto valid() const -> bool
auto id() const -> int
Mir's internal output ID mostly useful for matching against a miral::WindowInfo::output_id.
auto attribute(std::string const &key) const -> std::optional< std::string >
A custom attribute value.
auto physical_size_mm() const -> PhysicalSizeMM
The physical size of the output.
auto logical_group_id() const -> int
A positive number if this output is part of a logical output group (aka a display wall) A single disp...
auto power_mode() const -> MirPowerMode
Current power mode.
auto used() const -> bool
Whether the output is used in the configuration.
auto is_same_output(Output const &other) const -> bool
auto extents() const -> Rectangle
The logical rectangle occupied by the output, based on its position, current mode and orientation (ro...
auto scale() const -> float
Requested scale factor for this output, for HiDPI support.
Basic geometry types. Types for dimensions, displacements, etc. and the operations that they support.
Definition: size.h:27
Definition: output.h:28
Definition: runner.h:27
Mir Abstraction Layer.
Definition: runner.h:35
bool operator!=(Output::PhysicalSizeMM const &lhs, Output::PhysicalSizeMM const &rhs)
Definition: output.h:127
auto equivalent_display_area(Output const &lhs, Output const &rhs) -> bool
bool operator==(Output::PhysicalSizeMM const &lhs, Output::PhysicalSizeMM const &rhs)
Definition: output.h:38
int width
Definition: output.h:38
int height
Definition: output.h:38

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.