aboutsummaryrefslogtreecommitdiffstats
path: root/code_sniffer
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2014-05-10 17:14:00 +0200
committerAndreas Fischer <bantu@phpbb.com>2014-05-10 17:14:00 +0200
commitcc0446dc17aeb3639b374a6688e32fca271e0694 (patch)
tree64c4100056830223051f20e4c507c6690b6b17d1 /code_sniffer
parent436e388b87c39d778e5996d3ab0f0761fffe5e23 (diff)
parent333120a9921d8b36914965540d2d513cb939dc51 (diff)
downloadforums-cc0446dc17aeb3639b374a6688e32fca271e0694.tar
forums-cc0446dc17aeb3639b374a6688e32fca271e0694.tar.gz
forums-cc0446dc17aeb3639b374a6688e32fca271e0694.tar.bz2
forums-cc0446dc17aeb3639b374a6688e32fca271e0694.tar.xz
forums-cc0446dc17aeb3639b374a6688e32fca271e0694.zip
Merge pull request #2430 from nickvergessen/ticket/10839-olympus
[Ticket/10839] olympus - Remove phpunit configuration files * nickvergessen/ticket/10839-olympus: [ticket/10839] Fix note about running slow tests and build task [ticket/10839] Removing phpunit.xml.all [ticket/10839] Always run functional tests by default
Diffstat (limited to 'code_sniffer')
0 files changed, 0 insertions, 0 deletions
2'>22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
package Xconfig; # $Id$

use diagnostics;
use strict;

use any;
use log;
use common;
use mouse;
use devices;
use keyboard;
use Xconfigurator_consts;


sub keyboard_from_kmap {
    my ($loadkey) = @_;
    foreach (keyboard::keyboards()) {
	keyboard::keyboard2kmap($_) eq $loadkey and return keyboard::keyboard2xkb($_);
    }
    '';
}


sub info {
    my ($X) = @_;
    my $info;
    my $xf_ver = $X->{card}{driver} && !$X->{card}{prefer_xf3} ? "4.2.0" : "3.3.6";
    my $title = ($X->{card}{use_DRI_GLX} || $X->{card}{use_UTAH_GLX} ?
		 _("XFree %s with 3D hardware acceleration", $xf_ver) : _("XFree %s", $xf_ver));

    $info .= _("Keyboard layout: %s\n", $X->{keyboard}{XkbLayout});
    $info .= _("Mouse type: %s\n", $X->{mouse}{XMOUSETYPE});
    $info .= _("Mouse device: %s\n", $X->{mouse}{device}) if $::expert;
    $info .= _("Monitor: %s\n", $X->{monitor}{ModelName});
    $info .= _("Monitor HorizSync: %s\n", $X->{monitor}{hsyncrange}) if $::expert;
    $info .= _("Monitor VertRefresh: %s\n", $X->{monitor}{vsyncrange}) if $::expert;
    $info .= _("Graphics card: %s\n", $X->{card}{VendorName} . ' '. $X->{card}{BoardName});
    $info .= _("Graphics card identification: %s\n", $X->{card}{identifier}) if $::expert;
    $info .= _("Graphics memory: %s kB\n", $X->{card}{VideoRam}) if $X->{card}{VideoRam};
    if ($X->{default_depth} and my $depth = $X->{card}{depth}{$X->{default_depth}}) {
	$info .= _("Color depth: %s\n", translate($Xconfigurator_consts::depths{$X->{default_depth}}));
	$info .= _("Resolution: %s\n", join "x", @{$depth->[0]}) if $depth && !is_empty_array_ref($depth->[0]);
    }
    $info .= _("XFree86 server: %s\n", $X->{card}{server}) if $X->{card}{server};
    $info .= _("XFree86 driver: %s\n", $X->{card}{driver}) if $X->{card}{driver};
    "$title\n\n$info";
}

sub getinfo {
    my $X = shift || {};
    getinfoFromDDC($X);
    getinfoFromSysconfig($X);

    my ($mouse) = mouse::detect();
    add2hash($X->{mouse}, $mouse) if !$X->{mouse}{XMOUSETYPE};
    add2hash($X->{mouse}{auxmouse}, $mouse->{auxmouse}) if !$X->{mouse}{auxmouse}{XMOUSETYPE};
    $X->{mouse}{auxmouse}{XMOUSETYPE} or delete $X->{mouse}{auxmouse};

    $X->{mouse}{device} ||= "mouse" if -e "/dev/mouse";
    $X;
}

