line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# This file is part of Config-Model-Xorg |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# This software is Copyright (c) 2007-2016 by Dominique Dumont. |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# This is free software, licensed under: |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# The GNU Lesser General Public License, Version 2.1, February 1999 |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
package Config::Model::Backend::Xorg::Write ; |
12
|
|
|
|
|
|
|
$Config::Model::Backend::Xorg::Write::VERSION = '1.113'; |
13
|
1
|
|
|
1
|
|
718
|
use Mouse::Role ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
343
|
use Carp ; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
62
|
|
16
|
1
|
|
|
1
|
|
15
|
use IO::File ; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
149
|
|
17
|
1
|
|
|
1
|
|
5
|
use Config::Model::ObjTreeScanner ; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
18
|
1
|
|
|
1
|
|
5
|
use Log::Log4perl ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
19
|
1
|
|
|
1
|
|
44
|
use File::Path ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1003
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $logger = Log::Log4perl::get_logger('Backend::Xorg::Write'); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub wr_std_leaf { |
24
|
272
|
|
|
272
|
0
|
508
|
my ($scanner, $data_r, $node,$element_name,$index, $leaf_object,$v) = @_ ; |
25
|
272
|
100
|
|
|
|
2023
|
push @$data_r , qq(\t$element_name\t"$v") if defined $v; |
26
|
|
|
|
|
|
|
} ; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub wr_module { |
29
|
65
|
|
|
65
|
0
|
112
|
my ($scanner, $data_r , $node,$element_name,$index, $leaf_object,$v) = @_ ; |
30
|
65
|
100
|
|
|
|
471
|
push @$data_r, qq(\tLoad "$element_name") if $v ; |
31
|
|
|
|
|
|
|
} ; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub wr_std_options { |
34
|
571
|
|
|
571
|
0
|
885
|
my ($scanner, $data_r ,$node,$element_name,$index, $leaf_object,$v) = @_ ; |
35
|
571
|
|
|
|
|
1208
|
my $b_in = $leaf_object->upstream_default ; |
36
|
571
|
100
|
66
|
|
|
3230
|
if ( defined $v && ( (not defined $b_in) |
|
|
|
66
|
|
|
|
|
37
|
|
|
|
|
|
|
|| (defined $b_in && $v && $v ne $b_in) ) |
38
|
|
|
|
|
|
|
) { |
39
|
61
|
|
|
|
|
106
|
my $str = qq(\tOption\t"$element_name"); |
40
|
61
|
50
|
33
|
|
|
380
|
$str .= qq(\t"$v") if defined $v && $v ; |
41
|
61
|
|
|
|
|
382
|
push @$data_r, $str ; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} ; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub wr_kbd_model_options { |
46
|
92
|
|
|
92
|
0
|
170
|
my ($scanner, $data_r ,$node,$element_name,$index, $leaf_object,$v) = @_ ; |
47
|
92
|
100
|
66
|
|
|
542
|
if ( defined $v && $v ) { |
48
|
1
|
|
|
|
|
10
|
push @$data_r, qq(\tOption\t"XkbOptions"\t"$element_name:$v"); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} ; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub push_value { |
53
|
275
|
|
|
275
|
0
|
458
|
my ($scanner, $data_r ,$node,$element_name,$index, $leaf_object,$v) = @_ ; |
54
|
275
|
100
|
|
|
|
1865
|
push @$data_r, $v if defined $v; |
55
|
|
|
|
|
|
|
} ; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub push_flag_value { |
59
|
150
|
|
|
150
|
0
|
238
|
my ($scanner, $data_r ,$node,$element_name,$index, $leaf_object,$v) = @_ ; |
60
|
150
|
100
|
100
|
|
|
395
|
if (defined $v && $element_name =~ s/Polarity// ) { |
61
|
4
|
100
|
|
|
|
13
|
$v = ($v eq 'positive' ? '+' : '-' ) . $element_name ; |
62
|
4
|
|
|
|
|
22
|
push @$data_r, $v ; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
else { |
65
|
146
|
100
|
66
|
|
|
831
|
push @$data_r, $element_name if defined $v && $v ; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} ; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
my %dispatch_leaf |
70
|
|
|
|
|
|
|
= ( |
71
|
|
|
|
|
|
|
'Xorg' => 1, |
72
|
|
|
|
|
|
|
'Xorg::Module' => \&wr_module, |
73
|
|
|
|
|
|
|
'Xorg::Files' => \&wr_std_leaf , |
74
|
|
|
|
|
|
|
'Xorg::InputDevice' => \&wr_std_leaf , |
75
|
|
|
|
|
|
|
'Xorg::InputDevice::MouseOpt' => \&wr_std_options , |
76
|
|
|
|
|
|
|
'Xorg::InputDevice::KeyboardOpt' => \&wr_std_options , |
77
|
|
|
|
|
|
|
'Xorg::Device' => \&wr_std_leaf , |
78
|
|
|
|
|
|
|
'Xorg::Device::Ati' => \&wr_std_options , |
79
|
|
|
|
|
|
|
'Xorg::Device::Radeon' => \&wr_std_options , |
80
|
|
|
|
|
|
|
'Xorg::Device::Nvidia' => \&wr_std_options , |
81
|
|
|
|
|
|
|
'Xorg::Device::Fglrx' => \&wr_std_options , |
82
|
|
|
|
|
|
|
'Xorg::Device::Vesa' => \&wr_std_options , |
83
|
|
|
|
|
|
|
'Xorg::Extensions' => \&wr_std_options , |
84
|
|
|
|
|
|
|
'Xorg::Extensions::Option' => \&wr_std_options , |
85
|
|
|
|
|
|
|
'Xorg::Monitor' => \&wr_std_leaf , |
86
|
|
|
|
|
|
|
'Xorg::Monitor::Option' => \&wr_std_options , |
87
|
|
|
|
|
|
|
'Xorg::Monitor::Mode' => \&push_value , |
88
|
|
|
|
|
|
|
'Xorg::Monitor::Mode::Timing' => \&push_value , |
89
|
|
|
|
|
|
|
'Xorg::Monitor::Mode::Flags' => \&push_flag_value , |
90
|
|
|
|
|
|
|
'Xorg::Screen' => \&wr_std_leaf , |
91
|
|
|
|
|
|
|
'Xorg::Screen::Option' => \&wr_std_options , |
92
|
|
|
|
|
|
|
'Xorg::Screen::Display' => \&wr_std_leaf , |
93
|
|
|
|
|
|
|
'Xorg::ServerLayout' => \&wr_std_leaf , |
94
|
|
|
|
|
|
|
'Xorg::ServerFlags' => \&wr_std_options , |
95
|
|
|
|
|
|
|
'Xorg::DRI' => \&wr_std_leaf |
96
|
|
|
|
|
|
|
) ; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
my %dispatch_leaf_re |
99
|
|
|
|
|
|
|
= ( |
100
|
|
|
|
|
|
|
'Xorg::InputDevice::KeyboardOptModel::.*' => \&wr_kbd_model_options , |
101
|
|
|
|
|
|
|
) ; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub wr_leaf { |
104
|
1440
|
|
|
1440
|
0
|
118178
|
my ($scanner, $data_r, $node,$element_name,$index, $leaf_object) = @_ ; |
105
|
1440
|
|
|
|
|
3872
|
my $v = $leaf_object->fetch ; |
106
|
1440
|
|
|
|
|
262796
|
my $class_name = $node ->config_class_name() ; |
107
|
1440
|
|
|
|
|
2456
|
my $cb = $dispatch_leaf{$class_name} ; |
108
|
|
|
|
|
|
|
|
109
|
1440
|
100
|
|
|
|
3265
|
if (not defined $cb) { |
110
|
92
|
|
|
|
|
196
|
foreach my $k (keys %dispatch_leaf_re) { |
111
|
92
|
50
|
|
|
|
566
|
next unless $class_name =~ /$k/ ; |
112
|
92
|
|
|
|
|
115
|
$cb = $dispatch_leaf_re{$k}; |
113
|
|
|
|
|
|
|
#warn "using regexp dispath $k for $class_name\n"; |
114
|
92
|
|
|
|
|
117
|
last; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
1440
|
100
|
66
|
|
|
6595
|
if (defined $cb && ref $cb) { |
|
|
50
|
|
|
|
|
|
119
|
1425
|
|
|
|
|
2856
|
$cb->(@_ ,$v ) ; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
elsif (not defined $cb) { |
122
|
|
|
|
|
|
|
# can't fallback to wr_std_leaf as some elements from model |
123
|
|
|
|
|
|
|
# are not meant to be written back in xorg.conf |
124
|
0
|
|
|
|
|
0
|
warn "wr_leaf: no call-back defined for ",$node ->config_class_name() ; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub wr_section { |
129
|
73
|
|
|
73
|
0
|
129
|
my ($scanner, $data_r, $node,$element_name,$key,$next_node) = @_; |
130
|
|
|
|
|
|
|
#print "wr_section called on ",$node->name," $element_name,$key\n"; |
131
|
|
|
|
|
|
|
|
132
|
73
|
|
|
|
|
139
|
my @section_lines ; |
133
|
73
|
100
|
|
|
|
367
|
push @section_lines, qq(\tIdentifier\t"$key") if defined $key ; |
134
|
|
|
|
|
|
|
|
135
|
73
|
100
|
|
|
|
244
|
if ($element_name eq 'InputDevice') { |
136
|
|
|
|
|
|
|
map { |
137
|
21
|
|
|
|
|
36
|
my $core_v = $node->grab_value("! $_") ; |
|
42
|
|
|
|
|
196
|
|
138
|
42
|
100
|
100
|
|
|
87980
|
push @section_lines, qq(\tOption\t"$_") |
139
|
|
|
|
|
|
|
if (defined $core_v and $key eq $core_v) ; |
140
|
|
|
|
|
|
|
} qw/CoreKeyboard CorePointer/ ; |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
73
|
|
|
|
|
338
|
$scanner->scan_node(\@section_lines,$next_node) ; |
144
|
|
|
|
|
|
|
|
145
|
73
|
100
|
|
|
|
3187
|
if (@section_lines) { |
146
|
62
|
|
|
|
|
845
|
push @$data_r, qq(Section "$element_name"), @section_lines, |
147
|
|
|
|
|
|
|
"EndSection" , '' ; |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub wr_mode_line { |
152
|
25
|
|
|
25
|
0
|
39
|
my ($scanner, $data_r, $node,$element_name,$key,$next_node) = @_; |
153
|
|
|
|
|
|
|
|
154
|
25
|
|
|
|
|
26
|
my @mode_values ; |
155
|
25
|
|
|
|
|
77
|
$scanner->scan_node(\@mode_values,$next_node) ; |
156
|
25
|
|
|
|
|
176
|
my @numbers = splice (@mode_values, 0, 9) ; |
157
|
|
|
|
|
|
|
|
158
|
25
|
|
100
|
|
|
112
|
my $flags = join(' ',@mode_values) || '' ; |
159
|
25
|
|
|
|
|
736
|
push @$data_r, |
160
|
|
|
|
|
|
|
sprintf( |
161
|
|
|
|
|
|
|
qq(\tModeLine %-20s %8.3f %4u %4u %4u %4u %4u %4u %4u %4u %s), |
162
|
|
|
|
|
|
|
qq("$key"), @numbers, $flags); |
163
|
|
|
|
|
|
|
} ; |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
sub wr_sub_section { |
166
|
15
|
|
|
15
|
0
|
44
|
my ($scanner, $data_r, $node,$element_name,$key,$next_node) = @_; |
167
|
|
|
|
|
|
|
{ |
168
|
1
|
|
|
1
|
|
8
|
no warnings "uninitialized" ; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
902
|
|
|
15
|
|
|
|
|
31
|
|
169
|
15
|
|
|
|
|
71
|
$logger->debug( "wr_sub_section called on ",$node->name," $element_name,$key"); |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
|
172
|
15
|
|
|
|
|
280
|
push @$data_r, qq(\tSubSection "$element_name") , |
173
|
|
|
|
|
|
|
qq(\t\tDepth\t$key) ; |
174
|
|
|
|
|
|
|
|
175
|
15
|
|
|
|
|
64
|
$scanner->scan_node($data_r,$next_node) ; |
176
|
15
|
|
|
|
|
334
|
push @$data_r, "\tEndSubSection" , '' ; |
177
|
|
|
|
|
|
|
} ; |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
sub wr_serverlayout_screen { |
180
|
6
|
|
|
6
|
0
|
15
|
my ($scanner, $data_r, $node,$element_name,$key,$next_node) = @_; |
181
|
6
|
|
|
|
|
30
|
my $id = $next_node->fetch_element_value('screen_id') ; |
182
|
6
|
|
|
|
|
15834
|
my $rel_loc = $next_node->grab_value("position relative_screen_location") ; |
183
|
|
|
|
|
|
|
|
184
|
6
|
|
|
|
|
3780
|
my $str = qq(\tScreen $key "$id") ; |
185
|
|
|
|
|
|
|
|
186
|
6
|
100
|
|
|
|
30
|
if (defined $rel_loc) { |
187
|
4
|
|
|
|
|
20
|
$str .= qq( $rel_loc ) ; |
188
|
4
|
|
|
|
|
23
|
my $pos_obj = $next_node->fetch_element('position') ; |
189
|
4
|
100
|
|
|
|
213
|
if ($pos_obj-> is_element_available('screen_id')) { |
190
|
1
|
|
|
|
|
72
|
$str .= '"'. $pos_obj->fetch_element_value("screen_id").'" ' ; |
191
|
|
|
|
|
|
|
} |
192
|
4
|
100
|
|
|
|
2908
|
if ($pos_obj-> is_element_available('x')) { |
193
|
|
|
|
|
|
|
map { |
194
|
3
|
|
|
|
|
239
|
$str .= $pos_obj->fetch_element_value($_).' ' ; |
|
6
|
|
|
|
|
788
|
|
195
|
|
|
|
|
|
|
} qw/x y/ ; |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
} |
199
|
6
|
|
|
|
|
907
|
push @$data_r, $str ; |
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
sub wr_serverlayout_inputdevice { |
203
|
12
|
|
|
12
|
0
|
26
|
my ($scanner, $data_r, $node,$element_name,$key,$next_node) = @_; |
204
|
|
|
|
|
|
|
|
205
|
12
|
|
|
|
|
46
|
my $str = qq(\tInputDevice "$key") ; |
206
|
12
|
|
|
|
|
46
|
my $sce = $next_node->fetch_element_value("SendCoreEvents"); |
207
|
12
|
50
|
33
|
|
|
2857
|
if (defined $sce && $sce) { |
208
|
0
|
|
|
|
|
0
|
$str .= ' "SendCoreEvents" ' ; |
209
|
|
|
|
|
|
|
} |
210
|
12
|
|
|
|
|
108
|
push @$data_r, $str ; |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
sub wr_monitor_display_size { |
214
|
8
|
|
|
8
|
0
|
15
|
my ($scanner, $data_r, $node,$element_name,$key,$next_node) = @_; |
215
|
|
|
|
|
|
|
|
216
|
8
|
|
|
|
|
27
|
my $w = $next_node->fetch_element_value("width") ; |
217
|
8
|
|
|
|
|
1505
|
my $h = $next_node->fetch_element_value("height") ; |
218
|
|
|
|
|
|
|
|
219
|
8
|
100
|
66
|
|
|
1660
|
push @$data_r, "\tDisplaySize\t$w $h" if defined $w && defined $h; |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
sub wr_monitor_gamma { |
223
|
8
|
|
|
8
|
0
|
39
|
my ($scanner, $data_r, $node,$element_name,$key,$next_node) = @_; |
224
|
|
|
|
|
|
|
|
225
|
8
|
100
|
|
|
|
25
|
if ($next_node->fetch_element_value("use_global_gamma")) { |
226
|
7
|
|
|
|
|
1432
|
my $g = $next_node->fetch_element_value("gamma") ; |
227
|
7
|
100
|
|
|
|
1433
|
push @$data_r, "\tGamma\t$g" if defined $g ; |
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
else { |
230
|
1
|
|
|
|
|
198
|
my @v = map { $next_node->fetch_element_value($_."_gamma") } |
|
3
|
|
|
|
|
349
|
|
231
|
|
|
|
|
|
|
qw/red green blue/ ; |
232
|
1
|
|
|
|
|
211
|
push @$data_r, "\tGamma\t@v" ; |
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
sub wr_screen_display_virtual { |
238
|
15
|
|
|
15
|
0
|
42
|
my ($scanner, $data_r, $node,$element_name,$key,$next_node) = @_; |
239
|
|
|
|
|
|
|
|
240
|
15
|
|
|
|
|
67
|
my $x = $next_node->fetch_element_value("xdim") ; |
241
|
15
|
|
|
|
|
2972
|
my $y = $next_node->fetch_element_value("ydim") ; |
242
|
|
|
|
|
|
|
|
243
|
15
|
100
|
66
|
|
|
2819
|
push @$data_r, "\t\tVirtual\t$x $y" if defined $x && defined $y; |
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
sub wr_screen_display_viewport { |
247
|
15
|
|
|
15
|
0
|
32
|
my ($scanner, $data_r, $node,$element_name,$key,$next_node) = @_; |
248
|
|
|
|
|
|
|
|
249
|
15
|
|
|
|
|
52
|
my $x = $next_node->fetch_element_value("x0") ; |
250
|
15
|
|
|
|
|
2780
|
my $y = $next_node->fetch_element_value("y0") ; |
251
|
|
|
|
|
|
|
|
252
|
15
|
100
|
66
|
|
|
2926
|
push @$data_r, "\t\tViewPort\t$x $y" if defined $x && defined $y; |
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
sub wr_device_kbd_autorepeat { |
256
|
10
|
|
|
10
|
0
|
21
|
my ($scanner, $data_r, $node,$element_name,$key,$next_node) = @_; |
257
|
|
|
|
|
|
|
|
258
|
10
|
|
|
|
|
35
|
my $d = $next_node->fetch_element_value("delay") ; |
259
|
10
|
|
|
|
|
1926
|
my $r = $next_node->fetch_element_value("rate") ; |
260
|
|
|
|
|
|
|
|
261
|
10
|
100
|
66
|
|
|
2050
|
push @$data_r, qq(\tOption\t"AutoRepeat" "$d $r") |
262
|
|
|
|
|
|
|
if defined $d && defined $r; |
263
|
|
|
|
|
|
|
} |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
my %dispatch_node |
266
|
|
|
|
|
|
|
= ( |
267
|
|
|
|
|
|
|
'Xorg' => 1 , |
268
|
|
|
|
|
|
|
'Xorg::Extensions' => \&wr_section, |
269
|
|
|
|
|
|
|
'Xorg::Files' => \&wr_section, |
270
|
|
|
|
|
|
|
'Xorg::Module' => \&wr_section, |
271
|
|
|
|
|
|
|
'Xorg::InputDevice' => \&wr_section, |
272
|
|
|
|
|
|
|
'Xorg::InputDevice::KeyboardOpt::AutoRepeat' => \&wr_device_kbd_autorepeat, |
273
|
|
|
|
|
|
|
'Xorg::Device' => \&wr_section, |
274
|
|
|
|
|
|
|
'Xorg::DRI' => \&wr_section, |
275
|
|
|
|
|
|
|
'Xorg::Monitor' => \&wr_section, |
276
|
|
|
|
|
|
|
'Xorg::Monitor::Mode' => \&wr_mode_line , |
277
|
|
|
|
|
|
|
'Xorg::Monitor::DisplaySize' => \&wr_monitor_display_size , |
278
|
|
|
|
|
|
|
'Xorg::Monitor::Gamma' => \&wr_monitor_gamma , |
279
|
|
|
|
|
|
|
'Xorg::Screen' => \&wr_section, |
280
|
|
|
|
|
|
|
'Xorg::Screen::Display' => \&wr_sub_section, |
281
|
|
|
|
|
|
|
"Xorg::Screen::Display::Virtual" => \&wr_screen_display_virtual, |
282
|
|
|
|
|
|
|
"Xorg::Screen::Display::ViewPort" => \&wr_screen_display_viewport, |
283
|
|
|
|
|
|
|
'Xorg::ServerLayout' => \&wr_section, |
284
|
|
|
|
|
|
|
'Xorg::ServerFlags' => \&wr_section, |
285
|
|
|
|
|
|
|
'Xorg::ServerLayout::Screen' => \&wr_serverlayout_screen, |
286
|
|
|
|
|
|
|
'Xorg::ServerLayout::InputDevice' => \&wr_serverlayout_inputdevice, |
287
|
|
|
|
|
|
|
) ; |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
sub wr_node { |
290
|
314
|
|
|
314
|
0
|
33516
|
my ($scanner, $data_r, $node,$element_name,$key, $next_node) = @_; |
291
|
314
|
|
|
|
|
1083
|
my $dispatcher_data = $next_node->config_class_name ; |
292
|
314
|
|
|
|
|
935
|
my $cb = $dispatch_node{$dispatcher_data} ; |
293
|
314
|
100
|
66
|
|
|
1630
|
if (defined $cb && ref $cb) { $cb->(@_) ; } |
|
187
|
50
|
33
|
|
|
490
|
|
294
|
|
|
|
|
|
|
elsif (defined $cb && $cb) { |
295
|
0
|
|
|
|
|
0
|
$scanner->scan_node($data_r,$next_node) ; |
296
|
|
|
|
|
|
|
} |
297
|
|
|
|
|
|
|
else { |
298
|
1
|
|
|
1
|
|
7
|
no warnings "uninitialized" ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
381
|
|
299
|
127
|
|
|
|
|
581
|
$logger->debug( "wr_node called on $dispatcher_data $element_name,$key"); |
300
|
127
|
|
|
|
|
944
|
$scanner->scan_node($data_r,$next_node) ; |
301
|
|
|
|
|
|
|
} |
302
|
|
|
|
|
|
|
} ; |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
sub wr_mode_list { |
305
|
0
|
|
|
0
|
0
|
0
|
my ($scanner, $data_ref,$node,$element_name,@indexes) = @_ ; |
306
|
0
|
|
|
|
|
0
|
my @list = $node->fetch_element($element_name)->fetch_all_values ; |
307
|
0
|
0
|
|
|
|
0
|
push @$data_ref, qq(\t\tModes\t").join('" "',@list).'"' if @list; |
308
|
|
|
|
|
|
|
} |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
my %dispatch_list = ( 'Xorg::Screen::Display' => \&wr_mode_list ); |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
sub wr_list { |
313
|
0
|
|
|
0
|
0
|
0
|
my ($scanner, $data_ref,$node,$element_name,@indexes) = @_ ; |
314
|
0
|
|
|
|
|
0
|
my $dispatcher_data = $node->config_class_name ; |
315
|
0
|
|
|
|
|
0
|
my $cb = $dispatch_list{$dispatcher_data} ; |
316
|
0
|
0
|
|
|
|
0
|
if (defined $cb ) { $cb->(@_) ; } |
|
0
|
|
|
|
|
0
|
|
317
|
|
|
|
|
|
|
else { |
318
|
|
|
|
|
|
|
# resume exploration |
319
|
0
|
|
|
|
|
0
|
map {$scanner->scan_list($data_ref,$node,$element_name,$_)} @indexes ; |
|
0
|
|
|
|
|
0
|
|
320
|
|
|
|
|
|
|
} |
321
|
|
|
|
|
|
|
} |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
sub wr_check_list { |
324
|
15
|
|
|
15
|
0
|
866
|
my ($scanner, $data_ref,$node,$element_name,@indexes) = @_ ; |
325
|
|
|
|
|
|
|
#warn "wr_check_list called on node ".$node->name." element $element_name\n"; |
326
|
15
|
|
|
|
|
47
|
my @list = $node->fetch_element($element_name)->get_checked_list ; |
327
|
15
|
100
|
|
|
|
402561
|
push @$data_ref, qq(\t\t$element_name\t").join('" "',@list).'"' if @list; |
328
|
|
|
|
|
|
|
} |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
sub write_all { |
331
|
5
|
|
|
5
|
0
|
9
|
my $root = shift ; |
332
|
|
|
|
|
|
|
|
333
|
5
|
|
|
|
|
25
|
$logger->debug( "write_all called"); |
334
|
|
|
|
|
|
|
|
335
|
5
|
|
|
|
|
91
|
my @result = ("# Xorg.conf written by Xorg Config::Model", |
336
|
|
|
|
|
|
|
"# do not edit", '' ) ; |
337
|
|
|
|
|
|
|
|
338
|
5
|
|
|
|
|
70
|
my $scan = Config::Model::ObjTreeScanner-> new |
339
|
|
|
|
|
|
|
( |
340
|
|
|
|
|
|
|
leaf_cb => \&wr_leaf , |
341
|
|
|
|
|
|
|
node_element_cb => \&wr_node , |
342
|
|
|
|
|
|
|
check_list_element_cb => \&wr_check_list , |
343
|
|
|
|
|
|
|
fallback => 'all', |
344
|
|
|
|
|
|
|
) ; |
345
|
|
|
|
|
|
|
|
346
|
5
|
|
|
|
|
868
|
$scan->scan_node (\@result, $root) ; |
347
|
|
|
|
|
|
|
|
348
|
5
|
|
|
|
|
166
|
return \@result ; |
349
|
|
|
|
|
|
|
# foreach my $sect_obj (@_) { |
350
|
|
|
|
|
|
|
# my $section_name = $sect_obj->element_name ; |
351
|
|
|
|
|
|
|
# $$ref .= qq(Section "$section_name"\n) ; |
352
|
|
|
|
|
|
|
# $scan->scan_node($sect_obj) ; |
353
|
|
|
|
|
|
|
# $$ref .= "EndSection\n\n" ; |
354
|
|
|
|
|
|
|
# } |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
} |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
1; |
359
|
|
|
|
|
|
|
__END__ |