x11vnc: use DEC-XTRAP on legacy X11R5, -shiftcmap, -http

pull/1/head
runge 19 years ago
parent dfe5981ce9
commit ac01f36ce0

@ -1,3 +1,8 @@
2005-04-03 Karl Runge <runge@karlrunge.com>
* configure.ac: add conditional libXTrap checking
* x11vnc: use DEC-XTRAP on old X11R5 for grab control.
-shiftcmap n, -http, fix DAMAGE event leak.
2005-03-29 Karl Runge <runge@karlrunge.com> 2005-03-29 Karl Runge <runge@karlrunge.com>
* x11vnc: fix event leaks, build-time customizations, -nolookup * x11vnc: fix event leaks, build-time customizations, -nolookup

@ -45,11 +45,13 @@ HAVE_X="false"
AC_PATH_XTRA AC_PATH_XTRA
AH_TEMPLATE(HAVE_XSHM, [MIT-SHM extension build environment present]) AH_TEMPLATE(HAVE_XSHM, [MIT-SHM extension build environment present])
AH_TEMPLATE(HAVE_XTEST, [XTEST extension build environment present]) AH_TEMPLATE(HAVE_XTEST, [XTEST extension build environment present])
AH_TEMPLATE(HAVE_XTESTGRABCONTROL, [XTEST extension has XTestGrabControl])
AH_TEMPLATE(HAVE_XKEYBOARD, [XKEYBOARD extension build environment present]) AH_TEMPLATE(HAVE_XKEYBOARD, [XKEYBOARD extension build environment present])
AH_TEMPLATE(HAVE_LIBXINERAMA, [XINERAMA extension build environment present]) AH_TEMPLATE(HAVE_LIBXINERAMA, [XINERAMA extension build environment present])
AH_TEMPLATE(HAVE_LIBXRANDR, [XRANDR extension build environment present]) AH_TEMPLATE(HAVE_LIBXRANDR, [XRANDR extension build environment present])
AH_TEMPLATE(HAVE_LIBXFIXES, [XFIXES extension build environment present]) AH_TEMPLATE(HAVE_LIBXFIXES, [XFIXES extension build environment present])
AH_TEMPLATE(HAVE_LIBXDAMAGE, [XDAMAGE extension build environment present]) AH_TEMPLATE(HAVE_LIBXDAMAGE, [XDAMAGE extension build environment present])
AH_TEMPLATE(HAVE_LIBXTRAP, [DEC-XTRAP extension build environment present])
if test "$X_CFLAGS" != "-DX_DISPLAY_MISSING"; then if test "$X_CFLAGS" != "-DX_DISPLAY_MISSING"; then
AC_CHECK_LIB(X11, XGetImage, HAVE_X="true", AC_CHECK_LIB(X11, XGetImage, HAVE_X="true",
HAVE_X="false", HAVE_X="false",
@ -62,11 +64,29 @@ if test "$X_CFLAGS" != "-DX_DISPLAY_MISSING"; then
[AC_DEFINE(HAVE_XSHM)], , [AC_DEFINE(HAVE_XSHM)], ,
$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS) $X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
AC_CHECK_LIB(Xtst, XTestGrabControl,
X_PRELIBS="$X_PRELIBS -lXtst"
[AC_DEFINE(HAVE_XTESTGRABCONTROL) HAVE_XTESTGRABCONTROL="true"], ,
$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
AC_CHECK_LIB(Xtst, XTestFakeKeyEvent, AC_CHECK_LIB(Xtst, XTestFakeKeyEvent,
X_PRELIBS="$X_PRELIBS -lXtst" X_PRELIBS="$X_PRELIBS -lXtst"
[AC_DEFINE(HAVE_XTEST)], , [AC_DEFINE(HAVE_XTEST)], ,
$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS) $X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
# we use XTRAP on X11R5, or user can set X11VNC_USE_XTRAP
if test ! -z "$X11VNC_USE_XTRAP" -o -z "$HAVE_XTESTGRABCONTROL"; then
AC_CHECK_LIB(XTrap, XETrapSetGrabServer,
X_PRELIBS="$X_PRELIBS -lXTrap"
[AC_DEFINE(HAVE_LIBXTRAP)], ,
$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
# tru64 uses libXETrap.so
AC_CHECK_LIB(XETrap, XETrapSetGrabServer,
X_PRELIBS="$X_PRELIBS -lXETrap"
[AC_DEFINE(HAVE_LIBXTRAP)], ,
$X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS)
fi
saved_CPPFLAGS="$CPPFLAGS" saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $X_CFLAGS" CPPFLAGS="$CPPFLAGS $X_CFLAGS"
AC_CHECK_HEADER(X11/XKBlib.h, HAVE_XKBLIB_H="true", AC_CHECK_HEADER(X11/XKBlib.h, HAVE_XKBLIB_H="true",

@ -1,3 +1,10 @@
2005-04-03 Karl Runge <runge@karlrunge.com>
* try DEC-XTRAP on X11R5 if XTestGrabControl is missing.
* -shiftcmap n, for 8bpp displays using < 256 color cells
and with pixel values shifted from zero.
* fix DAMAGE event leak after viewers disconnect.
* -http option to try to guess where the java viewer is.
2005-03-29 Karl Runge <runge@karlrunge.com> 2005-03-29 Karl Runge <runge@karlrunge.com>
* build-time customizations X11VNC_SHARED, X11VNC_FOREVER, * build-time customizations X11VNC_SHARED, X11VNC_FOREVER,
REMOTE_CONTROL, SMALL_FOOTPRINT for CPPFLAGS REMOTE_CONTROL, SMALL_FOOTPRINT for CPPFLAGS

@ -1,5 +1,5 @@
x11vnc README file Date: Tue Mar 29 09:30:54 EST 2005 x11vnc README file Date: Sun Apr 3 16:28:59 EDT 2005
The following information is taken from these URLs: The following information is taken from these URLs:
@ -515,9 +515,14 @@ make
x11vnc is both a client and a server at the same time. It is an X x11vnc is both a client and a server at the same time. It is an X
client because it connects to the running X server to do the screen client because it connects to the running X server to do the screen
polls. Think of it as a rather efficient "screenshot" program running polls. Think of it as a rather efficient "screenshot" program running
continuously. It is a server in the sense that it is a VNC server that continuously. It is a server in the sense that it is a VNC server VNC
VNC viewers on the network can connect to and view the screen viewers on the network can connect to and view the screen framebuffer
framebuffer it manages. it manages.
When trying debug problems, remember to think of both roles. E.g. "how
is x11vnc connecting to the X server?", "how is the vncviewer
connecting to x11vnc?", "what permits/restricts the connection?". Both
links may have reachability, permission, and other issues.
Network performance: Whether you are using Xvnc or x11vnc it is Network performance: Whether you are using Xvnc or x11vnc it is
always a good idea to have a solid background color instead of a always a good idea to have a solid background color instead of a
@ -1311,7 +1316,22 @@ display :0
env CPPFLAGS="-DX11VNC_FOREVER=1" ./configure; make env CPPFLAGS="-DX11VNC_FOREVER=1" ./configure; make
If other things (e.g. "-I ...") are needed in CPPFLAGS add them as If other things (e.g. "-I ...") are needed in CPPFLAGS add them as
well. Let us know if more customizations would be useful. well.
Let us know if more build-time customizations would be useful.
If the system does not have the XTEST XTestGrabControl interface (some
early X11R5 systems have XTEST but not this interface), then configure
will automatically try to see if the DEC-XTRAP extension build
environment is available and use that for avoiding GrabServer
deadlock. If you want DEC-XTRAP compiled in no matter what, set
X11VNC_USE_XTRAP=1 in your environment. Note that DEC-XTRAP should
only be used as a last resort on legacy machines since the standard
XTEST works well. If there is interest for legacy machines to use
DEC-XTRAP for all of the user input injection (not just grab control)
let us know and we will put it in for you to try. (Note: DEC-XTRAP
grab control seems to be broken on Linux/XFree86)
[Win2VNC Related] [Win2VNC Related]
Q-12: I have two separate machine displays in front of me, one Windows Q-12: I have two separate machine displays in front of me, one Windows
@ -1559,8 +1579,8 @@ TrueColor defdepth 24
If the X display machine is a traditional Xterminal (where the X If the X display machine is a traditional Xterminal (where the X
server process runs on the Xterminal box, but all of the X client server process runs on the Xterminal box, but all of the X client
applications (mozilla, etc) run on a central server (aka "terminal applications (mozilla, etc) run on a central server (aka "terminal
server")), you will need somehow to be able to log into the Xterminal server")), you will need to log into the Xterminal machine (i.e. get a
machine (i.e. get a shell there) and start the x11vnc program. If the shell running there) and then start the x11vnc program. If the
Xterminal Linux/Unix machine is stripped down (e.g. no users besides Xterminal Linux/Unix machine is stripped down (e.g. no users besides
root) that may be difficult. root) that may be difficult.
@ -1568,13 +1588,14 @@ TrueColor defdepth 24
hence the MIT-MAGIC-COOKIE auth files, are on the central server and hence the MIT-MAGIC-COOKIE auth files, are on the central server and
not on the Xterminal box where the X server and x11vnc processes are. not on the Xterminal box where the X server and x11vnc processes are.
To run the x11vnc process on the Xterminal box, somehow the So unless X permissions are completely turned off (e.g. "xhost +"), to
MIT-MAGIC-COOKIE auth file data (XAUTHORITY or $HOME/.Xauthority) must run the x11vnc process on the Xterminal box the MIT-MAGIC-COOKIE auth
be accessible by or copied to the Xterminal. If $HOME/.Xauthority is file data (XAUTHORITY or $HOME/.Xauthority) must be accessible by or
exported via NFS (this is insecure of course, but has been going on copied to the Xterminal. If $HOME/.Xauthority is exported via NFS
for decades), then x11vnc can simply pick it up via NFS (you may need (this is insecure of course, but has been going on for decades), then
to use the [189]-auth option to point to the correct file). Other x11vnc can simply pick it up via NFS (you may need to use the
options include copying the auth file using scp, or something like: [189]-auth option to point to the correct file). Other options include
copying the auth file using scp, or something like:
central-server> xauth nextract - xterm123:0 | ssh xterm123 xauth nmerge - central-server> xauth nextract - xterm123:0 | ssh xterm123 xauth nmerge -
and then, say, ssh from central-server to xterm123 to start x11vnc. and then, say, ssh from central-server to xterm123 to start x11vnc.
@ -3822,62 +3843,64 @@ 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.7.2pre lastmod: 2005-03-1 x11vnc: allow VNC connections to real X11 displays. 0.7.2pre lastmod: 2005-04-0
9 3
x11vnc options: x11vnc options:
-display disp -auth file -display disp -auth file
-id windowid -sid windowid -id windowid -sid windowid
-clip WxH+X+Y -flashcmap -clip WxH+X+Y -flashcmap
-notruecolor -visual n -shiftcmap n -notruecolor
-overlay -overlay_nocursor -visual n -overlay
-scale fraction -scale_cursor frac -overlay_nocursor -scale fraction
-viewonly -shared -scale_cursor frac -viewonly
-once -forever -shared -once
-timeout n -inetd -forever -timeout n
-inetd -http
-connect string -vncconnect -connect string -vncconnect
-novncconnect -allow host1[,host2..] -novncconnect -allow host1[,host2..]
-localhost -input string -localhost -nolookup
-viewpasswd string -passwdfile filename -input string -viewpasswd string
-storepasswd pass file -accept string -passwdfile filename -storepasswd pass file
-gone string -users list -accept string -gone string
-noshm -flipbyteorder -users list -noshm
-onetile -solid [color] -flipbyteorder -onetile
-blackout string -xinerama -solid [color] -blackout string
-xrandr [mode] -padgeom WxH -xinerama -xrandr [mode]
-o logfile -rc filename -padgeom WxH -o logfile
-norc -h, -help -rc filename -norc
-?, -opts -V, -version -h, -help -?, -opts
-q -bg -V, -version -q
-modtweak -nomodtweak -bg -modtweak
-xkb -skip_keycodes string -nomodtweak -xkb
-add_keysyms -clear_mods -skip_keycodes string -add_keysyms
-clear_keys -remap string -clear_mods -clear_keys
-norepeat -repeat -remap string -norepeat
-nofb -nobell -repeat -nofb
-nosel -noprimary -nobell -nosel
-cursor [mode] -nocursor -noprimary -cursor [mode]
-arrow n -noxfixes -nocursor -arrow n
-alphacut n -alphafrac fraction -noxfixes -alphacut n
-alpharemove -noalphablend -alphafrac fraction -alpharemove
-nocursorshape -cursorpos -noalphablend -nocursorshape
-nocursorpos -xwarppointer -cursorpos -nocursorpos
-buttonmap string -nodragging -xwarppointer -buttonmap string
-pointer_mode n -input_skip n -nodragging -pointer_mode n
-speeds rd,bw,lat -debug_pointer -input_skip n -speeds rd,bw,lat
-debug_keyboard -defer time -debug_pointer -debug_keyboard
-wait time -nap -defer time -wait time
-nonap -sb time -nap -nonap
-noxdamage -xd_area A -sb time -noxdamage
-xd_mem f -sigpipe string -xd_area A -xd_mem f
-threads -nothreads -sigpipe string -threads
-fs f -gaps n -nothreads -fs f
-grow n -fuzz n -gaps n -grow n
-snapfb -gui [gui-opts] -fuzz n -snapfb
-remote command -query variable -gui [gui-opts] -remote command
-sync -noremote -query variable -sync
-unsafe -safer -noremote -unsafe
-deny_all -safer -deny_all
libvncserver options: libvncserver options:
-rfbport port TCP port for RFB protocol -rfbport port TCP port for RFB protocol
@ -3903,8 +3926,8 @@ libvncserver options:
% x11vnc -help % x11vnc -help
x11vnc: allow VNC connections to real X11 displays. 0.7.2pre lastmod: 2005-03-1 x11vnc: allow VNC connections to real X11 displays. 0.7.2pre lastmod: 2005-04-0
9 3
Typical usage is: Typical usage is:
@ -3978,6 +4001,13 @@ Options:
-flashcmap In 8bpp indexed color, let the installed colormap flash -flashcmap In 8bpp indexed color, let the installed colormap flash
as the pointer moves from window to window (slow). as the pointer moves from window to window (slow).
-shiftcmap n Rare problem, but some 8bpp displays use less than 256
colorcells (e.g. 16-color grayscale, perhaps the other
bits are used for double buffering) *and* also need to
shift the pixels values away from 0, .., ncells. "n"
indicates the shift to be applied to the pixel values.
To see the pixel values set DEBUG_CMAP=1 to print out
a colormap histogram. Example: -shiftcmap 240
-notruecolor For 8bpp displays, force indexed color (i.e. a colormap) -notruecolor For 8bpp displays, force indexed color (i.e. a colormap)
even if it looks like 8bpp TrueColor (rare problem). even if it looks like 8bpp TrueColor (rare problem).
-visual n Experimental option: probably does not do what you -visual n Experimental option: probably does not do what you
@ -4027,7 +4057,7 @@ Options:
If "fraction" contains a decimal point "." it If "fraction" contains a decimal point "." it
is taken as a floating point number, alternatively is taken as a floating point number, alternatively
the notation "m/n" may be used to denote fractions the notation "m/n" may be used to denote fractions
exactly, e.g. -scale 2/3. exactly, e.g. -scale 2/3
Scaling Options: can be added after "fraction" via Scaling Options: can be added after "fraction" via
":", to supply multiple ":" options use commas. ":", to supply multiple ":" options use commas.
@ -4061,6 +4091,11 @@ Options:
Note: if you are not redirecting stderr to a log file Note: if you are not redirecting stderr to a log file
(via shell 2> or -o option) you must also specify the (via shell 2> or -o option) you must also specify the
-q option, otherwise the stderr goes to the viewer. -q option, otherwise the stderr goes to the viewer.
-http Instead of using -httpdir (see below) to specify
where the Java vncviewer applet is, have x11vnc try
to *guess* where the directory is by looking relative
to the program location and in standard locations
(/usr/local/share/x11vnc/classes, etc).
-connect string For use with "vncviewer -listen" reverse connections. -connect string For use with "vncviewer -listen" reverse connections.
If "string" has the form "host" or "host:port" If "string" has the form "host" or "host:port"
the connection is made once at startup. Use commas the connection is made once at startup. Use commas
@ -4100,6 +4135,11 @@ Options:
vice versa) to avoid situations where no connections vice versa) to avoid situations where no connections
(or too many) are allowed. (or too many) are allowed.
-nolookup Do not use gethostbyname() or gethostbyaddr() to look up
host names or IP numbers. Use this if name resolution
is incorrectly set up and leads to long pauses as name
lookup times out, etc.
-input string Fine tuning of allowed user input. If "string" does -input string Fine tuning of allowed user input. If "string" does
not contain a comma "," the tuning applies only to not contain a comma "," the tuning applies only to
normal clients. Otherwise the part before "," is normal clients. Otherwise the part before "," is
@ -4341,6 +4381,7 @@ Options:
to the terminal. Same as "-logfile file". To append to the terminal. Same as "-logfile file". To append
to the file use "-oa file" or "-logappend file". to the file use "-oa file" or "-logappend file".
-rc filename Use "filename" instead of $HOME/.x11vncrc for rc file. -rc filename Use "filename" instead of $HOME/.x11vncrc for rc file.
-norc Do not process any .x11vncrc file for options. -norc Do not process any .x11vncrc file for options.
-h, -help Print this help text. -h, -help Print this help text.
-?, -opts Only list the x11vnc options. -?, -opts Only list the x11vnc options.
@ -4576,7 +4617,7 @@ Options:
or scrolling. So a scheme has to be used to "eat" or scrolling. So a scheme has to be used to "eat"
much of that pointer input before re-polling the screen much of that pointer input before re-polling the screen
and sending out framebuffer updates. The mode number and sending out framebuffer updates. The mode number
"n" can be 0 to 4 and selects one of the schemes "n" can be 0 to 5 and selects one of the schemes
desribed below. desribed below.
n=0: does the same as -nodragging. (all screen polling n=0: does the same as -nodragging. (all screen polling
@ -4589,19 +4630,24 @@ Options:
n=2 is an improved scheme: by watching the current rate n=2 is an improved scheme: by watching the current rate
of input events it tries to detect if it should try to of input events it tries to detect if it should try to
"eat" additional pointer events before continuing. "eat" additional pointer events before continuing.
This mode was the default until Apr 2005.
n=3 is basically the same as n=2 except with slightly
tweaked parameters. We made this a new one so one
could use -pm 2 for the old behavior. NOT FINISHED.
n=3 is basically a dynamic -nodragging mode: it detects n=4 is basically a dynamic -nodragging mode: it detects
when the mouse motion has paused and then refreshes when the mouse motion has paused and then refreshes
the display. the display.
n=4: attempts to measures network rates and latency, n=5 attempts to measures network rates and latency,
the video card read rate, and how many tiles have been the video card read rate, and how many tiles have been
changed on the screen. From this, it aggressively tries changed on the screen. From this, it aggressively tries
to push screen "frames" when it decides it has enough to push screen "frames" when it decides it has enough
resources to do so. NOT FINISHED. resources to do so. NOT FINISHED.
The default n is 2. Note that modes 2, 3, 4 will skip The default n is 2. Note that modes 2, 3, 4, 5 will
-input_skip keyboard events (but it will not count skip -input_skip keyboard events (but it will not count
pointer events). Also note that these modes are not pointer events). Also note that these modes are not
available in -threads mode which has its own pointer available in -threads mode which has its own pointer
event handling mechanism. event handling mechanism.
@ -4619,7 +4665,7 @@ Options:
-speeds rd,bw,lat x11vnc tries to estimate some speed parameters that -speeds rd,bw,lat x11vnc tries to estimate some speed parameters that
are used to optimize scheduling (e.g. -pointer_mode are used to optimize scheduling (e.g. -pointer_mode
4) and other things. Use the -speeds option to set 5) and other things. Use the -speeds option to set
these manually. The triple "rd,bw,lat" corresponds these manually. The triple "rd,bw,lat" corresponds
to video h/w read rate in MB/sec, network bandwidth to to video h/w read rate in MB/sec, network bandwidth to
clients in KB/sec, and network latency to clients in clients in KB/sec, and network latency to clients in
@ -4627,14 +4673,16 @@ Options:
e.g. "-speeds ,100,15", then the internal scheme is e.g. "-speeds ,100,15", then the internal scheme is
used to estimate the empty value(s). used to estimate the empty value(s).
Note: use this option is currently NOT FINISHED.
Typical PC video cards have read rates of 5-10 MB/sec. Typical PC video cards have read rates of 5-10 MB/sec.
If the framebuffer is in main memory instead of video If the framebuffer is in main memory instead of video
h/w (e.g. SunRay, shadowfb, Xvfb), the read rate may h/w (e.g. SunRay, shadowfb, Xvfb), the read rate may
be much faster. "x11perf -getimage500" can be used be much faster. "x11perf -getimage500" can be used
to get a lower bound (remember to factor in the bytes to get a lower bound (remember to factor in the bytes
per pixel). It is up to you to estimate the network per pixel). It is up to you to estimate the network
bandwith to clients. For the latency the ping(1) bandwith and latency to clients. For the latency the
command can be used. ping(1) command can be used.
For convenience there are some aliases provided, For convenience there are some aliases provided,
e.g. "-speeds modem". The aliases are: "modem" for e.g. "-speeds modem". The aliases are: "modem" for
@ -4815,6 +4863,7 @@ Options:
clip:WxH+X+Y set -clip mode to "WxH+X+Y" clip:WxH+X+Y set -clip mode to "WxH+X+Y"
flashcmap enable -flashcmap mode. flashcmap enable -flashcmap mode.
noflashcmap disable -flashcmap mode. noflashcmap disable -flashcmap mode.
shiftcmap:n set -shiftcmap to n.
notruecolor enable -notruecolor mode. notruecolor enable -notruecolor mode.
truecolor disable -notruecolor mode. truecolor disable -notruecolor mode.
overlay enable -overlay mode (if applicable). overlay enable -overlay mode (if applicable).
@ -4834,6 +4883,8 @@ Options:
timeout:n reset -timeout to n, if there are timeout:n reset -timeout to n, if there are
currently no clients, exit unless one currently no clients, exit unless one
connects in the next n secs. connects in the next n secs.
http enable http client connections.
nohttp disable http client connections.
deny deny any new connections, same as "lock" deny deny any new connections, same as "lock"
nodeny allow new connections, same as "unlock" nodeny allow new connections, same as "unlock"
connect:host do reverse connection to host, "host" connect:host do reverse connection to host, "host"
@ -4843,8 +4894,8 @@ Options:
same as "close:host". Use host same as "close:host". Use host
"all" to close all current clients. "all" to close all current clients.
If you know the client internal hex ID, If you know the client internal hex ID,
e.g. 0x3 (returned by -query clients and e.g. 0x3 (returned by "-query clients"
RFB_CLIENT_ID), you can use that too. and RFB_CLIENT_ID) you can use that too.
allowonce:host For the next connection only, allow allowonce:host For the next connection only, allow
connection from "host". connection from "host".
allow:hostlist set -allow list to (comma separated) allow:hostlist set -allow list to (comma separated)
@ -4855,6 +4906,8 @@ Options:
localhost enable -localhost mode localhost enable -localhost mode
nolocalhost disable -localhost mode nolocalhost disable -localhost mode
listen:str set -listen to str, empty to disable. listen:str set -listen to str, empty to disable.
nolookup enable -nolookup mode.
lookup disable -nolookup mode.
input:str set -input to "str", empty to disable. input:str set -input to "str", empty to disable.
client_input:str set the K, M, B -input on a per-client client_input:str set the K, M, B -input on a per-client
basis. select which client as for basis. select which client as for
@ -4965,8 +5018,6 @@ Options:
desktop:str set -desktop name to str for new clients desktop:str set -desktop name to str for new clients
. .
rfbport:n set -rfbport to n. rfbport:n set -rfbport to n.
http enable http client connections.
nohttp disable http client connections.
httpport:n set -httpport to n. httpport:n set -httpport to n.
httpdir:dir set -httpdir to dir (and enable http). httpdir:dir set -httpdir to dir (and enable http).
enablehttpproxy enable -enablehttpproxy mode. enablehttpproxy enable -enablehttpproxy mode.
@ -5019,27 +5070,28 @@ Options:
the returned value corresponds to (hint: the ext_* the returned value corresponds to (hint: the ext_*
variables correspond to the presence of X extensions): variables correspond to the presence of X extensions):
ans= stop quit exit shutdown ping blacken zero refresh ans= stop quit exit shutdown ping blacken zero
reset close disconnect id sid waitmapped nowaitmapped refresh reset close disconnect id sid waitmapped
clip flashcmap noflashcmap truecolor notruecolor nowaitmapped clip flashcmap noflashcmap shiftcmap
overlay nooverlay overlay_cursor overlay_yescursor truecolor notruecolor overlay nooverlay overlay_cursor
nooverlay_nocursor nooverlay_cursor nooverlay_yescursor overlay_yescursor nooverlay_nocursor nooverlay_cursor
overlay_nocursor visual scale scale_cursor viewonly nooverlay_yescursor overlay_nocursor visual scale
noviewonly shared noshared forever noforever once scale_cursor viewonly noviewonly shared noshared
timeout deny lock nodeny unlock connect allowonce forever noforever once timeout deny lock nodeny unlock
allow localhost nolocalhost listen accept gone connect allowonce allow localhost nolocalhost listen
shm noshm flipbyteorder noflipbyteorder onetile lookup nolookup accept gone shm noshm flipbyteorder
noonetile solid_color solid nosolid blackout xinerama noflipbyteorder onetile noonetile solid_color solid
noxinerama xrandr noxrandr xrandr_mode padgeom quiet nosolid blackout xinerama noxinerama xrandr noxrandr
q noquiet modtweak nomodtweak xkb noxkb skip_keycodes xrandr_mode padgeom quiet q noquiet modtweak nomodtweak
add_keysyms noadd_keysyms clear_mods noclear_mods xkb noxkb skip_keycodes add_keysyms noadd_keysyms
clear_keys noclear_keys remap repeat norepeat fb nofb clear_mods noclear_mods clear_keys noclear_keys
bell nobell sel nosel primary noprimary cursorshape remap repeat norepeat fb nofb bell nobell sel nosel
nocursorshape cursorpos nocursorpos cursor show_cursor primary noprimary cursorshape nocursorshape cursorpos
noshow_cursor nocursor arrow xfixes noxfixes xdamage nocursorpos cursor show_cursor noshow_cursor nocursor
noxdamage xd_area xd_mem alphacut alphafrac alpharemove arrow xfixes noxfixes xdamage noxdamage xd_area
noalpharemove alphablend noalphablend xwarp xwarppointer xd_mem alphacut alphafrac alpharemove noalpharemove
noxwarp noxwarppointer buttonmap dragging nodragging alphablend noalphablend xwarp xwarppointer noxwarp
noxwarppointer buttonmap dragging nodragging
pointer_mode pm input_skip input client_input speeds pointer_mode pm input_skip input client_input speeds
debug_pointer dp nodebug_pointer nodp debug_keyboard dk debug_pointer dp nodebug_pointer nodp debug_keyboard dk
nodebug_keyboard nodk deferupdate defer wait rfbwait nodebug_keyboard nodk deferupdate defer wait rfbwait
@ -5055,19 +5107,20 @@ Options:
scaling_nomult4 scaling_pad scaling_interpolate inetd scaling_nomult4 scaling_pad scaling_interpolate inetd
safer unsafe passwdfile using_shm logfile o rc norc safer unsafe passwdfile using_shm logfile o rc norc
h help V version lastmod bg sigpipe threads clients h help V version lastmod bg sigpipe threads clients
client_count pid ext_xtest ext_xkb ext_xshm ext_xinerama client_count pid ext_xtest ext_xtrap ext_xkb ext_xshm
ext_overlay ext_xfixes ext_xdamage ext_xrandr rootwin ext_xinerama ext_overlay ext_xfixes ext_xdamage
num_buttons button_mask mouse_x mouse_y bpp depth ext_xrandr rootwin num_buttons button_mask mouse_x
indexed_color dpy_x dpy_y wdpy_x wdpy_y off_x off_y mouse_y bpp depth indexed_color dpy_x dpy_y wdpy_x
cdpy_x cdpy_y coff_x coff_y rfbauth passwd wdpy_y off_x off_y cdpy_x cdpy_y coff_x coff_y rfbauth
passwd
-sync By default -remote commands are run asynchronously, that -sync By default -remote commands are run asynchronously, that
is, the request is posted and the program immediately is, the request is posted and the program immediately
exits. Use -sync to have the program wait for an exits. Use -sync to have the program wait for an
acknowledgement from the x11vnc server that command acknowledgement from the x11vnc server that command was
was processed. On the other hand -query requests are processed (somehow). On the other hand -query requests
always processed synchronously because they have wait are always processed synchronously because they have
for the result. to wait for the result.
Also note that if both -remote and -query requests are Also note that if both -remote and -query requests are
supplied on the command line, the -remote is processed supplied on the command line, the -remote is processed
@ -5083,19 +5136,21 @@ Options:
-noremote Do not process any remote control commands or queries. -noremote Do not process any remote control commands or queries.
A note about security wrt remote control commands. A note about security wrt remote control commands.
If someone can connect to the X display and change the If someone can connect to the X display and change
property VNC_CONNECT, then they can remotely control the property VNC_CONNECT, then they can remotely
x11vnc. Normally access to the X display is protected. control x11vnc. Normally access to the X display is
Note that if they can modify VNC_CONNECT, they could protected. Note that if they can modify VNC_CONNECT
also run their own x11vnc and have complete control on the X server, they have enough permissions to also
run their own x11vnc and thus have complete control
of the desktop. If the "-connect /path/to/file" of the desktop. If the "-connect /path/to/file"
channel is being used, obviously anyone who can channel is being used, obviously anyone who can write
write to /path/to/file can remotely control x11vnc. to /path/to/file can remotely control x11vnc. So be
So be sure to protect the X display and that file's sure to protect the X display and that file's write
write permissions. permissions.
To disable the VNC_CONNECT property channel completely If you are paranoid and do not think -noremote is
use -novncconnect. enough, to disable the VNC_CONNECT property channel
completely use -novncconnect.
-unsafe If x11vnc is running as root (e.g. inetd or Xsetup for -unsafe If x11vnc is running as root (e.g. inetd or Xsetup for
a display manager) a few remote commands are disabled a display manager) a few remote commands are disabled

@ -114,6 +114,7 @@ Screen
-- --
visual: visual:
flashcmap flashcmap
shiftcmap:
notruecolor notruecolor
-- --
clip: clip:

@ -120,6 +120,7 @@
" --\n" " --\n"
" visual:\n" " visual:\n"
" flashcmap\n" " flashcmap\n"
" shiftcmap:\n"
" notruecolor\n" " notruecolor\n"
" --\n" " --\n"
" clip:\n" " clip:\n"

@ -1,8 +1,8 @@
.\" This file was automatically generated from x11vnc -help output. .\" This file was automatically generated from x11vnc -help output.
.TH X11VNC "1" "March 2005" "x11vnc " "User Commands" .TH X11VNC "1" "April 2005" "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.7.2pre, lastmod: 2005-03-29 version: 0.7.2pre, lastmod: 2005-04-03
.SH SYNOPSIS .SH SYNOPSIS
.B x11vnc .B x11vnc
[OPTION]... [OPTION]...
@ -103,6 +103,16 @@ of the selected window.
In 8bpp indexed color, let the installed colormap flash In 8bpp indexed color, let the installed colormap flash
as the pointer moves from window to window (slow). as the pointer moves from window to window (slow).
.PP .PP
\fB-shiftcmap\fR \fIn\fR
.IP
Rare problem, but some 8bpp displays use less than 256
colorcells (e.g. 16-color grayscale, perhaps the other
bits are used for double buffering) *and* also need to
shift the pixels values away from 0, .., ncells. \fIn\fR
indicates the shift to be applied to the pixel values.
To see the pixel values set DEBUG_CMAP=1 to print out
a colormap histogram. Example: \fB-shiftcmap\fR 240
.PP
\fB-notruecolor\fR \fB-notruecolor\fR
.IP .IP
For 8bpp displays, force indexed color (i.e. a colormap) For 8bpp displays, force indexed color (i.e. a colormap)
@ -224,6 +234,14 @@ Note: if you are not redirecting stderr to a log file
(via shell 2> or \fB-o\fR option) you must also specify the (via shell 2> or \fB-o\fR option) you must also specify the
\fB-q\fR option, otherwise the stderr goes to the viewer. \fB-q\fR option, otherwise the stderr goes to the viewer.
.PP .PP
\fB-http\fR
.IP
Instead of using \fB-httpdir\fR (see below) to specify
where the Java vncviewer applet is, have x11vnc try
to *guess* where the directory is by looking relative
to the program location and in standard locations
(/usr/local/share/x11vnc/classes, etc).
.PP
\fB-connect\fR \fIstring\fR \fB-connect\fR \fIstring\fR
.IP .IP
For use with "vncviewer -listen" reverse connections. For use with "vncviewer -listen" reverse connections.
@ -942,7 +960,7 @@ This mode was the default until Apr 2005.
.IP .IP
n=3 is basically the same as n=2 except with slightly n=3 is basically the same as n=2 except with slightly
tweaked parameters. We made this a new one so one tweaked parameters. We made this a new one so one
could use \fB-pm\fR 2 for the old behavior. could use \fB-pm\fR 2 for the old behavior. NOT FINISHED.
.IP .IP
n=4 is basically a dynamic \fB-nodragging\fR mode: it detects n=4 is basically a dynamic \fB-nodragging\fR mode: it detects
when the mouse motion has paused and then refreshes when the mouse motion has paused and then refreshes
@ -954,7 +972,7 @@ changed on the screen. From this, it aggressively tries
to push screen "frames" when it decides it has enough to push screen "frames" when it decides it has enough
resources to do so. NOT FINISHED. resources to do so. NOT FINISHED.
.IP .IP
The default n is 3. Note that modes 2, 3, 4, 5 will The default n is 2. Note that modes 2, 3, 4, 5 will
skip \fB-input_skip\fR keyboard events (but it will not count skip \fB-input_skip\fR keyboard events (but it will not count
pointer events). Also note that these modes are not pointer events). Also note that these modes are not
available in \fB-threads\fR mode which has its own pointer available in \fB-threads\fR mode which has its own pointer
@ -977,7 +995,7 @@ Default: 10
.IP .IP
x11vnc tries to estimate some speed parameters that x11vnc tries to estimate some speed parameters that
are used to optimize scheduling (e.g. \fB-pointer_mode\fR are used to optimize scheduling (e.g. \fB-pointer_mode\fR
4) and other things. Use the \fB-speeds\fR option to set 5) and other things. Use the \fB-speeds\fR option to set
these manually. The triple \fIrd,bw,lat\fR corresponds these manually. The triple \fIrd,bw,lat\fR corresponds
to video h/w read rate in MB/sec, network bandwidth to to video h/w read rate in MB/sec, network bandwidth to
clients in KB/sec, and network latency to clients in clients in KB/sec, and network latency to clients in
@ -1239,6 +1257,8 @@ flashcmap enable \fB-flashcmap\fR mode.
.IP .IP
noflashcmap disable \fB-flashcmap\fR mode. noflashcmap disable \fB-flashcmap\fR mode.
.IP .IP
shiftcmap:n set \fB-shiftcmap\fR to n.
.IP
notruecolor enable \fB-notruecolor\fR mode. notruecolor enable \fB-notruecolor\fR mode.
.IP .IP
truecolor disable \fB-notruecolor\fR mode. truecolor disable \fB-notruecolor\fR mode.
@ -1274,6 +1294,10 @@ timeout:n reset \fB-timeout\fR to n, if there are
currently no clients, exit unless one currently no clients, exit unless one
connects in the next n secs. connects in the next n secs.
.IP .IP
http enable http client connections.
.IP
nohttp disable http client connections.
.IP
deny deny any new connections, same as "lock" deny deny any new connections, same as "lock"
.IP .IP
nodeny allow new connections, same as "unlock" nodeny allow new connections, same as "unlock"
@ -1508,10 +1532,6 @@ desktop:str set \fB-desktop\fR name to str for new clients.
.IP .IP
rfbport:n set \fB-rfbport\fR to n. rfbport:n set \fB-rfbport\fR to n.
.IP .IP
http enable http client connections.
.IP
nohttp disable http client connections.
.IP
httpport:n set \fB-httpport\fR to n. httpport:n set \fB-httpport\fR to n.
.IP .IP
httpdir:dir set \fB-httpdir\fR to dir (and enable http). httpdir:dir set \fB-httpdir\fR to dir (and enable http).
@ -1592,27 +1612,28 @@ remote command, we hope the name makes it obvious what
the returned value corresponds to (hint: the ext_* the returned value corresponds to (hint: the ext_*
variables correspond to the presence of X extensions): variables correspond to the presence of X extensions):
.IP .IP
ans= stop quit exit shutdown ping blacken zero refresh ans= stop quit exit shutdown ping blacken zero
reset close disconnect id sid waitmapped nowaitmapped refresh reset close disconnect id sid waitmapped
clip flashcmap noflashcmap truecolor notruecolor nowaitmapped clip flashcmap noflashcmap shiftcmap
overlay nooverlay overlay_cursor overlay_yescursor truecolor notruecolor overlay nooverlay overlay_cursor
nooverlay_nocursor nooverlay_cursor nooverlay_yescursor overlay_yescursor nooverlay_nocursor nooverlay_cursor
overlay_nocursor visual scale scale_cursor viewonly nooverlay_yescursor overlay_nocursor visual scale
noviewonly shared noshared forever noforever once scale_cursor viewonly noviewonly shared noshared
timeout deny lock nodeny unlock connect allowonce allow forever noforever once timeout deny lock nodeny unlock
localhost nolocalhost listen lookup nolookup accept connect allowonce allow localhost nolocalhost listen
gone shm noshm flipbyteorder noflipbyteorder onetile lookup nolookup accept gone shm noshm flipbyteorder
noonetile solid_color solid nosolid blackout xinerama noflipbyteorder onetile noonetile solid_color solid
noxinerama xrandr noxrandr xrandr_mode padgeom quiet nosolid blackout xinerama noxinerama xrandr noxrandr
q noquiet modtweak nomodtweak xkb noxkb skip_keycodes xrandr_mode padgeom quiet q noquiet modtweak nomodtweak
add_keysyms noadd_keysyms clear_mods noclear_mods xkb noxkb skip_keycodes add_keysyms noadd_keysyms
clear_keys noclear_keys remap repeat norepeat fb nofb clear_mods noclear_mods clear_keys noclear_keys
bell nobell sel nosel primary noprimary cursorshape remap repeat norepeat fb nofb bell nobell sel nosel
nocursorshape cursorpos nocursorpos cursor show_cursor primary noprimary cursorshape nocursorshape cursorpos
noshow_cursor nocursor arrow xfixes noxfixes xdamage nocursorpos cursor show_cursor noshow_cursor nocursor
noxdamage xd_area xd_mem alphacut alphafrac alpharemove arrow xfixes noxfixes xdamage noxdamage xd_area
noalpharemove alphablend noalphablend xwarp xwarppointer xd_mem alphacut alphafrac alpharemove noalpharemove
noxwarp noxwarppointer buttonmap dragging nodragging alphablend noalphablend xwarp xwarppointer noxwarp
noxwarppointer buttonmap dragging nodragging
pointer_mode pm input_skip input client_input speeds pointer_mode pm input_skip input client_input speeds
debug_pointer dp nodebug_pointer nodp debug_keyboard dk debug_pointer dp nodebug_pointer nodp debug_keyboard dk
nodebug_keyboard nodk deferupdate defer wait rfbwait nodebug_keyboard nodk deferupdate defer wait rfbwait
@ -1628,11 +1649,12 @@ scale_numer scale_denom scale_fac scaling_noblend
scaling_nomult4 scaling_pad scaling_interpolate inetd scaling_nomult4 scaling_pad scaling_interpolate inetd
safer unsafe passwdfile using_shm logfile o rc norc safer unsafe passwdfile using_shm logfile o rc norc
h help V version lastmod bg sigpipe threads clients h help V version lastmod bg sigpipe threads clients
client_count pid ext_xtest ext_xkb ext_xshm ext_xinerama client_count pid ext_xtest ext_xtrap ext_xkb ext_xshm
ext_overlay ext_xfixes ext_xdamage ext_xrandr rootwin ext_xinerama ext_overlay ext_xfixes ext_xdamage
num_buttons button_mask mouse_x mouse_y bpp depth ext_xrandr rootwin num_buttons button_mask mouse_x
indexed_color dpy_x dpy_y wdpy_x wdpy_y off_x off_y mouse_y bpp depth indexed_color dpy_x dpy_y wdpy_x
cdpy_x cdpy_y coff_x coff_y rfbauth passwd wdpy_y off_x off_y cdpy_x cdpy_y coff_x coff_y rfbauth
passwd
.PP .PP
\fB-sync\fR \fB-sync\fR
.IP .IP

@ -165,6 +165,7 @@
#define LIBVNCSERVER_HAVE_XSHM 1 #define LIBVNCSERVER_HAVE_XSHM 1
#define LIBVNCSERVER_HAVE_XTEST 1 #define LIBVNCSERVER_HAVE_XTEST 1
#define LIBVNCSERVER_HAVE_XTESTGRABCONTROL 1
#define LIBVNCSERVER_HAVE_PWD_H 1 #define LIBVNCSERVER_HAVE_PWD_H 1
#define LIBVNCSERVER_HAVE_SYS_WAIT_H 1 #define LIBVNCSERVER_HAVE_SYS_WAIT_H 1
@ -290,6 +291,7 @@
#define LIBVNCSERVER_HAVE_PWD_H 0 #define LIBVNCSERVER_HAVE_PWD_H 0
#define REMOTE_CONTROL 0 #define REMOTE_CONTROL 0
#endif #endif
/****************************************************************************/
/* Extensions and related includes: */ /* Extensions and related includes: */
@ -306,6 +308,16 @@
#if LIBVNCSERVER_HAVE_XTEST #if LIBVNCSERVER_HAVE_XTEST
#include <X11/extensions/XTest.h> #include <X11/extensions/XTest.h>
#endif #endif
static int xtest_base_event_type = 0;
#if LIBVNCSERVER_HAVE_LIBXTRAP
#define NEED_EVENTS
#define NEED_REPLIES
#include <X11/extensions/xtraplib.h>
#include <X11/extensions/xtraplibp.h>
XETC *trap_ctx = NULL;
#endif
static int xtrap_base_event_type = 0;
#if LIBVNCSERVER_HAVE_XKEYBOARD #if LIBVNCSERVER_HAVE_XKEYBOARD
#include <X11/XKBlib.h> #include <X11/XKBlib.h>
@ -373,8 +385,9 @@ int overlay_present = 0;
*/ */
#if LIBVNCSERVER_HAVE_LIBXRANDR #if LIBVNCSERVER_HAVE_LIBXRANDR
#include <X11/extensions/Xrandr.h> #include <X11/extensions/Xrandr.h>
static int xrandr_base_event_type = 0;
#endif #endif
static int xrandr_base_event_type = 0;
int xfixes_present = 0; int xfixes_present = 0;
int use_xfixes = 1; int use_xfixes = 1;
@ -383,29 +396,29 @@ int alpha_threshold = 240;
double alpha_frac = 0.33; double alpha_frac = 0.33;
int alpha_remove = 0; int alpha_remove = 0;
int alpha_blend = 1; int alpha_blend = 1;
int alt_arrow = 1; int alt_arrow = 1;
#if LIBVNCSERVER_HAVE_LIBXFIXES #if LIBVNCSERVER_HAVE_LIBXFIXES
#include <X11/extensions/Xfixes.h> #include <X11/extensions/Xfixes.h>
static int xfixes_base_event_type = 0;
#endif #endif
static int xfixes_base_event_type = 0;
int xdamage_present = 0; int xdamage_present = 0;
int use_xdamage = 1; /* just use the xdamage rects. for scanline hints */ int use_xdamage = 1; /* just use the xdamage rects. for scanline hints */
#if LIBVNCSERVER_HAVE_LIBXDAMAGE #if LIBVNCSERVER_HAVE_LIBXDAMAGE
#include <X11/extensions/Xdamage.h> #include <X11/extensions/Xdamage.h>
static int xdamage_base_event_type = 0;
Damage xdamage = 0; Damage xdamage = 0;
#endif #endif
static int xdamage_base_event_type = 0;
int xdamage_max_area = 20000; /* pixels */ int xdamage_max_area = 20000; /* pixels */
double xdamage_memory = 1.0; /* in units of NSCAN */ double xdamage_memory = 1.0; /* in units of NSCAN */
int xdamage_tile_count; int xdamage_tile_count;
int hack_val = 0;
/* date +'lastmod: %Y-%m-%d' */ /* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.7.2pre lastmod: 2005-03-29"; char lastmod[] = "0.7.2pre lastmod: 2005-04-03";
int hack_val = 0;
/* X display info */ /* X display info */
@ -461,7 +474,7 @@ unsigned long main_red_mask, main_green_mask, main_blue_mask;
unsigned short main_red_max, main_green_max, main_blue_max; unsigned short main_red_max, main_green_max, main_blue_max;
unsigned short main_red_shift, main_green_shift, main_blue_shift; unsigned short main_red_shift, main_green_shift, main_blue_shift;
/* we now have a struct with client specific data: */ /* struct with client specific data: */
#define RATE_SAMPLES 5 #define RATE_SAMPLES 5
#define CILEN 10 #define CILEN 10
typedef struct _ClientData { typedef struct _ClientData {
@ -559,8 +572,8 @@ int scanlines[NSCAN] = {
19, 3, 27, 11, 29, 13, 5, 21 19, 3, 27, 11, 29, 13, 5, 21
}; };
/* function prototypes (see filename comment above) */
/* function prototypes (see filename comment above) */
int all_clients_initialized(void); int all_clients_initialized(void);
void close_all_clients(void); void close_all_clients(void);
void close_clients(char *); void close_clients(char *);
@ -606,8 +619,8 @@ void initialize_watch_bell(void);
void initialize_xinerama(void); void initialize_xinerama(void);
void initialize_xfixes(void); void initialize_xfixes(void);
void initialize_xdamage(void); void initialize_xdamage(void);
void create_xdamage(void); void create_xdamage_if_needed(void);
void destroy_xdamage(void); void destroy_xdamage_if_needed(void);
void initialize_xrandr(void); void initialize_xrandr(void);
XImage *initialize_xdisplay_fb(void); XImage *initialize_xdisplay_fb(void);
@ -620,6 +633,7 @@ int XTestGrabControl_wr(Display*, Bool);
Bool XTestCompareCurrentCursorWithWindow_wr(Display*, Window); Bool XTestCompareCurrentCursorWithWindow_wr(Display*, Window);
Bool XTestCompareCursorWithWindow_wr(Display*, Window, Cursor); Bool XTestCompareCursorWithWindow_wr(Display*, Window, Cursor);
Bool XTestQueryExtension_wr(Display*, int*, int*, int*, int*); Bool XTestQueryExtension_wr(Display*, int*, int*, int*, int*);
Bool XETrapQueryExtension_wr(Display*, int*, int*, int*);
void XTestDiscard_wr(Display*); void XTestDiscard_wr(Display*);
typedef struct hint { typedef struct hint {
@ -698,6 +712,7 @@ void push_black_screen(int);
void push_sleep(int); void push_sleep(int);
void refresh_screen(void); void refresh_screen(void);
/* -- options.h -- */ /* -- options.h -- */
/* /*
* variables for the command line options * variables for the command line options
@ -753,6 +768,7 @@ char *viewonly_passwd = NULL; /* view only passwd. */
int inetd = 0; /* spawned from inetd(1) */ int inetd = 0; /* spawned from inetd(1) */
int first_conn_timeout = 0; /* -timeout */ int first_conn_timeout = 0; /* -timeout */
int flash_cmap = 0; /* follow installed colormaps */ int flash_cmap = 0; /* follow installed colormaps */
int shift_cmap = 0; /* ncells < 256 and needs shift of pixel values */
int force_indexed_color = 0; /* whether to force indexed color for 8bpp */ int force_indexed_color = 0; /* whether to force indexed color for 8bpp */
int launch_gui = 0; /* -gui */ int launch_gui = 0; /* -gui */
@ -801,7 +817,7 @@ char *remap_file = NULL; /* -remap */
char *pointer_remap = NULL; char *pointer_remap = NULL;
/* use the various ways of updating pointer */ /* use the various ways of updating pointer */
#ifndef POINTER_MODE_DEFAULT #ifndef POINTER_MODE_DEFAULT
#define POINTER_MODE_DEFAULT 3 #define POINTER_MODE_DEFAULT 2
#endif #endif
#define POINTER_MODE_NOFB 2 #define POINTER_MODE_NOFB 2
int pointer_mode = POINTER_MODE_DEFAULT; int pointer_mode = POINTER_MODE_DEFAULT;
@ -851,6 +867,11 @@ int xtest_present = 1;
#else #else
int xtest_present = 0; int xtest_present = 0;
#endif #endif
#if LIBVNCSERVER_HAVE_LIBXTRAP
int xtrap_present = 1;
#else
int xtrap_present = 0;
#endif
#if LIBVNCSERVER_HAVE_XKEYBOARD #if LIBVNCSERVER_HAVE_XKEYBOARD
int xkb_present = 1; int xkb_present = 1;
#else #else
@ -2300,6 +2321,7 @@ void XTestFakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down,
XTestFakeKeyEvent(dpy, key, down, delay); XTestFakeKeyEvent(dpy, key, down, delay);
#endif #endif
} }
/* XTRAP: XESimulateXEventRequest(tc, KeyPress, key, 0, 0, 0); */
void XTestFakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press, void XTestFakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press,
unsigned long delay) { unsigned long delay) {
@ -2310,6 +2332,7 @@ void XTestFakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press,
XTestFakeButtonEvent(dpy, button, is_press, delay); XTestFakeButtonEvent(dpy, button, is_press, delay);
#endif #endif
} }
/* XTRAP: XESimulateXEventRequest(tc, ButtonPress, button, 0, 0, 0); */
void XTestFakeMotionEvent_wr(Display* dpy, int screen, int x, int y, void XTestFakeMotionEvent_wr(Display* dpy, int screen, int x, int y,
unsigned long delay) { unsigned long delay) {
@ -2320,6 +2343,7 @@ void XTestFakeMotionEvent_wr(Display* dpy, int screen, int x, int y,
XTestFakeMotionEvent(dpy, screen, x, y, delay); XTestFakeMotionEvent(dpy, screen, x, y, delay);
#endif #endif
} }
/* XTRAP: XESimulateXEventRequest(tc, MotionNotify, 0, x, y, 0); */
Bool XTestCompareCurrentCursorWithWindow_wr(Display* dpy, Window w) { Bool XTestCompareCurrentCursorWithWindow_wr(Display* dpy, Window w) {
if (! xtest_present) { if (! xtest_present) {
@ -2343,11 +2367,20 @@ Bool XTestCompareCursorWithWindow_wr(Display* dpy, Window w, Cursor cursor) {
#endif #endif
} }
/* how to handle old tree for this w/o OLD_TREE? */
#if 0
#if LIBVNCSERVER_HAVE_XTEST
#ifndef LIBVNCSERVER_HAVE_XTESTGRABCONTROL
#define LIBVNCSERVER_HAVE_XTESTGRABCONTROL 1
#endif
#endif
#endif
int XTestGrabControl_wr(Display* dpy, Bool impervious) { int XTestGrabControl_wr(Display* dpy, Bool impervious) {
if (! xtest_present) { if (! xtest_present) {
return 0; return 0;
} }
#if LIBVNCSERVER_HAVE_XTEST #if LIBVNCSERVER_HAVE_XTEST && LIBVNCSERVER_HAVE_XTESTGRABCONTROL
return XTestGrabControl(dpy, impervious); return XTestGrabControl(dpy, impervious);
#else #else
return 0; return 0;
@ -2372,6 +2405,43 @@ void XTestDiscard_wr(Display *dpy) {
#endif #endif
} }
Bool XETrapQueryExtension_wr(Display *dpy, int *ev, int *er, int *op) {
#if LIBVNCSERVER_HAVE_LIBXTRAP
return XETrapQueryExtension(dpy, (INT32 *)ev, (INT32 *)er,
(INT32 *)op);
#else
return False;
#endif
}
void disable_grabserver(void) {
#if LIBVNCSERVER_HAVE_XTEST && LIBVNCSERVER_HAVE_XTESTGRABCONTROL
if (XTestGrabControl_wr(dpy, True)) {
return;
}
#endif
#if LIBVNCSERVER_HAVE_LIBXTRAP
if (xtrap_present) {
ReqFlags requests;
trap_ctx = XECreateTC(dpy, 0, NULL);
if (! trap_ctx) {
rfbLog("DEC-XTRAP XECreateTC failed. Watch out for"
"XGrabServer from wm's\n");
return;
}
XEStartTrapRequest(trap_ctx);
memset(requests, 0, sizeof(requests));
BitTrue(requests, X_GrabServer);
BitTrue(requests, X_UngrabServer);
XETrapSetRequests(trap_ctx, True, requests);
XETrapSetGrabServer(trap_ctx, True);
return;
}
#endif
rfbLog("No XTEST or DEC-XTRAP protection from XGrabServer.\n");
}
/* -- cleanup.c -- */ /* -- cleanup.c -- */
/* /*
@ -2452,6 +2522,11 @@ void clean_up_exit (int ret) {
if (xdamage) { if (xdamage) {
XDamageDestroy(dpy, xdamage); XDamageDestroy(dpy, xdamage);
} }
#endif
#if LIBVNCSERVER_HAVE_LIBXTRAP
if (trap_ctx) {
XEFreeTC(trap_ctx);
}
#endif #endif
XCloseDisplay(dpy); XCloseDisplay(dpy);
X_UNLOCK; X_UNLOCK;
@ -7049,17 +7124,30 @@ void check_xevents(void) {
} }
} }
if (now > last_call && XCheckTypedEvent(dpy, MappingNotify, &xev)) { if (now > last_call+1) {
/* we only check this once a second or so. */ /* we only check these once a second or so. */
XRefreshKeyboardMapping((XMappingEvent *) &xev); int n = 0;
while (XCheckTypedEvent(dpy, MappingNotify, &xev)) { while (XCheckTypedEvent(dpy, MappingNotify, &xev)) {
XRefreshKeyboardMapping((XMappingEvent *) &xev); XRefreshKeyboardMapping((XMappingEvent *) &xev);
n++;
} }
if (use_modifier_tweak) { if (n && use_modifier_tweak) {
X_UNLOCK; X_UNLOCK;
initialize_modtweak(); initialize_modtweak();
X_LOCK; X_LOCK;
} }
if (xtrap_base_event_type) {
int base = xtrap_base_event_type;
while (XCheckTypedEvent(dpy, base, &xev)) {
;
}
}
if (xtest_base_event_type) {
int base = xtest_base_event_type;
while (XCheckTypedEvent(dpy, base, &xev)) {
;
}
}
} }
if (last_sendevent && (now > last_sendevent+1 || now % 10 == 0)) { if (last_sendevent && (now > last_sendevent+1 || now % 10 == 0)) {
@ -7176,7 +7264,7 @@ void check_xevents(void) {
} }
#ifndef DEBUG_XEVENTS #ifndef DEBUG_XEVENTS
#define DEBUG_XEVENTS 0 #define DEBUG_XEVENTS 1
#endif #endif
#if DEBUG_XEVENTS #if DEBUG_XEVENTS
if (hack_val) { if (hack_val) {
@ -7210,7 +7298,7 @@ void check_xevents(void) {
} }
#endif #endif
if (now > last_sync + 3600) { if (now > last_sync + 1200) {
/* kludge for any remaining event leaks */ /* kludge for any remaining event leaks */
int bugout = use_xdamage ? 500 : 50; int bugout = use_xdamage ? 500 : 50;
if (last_sync != 0) { if (last_sync != 0) {
@ -7547,7 +7635,8 @@ int check_httpdir(void) {
if (stat(httpdir, &sbuf) == 0) { if (stat(httpdir, &sbuf) == 0) {
/* good enough for me */ /* good enough for me */
rfbLog("check_httpdir: guessed: %s\n", httpdir); rfbLog("check_httpdir: guessed directory:\n");
rfbLog(" %s\n", httpdir);
http_dir = httpdir; http_dir = httpdir;
return 1; return 1;
} else { } else {
@ -7562,7 +7651,8 @@ int check_httpdir(void) {
http_dir = strdup("/usr/share/x11vnc/classes"); http_dir = strdup("/usr/share/x11vnc/classes");
return 1; return 1;
} }
rfbLog("check_httpdir: bad guess: %s\n", httpdir); rfbLog("check_httpdir: bad guess:\n");
rfbLog(" %s\n", httpdir);
return 0; return 0;
} }
} }
@ -7941,6 +8031,17 @@ char *process_remote_cmd(char *cmd, int stringonly) {
rfbLog("process_remote_cmd: turning off flashcmap mode.\n"); rfbLog("process_remote_cmd: turning off flashcmap mode.\n");
flash_cmap = 0; flash_cmap = 0;
} else if (strstr(p, "shiftcmap") == p) {
COLON_CHECK("shiftcmap:")
if (query) {
snprintf(buf, bufn, "ans=%s%s%d", p, co, shift_cmap);
goto qry;
}
p += strlen("shiftcmap:");
shift_cmap = atoi(p);
rfbLog("process_remote_cmd: set -shiftcmap %d\n", shift_cmap);
do_new_fb(1);
} else if (!strcmp(p, "truecolor")) { } else if (!strcmp(p, "truecolor")) {
int orig = force_indexed_color; int orig = force_indexed_color;
if (query) { if (query) {
@ -9190,7 +9291,7 @@ char *process_remote_cmd(char *cmd, int stringonly) {
use_xdamage = 1; use_xdamage = 1;
if (use_xdamage != orig) { if (use_xdamage != orig) {
initialize_xdamage(); initialize_xdamage();
create_xdamage(); create_xdamage_if_needed();
} }
} else if (!strcmp(p, "noxdamage")) { } else if (!strcmp(p, "noxdamage")) {
int orig = use_xdamage; int orig = use_xdamage;
@ -9207,7 +9308,7 @@ char *process_remote_cmd(char *cmd, int stringonly) {
use_xdamage = 0; use_xdamage = 0;
if (use_xdamage != orig) { if (use_xdamage != orig) {
initialize_xdamage(); initialize_xdamage();
destroy_xdamage(); destroy_xdamage_if_needed();
} }
} else if (strstr(p, "xd_area") == p) { } else if (strstr(p, "xd_area") == p) {
@ -9948,6 +10049,8 @@ char *process_remote_cmd(char *cmd, int stringonly) {
snprintf(buf, bufn, "aro=%s:%d", p, (int) getpid()); snprintf(buf, bufn, "aro=%s:%d", p, (int) getpid());
} else if (!strcmp(p, "ext_xtest")) { } else if (!strcmp(p, "ext_xtest")) {
snprintf(buf, bufn, "aro=%s:%d", p, xtest_present); snprintf(buf, bufn, "aro=%s:%d", p, xtest_present);
} else if (!strcmp(p, "ext_xtrap")) {
snprintf(buf, bufn, "aro=%s:%d", p, xtrap_present);
} else if (!strcmp(p, "ext_xkb")) { } else if (!strcmp(p, "ext_xkb")) {
snprintf(buf, bufn, "aro=%s:%d", p, xkb_present); snprintf(buf, bufn, "aro=%s:%d", p, xkb_present);
} else if (!strcmp(p, "ext_xshm")) { } else if (!strcmp(p, "ext_xshm")) {
@ -10318,7 +10421,7 @@ void initialize_xdamage(void) {
} }
} }
void create_xdamage(void) { void create_xdamage_if_needed(void) {
#if LIBVNCSERVER_HAVE_LIBXDAMAGE #if LIBVNCSERVER_HAVE_LIBXDAMAGE
if (! xdamage) { if (! xdamage) {
X_LOCK; X_LOCK;
@ -10330,7 +10433,7 @@ void create_xdamage(void) {
#endif #endif
} }
void destroy_xdamage(void) { void destroy_xdamage_if_needed(void) {
#if LIBVNCSERVER_HAVE_LIBXDAMAGE #if LIBVNCSERVER_HAVE_LIBXDAMAGE
if (xdamage) { if (xdamage) {
XEvent ev; XEvent ev;
@ -10351,7 +10454,7 @@ void destroy_xdamage(void) {
} }
void check_xdamage_state(void) { void check_xdamage_state(void) {
if (! use_xdamage || ! xdamage_present) { if (! xdamage_present) {
return; return;
} }
/* /*
@ -10359,9 +10462,9 @@ void check_xdamage_state(void) {
* one if no clients are connected. * one if no clients are connected.
*/ */
if (client_count) { if (client_count) {
create_xdamage(); create_xdamage_if_needed();
} else { } else {
destroy_xdamage(); destroy_xdamage_if_needed();
} }
} }
@ -11723,19 +11826,30 @@ int get_which_cursor(void) {
} }
if (which == which0) { if (which == which0) {
/* the string "term" mean I-beam. */ /* the string "term" mean I-beam. */
char *name, *class;
lowercase(winfo.res_name); lowercase(winfo.res_name);
lowercase(winfo.res_class); lowercase(winfo.res_class);
if (strstr(winfo.res_name, "term")) { name = winfo.res_name;
class = winfo.res_class;
if (strstr(name, "term")) {
which = CURS_TERM;
} else if (strstr(class, "term")) {
which = CURS_TERM;
} else if (strstr(name, "text")) {
which = CURS_TERM;
} else if (strstr(class, "text")) {
which = CURS_TERM;
} else if (strstr(name, "onsole")) {
which = CURS_TERM; which = CURS_TERM;
} else if (strstr(winfo.res_class, "term")) { } else if (strstr(class, "onsole")) {
which = CURS_TERM; which = CURS_TERM;
} else if (strstr(winfo.res_name, "text")) { } else if (strstr(name, "cmdtool")) {
which = CURS_TERM; which = CURS_TERM;
} else if (strstr(winfo.res_class, "text")) { } else if (strstr(class, "cmdtool")) {
which = CURS_TERM; which = CURS_TERM;
} else if (strstr(winfo.res_name, "onsole")) { } else if (strstr(name, "shelltool")) {
which = CURS_TERM; which = CURS_TERM;
} else if (strstr(winfo.res_class, "onsole")) { } else if (strstr(class, "shelltool")) {
which = CURS_TERM; which = CURS_TERM;
} }
} }
@ -12184,12 +12298,14 @@ void set_colormap(int reset) {
} }
} }
if (first && ncells != NCOLOR) { if (ncells != NCOLOR) {
if (! quiet) { if (first && ! quiet) {
fprintf(stderr, "set_colormap: number of cells is %d " rfbLog("set_colormap: number of cells is %d "
"instead of %d.\n", ncells, NCOLOR); "instead of %d.\n", ncells, NCOLOR);
} }
screen->colourMap.count = ncells; if (! shift_cmap) {
screen->colourMap.count = ncells;
}
} }
if (flash_cmap && ! first) { if (flash_cmap && ! first) {
@ -12215,7 +12331,7 @@ void set_colormap(int reset) {
} }
} }
if (ncells > NCOLOR && ! quiet) { if (ncells > NCOLOR && ! quiet) {
fprintf(stderr, "set_colormap: big problem: ncells=%d > %d\n", rfbLog("set_colormap: big problem: ncells=%d > %d\n",
ncells, NCOLOR); ncells, NCOLOR);
} }
@ -12225,7 +12341,7 @@ void set_colormap(int reset) {
* the StaticColor map. The ncells = 8 is "8 per subfield" * the StaticColor map. The ncells = 8 is "8 per subfield"
* mentioned in xdpyinfo. Looks OK... perhaps fortuitously. * mentioned in xdpyinfo. Looks OK... perhaps fortuitously.
*/ */
if (ncells == 8) { if (ncells == 8 && ! shift_cmap) {
ncells = NCOLOR; ncells = NCOLOR;
} }
} }
@ -12239,7 +12355,9 @@ void set_colormap(int reset) {
X_UNLOCK; X_UNLOCK;
for(i=0; i < ncells; i++) { for(i = ncells - 1; i >= 0; i--) {
int k = i + shift_cmap;
screen->colourMap.data.shorts[i*3+0] = color[i].red; screen->colourMap.data.shorts[i*3+0] = color[i].red;
screen->colourMap.data.shorts[i*3+1] = color[i].green; screen->colourMap.data.shorts[i*3+1] = color[i].green;
screen->colourMap.data.shorts[i*3+2] = color[i].blue; screen->colourMap.data.shorts[i*3+2] = color[i].blue;
@ -12249,6 +12367,13 @@ void set_colormap(int reset) {
prev[i].blue != color[i].blue ) { prev[i].blue != color[i].blue ) {
diffs++; diffs++;
} }
if (shift_cmap && k >= 0 && k < NCOLOR) {
/* kludge to copy the colors to higher pixel values */
screen->colourMap.data.shorts[k*3+0] = color[i].red;
screen->colourMap.data.shorts[k*3+1] = color[i].green;
screen->colourMap.data.shorts[k*3+2] = color[i].blue;
}
} }
if (diffs && ! first) { if (diffs && ! first) {
@ -12256,12 +12381,57 @@ void set_colormap(int reset) {
rfbLog("set_colormap: warning: sending cmap " rfbLog("set_colormap: warning: sending cmap "
"with uninitialized clients.\n"); "with uninitialized clients.\n");
} }
rfbSetClientColourMaps(screen, 0, ncells); if (shift_cmap) {
rfbSetClientColourMaps(screen, 0, NCOLOR);
} else {
rfbSetClientColourMaps(screen, 0, ncells);
}
} }
first = 0; first = 0;
} }
void debug_colormap(XImage *fb) {
static int debug_cmap = -1;
int i, k, histo[NCOLOR];
if (debug_cmap < 0) {
if (getenv("DEBUG_CMAP") != NULL) {
debug_cmap = 1;
} else {
debug_cmap = 0;
}
}
if (! debug_cmap) {
return;
}
if (! fb) {
return;
}
if (fb->bits_per_pixel != 8) {
return;
}
for (i=0; i < NCOLOR; i++) {
histo[i] = 0;
}
for (k = 0; k < fb->width * fb->height; k++) {
unsigned char n;
char c = *(fb->data + k);
n = (unsigned char) c;
histo[n]++;
}
fprintf(stderr, "\nColormap histogram for current screen contents:\n");
for (i=0; i < NCOLOR; i++) {
fprintf(stderr, " %03d: %7d", i, histo[i]);
if ((i+1) % 4 == 0) {
fprintf(stderr, "\n");
}
}
fprintf(stderr, "\n");
}
/* /*
* Experimental mode to force the visual of the window instead of querying * Experimental mode to force the visual of the window instead of querying
* it. Used for testing, overriding some rare cases (win2vnc), and for * it. Used for testing, overriding some rare cases (win2vnc), and for
@ -13088,6 +13258,7 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
screen->serverFormat.trueColour = FALSE; screen->serverFormat.trueColour = FALSE;
indexed_color = 1; indexed_color = 1;
set_colormap(1); set_colormap(1);
debug_colormap(fb);
} else { } else {
/* /*
* general case, we call it truecolor, but could be direct * general case, we call it truecolor, but could be direct
@ -18095,6 +18266,7 @@ static void watch_loop(void) {
check_xevents(); check_xevents();
check_connect_inputs(); check_connect_inputs();
check_padded_fb(); check_padded_fb();
check_xdamage_state();
if (started_as_root) { if (started_as_root) {
check_switched_user(); check_switched_user();
} }
@ -18129,10 +18301,6 @@ static void watch_loop(void) {
continue; continue;
} }
if (use_xdamage) {
check_xdamage_state();
}
if (button_mask && (!show_dragging || pointer_mode == 0)) { if (button_mask && (!show_dragging || pointer_mode == 0)) {
/* /*
* if any button is pressed do not update rfb * if any button is pressed do not update rfb
@ -18247,6 +18415,13 @@ static void print_help(int mode) {
"\n" "\n"
"-flashcmap In 8bpp indexed color, let the installed colormap flash\n" "-flashcmap In 8bpp indexed color, let the installed colormap flash\n"
" as the pointer moves from window to window (slow).\n" " as the pointer moves from window to window (slow).\n"
"-shiftcmap n Rare problem, but some 8bpp displays use less than 256\n"
" colorcells (e.g. 16-color grayscale, perhaps the other\n"
" bits are used for double buffering) *and* also need to\n"
" shift the pixels values away from 0, .., ncells. \"n\"\n"
" indicates the shift to be applied to the pixel values.\n"
" To see the pixel values set DEBUG_CMAP=1 to print out\n"
" a colormap histogram. Example: -shiftcmap 240\n"
"-notruecolor For 8bpp displays, force indexed color (i.e. a colormap)\n" "-notruecolor For 8bpp displays, force indexed color (i.e. a colormap)\n"
" even if it looks like 8bpp TrueColor (rare problem).\n" " even if it looks like 8bpp TrueColor (rare problem).\n"
"-visual n Experimental option: probably does not do what you\n" "-visual n Experimental option: probably does not do what you\n"
@ -18330,6 +18505,11 @@ static void print_help(int mode) {
" Note: if you are not redirecting stderr to a log file\n" " Note: if you are not redirecting stderr to a log file\n"
" (via shell 2> or -o option) you must also specify the\n" " (via shell 2> or -o option) you must also specify the\n"
" -q option, otherwise the stderr goes to the viewer.\n" " -q option, otherwise the stderr goes to the viewer.\n"
"-http Instead of using -httpdir (see below) to specify\n"
" where the Java vncviewer applet is, have x11vnc try\n"
" to *guess* where the directory is by looking relative\n"
" to the program location and in standard locations\n"
" (/usr/local/share/x11vnc/classes, etc).\n"
"-connect string For use with \"vncviewer -listen\" reverse connections.\n" "-connect string For use with \"vncviewer -listen\" reverse connections.\n"
" If \"string\" has the form \"host\" or \"host:port\"\n" " If \"string\" has the form \"host\" or \"host:port\"\n"
" the connection is made once at startup. Use commas\n" " the connection is made once at startup. Use commas\n"
@ -18880,7 +19060,7 @@ static void print_help(int mode) {
"\n" "\n"
" n=3 is basically the same as n=2 except with slightly\n" " n=3 is basically the same as n=2 except with slightly\n"
" tweaked parameters. We made this a new one so one\n" " tweaked parameters. We made this a new one so one\n"
" could use -pm 2 for the old behavior.\n" " could use -pm 2 for the old behavior. NOT FINISHED.\n"
"\n" "\n"
" n=4 is basically a dynamic -nodragging mode: it detects\n" " n=4 is basically a dynamic -nodragging mode: it detects\n"
" when the mouse motion has paused and then refreshes\n" " when the mouse motion has paused and then refreshes\n"
@ -18911,7 +19091,7 @@ static void print_help(int mode) {
"\n" "\n"
"-speeds rd,bw,lat x11vnc tries to estimate some speed parameters that\n" "-speeds rd,bw,lat x11vnc tries to estimate some speed parameters that\n"
" are used to optimize scheduling (e.g. -pointer_mode\n" " are used to optimize scheduling (e.g. -pointer_mode\n"
" 4) and other things. Use the -speeds option to set\n" " 5) and other things. Use the -speeds option to set\n"
" these manually. The triple \"rd,bw,lat\" corresponds\n" " these manually. The triple \"rd,bw,lat\" corresponds\n"
" to video h/w read rate in MB/sec, network bandwidth to\n" " to video h/w read rate in MB/sec, network bandwidth to\n"
" clients in KB/sec, and network latency to clients in\n" " clients in KB/sec, and network latency to clients in\n"
@ -19110,6 +19290,7 @@ static void print_help(int mode) {
" clip:WxH+X+Y set -clip mode to \"WxH+X+Y\"\n" " clip:WxH+X+Y set -clip mode to \"WxH+X+Y\"\n"
" flashcmap enable -flashcmap mode.\n" " flashcmap enable -flashcmap mode.\n"
" noflashcmap disable -flashcmap mode.\n" " noflashcmap disable -flashcmap mode.\n"
" shiftcmap:n set -shiftcmap to n.\n"
" notruecolor enable -notruecolor mode.\n" " notruecolor enable -notruecolor mode.\n"
" truecolor disable -notruecolor mode.\n" " truecolor disable -notruecolor mode.\n"
" overlay enable -overlay mode (if applicable).\n" " overlay enable -overlay mode (if applicable).\n"
@ -19130,6 +19311,9 @@ static void print_help(int mode) {
" timeout:n reset -timeout to n, if there are\n" " timeout:n reset -timeout to n, if there are\n"
" currently no clients, exit unless one\n" " currently no clients, exit unless one\n"
" connects in the next n secs.\n" " connects in the next n secs.\n"
/* access */
" http enable http client connections.\n"
" nohttp disable http client connections.\n"
" deny deny any new connections, same as \"lock\"\n" " deny deny any new connections, same as \"lock\"\n"
" nodeny allow new connections, same as \"unlock\"\n" " nodeny allow new connections, same as \"unlock\"\n"
/* access, filename */ /* access, filename */
@ -19269,8 +19453,6 @@ static void print_help(int mode) {
" desktop:str set -desktop name to str for new clients.\n" " desktop:str set -desktop name to str for new clients.\n"
" rfbport:n set -rfbport to n.\n" " rfbport:n set -rfbport to n.\n"
/* access */ /* access */
" http enable http client connections.\n"
" nohttp disable http client connections.\n"
" httpport:n set -httpport to n.\n" " httpport:n set -httpport to n.\n"
" httpdir:dir set -httpdir to dir (and enable http).\n" " httpdir:dir set -httpdir to dir (and enable http).\n"
" enablehttpproxy enable -enablehttpproxy mode.\n" " enablehttpproxy enable -enablehttpproxy mode.\n"
@ -19323,27 +19505,28 @@ static void print_help(int mode) {
" the returned value corresponds to (hint: the ext_*\n" " the returned value corresponds to (hint: the ext_*\n"
" variables correspond to the presence of X extensions):\n" " variables correspond to the presence of X extensions):\n"
"\n" "\n"
" ans= stop quit exit shutdown ping blacken zero refresh\n" " ans= stop quit exit shutdown ping blacken zero\n"
" reset close disconnect id sid waitmapped nowaitmapped\n" " refresh reset close disconnect id sid waitmapped\n"
" clip flashcmap noflashcmap truecolor notruecolor\n" " nowaitmapped clip flashcmap noflashcmap shiftcmap\n"
" overlay nooverlay overlay_cursor overlay_yescursor\n" " truecolor notruecolor overlay nooverlay overlay_cursor\n"
" nooverlay_nocursor nooverlay_cursor nooverlay_yescursor\n" " overlay_yescursor nooverlay_nocursor nooverlay_cursor\n"
" overlay_nocursor visual scale scale_cursor viewonly\n" " nooverlay_yescursor overlay_nocursor visual scale\n"
" noviewonly shared noshared forever noforever once\n" " scale_cursor viewonly noviewonly shared noshared\n"
" timeout deny lock nodeny unlock connect allowonce allow\n" " forever noforever once timeout deny lock nodeny unlock\n"
" localhost nolocalhost listen lookup nolookup accept\n" " connect allowonce allow localhost nolocalhost listen\n"
" gone shm noshm flipbyteorder noflipbyteorder onetile\n" " lookup nolookup accept gone shm noshm flipbyteorder\n"
" noonetile solid_color solid nosolid blackout xinerama\n" " noflipbyteorder onetile noonetile solid_color solid\n"
" noxinerama xrandr noxrandr xrandr_mode padgeom quiet\n" " nosolid blackout xinerama noxinerama xrandr noxrandr\n"
" q noquiet modtweak nomodtweak xkb noxkb skip_keycodes\n" " xrandr_mode padgeom quiet q noquiet modtweak nomodtweak\n"
" add_keysyms noadd_keysyms clear_mods noclear_mods\n" " xkb noxkb skip_keycodes add_keysyms noadd_keysyms\n"
" clear_keys noclear_keys remap repeat norepeat fb nofb\n" " clear_mods noclear_mods clear_keys noclear_keys\n"
" bell nobell sel nosel primary noprimary cursorshape\n" " remap repeat norepeat fb nofb bell nobell sel nosel\n"
" nocursorshape cursorpos nocursorpos cursor show_cursor\n" " primary noprimary cursorshape nocursorshape cursorpos\n"
" noshow_cursor nocursor arrow xfixes noxfixes xdamage\n" " nocursorpos cursor show_cursor noshow_cursor nocursor\n"
" noxdamage xd_area xd_mem alphacut alphafrac alpharemove\n" " arrow xfixes noxfixes xdamage noxdamage xd_area\n"
" noalpharemove alphablend noalphablend xwarp xwarppointer\n" " xd_mem alphacut alphafrac alpharemove noalpharemove\n"
" noxwarp noxwarppointer buttonmap dragging nodragging\n" " alphablend noalphablend xwarp xwarppointer noxwarp\n"
" noxwarppointer buttonmap dragging nodragging\n"
" pointer_mode pm input_skip input client_input speeds\n" " pointer_mode pm input_skip input client_input speeds\n"
" debug_pointer dp nodebug_pointer nodp debug_keyboard dk\n" " debug_pointer dp nodebug_pointer nodp debug_keyboard dk\n"
" nodebug_keyboard nodk deferupdate defer wait rfbwait\n" " nodebug_keyboard nodk deferupdate defer wait rfbwait\n"
@ -19359,11 +19542,12 @@ static void print_help(int mode) {
" scaling_nomult4 scaling_pad scaling_interpolate inetd\n" " scaling_nomult4 scaling_pad scaling_interpolate inetd\n"
" safer unsafe passwdfile using_shm logfile o rc norc\n" " safer unsafe passwdfile using_shm logfile o rc norc\n"
" h help V version lastmod bg sigpipe threads clients\n" " h help V version lastmod bg sigpipe threads clients\n"
" client_count pid ext_xtest ext_xkb ext_xshm ext_xinerama\n" " client_count pid ext_xtest ext_xtrap ext_xkb ext_xshm\n"
" ext_overlay ext_xfixes ext_xdamage ext_xrandr rootwin\n" " ext_xinerama ext_overlay ext_xfixes ext_xdamage\n"
" num_buttons button_mask mouse_x mouse_y bpp depth\n" " ext_xrandr rootwin num_buttons button_mask mouse_x\n"
" indexed_color dpy_x dpy_y wdpy_x wdpy_y off_x off_y\n" " mouse_y bpp depth indexed_color dpy_x dpy_y wdpy_x\n"
" cdpy_x cdpy_y coff_x coff_y rfbauth passwd\n" " wdpy_y off_x off_y cdpy_x cdpy_y coff_x coff_y rfbauth\n"
" passwd\n"
"\n" "\n"
"-sync By default -remote commands are run asynchronously, that\n" "-sync By default -remote commands are run asynchronously, that\n"
" is, the request is posted and the program immediately\n" " is, the request is posted and the program immediately\n"
@ -19832,6 +20016,7 @@ int main(int argc, char* argv[]) {
int vpw_loc = -1; int vpw_loc = -1;
int dt = 0, bg = 0; int dt = 0, bg = 0;
int got_rfbwait = 0, got_deferupdate = 0, got_defer = 0; int got_rfbwait = 0, got_deferupdate = 0, got_defer = 0;
int got_httpdir = 0, try_http = 0;
/* used to pass args we do not know about to rfbGetScreen(): */ /* used to pass args we do not know about to rfbGetScreen(): */
int argc_vnc = 1; char *argv_vnc[128]; int argc_vnc = 1; char *argv_vnc[128];
@ -19922,6 +20107,9 @@ int main(int argc, char* argv[]) {
clip_str = strdup(argv[++i]); clip_str = strdup(argv[++i]);
} else if (!strcmp(arg, "-flashcmap")) { } else if (!strcmp(arg, "-flashcmap")) {
flash_cmap = 1; flash_cmap = 1;
} else if (!strcmp(arg, "-shiftcmap")) {
CHECK_ARGC
shift_cmap = atoi(argv[++i]);
} else if (!strcmp(arg, "-notruecolor")) { } else if (!strcmp(arg, "-notruecolor")) {
force_indexed_color = 1; force_indexed_color = 1;
} else if (!strcmp(arg, "-overlay")) { } else if (!strcmp(arg, "-overlay")) {
@ -19957,6 +20145,8 @@ int main(int argc, char* argv[]) {
users_list = strdup(argv[++i]); users_list = strdup(argv[++i]);
} else if (!strcmp(arg, "-inetd")) { } else if (!strcmp(arg, "-inetd")) {
inetd = 1; inetd = 1;
} else if (!strcmp(arg, "-http")) {
try_http = 1;
} else if (!strcmp(arg, "-connect")) { } else if (!strcmp(arg, "-connect")) {
CHECK_ARGC CHECK_ARGC
if (strchr(argv[++i], '/')) { if (strchr(argv[++i], '/')) {
@ -20281,6 +20471,7 @@ int main(int argc, char* argv[]) {
} else if (!strcmp(arg, "-httpdir")) { } else if (!strcmp(arg, "-httpdir")) {
CHECK_ARGC CHECK_ARGC
http_dir = strdup(argv[++i]); http_dir = strdup(argv[++i]);
got_httpdir = 1;
} else { } else {
if (!strcmp(arg, "-desktop") && i < argc-1) { if (!strcmp(arg, "-desktop") && i < argc-1) {
dt = 1; dt = 1;
@ -20563,6 +20754,7 @@ int main(int argc, char* argv[]) {
fprintf(stderr, " clip: %s\n", clip_str ? clip_str fprintf(stderr, " clip: %s\n", clip_str ? clip_str
: "null"); : "null");
fprintf(stderr, " flashcmap: %d\n", flash_cmap); fprintf(stderr, " flashcmap: %d\n", flash_cmap);
fprintf(stderr, " shiftcmap: %d\n", shift_cmap);
fprintf(stderr, " force_idx: %d\n", force_indexed_color); fprintf(stderr, " force_idx: %d\n", force_indexed_color);
fprintf(stderr, " visual: %s\n", visual_str ? visual_str fprintf(stderr, " visual: %s\n", visual_str ? visual_str
: "null"); : "null");
@ -20908,13 +21100,23 @@ int main(int argc, char* argv[]) {
} }
xtest_present = 0; xtest_present = 0;
use_xwarppointer = 1; use_xwarppointer = 1;
} else {
xtest_base_event_type = ev;
} }
if (! XETrapQueryExtension_wr(dpy, &ev, &er, &maj)) {
xtrap_present = 0;
} else {
xtrap_base_event_type = ev;
}
/* /*
* Window managers will often grab the display during resize, etc. * Window managers will often grab the display during resize,
* To avoid deadlock (our user resize input is not processed) * etc, using XGrabServer(). To avoid deadlock (our user resize
* we tell the server to process our requests during all grabs: * input is not processed) we tell the server to process our
* requests during all grabs:
*/ */
XTestGrabControl_wr(dpy, True); disable_grabserver();
/* set OS struct UT */ /* set OS struct UT */
uname(&UT); uname(&UT);
@ -20996,6 +21198,10 @@ int main(int argc, char* argv[]) {
initialize_screen(&argc_vnc, argv_vnc, fb0); initialize_screen(&argc_vnc, argv_vnc, fb0);
if (try_http && ! got_httpdir && check_httpdir()) {
http_connections(1);
}
initialize_tiles(); initialize_tiles();
/* rectangular blackout regions */ /* rectangular blackout regions */

Loading…
Cancel
Save