sub getinfoFromXF86Config {
    my ($X, $prefix) = @_; #- original $::o->{X} which must be changed only if sure!
    $X ||= {};

    #- don't keep the preference on upgrades??
    $X->{card}{prefer_xf3} = readlink("$::prefix/etc/X11/X") =~ /XF86_/ if $::isStandalone;

    my (%keyboard, %mouse, %wacom, %card, %monitor);
    my (%c, $depth);

    foreach (cat_("$prefix/etc/X11/XF86Config-4")) {
	if (my $i = /^Section "InputDevice"/ .. /^EndSection/) {
	    %c = () if $i == 1;

	    $c{driver} = $1 if /^\s*Driver\s+"(.*?)"/;
	    $c{id} = $1 if /^\s*Identifier\s+"[^\d"]*(\d*)"/;
	    $c{XkbModel} ||= $1 if /^\s*Option\s+"XkbModel"\s+"(.*?)"/;
	    $c{XkbLayout} ||= $1 if /^\s*Option\s+"XkbLayout"\s+"(.*?)"/;
	    $c{XMOUSETYPE} ||= $1 if /^\s*Option\s+"Protocol"\s+"(.*?)"/;
	    $c{device} ||= $1 if /^\s*Option\s+"Device"\s+"\/dev\/(.*?)"/;
	    $c{nbuttons}   = 2 if /^\s*Option\s+"Emulate3Buttons"\s+/;
	    $c{nbuttons} ||= 5 if /^\s*#\s*Option\s+"ZAxisMapping"\s.*5/;
	    $c{nbuttons}   = 7 if /^\s*#\s*Option\s+"ZAxisMapping"\s.*7/;

	    if ($i =~ /E0/) {
		@keyboard{qw(XkbLayout)} = @c{qw(XkbLayout)}
		  if $c{driver} =~ /keyboard/i;
		@{$mouse{auxmouse}}{qw(XMOUSETYPE device nbuttons)} = @c{qw(XMOUSETYPE device nbuttons)}
		  if $c{driver} =~ /mouse/i && $c{id} > 1;
		@mouse{qw(XMOUSETYPE device nbuttons)} = @c{qw(XMOUSETYPE device nbuttons)}
		  if $c{driver} =~ /mouse/i && $c{id} < 1;
		$wacom{$c{device}} = undef
		  if $c{driver} =~ /wacom/i;
	    }
	} elsif (/^Section "Monitor"/ .. /^EndSection/) {
	    $monitor{hsyncrange} ||= $1 if /^\s*HorizSync\s+(.*)/;
	    $monitor{vsyncrange} ||= $1 if /^\s*VertRefresh\s+(.*)/;
	    $monitor{VendorName} ||= $1 if /^\s*VendorName\s+"(.*?)"/;
	    $monitor{ModelName} ||= $1 if /^\s*ModelName\s+"(.*?)"/;
	    $monitor{ModeLines} .= $_ if /^\s*Mode[lL]ine\s+(\S+)\s+(\S+)\s+/;
	} elsif (my $s = /^Section "Screen"/ .. /^EndSection/) {
	    $card{default_depth} ||= $1 if /^\s*DefaultColorDepth\s+(\d+)/;
	    if (my $i = /^\s*Subsection\s+"Display"/ .. /^\s*EndSubsection/) {
		undef $depth if $i == 1;
		$depth = $1 if /^\s*Depth\s+(\d*)/;
		if (/^\s*Modes\s+(.*)/) {
		    my $a = 0;
		    unshift @{$card{depth}{$depth || 8} ||= []}, #- insert at the beginning for resolution_wanted!
		      grep { $_->[0] >= 640 } map { [ /"(\d+)x(\d+)"/ ] } split ' ', $1;
		}
	    }
	}
    }
    my $first_screen_section;
    foreach (cat_("$prefix/etc/X11/XF86Config")) {
	if (/^Section "Keyboard"/ .. /^EndSection/) {