x11vnc: add modeline creation to Xdummy.

pull/1/head
runge 15 years ago
parent 07008deea2
commit 909683fd97

@ -2,7 +2,7 @@
Copyright (C) 2002-2010 Karl J. Runge <runge@karlrunge.com> Copyright (C) 2002-2010 Karl J. Runge <runge@karlrunge.com>
All rights reserved. All rights reserved.
x11vnc README file Date: Sat Jan 2 21:07:41 EST 2010 x11vnc README file Date: Thu Jan 7 23:16:08 EST 2010
The following information is taken from these URLs: The following information is taken from these URLs:
@ -12954,7 +12954,7 @@ x11vnc: a VNC server for real X displays
Here are all of x11vnc command line options: Here are all of x11vnc command line options:
% x11vnc -opts (see below for -help long descriptions) % x11vnc -opts (see below for -help long descriptions)
x11vnc: allow VNC connections to real X11 displays. 0.9.10 lastmod: 2010-01-02 x11vnc: allow VNC connections to real X11 displays. 0.9.10 lastmod: 2010-01-07
x11vnc options: x11vnc options:
-display disp -auth file -N -display disp -auth file -N
@ -13082,7 +13082,7 @@ libvncserver-tight-extension options:
% x11vnc -help % x11vnc -help
x11vnc: allow VNC connections to real X11 displays. 0.9.10 lastmod: 2010-01-02 x11vnc: allow VNC connections to real X11 displays. 0.9.10 lastmod: 2010-01-07
(type "x11vnc -opts" to just list the options.) (type "x11vnc -opts" to just list the options.)

