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
25#include <mir/int_wrapper.h>
26
27#include <memory>
28
29namespace mir { namespace graphics { struct DisplayConfigurationOutput; } }
30
31namespace miral
32{
33using namespace mir::geometry;
34
35class Output
36{
37public:
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 };
59
60 explicit Output(const mir::graphics::DisplayConfigurationOutput &output);
61 Output(Output const&);
64
66 auto type() const -> Type;
67
70
72 auto connected() const -> bool;
73
75 auto used() const -> bool;
76
79
81 auto refresh_rate() const -> double;
82
84 auto power_mode() const -> MirPowerMode;
85
86 auto orientation() const -> MirOrientation;
87
89 auto scale() const -> float;
90
92 auto form_factor() const -> MirFormFactor;
93
96 auto extents() const -> Rectangle;
97
100 auto id() const -> int;
101
102 auto valid() const -> bool;
103
104 auto is_same_output(Output const& other) const -> bool;
105
106private:
107 std::shared_ptr<mir::graphics::DisplayConfigurationOutput> self;
108};
109
110bool operator==(Output::PhysicalSizeMM const& lhs, Output::PhysicalSizeMM const& rhs);
111inline bool operator!=(Output::PhysicalSizeMM const& lhs, Output::PhysicalSizeMM const& rhs)
112{ return !(lhs == rhs); }
113
114auto equivalent_display_area(Output const& lhs, Output const& rhs) -> bool;
115}
116
117#endif //MIRAL_OUTPUT_H
Definition: output.h:36
Output(Output const &)
auto connected() const -> bool
Whether the output is connected.
Type
Definition: output.h:42
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...
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 physical_size_mm() const -> PhysicalSizeMM
The physical size of the output.
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.
MirFormFactor
Form factor associated with a physical output.
Definition: common.h:429
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:275
MirPowerMode
Definition: common.h:190
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:245
Basic geometry types. Types for dimensions, displacements, etc. and the operations that they support.
Definition: dimensions.h:31
Definition: splash_session.h:24
Mir Abstraction Layer.
Definition: floating_window_manager.h:29
auto equivalent_display_area(Output const &lhs, Output const &rhs) -> bool
STL namespace.
Definition: rectangle.h:34
Definition: output.h:39
int width
Definition: output.h:39
int height
Definition: output.h:39

Copyright © 2012-2022 Canonical Ltd.
Generated on Wed Dec 28 21:01:08 UTC 2022
This documentation is licensed under the GPL version 2 or 3.