x11config-new.pl revision 2291faee92ebb5cc9722cd3f22e499900a5a411f
#
# Guest Additions X11 config update script
#
# Copyright (C) 2006-2010 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
my $auto_mouse = 0;
my $new_mouse = 0;
my $no_bak = 0;
my $old_mouse_dev = "/dev/psaux";
{
if (lc($arg) eq "--automouse")
{
$auto_mouse = 1;
}
elsif (lc($arg) eq "--newmouse")
{
$new_mouse = 1;
}
elsif (lc($arg) eq "--nobak")
{
$no_bak = 1;
}
elsif (lc($arg) eq "--nopsaux")
{
$old_mouse_dev = "/dev/input/mice";
}
else
{
my $CFG;
my $xkbopts = "";
my $kb_driver = "";
my $layout_kb = "";
{
my $TMP;
my $in_section = 0;
print TMP "# VirtualBox generated configuration file\n";
print TMP "# based on $cfg.\n";
{
{
my $section = lc($1);
if ( ($section eq "inputdevice")
|| ($section eq "device")
|| ($section eq "serverlayout")
|| ($section eq "screen")
|| ($section eq "monitor")
|| ($section eq "keyboard")
|| ($section eq "pointer"))
{
$in_section = 1;
}
} else {
if ($line =~ /^\s*EndSection/i)
{
$in_section = 0;
}
}
if ($in_section)
{
# Remember XKB options
{
}
# If we find a keyboard driver, remember it
{
$kb_driver = $1;
}
}
}
if ($kb_driver ne "")
{
Section "InputDevice"
Identifier "Keyboard[0]"
Driver "$kb_driver"
Option "CoreKeyboard"
$layout_kb = " InputDevice \"Keyboard[0]\" \"CoreKeyboard\"\n"
}
if (!$auto_mouse && !$new_mouse) {
Section "InputDevice"
Identifier "Mouse[1]"
Driver "vboxmouse"
Option "CorePointer"
Section "ServerLayout"
Identifier "Layout[all]"
Screen "Screen[0]"
}
if (!$auto_mouse && $new_mouse) {
Section "InputDevice"
Driver "mouse"
Identifier "Mouse[1]"
Option "CorePointer"
Section "InputDevice"
Driver "vboxmouse"
Identifier "Mouse[2]"
Option "SendCoreEvents"
Section "ServerLayout"
Identifier "Layout[all]"
Screen "Screen[0]"
}
Section "Monitor"
Identifier "Monitor[0]"
ModelName "VirtualBox Virtual Output"
VendorName "Sun Microsystems Inc"
Section "Device"
BoardName "VirtualBox Graphics"
Driver "vboxvideo"
Identifier "Device[0]"
VendorName "Sun Microsystems Inc"
Section "Screen"
SubSection "Display"
Depth 24
Device "Device[0]"
Identifier "Screen[0]"
Monitor "Monitor[0]"
close(TMP);
}
}
}
exit 0