@ -1,5 +1,27 @@
#!/bin/sh #!/bin/sh
# # ----------------------------------------------------------------------
# Copyright (C) 2005-2010 Karl J. Runge <runge@karlrunge.com>
# All rights reserved.
#
# This file is part of Xdummy.
#
# Xdummy is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# Xdummy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Xdummy; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA
# or see <http://www.gnu.org/licenses/>.
# ----------------------------------------------------------------------
#
#
# Xdummy: an LD_PRELOAD hack to run a stock Xorg(1) or XFree86(1) server # Xdummy: an LD_PRELOAD hack to run a stock Xorg(1) or XFree86(1) server
# with the "dummy" video driver to make it avoid Linux VT switching, etc. # with the "dummy" video driver to make it avoid Linux VT switching, etc.
# #
@ -14,6 +36,7 @@ root=""
nosudo="" nosudo=""
xserver="" xserver=""
geom="" geom=""
nomodelines=""
depth="" depth=""
debug="" debug=""
strace="" strace=""
@ -51,13 +74,20 @@ $program:
LD_PRELOAD tricks are usually "clever hacks" and so might not work LD_PRELOAD tricks are usually "clever hacks" and so might not work
in all situations or break when something changes. in all situations or break when something changes.
This program does not need to be run as root as of 12/2009. However, WARNING: Take care in using Xdummy, although it never has it is
if there are problems for certain situations (usually older servers) possible that it could damage hardware. One can use the -prconf
it may perform better if run as root (use the -root option.) option to have it print out the xorg.conf config that it would use
and then inspect it carefully before actually using it.
This program no longer needs to be run as root as of 12/2009.
However, if there are problems for certain situations (usually older
servers) it may perform better if run as root (use the -root option.)
When running as root remember the previous paragraph and that Xdummy
comes without any warranty.
Also, gcc/cc and other build tools are required for this script to gcc/cc and other build tools are required for this script to be able
be able to compile the LD_PRELOAD shared object. Be sure they are to compile the LD_PRELOAD shared object. Be sure they are installed
installed on the system. See -install and -uninstall described below. on the system. See -install and -uninstall described below.
Your Linux distribution may not install the dummy driver by default, Your Linux distribution may not install the dummy driver by default,
e.g: e.g:
@ -190,15 +220,20 @@ Options:
argument. It is passed to the real X server and argument. It is passed to the real X server and
also used by the Xdummy script as an identifier. also used by the Xdummy script as an identifier.
-geom geom1[,geom2...] Take the geometry (e.g. 1024x768) or -geom geom1[,geom2...] Take the geometry (e.g. 1024x768) or list
list of geometries and insert them into the of geometries and insert them into the Screen
Screen section of the tweaked X server section of the tweaked X server config file.
config file. Use this to have a smaller geometry Use this to have a different geometry than the
than the one in the system config file. one(s) in the system config file.
The option -geometry can be used instead of -geom; The option -geometry can be used instead of -geom;
x11vnc calls Xdummy and Xvfb this way. x11vnc calls Xdummy and Xvfb this way.
-nomodelines When you specify -geom/-geometry, $program will
create Modelines for each geometry and put them
in the Monitor section. If you do not want this
then supply -nomodelines.
-depth n Use pixel color depth n (e.g. 8, 16, or 24). This -depth n Use pixel color depth n (e.g. 8, 16, or 24). This
makes sure the X config file has a Screen.Display makes sure the X config file has a Screen.Display
subsection of this depth. Note this option is subsection of this depth. Note this option is
@ -274,6 +309,8 @@ Options:
that are not consistent with "dummy" mode will be overwritten that are not consistent with "dummy" mode will be overwritten
(unless -notweak is specified.) (unless -notweak is specified.)
Use -config xdummy-builtin to force usage of the builtin config.
If "file" is only a basename (e.g. "xorg.dummy.conf") with no /'s, If "file" is only a basename (e.g. "xorg.dummy.conf") with no /'s,
then no tweaking of it is done: the X server will look for that then no tweaking of it is done: the X server will look for that
basename via its normal search algorithm. If the found file does basename via its normal search algorithm. If the found file does
@ -439,6 +476,8 @@ do
;; ;;
"-geometry") geom="$2"; shift "-geometry") geom="$2"; shift
;; ;;
"-nomodelines") nomodelines=1
;;
"-depth") depth="$2"; args="$args -depth $2"; "-depth") depth="$2"; args="$args -depth $2";
shift shift
;; ;;
@ -513,18 +552,18 @@ make_so() {
tail -n +$n1 $0 | head -n $dn > $tmp tail -n +$n1 $0 | head -n $dn > $tmp
# compile it to Xdummy.so: # compile it to Xdummy.so:
if [ -f $SO ]; then if [ -f "$SO" ]; then
mv $SO $SO.$$ mv $SO $SO.$$
rm -f $SO.$$ rm -f $SO.$$
fi fi
rm -f $SO rm -f $SO
touch $SO touch $SO
if [ ! -f $SO ]; then if [ ! -f "$SO" ]; then
SO=$tdir/Xdummy.$user.so SO=$tdir/Xdummy.$user.so
warn "warning switching LD_PRELOAD shared object to: $SO" warn "warning switching LD_PRELOAD shared object to: $SO"
fi fi
if [ -f $SO ]; then if [ -f "$SO" ]; then
mv $SO $SO.$$ mv $SO $SO.$$
rm -f $SO.$$ rm -f $SO.$$
fi fi
@ -559,21 +598,21 @@ fi
# Handle -install/-uninstall case: # Handle -install/-uninstall case:
SO=$0.so SO=$0.so
if [ "X$install" != "X" -o "X$uninstall" != "X" ]; then if [ "X$install" != "X" -o "X$uninstall" != "X" ]; then
if [ -e $SO -o -h $SO ]; then if [ -e "$SO" -o -h "$SO" ]; then
warn "$program: removing $SO" warn "$program: removing $SO"
fi fi
if [ -f $SO ]; then if [ -f "$SO" ]; then
mv $SO $SO.$$ mv $SO $SO.$$
rm -f $SO.$$ rm -f $SO.$$
fi fi
rm -f $SO rm -f $SO
if [ -e $SO -o -h $SO ]; then if [ -e "$SO" -o -h "$SO" ]; then
warn "warning: $SO still exists." warn "warning: $SO still exists."
exit 1 exit 1
fi fi
if [ $install ]; then if [ $install ]; then
make_so make_so
if [ ! -f $SO ]; then if [ ! -f "$SO" ]; then
exit 1 exit 1
fi fi
fi fi
@ -628,7 +667,7 @@ fi
# #
tfile="$XDUMMY_TMPDIR/test.file" tfile="$XDUMMY_TMPDIR/test.file"
touch $tfile touch $tfile
if [ ! -f $tfile ]; then if [ ! -f "$tfile" ]; then
XDUMMY_TMPDIR="/tmp/Xdummy.$$.$USER" XDUMMY_TMPDIR="/tmp/Xdummy.$$.$USER"
warn "warning: setting tmpdir to $XDUMMY_TMPDIR ..." warn "warning: setting tmpdir to $XDUMMY_TMPDIR ..."
rm -rf $XDUMMY_TMPDIR || exit 1 rm -rf $XDUMMY_TMPDIR || exit 1
@ -640,7 +679,7 @@ export XDUMMY_TMPDIR
# Compile the LD_PRELOAD shared object if needed (needs XDUMMY_TMPDIR) # Compile the LD_PRELOAD shared object if needed (needs XDUMMY_TMPDIR)
# #
if [ ! -f $SO ]; then if [ ! -f "$SO" ]; then
SO="$XDUMMY_TMPDIR/Xdummy.so" SO="$XDUMMY_TMPDIR/Xdummy.so"
make_so make_so
fi fi
@ -835,10 +874,13 @@ tweak_config() {
# #
env XDUMMY_GEOM=$geom \ env XDUMMY_GEOM=$geom \
XDUMMY_DEPTH=$depth \ XDUMMY_DEPTH=$depth \
XDUMMY_NOMODELINES=$nomodelines \
perl > $config2 < $in -e ' perl > $config2 < $in -e '
$n = 0; $n = 0;
$geom = $ENV{XDUMMY_GEOM}; $geom = $ENV{XDUMMY_GEOM};
$depth = $ENV{XDUMMY_DEPTH}; $depth = $ENV{XDUMMY_DEPTH};
$nomodelines = $ENV{XDUMMY_NOMODELINES};
$mode_str = "";
$videoram = "24000"; $videoram = "24000";
$HorizSync = "30.0 - 130.0"; $HorizSync = "30.0 - 130.0";
$VertRefresh = "50.0 - 250.0"; $VertRefresh = "50.0 - 250.0";
@ -846,6 +888,22 @@ tweak_config() {
my $tmp = ""; my $tmp = "";
foreach $g (split(/,/, $geom)) { foreach $g (split(/,/, $geom)) {
$tmp .= "\"$g\" "; $tmp .= "\"$g\" ";
if (!$nomodelines && $g =~ /(\d+)x(\d+)/) {
my $w = $1;
my $h = $2;
$mode_str .= " Modeline \"$g\" ";
my $dot = sprintf("%.2f", $w * $h * 70 * 1.e-6);
$mode_str .= $dot;
$mode_str .= " " . $w;
$mode_str .= " " . int(1.02 * $w);
$mode_str .= " " . int(1.10 * $w);
$mode_str .= " " . int(1.20 * $w);
$mode_str .= " " . $h;
$mode_str .= " " . int($h + 1);
$mode_str .= " " . int($h + 3);
$mode_str .= " " . int($h + 20);
$mode_str .= "\n";
}
} }
$tmp =~ s/\s*$//; $tmp =~ s/\s*$//;
$geom = $tmp; $geom = $tmp;
@ -912,6 +970,10 @@ tweak_config() {
print " ##Xdummy:##\n"; print " ##Xdummy:##\n";
print " VertRefresh $VertRefresh\n"; print " VertRefresh $VertRefresh\n";
} }
if (!$nomodelines) {
print " ##Xdummy:##\n";
print $mode_str;
}
} }
$sect = ""; $sect = "";
print; print;
@ -925,7 +987,7 @@ tweak_config() {
$subsect =~ y/A-Z/a-z/; $subsect =~ y/A-Z/a-z/;
$subsects{$subsect} = 1; $subsects{$subsect} = 1;
if ($sect eq "screen" && $subsect eq "display") { if ($sect eq "screen" && $subsect eq "display") {
$got_Mode = 0; $got_Modes = 0;
} }
print; print;
next; next;
@ -938,7 +1000,7 @@ tweak_config() {
print " ##Xdummy:##\n"; print " ##Xdummy:##\n";
print " Depth\t$depth\n"; print " Depth\t$depth\n";
} }
if ($geom ne "" && ! $got_Mode) { if ($geom ne "" && ! $got_Modes) {
print " ##Xdummy:##\n"; print " ##Xdummy:##\n";
print " Modes\t$geom\n"; print " Modes\t$geom\n";
} }
@ -1073,7 +1135,9 @@ tweak_config() {
print " SubSection \"Display\"\n"; print " SubSection \"Display\"\n";
print " Viewport 0 0\n"; print " Viewport 0 0\n";
print " Depth 24\n"; print " Depth 24\n";
if ($geom ne "") { if ($got_Modes) {
;
} elsif ($geom ne "") {
print " Modes $geom\n"; print " Modes $geom\n";
} else { } else {
print " Modes \"1280x1024\" \"1024x768\" \"800x600\"\n"; print " Modes \"1280x1024\" \"1024x768\" \"800x600\"\n";
@ -1088,6 +1152,8 @@ tweak_config() {
# #
if [ "X$cmdline_config" = "X" ]; then if [ "X$cmdline_config" = "X" ]; then
: :
elif [ "X$cmdline_config" = "Xxdummy-builtin" ]; then
:
elif echo "$cmdline_config" | grep '/' > /dev/null; then elif echo "$cmdline_config" | grep '/' > /dev/null; then
: :
else else
@ -1119,7 +1185,7 @@ if [ ! $notweak ]; then
config="/etc/X11/XF86Config" config="/etc/X11/XF86Config"
fi fi
fi fi
if [ ! -f $config ]; then if [ ! -f "$config" ]; then
for c in /etc/X11/xorg.conf /etc/X11/XF86Config-4 /etc/X11/XF86Config for c in /etc/X11/xorg.conf /etc/X11/XF86Config-4 /etc/X11/XF86Config
do do
if [ -f $c ]; then if [ -f $c ]; then
@ -1130,7 +1196,11 @@ if [ ! $notweak ]; then
fi fi
fi fi
if [ ! -f $config ]; then if [ "X$config" = "Xxdummy-builtin" ]; then
config=""
fi
if [ ! -f "$config" ]; then
config="$XDUMMY_TMPDIR/xorg.conf" config="$XDUMMY_TMPDIR/xorg.conf"
warn "$program: using minimal built-in xorg.conf settings." warn "$program: using minimal built-in xorg.conf settings."
cat > $config <<END cat > $config <<END
@ -1195,7 +1265,7 @@ EndSection
END END
fi fi
if [ -f $config ]; then if [ -f "$config" ]; then
tweak_config $config tweak_config $config
fi fi

@ -2,7 +2,7 @@
.TH X11VNC "1" "January 2010" "x11vnc " "User Commands" .TH X11VNC "1" "January 2010" "x11vnc " "User Commands"
.SH NAME .SH NAME
x11vnc - allow VNC connections to real X11 displays x11vnc - allow VNC connections to real X11 displays
version: 0.9.10, lastmod: 2010-01-02 version: 0.9.10, lastmod: 2010-01-07
.SH SYNOPSIS .SH SYNOPSIS
.B x11vnc .B x11vnc
[OPTION]... [OPTION]...

@ -47,7 +47,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0; int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */ /* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.9.10 lastmod: 2010-01-02"; char lastmod[] = "0.9.10 lastmod: 2010-01-07";
/* X display info */ /* X display info */

Loading…
Cancel
Save