summaryrefslogtreecommitdiffstats
path: root/perl-install/Xconfig/screen.pm
blob: 761c5defd3be644b3edc9f00baaf5488cd53107a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package Xconfig::screen; # $Id$

use diagnostics;
use strict;

use common;


sub configure {
    my ($raw_X, $card) = @_;

    my @devices = $raw_X->get_devices;
    my @monitors = $raw_X->get_monitors;

    if (@monitors < @devices) {
	$raw_X->set_monitors(@monitors, ({}) x (@devices - @monitors));
	@monitors = $raw_X->get_monitors;
    }

    if ($card->{server}) {
	$raw_X->{xfree3}->set_screens({ Device => $devices[0]{Identifier}, Monitor => $monitors[0]{Identifier},
					Driver => $Xconfig::card::serversdriver{$card->{server}} || internal_error("bad XFree3 server $card->{server}"),
				      });
    } else {
	@{$raw_X->{xfree3}} = ();
    }

    if ($card->{Driver}) {
	my @sections = mapn {
	    my ($device, $monitor) = @_;
	    { Device => $device->{Identifier}, Monitor => $monitor->{Identifier} }
	} \@devices, \@monitors;

	$raw_X->{xfree4}->set_screens(@sections);
    } else {
	@{$raw_X->{xfree4}} = ();
    }

    1;
}

1;