XRandR/Output.pm

filter: Statementstmt 85.4% 47 / 55 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 70.0% 7 / 10 Podpod 100% 3 / 3 totaltotal 81.4% 57 / 70 CC 2 SCAR 7.4
CC
2
Cov
82%
to_string
6.0
map_reflection_in
2.0
map_reflection_out
2.0
CRAP 2.1
« XRandR/CurMode.pm ↑ Summary XRandR/Frequency.pm »
1 package X11::XRandR::Output;
2  
3 # ABSTRACT: A video output
4  
5 1 ▶use Types::Standard -types;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Types::Common::Numeric qw[ PositiveOrZeroNum PositiveOrZeroInt ];
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use X11::XRandR::Types -types;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use MooX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 our $VERSION = '0.01';
14  
15 1 ▶use overload '""' => \&to_string;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 #pod =attr name
18 #pod
19 #pod =cut
20  
21 1 has name => (
22 is => 'ro',
23 isa => Str,
24 required => 1,
25 );
26  
27 #pod =attr Border
28 #pod
29 #pod An instance of L<X11::XRandR::Border>. Optional.
30 #pod
31 #pod =method has_Border
32 #pod
33 #pod I<Boolean> True if L</Border> has been specified
34 #pod
35 #pod
36 #pod =cut
37  
38 1 has Border => (
39 is => 'ro',
40 isa => InstanceOf ['X11::XRandR::Border'],
41 predicate => 1,
42 );
43  
44 #pod =attr Clones
45 #pod
46 #pod Optional.
47 #pod
48 #pod =method has_Clones
49 #pod
50 #pod I<Boolean> True if L<Clones> was specified.
51 #pod
52 #pod =cut
53  
54 1 has Clones => (
55 is => 'ro',
56 isa => ArrayRef [Str],
57 predicate => 1,
58 );
59  
60 #pod =attr Brightness
61 #pod
62 #pod Optional.
63 #pod
64 #pod =method has_Brightness
65 #pod
66 #pod I<Boolean> True if L<Brightness> was specified.
67 #pod
68 #pod =cut
69  
70 1 has Brightness => (
71 is => 'ro',
72 isa => Num,
73 predicate => 1,
74 );
75  
76 #pod =attr connection
77 #pod
78 #pod The state of the connection. See L<X11::XRandR::Types/Connection> for values.
79 #pod
80 #pod =cut
81  
82 1 has connection => (
83 is => 'ro',
84 isa => Connection,
85 required => 1,
86 );
87  
88 #pod =attr CRTC
89 #pod
90 #pod The CRTC value.
91 #pod
92 #pod =cut
93  
94 1 has CRTC => (
95 is => 'ro',
96 isa => PositiveOrZeroInt
97 );
98  
99 #pod =attr CRTCs
100 #pod
101 #pod An array of CRTC values.
102 #pod
103 #pod =cut
104  
105 1 has CRTCs => (
106 is => 'ro',
107 isa => ArrayRef [PositiveOrZeroInt],
108 );
109  
110  
111 #pod =attr cur_crtc
112 #pod
113 #pod An instance of L<X11::XRandR::CurCrtc>. Optional.
114 #pod
115 #pod =method has_cur_crtc
116 #pod
117 #pod I<Boolean> True if L</cur_crtc> has been specified
118 #pod
119 #pod =cut
120  
121 1 has cur_crtc => (
122 is => 'ro',
123 isa => InstanceOf ['X11::XRandR::CurCrtc'],
124 predicate => 1,
125 );
126  
127 #pod =attr cur_mode
128 #pod
129 #pod An instance of L<X11::XRandR::CurMode>. Optional.
130 #pod
131 #pod =method has_cur_mode
132 #pod
133 #pod I<Boolean> True if L</cur_mode> has been specified
134 #pod
135 #pod =cut
136  
137 1 has cur_mode => (
138 is => 'ro',
139 isa => InstanceOf ['X11::XRandR::CurMode'],
140 predicate => 1,
141 );
142  
143 #pod =attr dimension
144 #pod
145 #pod An instance of L<X11::XRandR::Dimension>. Optional.
146 #pod
147 #pod =method has_dimension
148 #pod
149 #pod I<Boolean> True if L<dimension> was specified.
150 #pod
151 #pod =cut
152  
153 1 has dimension => (
154 is => 'ro',
155 isa => InstanceOf ['X11::XRandR::Dimension'],
156 predicate => 1,
157 );
158  
159 #pod =attr Gamma
160 #pod
161 #pod An arrayref of floats. Optional.
162 #pod
163 #pod =method has_Gamma
164 #pod
165 #pod I<Boolean> True if L<Gamma> was specified.
166 #pod
167 #pod =cut
168  
169 1 has Gamma => (
170 is => 'ro',
171 isa => Tuple[ PositiveOrZeroNum, PositiveOrZeroNum, PositiveOrZeroNum],
172 predicate => 1,
173 );
174  
175 #pod =attr Identifier
176 #pod
177 #pod =cut
178  
179 1 has Identifier => (
180 is => 'ro',
181 isa => PositiveOrZeroInt,
182 required => 1,
183 );
184  
185 #pod =attr Timestamp
186 #pod
187 #pod =cut
188  
189 1 has Timestamp => (
190 is => 'ro',
191 isa => PositiveOrZeroInt,
192 required => 1,
193 );
194  
195 #pod =attr Subpixel
196 #pod
197 #pod For values, see L<X11::XRandR::Types/SubPixelOrder>.
198 #pod
199 #pod =cut
200  
201 1 has Subpixel => (
202 is => 'ro',
203 isa => SubPixelOrder,
204 required => 1,
205 );
206  
207 #pod =attr rotations
208 #pod
209 #pod An array of L<X11::XRandR::Types/Direction> values
210 #pod
211 #pod =cut
212  
213 1 has rotations => (
214 is => 'ro',
215 isa => ArrayRef [Direction],
216 required => 1,
217 );
218  
219 #pod =attr reflections
220 #pod
221 #pod An array of C<x> and/or C<y> values.
222 #pod
223 #pod =cut
224  
225 1 has reflections => (
226 is => 'ro',
227 isa => ArrayRef [ Enum[ 'x', 'y' ] ],
228 required => 1,
229 );
230  
231 #pod =attr modes
232 #pod
233 #pod An array of L<X11::XRandR::Mode> objects.
234 #pod
235 #pod =method has_modes
236 #pod
237 #pod I<Boolean> True if L</modes> was specified.
238 #pod
239 #pod =cut
240  
241 1 has modes => (
242 is => 'ro',
243 isa => ArrayRef [ InstanceOf ['X11::XRandR::Mode'] ],
244 predicate => 1,
245 );
246  
247  
248 #pod =attr Panning
249 #pod
250 #pod An instance of L<X11::XRandR::Geometry>. Optional.
251 #pod
252 #pod =method has_Panning
253 #pod
254 #pod I<Boolean> True if L</Panning> was specified.
255 #pod
256 #pod =cut
257  
258 1 has Panning => (
259 is => 'ro',
260 isa => InstanceOf ['X11::XRandR::Geometry'],
261 predicate => 1,
262 );
263  
264 #pod =attr Tracking
265 #pod
266 #pod An instance of L<X11::XRandR::Geometry>. Optional.
267 #pod
268 #pod =method has_Tracking
269 #pod
270 #pod I<Boolean> True if L</Tracking> was specified.
271 #pod
272 #pod =cut
273  
274 1 has Tracking => (
275 is => 'ro',
276 isa => InstanceOf ['X11::XRandR::Geometry'],
277 predicate => 1,
278 );
279  
280 #pod =attr Transform
281 #pod
282 #pod An instance of L<X11::XRandR::Transform>.
283 #pod
284 #pod =cut
285  
286 1 has Transform => (
287 is => 'ro',
288 isa => InstanceOf ['X11::XRandR::Transform'],
289 required => 1,
290 );
291  
292 #pod =attr primary
293 #pod
294 #pod I<Boolean> True if the primary output.
295 #pod
296 #pod =cut
297  
298 1 has primary => (
299 is => 'ro',
300 isa => Bool
301 );
302  
303 #pod =attr properties
304 #pod
305 #pod An array of L<X11::XRandR::Property> objects. Optional
306 #pod
307 #pod =method has_properties
308 #pod
309 #pod I<Boolean> True if L</properties> was specified.
310 #pod
311 #pod =cut
312  
313 1 has properties => (
314 is => 'ro',
315 isa => ArrayRef [ InstanceOf['X11::XRandR::Property' ]],
316 predicate => 1,
317 );
318  
319 #pod =method to_string
320 #pod
321 #pod Return a string rendition of the object just as B<xrandr> would.
322 #pod
323 #pod =cut
324  
325 0 ▶sub to_string {
Subroutine to_string: not called CC=2 SCAR=17.9
Pod documented
326  
327 0 my $self = shift;
328  
329 0 my $string
330 = sprintf( "%s (0x%x) %s", $self->geometry, $self->id, $self->rotation );
331  
332 0 ▶ $string .= ' ' . $self->map_reflection_out( $self->reflection )
Branch: 1 branch
BranchTrueFalseTotal
if $self->reflection ne "normal" 0 0 0
333 if $self->reflection ne 'normal';
334  
335 0 $string;
336 }
337  
338 1 my %MapReflectionIn = (
339 none => 'normal',
340 'X axis' => 'x',
341 'Y axis' => 'y',
342 'X and Y axis' => 'xy',
343 );
344  
345 1 my %MapReflectionOut = (
346 normal => 'none',
347 'x' => 'X axis',
348 'y' => 'Y axis',
349 'xy' => 'X and Y axis',
350 );
351  
352 #pod =method map_reflection_in
353 #pod
354 #pod Map a reflection from C<xrandr>'s nomenclature for an output to a L<X11::XRandR::Type/Reflection> value.
355 #pod
356 #pod =cut
357  
358 0 ▶sub map_reflection_in {
Subroutine map_reflection_in: not called CC=1 SCAR=6.9
Pod documented
359 0 my $self = shift;
360 0 return $MapReflectionIn{ $_[0] };
361 }
362  
363 #pod =method map_reflection_out
364 #pod
365 #pod Map a L<X11::XRandR::Type/Reflection> value to C<xrandr>'s nomenclature for an output.
366 #pod
367 #pod =cut
368  
369 0 ▶sub map_reflection_out {
Subroutine map_reflection_out: not called CC=1 SCAR=6.9
Pod documented
370 0 my $self = shift;
371 0 return $MapReflectionOut{ $_[0] };
372 }
373  
374 1 1;
375  
376 #
377 # This file is part of X11-XRandR
378 #
379 # This software is Copyright (c) 2018 by Diab Jerius.
380 #
381 # This is free software, licensed under:
382 #
383 # The GNU General Public License, Version 3, June 2007
384 #
385  
386 __END__
« XRandR/CurMode.pm ↑ Summary XRandR/Frequency.pm »