update to x11vnc 0.9.12

pull/1/head
runge 14 years ago
parent ad25446978
commit 067a88160c

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
VERSION="0.9.11" VERSION="0.9.13"
cd "$(dirname "$0")" cd "$(dirname "$0")"
@ -33,9 +33,10 @@ echo "" >> Makefile.am
cat Makefile.am.LibVNCServer | \ cat Makefile.am.LibVNCServer | \
sed -e "s/^SUBDIRS.*$/#SUBDIRS=libvncserver libvncclient x11vnc classes/" \ sed -e "s/^SUBDIRS.*$/#SUBDIRS=libvncserver libvncclient x11vnc classes/" \
-e "s/^DIST_SUBDIRS.*$/#DIST_SUBDIRS=libvncserver libvncclient x11vnc classes/" \ -e "s/^DIST_SUBDIRS.*$/#DIST_SUBDIRS=libvncserver libvncclient x11vnc classes/" \
-e "/all: make_config_executable/,\$d" \
-e "/^.*bin_SCRIPTS.*$/d" \ -e "/^.*bin_SCRIPTS.*$/d" \
-e "s/include_/noinst_/" \ -e "s/^include_HEADERS/if HAVE_SYSTEM_LIBVNCSERVER^else^include_HEADERS/" \
-e "s/rfbclient\.h/rfbclient.h^endif/" \
| tr '^' '\n' \
>> Makefile.am >> Makefile.am
mv README README.LibVNCServer mv README README.LibVNCServer

@ -412,7 +412,7 @@ if (db24 > 2) fprintf(stderr, " check_for_multivis: %.4f\n", now - last_call);
/* /*
* every 10 seconds we try to clean out and also refresh the window * every 10 seconds we try to clean out and also refresh the window
* info in the the 8bpp window table: * info in the 8bpp window table:
*/ */
if (now > last_clear + 10) { if (now > last_clear + 10) {
last_clear = now; last_clear = now;

@ -1,3 +1,20 @@
2010-09-10 Karl Runge <runge@karlrunge.com>
* x11vnc: update classes/ssl jars, patches, and script.
update prepare_x11vnc_dist.sh to 0.9.13. Makefile.am no top_srcdir
Allow user to set avahi name and port via env. vars. Add
avahi_timeout() sigalarm. Rename pointer() to pointer_event()
because Xdefs.h is included for some unknown reason. Add
-always_inject option. Add vnc_reflect_cursor_pos() for -reflect
mode. Attempt at libvncclient VeNCrypt (disabled.) Fix bug
with --with-system-libvncserver missing FinishedFrameBufferUpdate.
More info in VncViewer.class http warning. Look for gdm* in
find display heuristics (e.g. gdm3). More heuristics with
XAUTHLOCALHOSTNAME attempts. X11VNC_CREATE_MAX_DISPLAYS: let user
specify max number of -create displays. FD_USERPREFS modes for
-unixpw (user conf file.) Document all exiting behavior. Let
user set X11VNC_NO_LIMIT_SHM to avoid autoreduction. Look for
kdm when avoiding being killed by dm, change timings too.
2010-05-08 Karl Runge <runge@karlrunge.com> 2010-05-08 Karl Runge <runge@karlrunge.com>
* x11vnc: set cd->unixname in apply_opts. Print message in * x11vnc: set cd->unixname in apply_opts. Print message in
vnc_reflect_resize. Some tweaks to prepare_x11vnc_dist.sh vnc_reflect_resize. Some tweaks to prepare_x11vnc_dist.sh

@ -30,7 +30,6 @@ INCLUDES_LIBVNCSERVER = @SYSTEM_LIBVNCSERVER_CFLAGS@
else else
INCLUDES_LIBVNCSERVER = INCLUDES_LIBVNCSERVER =
endif endif
INCLUDES = -I$(top_srcdir) INCLUDES = $(INCLUDES_LIBVNCSERVER) @X_CFLAGS@ @AVAHI_CFLAGS@
INCLUDES += $(INCLUDES_LIBVNCSERVER) @X_CFLAGS@ @AVAHI_CFLAGS@
x11vnc_LDADD=$(LDADD) @SSL_LIBS@ @CRYPT_LIBS@ @X_LIBS@ @AVAHI_LIBS@ $(LD_CYGIPC) x11vnc_LDADD=$(LDADD) @SSL_LIBS@ @CRYPT_LIBS@ @X_LIBS@ @AVAHI_LIBS@ $(LD_CYGIPC)

@ -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 May 8 19:32:50 EDT 2010 x11vnc README file Date: Fri Sep 10 12:29:36 EDT 2010
The following information is taken from these URLs: The following information is taken from these URLs:
@ -586,12 +586,12 @@ vncviewer -via $host localhost:0 # must be TightVNC vncviewer.
SourceForge.net. I use libvncserver for all of the VNC aspects; I SourceForge.net. I use libvncserver for all of the VNC aspects; I
couldn't have done without it. The full source code may be found and couldn't have done without it. The full source code may be found and
downloaded (either file-release tarball or GIT tree) from the above downloaded (either file-release tarball or GIT tree) from the above
link. As of May 2010, the x11vnc-0.9.10.tar.gz source package is link. As of Sep 2010, the x11vnc-0.9.12.tar.gz source package is
released (recommended download). The x11vnc 0.9.10 release notes. released (recommended download). The x11vnc 0.9.12 release notes.
The x11vnc package is the subset of the libvncserver package needed to The x11vnc package is the subset of the libvncserver package needed to
build the x11vnc program. Also, you can get a copy of my latest, build the x11vnc program. Also, you can get a copy of my latest,
bleeding edge x11vnc-0.9.11-dev.tar.gz tarball to build the most up to bleeding edge x11vnc-0.9.13-dev.tar.gz tarball to build the most up to
date one. date one.
Precompiled Binaries/Packages: See the FAQ below for information Precompiled Binaries/Packages: See the FAQ below for information
@ -629,13 +629,13 @@ vncviewer -via $host localhost:0 # must be TightVNC vncviewer.
default.) See this build FAQ for more details. default.) See this build FAQ for more details.
If your OS has libjpeg.so and libz.so in standard locations you can If your OS has libjpeg.so and libz.so in standard locations you can
build as follows (example given for the 0.9.10 release of x11vnc: build as follows (example given for the 0.9.12 release of x11vnc:
replace with the version you downloaded): replace with the version you downloaded):
(un-tar the x11vnc+libvncserver tarball) (un-tar the x11vnc+libvncserver tarball)
# gzip -dc x11vnc-0.9.10.tar.gz | tar -xvf - # gzip -dc x11vnc-0.9.12.tar.gz | tar -xvf -
(cd to the source directory) (cd to the source directory)
# cd x11vnc-0.9.10 # cd x11vnc-0.9.12
(run configure and then run make) (run configure and then run make)
# ./configure # ./configure
@ -885,13 +885,13 @@ make
I'd appreciate any additional testing very much. I'd appreciate any additional testing very much.
Thanks to those who suggested features and helped beta test x11vnc Thanks to those who suggested features and helped beta test x11vnc
0.9.10 released in May 2010! 0.9.12 released in Sep 2010!
Please help test and debug the 0.9.11 version for release sometime in Please help test and debug the 0.9.13 version for release sometime in
Summer 2010. Winter 2010.
The version 0.9.11 beta tarball is kept here: The version 0.9.13 beta tarball is kept here:
x11vnc-0.9.11-dev.tar.gz x11vnc-0.9.13-dev.tar.gz
There are also some Linux, Solaris, Mac OS X, and other OS test There are also some Linux, Solaris, Mac OS X, and other OS test
binaries here. Please kick the tires and report bugs, performance binaries here. Please kick the tires and report bugs, performance
@ -908,11 +908,40 @@ make
settings panel.) settings panel.)
Here are some features that will appear in the 0.9.11 release: Here are some features that will appear in the 0.9.13 release:
* Coming Soon. * Coming Soon!
Here are some features that appeared in the 0.9.10 release: Here are some features that appeared in the 0.9.12 release:
* One can now specify the maximum number of displays that can be
created in -create mode via the env. var.
X11VNC_CREATE_MAX_DISPLAYS
* The X11VNC_NO_LIMIT_SHM env. var. is added to skip any automatic
shared memory reduction.
* The kdm display manager is now detected when trying not to get
killed by the display manager.
* A compile time bug is fixed so that configuring using
--with-system-libvncserver pointing to LibVNCServer 0.9.7 works
again. A bug from forced used of Xdefs.h is worked around.
Here are some features that appeared in the 0.9.11 release (Aug/2010):
* The source tree is synchronized with the most recent libvncclient
(this only affects -reflect mode.) Build is fixed for
incompatibilities when using an external LibVNCServer (e.g.
./configure --with-system-libvncserver...) Please help test these
build and runtime aspects and report back what you find, thanks.
* The SSL enabled Java VNC Viewer Makefile has been modified so that
the jar files that are built are compatible back to Java 1.4.
* In -create/-unixpw mode, the env. var. FD_USERPREFS may be set to
a filename in the user's home directory that includes default
username:options values (so the options do not need to be typed
every time at the login prompt.)
* In -reflect mode cursor position updates are now handled
correctly.
Here are some features that appeared in the 0.9.10 release (May/2010):
* The included SSL enabled Java applet viewer now supports Chained * The included SSL enabled Java applet viewer now supports Chained
SSL Certificates. The debugCerts=yes applet parameter aids SSL Certificates. The debugCerts=yes applet parameter aids
troubleshooting certificate validation. The x11vnc -ssl mode has troubleshooting certificate validation. The x11vnc -ssl mode has
@ -1982,7 +2011,7 @@ http://www.karlrunge.com/x11vnc/faq.html:
Q-109: Help! x11vnc and my KDE screensaver keep switching each other Q-109: Help! x11vnc and my KDE screensaver keep switching each other
on and off every few seconds. on and off every few seconds.
Q-110: I am running the beryl 3D window manager (or compiz, MythTv, Q-110: I am running the compiz 3D window manager (or beryl, MythTv,
Google Earth, or some other OpenGL app) and I do not get screen Google Earth, or some other OpenGL app) and I do not get screen
updates in x11vnc. updates in x11vnc.
@ -5702,12 +5731,12 @@ ied)
* On Firefox/Mozilla (and anything else) turn off "Smooth Scroll" * On Firefox/Mozilla (and anything else) turn off "Smooth Scroll"
animations. In Firefox put in the URL "about:config" and set animations. In Firefox put in the URL "about:config" and set
general.smoothScroll to false. general.smoothScroll to false.
* On XFree86 turn on the Shadow Framebuffer to speed up reading. * On Xorg/XFree86 turn on the Shadow Framebuffer to speed up
(Option "ShadowFB" "true" in the Device section of reading. (Option "ShadowFB" "true" in the Device section of
/etc/X11/XF86Config) This disables 2D acceleration on the physical /etc/X11/XF86Config) This disables 2D acceleration on the physical
display and so may not be worth it, but could be of use in some display and so may not be worth it (if you play games, etc), but
situations. If the link is very slow, this speedup may not be could be of use in some situations. Note: If the network link is
noticed. very slow, this speedup may not be noticed.
VNC viewer parameters: VNC viewer parameters:
* Use a TightVNC enabled viewer! (Actually, RealVNC 4.x viewer with * Use a TightVNC enabled viewer! (Actually, RealVNC 4.x viewer with
@ -5726,7 +5755,7 @@ ied)
* Try other VNC encodings via -encodings (tight may be the fastest, * Try other VNC encodings via -encodings (tight may be the fastest,
but you should compare it to zrle and maybe some of the others) but you should compare it to zrle and maybe some of the others)
* On the machine where vncviewer is run, make sure Backing Store is * On the machine where vncviewer is run, make sure Backing Store is
enabled (XFree86/Xorg disables it by default causing re-exposures enabled (Xorg/XFree86 disables it by default causing re-exposures
of vncviewer to be very slow) Option "backingstore" in config of vncviewer to be very slow) Option "backingstore" in config
file. file.
@ -6192,8 +6221,9 @@ EndSection
shared) client-side caching is that one needs to extend the VNC shared) client-side caching is that one needs to extend the VNC
protocol, modify a viewer and then also convince users to adopt your protocol, modify a viewer and then also convince users to adopt your
modified VNC Viewer (or get the new features to be folded into the modified VNC Viewer (or get the new features to be folded into the
main VNC viewers, patches accepted, etc... likely takes years before main VNC viewers, patches accepted, etc... likely takes many years
they might be deployed in the field) before they might be deployed in the field.) So it is convenient that
the "-ncache n" works with any unaltered VNC viewer.
A drawback of the "-ncache n" method is that in the VNC Viewer you can A drawback of the "-ncache n" method is that in the VNC Viewer you can
scroll down and actually see the cached pixel data. So it looks like scroll down and actually see the cached pixel data. So it looks like
@ -6292,13 +6322,14 @@ Section "Device"
EndSection EndSection
No problems like this have been observed with Windows VNC Viewers: No problems like this have been observed with Windows VNC Viewers:
they all seem to keep their entire framebuffer in local memory. Gotcha they all seem to keep their entire framebuffer in local memory.
for KDE krdc VNC Viewer: One user found that KDE's krdc viewer has
some sort of hardwired limit on the maximum size of the framebuffer Gotcha for KDE krdc VNC Viewer: One user found that KDE's krdc viewer
(64MB?). It fails quickly saying "The connection to the host has been has some sort of hardwired limit on the maximum size of the
interrupted." The workaround for his 1280x1024 x11vnc-side display was framebuffer (64MB?). It fails quickly saying "The connection to the
to run with "-ncache 10", i.e. a smaller value to be under the krdc host has been interrupted." The workaround for his 1280x1024
threshold. x11vnc-side display was to run with "-ncache 10", i.e. a smaller value
to be under the krdc threshold.
Although this scheme is not as quick (nor as compressed) as Although this scheme is not as quick (nor as compressed) as
nx/nomachine, say, it does provide a good step in the direction of nx/nomachine, say, it does provide a good step in the direction of
@ -7337,18 +7368,18 @@ EndSection
the screensaver.) Feel free to file a bug against kdesktop_lock with the screensaver.) Feel free to file a bug against kdesktop_lock with
KDE. KDE.
Q-110: I am running the beryl 3D window manager (or compiz, MythTv, Q-110: I am running the compiz 3D window manager (or beryl, MythTv,
Google Earth, or some other OpenGL app) and I do not get screen Google Earth, or some other OpenGL app) and I do not get screen
updates in x11vnc. updates in x11vnc.
This appears to be because the 3D OpenGL/GLX hardware screen updates This appears to be because the 3D OpenGL/GLX hardware screen updates
do not get reported via the XDAMAGE mechanism. So this is a bug in do not get reported via the XDAMAGE mechanism. So this is a bug in
beryl/compiz or XDAMAGE/Xorg or the (possibly 3rd party) video card compiz/beryl or XDAMAGE/Xorg or the (possibly 3rd party) video card
driver. driver.
As a workaround apply the -noxdamage option. As of Feb/2007 x11vnc As a workaround apply the -noxdamage option. As of Feb/2007 x11vnc
will try to autodetect the problem and disable XDAMAGE if is appears will try to autodetect the problem and disable XDAMAGE if is appears
to be missing a lot of updates. But if you know you are using beryl to be missing a lot of updates. But if you know you are using compiz
you might as well always supply -noxdamage. Thanks to this user who you might as well always supply -noxdamage. Thanks to this user who
reported the problem and discovered the workaround. reported the problem and discovered the workaround.
@ -7361,6 +7392,10 @@ EndSection
responsiveness (especially for typing) and also leads to unnecessary responsiveness (especially for typing) and also leads to unnecessary
CPU and memory I/O load due to the extra polling. CPU and memory I/O load due to the extra polling.
Update: as of May/2010 NVIDIA may have fixed this problem in their
proprietary drivers. See the NVIDIA Release Notes. (look for
'x11vnc'.)
Q-111: Can I use x11vnc to view my VMWare session remotely? Q-111: Can I use x11vnc to view my VMWare session remotely?
Yes, since VMWare usually runs as an X application you can view it via Yes, since VMWare usually runs as an X application you can view it via
@ -8035,6 +8070,22 @@ rm -f $tmp
command for you.) Then once you are connected via VNC, iconify the command for you.) Then once you are connected via VNC, iconify the
Terminal windows (you can't delete them since that will kill x11vnc.) Terminal windows (you can't delete them since that will kill x11vnc.)
Update Aug/2010: A user reports the following useful information:
This is not a problem on Mac OS X 10.6.x when connecting via ssh to
start x11vnc. And, on Mac OS X 10.5.x, the problem can be permanently
eliminated by doing this:
sudo /usr/libexec/PlistBuddy -c 'delete :LimitLoadToSessionType' \
-c 'add :LimitLoadToSessionType string Background' \
/System/Library/LaunchAgents/com.apple.pboard.plist
# ignore any 'Delete: Entry, ":LimitLoadToSessionType", Does Not Exist' message
and then restarting (yes, you must restart not just log off). But
ONLY do that for Mac OS X 10.5.x and NOT for 10.6.x (which doesn't
need it anyway).
Q-118: Can x11vnc be used as a VNC reflector/repeater to improve Q-118: Can x11vnc be used as a VNC reflector/repeater to improve
performance for the case of a large number of simultaneous VNC viewers performance for the case of a large number of simultaneous VNC viewers
(e.g. classroom broadcasting or a large demo)? (e.g. classroom broadcasting or a large demo)?
@ -8367,7 +8418,6 @@ rm -f $tmp
* SingleWindow: "Select Single Window..." * SingleWindow: "Select Single Window..."
* TextChat: "Open Chat..." * TextChat: "Open Chat..."
* 1/n Server Scaling * 1/n Server Scaling
* rfbEncodingUltra compression encoding
The SSVNC Unix VNC viewer supports these UltraVNC extensions. The SSVNC Unix VNC viewer supports these UltraVNC extensions.
@ -9106,6 +9156,31 @@ x11vnc-remote.o := CFLAGS += -O0
the command line option to disable optimization, or otherwise have the the command line option to disable optimization, or otherwise have the
lines set CFLAGS to the empty string. lines set CFLAGS to the empty string.
_________________________________________________________________ _________________________________________________________________
Broken Thread Local Storage on SuSE 9.2: Starting with x11vnc 0.9.8
the bundled libvncserver uses the __thread keyword to make some of the
encodings (i.e. tight) thread safe (multiple VNC clients can be using
tight at the same time in x11vnc -threads mode.) Evidently on the old
SuSE 9.2 system the compiler does not support the thread local storage
properly. Here is an example build failure:
tight.c:1126: error: unrecognizable insn:
(insn:HI 11 10 13 0 (nil) (set (reg/f:SI 59)
(const:SI (plus:SI (symbol_ref:SI ("%lpalette"))
(const_int 2048 [0x800])))) -1 (nil)
(expr_list:REG_EQUAL (const:SI (plus:SI (symbol_ref:SI ("%lpalette"))
(const_int 2048 [0x800])))
(nil)))
tight.c:1126: internal compiler error: in extract_insn, at recog.c:2175
Please submit a full bug report,
with preprocessed source if appropriate.
See URL:http://www.suse.de/feedback for instructions.
The workaround is to disable thread local storage at configure time
like this:
env CPPFLAGS="-DTLS=''" ./configure
and then build it.
_________________________________________________________________
======================================================================= =======================================================================
http://www.karlrunge.com/x11vnc/sunray.html: http://www.karlrunge.com/x11vnc/sunray.html:
@ -11029,10 +11104,6 @@ Enhanced TightVNC Viewer (SSVNC: SSL/SSH VNC viewer)
simplified Terminal-Services mode (tsvnc) for use with x11vnc on the simplified Terminal-Services mode (tsvnc) for use with x11vnc on the
remote side. remote side.
It is also possible (although not recommended) to disable encryption:
-noenc cmdline option; Ctrl-E toggle; or Vnc:// host prefix; see the
online Help for details.
The tool has many additional features; see the descriptions below. The tool has many additional features; see the descriptions below.
It is a self-contained bundle, you could carry it around on, say, a It is a self-contained bundle, you could carry it around on, say, a
@ -11217,7 +11288,7 @@ Unix and Mac OS X:
Unpack the archive: Unpack the archive:
% gzip -dc ssvnc-1.0.28.tar.gz | tar xvf - % gzip -dc ssvnc-1.0.29.tar.gz | tar xvf -
Run the GUI: Run the GUI:
@ -11225,7 +11296,7 @@ Unix and Mac OS X:
% ./ssvnc/MacOSX/ssvnc (for Mac OS X) % ./ssvnc/MacOSX/ssvnc (for Mac OS X)
The smaller file "ssvnc_no_windows-1.0.28.tar.gz" The smaller file "ssvnc_no_windows-1.0.29.tar.gz"
could have been used as well. could have been used as well.
On MacOSX you could also click on the SSVNC app icon in the Finder. On MacOSX you could also click on the SSVNC app icon in the Finder.
@ -11271,8 +11342,8 @@ Unix/MacOSX Install:
For the conventional source tarball it will compile and install, e.g.: For the conventional source tarball it will compile and install, e.g.:
gzip -dc ssvnc-1.0.28.src.tar.gz | tar xvf - gzip -dc ssvnc-1.0.29.src.tar.gz | tar xvf -
cd ssvnc-1.0.28 cd ssvnc-1.0.29
make config make config
make all make all
make PREFIX=/my/install/dir install make PREFIX=/my/install/dir install
@ -11285,7 +11356,7 @@ Windows:
Unzip, using WinZip or a similar utility, the zip file: Unzip, using WinZip or a similar utility, the zip file:
ssvnc-1.0.28.zip ssvnc-1.0.29.zip
Run the GUI, e.g.: Run the GUI, e.g.:
@ -11297,7 +11368,7 @@ Windows:
select Open, and then OK to launch it. select Open, and then OK to launch it.
The smaller file "ssvnc_windows_only-1.0.28.zip" The smaller file "ssvnc_windows_only-1.0.29.zip"
could have been used as well. could have been used as well.
You can make a Windows shortcut to this program if you want to. You can make a Windows shortcut to this program if you want to.
@ -11964,25 +12035,25 @@ r
"ssvnc_unix_only" (or "ssvnc_no_windows" to recompile). "ssvnc_unix_only" (or "ssvnc_no_windows" to recompile).
On Mac OS X? Use "ssvnc_no_windows". On Mac OS X? Use "ssvnc_no_windows".
On Windows? Use "ssvnc_windows_only". On Windows? Use "ssvnc_windows_only".
ssvnc_windows_only-1.0.27.zip Windows Binaries Only. No source included ssvnc_windows_only-1.0.28.zip Windows Binaries Only. No source included
(6.2MB) (6.2MB)
ssvnc_no_windows-1.0.27.tar.gz Unix and Mac OS X Only. No Windows binarie ssvnc_no_windows-1.0.28.tar.gz Unix and Mac OS X Only. No Windows binarie
s. Source included. (10.1MB) s. Source included. (10.1MB)
ssvnc_unix_only-1.0.27.tar.gz Unix Binaries Only. No source included ssvnc_unix_only-1.0.28.tar.gz Unix Binaries Only. No source included
. (7.2MB) . (7.2MB)
ssvnc_unix_minimal-1.0.27.tar.gz Unix Minimal. You must supply your own vn ssvnc_unix_minimal-1.0.28.tar.gz Unix Minimal. You must supply your own vn
cviewer and stunnel. (0.2MB) cviewer and stunnel. (0.2MB)
ssvnc-1.0.27.tar.gz All Unix, Mac OS X, and Windows binaries a ssvnc-1.0.28.tar.gz All Unix, Mac OS X, and Windows binaries a
nd source TGZ. (16.1MB) nd source TGZ. (16.1MB)
ssvnc-1.0.27.zip All Unix, Mac OS X, and Windows binaries a ssvnc-1.0.28.zip All Unix, Mac OS X, and Windows binaries a
nd source ZIP. (16.4MB) nd source ZIP. (16.4MB)
ssvnc_all-1.0.27.zip All Unix, Mac OS X, and Windows binaries a ssvnc_all-1.0.28.zip All Unix, Mac OS X, and Windows binaries a
nd source AND full archives in the zip dir. (19.2MB) nd source AND full archives in the zip dir. (19.2MB)
Here is a conventional source tarball: Here is a conventional source tarball:
ssvnc-1.0.27.src.tar.gz Conventional Source for SSVNC GUI and Unix ssvnc-1.0.28.src.tar.gz Conventional Source for SSVNC GUI and Unix
VNCviewer (0.5MB) VNCviewer (0.5MB)
it will be of use to those who do not want the SSVNC it will be of use to those who do not want the SSVNC
@ -12000,19 +12071,19 @@ nd source AND full archives in the zip dir. (19.2MB)
"ssvnc_all", you may need to run the "./build.unix" script in the top "ssvnc_all", you may need to run the "./build.unix" script in the top
directory to recompile for your operating system. directory to recompile for your operating system.
Here are the corresponding 1.0.28 development bundles (Please help Here are the corresponding 1.0.29 development bundles (Please help
test them): test them):
ssvnc_windows_only-1.0.28.zip ssvnc_windows_only-1.0.29.zip
ssvnc_no_windows-1.0.28.tar.gz ssvnc_no_windows-1.0.29.tar.gz
ssvnc_unix_only-1.0.28.tar.gz ssvnc_unix_only-1.0.29.tar.gz
ssvnc_unix_minimal-1.0.28.tar.gz ssvnc_unix_minimal-1.0.29.tar.gz
ssvnc-1.0.28.tar.gz ssvnc-1.0.29.tar.gz
ssvnc-1.0.28.zip ssvnc-1.0.29.zip
ssvnc_all-1.0.28.zip ssvnc_all-1.0.29.zip
ssvnc-1.0.28.src.tar.gz Conventional Source for SSVNC GUI and Unix ssvnc-1.0.29.src.tar.gz Conventional Source for SSVNC GUI and Unix
VNCviewer (0.5MB) VNCviewer (0.5MB)
@ -12036,6 +12107,7 @@ nd source AND full archives in the zip dir. (19.2MB)
Release 1.0.25 at Sourceforge.net Release 1.0.25 at Sourceforge.net
Release 1.0.26 at Sourceforge.net Release 1.0.26 at Sourceforge.net
Release 1.0.27 at Sourceforge.net Release 1.0.27 at Sourceforge.net
Release 1.0.28 at Sourceforge.net
Please help test the UltraVNC File Transfer support in the native Unix Please help test the UltraVNC File Transfer support in the native Unix
@ -12100,7 +12172,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.11 lastmod: 2010-05-08 x11vnc: allow VNC connections to real X11 displays. 0.9.13 lastmod: 2010-09-10
x11vnc options: x11vnc options:
-display disp -auth file -N -display disp -auth file -N
@ -12162,41 +12234,42 @@ x11vnc options:
-noxfixes -alphacut n -alphafrac fraction -noxfixes -alphacut n -alphafrac fraction
-alpharemove -noalphablend -nocursorshape -alpharemove -noalphablend -nocursorshape
-cursorpos -nocursorpos -xwarppointer -cursorpos -nocursorpos -xwarppointer
-noxwarppointer -buttonmap string -nodragging -noxwarppointer -always_inject -buttonmap string
-ncache n -ncache_cr -ncache_no_moveraise -nodragging -ncache n -ncache_cr
-ncache_no_dtchange -ncache_no_rootpixmap -ncache_keep_anims -ncache_no_moveraise -ncache_no_dtchange -ncache_no_rootpixmap
-ncache_old_wm -ncache_pad n -debug_ncache -ncache_keep_anims -ncache_old_wm -ncache_pad n
-wireframe [str] -nowireframe -nowireframelocal -debug_ncache -wireframe [str] -nowireframe
-wirecopyrect mode -nowirecopyrect -debug_wireframe -nowireframelocal -wirecopyrect mode -nowirecopyrect
-scrollcopyrect mode -noscrollcopyrect -scr_area n -debug_wireframe -scrollcopyrect mode -noscrollcopyrect
-scr_skip list -scr_inc list -scr_keys list -scr_area n -scr_skip list -scr_inc list
-scr_term list -scr_keyrepeat lo-hi -scr_parms string -scr_keys list -scr_term list -scr_keyrepeat lo-hi
-fixscreen string -debug_scroll -noxrecord -scr_parms string -fixscreen string -debug_scroll
-grab_buster -nograb_buster -debug_grabs -noxrecord -grab_buster -nograb_buster
-debug_sel -pointer_mode n -input_skip n -debug_grabs -debug_sel -pointer_mode n
-allinput -input_eagerly -speeds rd,bw,lat -input_skip n -allinput -input_eagerly
-wmdt string -debug_pointer -debug_keyboard -speeds rd,bw,lat -wmdt string -debug_pointer
-defer time -wait time -extra_fbur n -debug_keyboard -defer time -wait time
-wait_ui factor -setdefer n -nowait_bog -extra_fbur n -wait_ui factor -setdefer n
-slow_fb time -xrefresh time -nap -nowait_bog -slow_fb time -xrefresh time
-nonap -sb time -readtimeout n -nap -nonap -sb time
-ping n -nofbpm -fbpm -readtimeout n -ping n -nofbpm
-nodpms -dpms -forcedpms -fbpm -nodpms -dpms
-clientdpms -noserverdpms -noultraext -forcedpms -clientdpms -noserverdpms
-chatwindow -noxdamage -xd_area A -noultraext -chatwindow -noxdamage
-xd_mem f -sigpipe string -threads -xd_area A -xd_mem f -sigpipe string
-nothreads -fs f -gaps n -threads -nothreads -fs f
-grow n -fuzz n -debug_tiles -gaps n -grow n -fuzz n
-snapfb -rawfb string -freqtab file -debug_tiles -snapfb -rawfb string
-pipeinput cmd -macnodim -macnosleep -freqtab file -pipeinput cmd -macnodim
-macnosaver -macnowait -macwheel n -macnosleep -macnosaver -macnowait
-macnoswap -macnoresize -maciconanim n -macwheel n -macnoswap -macnoresize
-macmenu -macuskbd -gui [gui-opts] -maciconanim n -macmenu -macuskbd
-remote command -query variable -QD variable -gui [gui-opts] -remote command -query variable
-sync -query_retries str -remote_prefix str -QD variable -sync -query_retries str
-noremote -yesremote -unsafe -remote_prefix str -noremote -yesremote
-safer -privremote -nocmds -unsafe -safer -privremote
-allowedcmds list -deny_all -nocmds -allowedcmds list -deny_all
LibVNCServer options: LibVNCServer options:
-rfbport port TCP port for RFB protocol -rfbport port TCP port for RFB protocol
@ -12230,7 +12303,7 @@ libvncserver-tight-extension options:
% x11vnc -help % x11vnc -help
x11vnc: allow VNC connections to real X11 displays. 0.9.11 lastmod: 2010-05-08 x11vnc: allow VNC connections to real X11 displays. 0.9.13 lastmod: 2010-09-10
(type "x11vnc -opts" to just list the options.) (type "x11vnc -opts" to just list the options.)
@ -12633,6 +12706,12 @@ Options:
-forever Keep listening for more connections rather than exiting -forever Keep listening for more connections rather than exiting
as soon as the first client(s) disconnect. Same as -many as soon as the first client(s) disconnect. Same as -many
To get the standard non-shared VNC behavior where when
a new VNC client connects the existing VNC client is
dropped use: -nevershared -forever This method can
also be used to guard against hung TCP connections that
do not go away.
-loop Create an outer loop restarting the x11vnc process -loop Create an outer loop restarting the x11vnc process
whenever it terminates. -bg and -inetd are ignored whenever it terminates. -bg and -inetd are ignored
in this mode (however see -loopbg below). in this mode (however see -loopbg below).
@ -12740,6 +12819,11 @@ Options:
may need to start avahi-daemon and open udp port 5353 may need to start avahi-daemon and open udp port 5353
in your firewall. in your firewall.
You can set X11VNC_AVAHI_NAME, X11VNC_AVAHI_HOST,
and/or X11VNC_AVAHI_PORT environment variables
to override the default values. For example:
-env X11VNC_AVAHI_NAME=wally
If the avahi API cannot be found at build time, a helper If the avahi API cannot be found at build time, a helper
program like avahi-publish(1) or dns-sd(1) will be tried program like avahi-publish(1) or dns-sd(1) will be tried
@ -13366,13 +13450,13 @@ Options:
virtual terminal of the X server. virtual terminal of the X server.
-listdpy Have the FINDDISPLAY program list all of your displays -listdpy Have the FINDDISPLAY program list all of your displays
(i.e. all the X displays on the local machine that you (i.e. all the X displays on the local machine that you
have access rights to). have access rights to). x11vnc then exits.
-findauth [disp] Apply the -find/-finddpy heuristics to try to guess -findauth [disp] Apply the -find/-finddpy heuristics to try to guess
the XAUTHORITY file for DISPLAY 'disp'. If 'disp' the XAUTHORITY file for DISPLAY 'disp'. If 'disp'
is not supplied, then the value in the -display on is not supplied, then the value in the -display on
the cmdline is used; failing that $DISPLAY is used; the cmdline is used; failing that $DISPLAY is used;
and failing that ":0" is used. and failing that ":0" is used. x11vnc then exits.
If nothing is printed out, that means no XAUTHORITY was If nothing is printed out, that means no XAUTHORITY was
found for 'disp'; i.e. failure. If "XAUTHORITY=" found for 'disp'; i.e. failure. If "XAUTHORITY="
@ -13608,8 +13692,19 @@ Options:
if the viewer-side supplied value is not completely if the viewer-side supplied value is not completely
composed of alphanumeric or '_' or '-' characters. composed of alphanumeric or '_' or '-' characters.
User preferences file: Instead of having the user type
in geom=WxH,... etc. every time he logs in to find
or create his X session, if you set FD_USERPREFS to
a string that does not contain the "/" character,
then the user's home directory is prepended to that
string and if the file exists its first line is read
and appended to any options he supplied at the login:
prompt. For example -env FD_USERPREFS=.x11vnc_create
and the user put "geom=1600x1200" in his
~/.x11vnc_create file.
To troubleshoot the FINDCREATEDISPLAY mechanism, To troubleshoot the FINDCREATEDISPLAY mechanism,
set the following env. var. to an ouput log file, set the following env. var. to an output log file,
e.g -env CREATE_DISPLAY_OUTPUT=/tmp/mydebug.txt e.g -env CREATE_DISPLAY_OUTPUT=/tmp/mydebug.txt
To disable the option setting set the environment To disable the option setting set the environment
@ -13699,6 +13794,8 @@ Options:
It will start looking for an open display number at :20 It will start looking for an open display number at :20
Override via X11VNC_CREATE_STARTING_DISPLAY_NUMBER=n Override via X11VNC_CREATE_STARTING_DISPLAY_NUMBER=n
By default 80 X displays are allowed (i.e. going to :99)
Override via X11VNC_CREATE_MAX_DISPLAYS=n
By default FINDCREATEDISPLAY will try Xvfb and then By default FINDCREATEDISPLAY will try Xvfb and then
Xdummy: Xdummy:
@ -14221,6 +14318,7 @@ Options:
-sslGenCA [dir] Generate your own Certificate Authority private key, -sslGenCA [dir] Generate your own Certificate Authority private key,
certificate, and other files in directory [dir]. certificate, and other files in directory [dir].
x11vnc then exits.
If [dir] is not supplied, a -ssldir setting is used, If [dir] is not supplied, a -ssldir setting is used,
or otherwise ~/.vnc/certs is used. or otherwise ~/.vnc/certs is used.
@ -14231,7 +14329,7 @@ Options:
in PATH. in PATH.
After the CA files and directories are created the After the CA files and directories are created the
command exits; the VNC server is not run. x11vnc command exits; the VNC server is not run.
You will be prompted for information to put into the CA You will be prompted for information to put into the CA
certificate. The info does not have to be accurate just certificate. The info does not have to be accurate just
@ -14259,8 +14357,8 @@ Options:
-sslGenCA. The openssl(1) program must be installed -sslGenCA. The openssl(1) program must be installed
on the system and available in PATH. on the system and available in PATH.
After the Certificate is generated the command exits; After the Certificate is generated x11vnc exits; the
the VNC server is not run. VNC server is not run.
The type of key to be generated is the string "type". The type of key to be generated is the string "type".
It is either "server" (i.e. for use by x11vnc) or It is either "server" (i.e. for use by x11vnc) or
@ -14379,7 +14477,7 @@ Options:
scp ~/.vnc/certs/clients/roger.pem somehost:. scp ~/.vnc/certs/clients/roger.pem somehost:.
rm ~/.vnc/certs/clients/roger.pem rm ~/.vnc/certs/clients/roger.pem
x11vnc is then started with the the option -sslverify x11vnc is then started with the option -sslverify
~/.vnc/certs/clients/roger.crt (or simply -sslverify ~/.vnc/certs/clients/roger.crt (or simply -sslverify
roger), and on the viewer user on somehost could do roger), and on the viewer user on somehost could do
for example: for example:
@ -14402,7 +14500,7 @@ Options:
The openssl(1) program must be installed on the system The openssl(1) program must be installed on the system
and available in PATH. After the Key file is encrypted and available in PATH. After the Key file is encrypted
the command exits; the VNC server is not run. the x11vnc command exits; the VNC server is not run.
Examples: Examples:
x11vnc -sslEncKey /path/to/foo.pem x11vnc -sslEncKey /path/to/foo.pem
@ -14414,6 +14512,9 @@ Options:
The openssl(1) program must be in PATH. Basically the The openssl(1) program must be in PATH. Basically the
command "openssl x509 -text" is run on the pem. command "openssl x509 -text" is run on the pem.
After the info is printed the x11vnc command exits;
the VNC server is not run.
The "SAVE" notation described under -ssl applies The "SAVE" notation described under -ssl applies
as well. as well.
@ -14439,13 +14540,13 @@ Options:
also be lowercase, e.g. "list". also be lowercase, e.g. "list".
-sslDelCert pem Prompts you to delete all .crt .pem .key .req files -sslDelCert pem Prompts you to delete all .crt .pem .key .req files
associated with [pem]. "SAVE" and lookups as in associated with [pem]. x11vnc then exits. "SAVE"
-sslCertInfo apply as well. and lookups as in -sslCertInfo apply as well.
-sslScripts Prints out both the 'genCA' and 'genCert' x11vnc -sslScripts Prints out both the 'genCA' and 'genCert' x11vnc
openssl wrapper scripts for you to examine, modify, etc. openssl wrapper scripts for you to examine, modify, etc.
The scripts are printed to stdout and then the program The scripts are printed to stdout and then the x11vnc
exits. program exits.
-stunnel [pem] Use the stunnel(8) (stunnel.mirt.net) to provide an -stunnel [pem] Use the stunnel(8) (stunnel.mirt.net) to provide an
@ -15015,6 +15116,9 @@ t
just use 1 shm tile for polling. Limits shm segments just use 1 shm tile for polling. Limits shm segments
used to 3. used to 3.
To disable any automatic shm reduction set the
env. var. X11VNC_NO_LIMIT_SHM.
-solid [color] To improve performance, when VNC clients are connected -solid [color] To improve performance, when VNC clients are connected
try to change the desktop background to a solid color. try to change the desktop background to a solid color.
The [color] is optional: the default color is "cyan4". The [color] is optional: the default color is "cyan4".
@ -15265,7 +15369,7 @@ t
the wire and are applied correctly to the x11vnc-side the wire and are applied correctly to the x11vnc-side
X server. Note this mode probably won't do what you X server. Note this mode probably won't do what you
want in -nomodtweak mode. Also, a kludge for KP_n want in -nomodtweak mode. Also, a kludge for KP_n
digits is always done it this mode: they are mapped to digits is always done in this mode: they are mapped to
regular digit keysyms. See also -capslock above. regular digit keysyms. See also -capslock above.
The default is -noskip_lockkeys. The default is -noskip_lockkeys.
@ -15548,6 +15652,34 @@ t
enabled by default if XINERAMA is found to be active. enabled by default if XINERAMA is found to be active.
To prevent this, use -noxwarppointer. To prevent this, use -noxwarppointer.
-always_inject Even if there is no displacement (dx = dy = 0) for a
VNC mouse event force the pointer to the indicated x,y
position anyway. Recent (2009) gui toolkits (gnome)
have problems with x11vnc's original mouse input
injection method. So x11vnc's mouse input injection
method has been modified. To regain the OLD behavior
use this option: -always_inject. Then x11vnc will
always force positioning the mouse to the x,y position
even if that position has not changed since the previous
VNC input event.
The first place this problem was noticed was in gnome
terminal: if you pressed and released mouse button 3, a
menu was posted and then its first element 'New Terminal
Window' was activated. This was because x11vnc injected
the mouse position twice: once on ButtonPress and again
on ButtonRelease. The toolkit interpreted the 2nd one
as mouse motion even though the mouse hadn't moved.
So now by default x11vnc tries to avoid injecting the
2nd one.
Note that with the new default x11vnc will be oblivious
to applications moving the pointer (warping) or the
user at the physical display moving it. So it might,
e.g., inject ButtonRelease at the wrong position.
If this (or similar scenarios) causes problems in your
environment, specify -always_inject for the old method.
-buttonmap string String to remap mouse buttons. Format: IJK-LMN, this -buttonmap string String to remap mouse buttons. Format: IJK-LMN, this
maps buttons I -> L, etc., e.g. -buttonmap 13-31 maps buttons I -> L, etc., e.g. -buttonmap 13-31
@ -16005,7 +16137,7 @@ t
the whole-server grabbing application expects mouse or the whole-server grabbing application expects mouse or
keyboard input before releasing the grab. It is usually keyboard input before releasing the grab. It is usually
a window manager that does this. x11vnc takes care to a window manager that does this. x11vnc takes care to
avoid the the problem, but if caught x11vnc will freeze. avoid the problem, but if caught x11vnc will freeze.
Without -grab_buster, the only solution is to go the Without -grab_buster, the only solution is to go the
physical display and give it some input to satisfy the physical display and give it some input to satisfy the
grabbing app. Or manually kill and restart the window grabbing app. Or manually kill and restart the window
@ -16845,7 +16977,7 @@ er
-macuskbd For the native MacOSX server, use the original -macuskbd For the native MacOSX server, use the original
keystroke insertion code based on a US keyboard. keystroke insertion code based on a US keyboard.
-gui [gui-opts] Start up a simple tcl/tk gui based on the the remote -gui [gui-opts] Start up a simple tcl/tk gui based on the remote
control options -remote/-query described below. control options -remote/-query described below.
Requires the "wish" program to be installed on the Requires the "wish" program to be installed on the
machine. "gui-opts" is not required: the default machine. "gui-opts" is not required: the default
@ -16976,9 +17108,9 @@ n
x11vnc server. "-R" and "-r" are aliases for x11vnc server. "-R" and "-r" are aliases for
"-remote". After the remote control command is "-remote". After the remote control command is
sent to the running server the 'x11vnc -remote ...' sent to the running server the 'x11vnc -remote ...'
command exits. You can often use the -query command x11vnc command exits. You can often use the -query
(see below) to see if the x11vnc server processed your command (see below) to see if the x11vnc server
-remote command. processed your -remote command.
The default communication channel is that of X The default communication channel is that of X
properties (specifically X11VNC_REMOTE), and so this properties (specifically X11VNC_REMOTE), and so this
@ -17231,6 +17363,8 @@ n
nocursorpos enable -nocursorpos mode. nocursorpos enable -nocursorpos mode.
xwarp enable -xwarppointer mode. xwarp enable -xwarppointer mode.
noxwarp disable -xwarppointer mode. noxwarp disable -xwarppointer mode.
always_inject enable -always_inject mode.
noalways_inject disable -always_inject mode.
buttonmap:str set -buttonmap "str", empty to disable buttonmap:str set -buttonmap "str", empty to disable
dragging disable -nodragging mode. dragging disable -nodragging mode.
nodragging enable -nodragging mode. nodragging enable -nodragging mode.
@ -17555,11 +17689,11 @@ n
nosetprimary clipboard noclipboard setclipboard nosetprimary clipboard noclipboard setclipboard
nosetclipboard seldir cursorshape nocursorshape nosetclipboard seldir cursorshape nocursorshape
cursorpos nocursorpos cursor_drag nocursor_drag cursor cursorpos nocursorpos cursor_drag nocursor_drag cursor
show_cursor noshow_cursor nocursor arrow xfixes show_cursor noshow_cursor nocursor arrow xfixes noxfixes
noxfixes xdamage noxdamage xd_area xd_mem alphacut xdamage noxdamage xd_area xd_mem alphacut alphafrac
alphafrac alpharemove noalpharemove alphablend alpharemove noalpharemove alphablend noalphablend
noalphablend xwarppointer xwarp noxwarppointer xwarppointer xwarp noxwarppointer noxwarp always_inject
noxwarp buttonmap dragging nodragging ncache_cr noalways_inject buttonmap dragging nodragging ncache_cr
noncache_cr ncache_no_moveraise noncache_no_moveraise noncache_cr ncache_no_moveraise noncache_no_moveraise
ncache_no_dtchange noncache_no_dtchange ncache_no_dtchange noncache_no_dtchange
ncache_no_rootpixmap noncache_no_rootpixmap ncache_no_rootpixmap noncache_no_rootpixmap

@ -37,7 +37,7 @@ so, delete this exception statement from your version.
#include "cleanup.h" #include "cleanup.h"
void avahi_initialise(void); void avahi_initialise(void);
void avahi_advertise(const char *name, const char *host, const uint16_t port); void avahi_advertise(char *name, char *host, uint16_t port);
void avahi_reset(void); void avahi_reset(void);
void avahi_cleanup(void); void avahi_cleanup(void);
@ -45,12 +45,13 @@ static pid_t avahi_pid = 0;
static void kill_avahi_pid(void) { static void kill_avahi_pid(void) {
if (avahi_pid != 0) { if (avahi_pid != 0) {
rfbLog("kill_avahi_pid: %d\n", (int) avahi_pid);
kill(avahi_pid, SIGTERM); kill(avahi_pid, SIGTERM);
avahi_pid = 0; avahi_pid = 0;
} }
} }
static int try_avahi_helper(const char *name, const char *host, const uint16_t port) { static int try_avahi_helper(char *name, char *host, uint16_t port) {
#if LIBVNCSERVER_HAVE_FORK #if LIBVNCSERVER_HAVE_FORK
char *cmd, *p, *path = getenv("PATH"), portstr[32]; char *cmd, *p, *path = getenv("PATH"), portstr[32];
int i; int i;
@ -146,7 +147,12 @@ void avahi_initialise(void) {
rfbLog("avahi_initialise: no Avahi support at buildtime.\n"); rfbLog("avahi_initialise: no Avahi support at buildtime.\n");
} }
void avahi_advertise(const char *name, const char *host, const uint16_t port) { void avahi_advertise(char *name, char *host, uint16_t port) {
char *t;
t = getenv("X11VNC_AVAHI_NAME"); if (t) name = t;
t = getenv("X11VNC_AVAHI_HOST"); if (t) host = t;
t = getenv("X11VNC_AVAHI_PORT"); if (t) port = atoi(t);
if (!try_avahi_helper(name, host, port)) { if (!try_avahi_helper(name, host, port)) {
rfbLog("avahi_advertise: no Avahi support at buildtime.\n"); rfbLog("avahi_advertise: no Avahi support at buildtime.\n");
avahi = 0; avahi = 0;
@ -243,8 +249,8 @@ if (db) fprintf(stderr, " avahi_initialise: poll not null\n");
if (db) fprintf(stderr, "out avahi_initialise\n"); if (db) fprintf(stderr, "out avahi_initialise\n");
} }
static void _avahi_create_services(const char *name, const char *host, static void _avahi_create_services(char *name, char *host,
const uint16_t port); uint16_t port);
static void _avahi_entry_group_callback(AvahiEntryGroup *g, static void _avahi_entry_group_callback(AvahiEntryGroup *g,
AvahiEntryGroupState state, void *userdata) { AvahiEntryGroupState state, void *userdata) {
@ -285,12 +291,11 @@ if (db) fprintf(stderr, "in _avahi_entry_group_callback %d 0x%p\n", state, svc)
if (db) fprintf(stderr, "out _avahi_entry_group_callback\n"); if (db) fprintf(stderr, "out _avahi_entry_group_callback\n");
} }
static void _avahi_create_services(const char *name, const char *host, static void _avahi_create_services(char *name, char *host, uint16_t port) {
const uint16_t port) {
avahi_service_t *svc = (avahi_service_t *)malloc(sizeof(avahi_service_t)); avahi_service_t *svc = (avahi_service_t *)malloc(sizeof(avahi_service_t));
int ret = 0; int ret = 0;
if (db) fprintf(stderr, "in _avahi_create_services %s %s %d\n", name, host, port); if (db) fprintf(stderr, "in _avahi_create_services '%s' '%s' %d\n", name, host, port);
svc->name = name; svc->name = name;
svc->host = host; svc->host = host;
svc->port = port; svc->port = port;
@ -323,9 +328,14 @@ if (db) fprintf(stderr, " _avahi_create_services create group\n");
if (db) fprintf(stderr, "out _avahi_create_services\n"); if (db) fprintf(stderr, "out _avahi_create_services\n");
} }
void avahi_advertise(const char *name, const char *host, const uint16_t port) { void avahi_advertise(char *name, char *host, uint16_t port) {
int i; int i;
if (db) fprintf(stderr, "in avahi_advertise: %s %s %d\n", name, host, port); char *t;
t = getenv("X11VNC_AVAHI_NAME"); if (t) name = t;
t = getenv("X11VNC_AVAHI_HOST"); if (t) host = t;
t = getenv("X11VNC_AVAHI_PORT"); if (t) port = atoi(t);
if (db) fprintf(stderr, "in avahi_advertise: '%s' '%s' %d\n", name, host, port);
if (!_client) { if (!_client) {
if (db) fprintf(stderr, " avahi_advertise client null\n"); if (db) fprintf(stderr, " avahi_advertise client null\n");
return; return;
@ -388,18 +398,34 @@ if (db) fprintf(stderr, " avahi_reset client/group null\n");
if (db) fprintf(stderr, "out avahi_reset\n"); if (db) fprintf(stderr, "out avahi_reset\n");
} }
static void avahi_timeout (int sig) {
int i;
rfbLog("sig: %d, avahi_cleanup timed out.\n", sig);
exit(1);
}
void avahi_cleanup(void) { void avahi_cleanup(void) {
if (db) fprintf(stderr, "in avahi_cleanup\n"); if (db) fprintf(stderr, "in avahi_cleanup\n");
if (!_client) { if (!_client) {
if (db) fprintf(stderr, " avahi_cleanup client null\n"); if (db) fprintf(stderr, " avahi_cleanup client null\n");
return; return;
} }
if (db) fprintf(stderr, " avahi_cleanup poll_lock\n");
avahi_threaded_poll_lock(_poll); avahi_threaded_poll_lock(_poll);
if (db) fprintf(stderr, " avahi_cleanup poll_stop\n");
signal(SIGALRM, avahi_timeout);
alarm(3);
avahi_threaded_poll_stop(_poll); avahi_threaded_poll_stop(_poll);
alarm(0);
signal(SIGALRM, SIG_DFL);
if (db) fprintf(stderr, " avahi_cleanup client_free\n");
avahi_client_free(_client); avahi_client_free(_client);
_client = NULL; _client = NULL;
if (db) fprintf(stderr, " avahi_cleanup poll_free\n");
avahi_threaded_poll_free(_poll); avahi_threaded_poll_free(_poll);
_poll = NULL; _poll = NULL;
if (db) fprintf(stderr, "out avahi_cleanup\n"); if (db) fprintf(stderr, "out avahi_cleanup\n");

@ -36,7 +36,7 @@ so, delete this exception statement from your version.
/* -- avahi.h -- */ /* -- avahi.h -- */
extern void avahi_initialise(void); extern void avahi_initialise(void);
extern void avahi_advertise(const char *name, const char *host, const uint16_t port); extern void avahi_advertise(char *name, char *host, uint16_t port);
extern void avahi_reset(void); extern void avahi_reset(void);
extern void avahi_cleanup(void); extern void avahi_cleanup(void);

@ -165,9 +165,6 @@ void clean_up_exit(int ret) {
ssl_helper_pid(0, 0); /* killall */ ssl_helper_pid(0, 0); /* killall */
} }
if (avahi) {
avahi_cleanup();
}
if (ssh_pid > 0) { if (ssh_pid > 0) {
kill(ssh_pid, SIGTERM); kill(ssh_pid, SIGTERM);
ssh_pid = 0; ssh_pid = 0;
@ -242,6 +239,11 @@ void clean_up_exit(int ret) {
rm_flagfile = NULL; rm_flagfile = NULL;
} }
if (avahi) {
avahi_cleanup();
fflush(stderr);
}
exit(ret); exit(ret);
} }

@ -932,11 +932,7 @@ void client_gone(rfbClientPtr client) {
kill(gui_pid, SIGTERM); kill(gui_pid, SIGTERM);
} }
CLIENT_UNLOCK; CLIENT_UNLOCK;
if (connect_or_exit) { clean_up_exit(0);
clean_up_exit(1);
} else {
clean_up_exit(0);
}
} }
#ifdef MACOSX #ifdef MACOSX
if (macosx_console && client_count == 0) { if (macosx_console && client_count == 0) {
@ -3149,7 +3145,7 @@ static void pmove(int x, int y) {
return; return;
} }
rfbLog("pmove: x y: %d %d\n", x, y); rfbLog("pmove: x y: %d %d\n", x, y);
pointer(0, x, y, NULL); pointer_event(0, x, y, NULL);
X_LOCK; X_LOCK;
XFlush_wr(dpy); XFlush_wr(dpy);
X_UNLOCK; X_UNLOCK;

@ -467,6 +467,12 @@ void print_help(int mode) {
"-forever Keep listening for more connections rather than exiting\n" "-forever Keep listening for more connections rather than exiting\n"
" as soon as the first client(s) disconnect. Same as -many\n" " as soon as the first client(s) disconnect. Same as -many\n"
"\n" "\n"
" To get the standard non-shared VNC behavior where when\n"
" a new VNC client connects the existing VNC client is\n"
" dropped use: -nevershared -forever This method can\n"
" also be used to guard against hung TCP connections that\n"
" do not go away.\n"
"\n"
"-loop Create an outer loop restarting the x11vnc process\n" "-loop Create an outer loop restarting the x11vnc process\n"
" whenever it terminates. -bg and -inetd are ignored\n" " whenever it terminates. -bg and -inetd are ignored\n"
" in this mode (however see -loopbg below).\n" " in this mode (however see -loopbg below).\n"
@ -574,6 +580,11 @@ void print_help(int mode) {
" may need to start avahi-daemon and open udp port 5353\n" " may need to start avahi-daemon and open udp port 5353\n"
" in your firewall.\n" " in your firewall.\n"
"\n" "\n"
" You can set X11VNC_AVAHI_NAME, X11VNC_AVAHI_HOST,\n"
" and/or X11VNC_AVAHI_PORT environment variables\n"
" to override the default values. For example:\n"
" -env X11VNC_AVAHI_NAME=wally\n"
"\n"
" If the avahi API cannot be found at build time, a helper\n" " If the avahi API cannot be found at build time, a helper\n"
" program like avahi-publish(1) or dns-sd(1) will be tried\n" " program like avahi-publish(1) or dns-sd(1) will be tried\n"
"\n" "\n"
@ -1212,13 +1223,13 @@ void print_help(int mode) {
" virtual terminal of the X server.\n" " virtual terminal of the X server.\n"
"-listdpy Have the FINDDISPLAY program list all of your displays\n" "-listdpy Have the FINDDISPLAY program list all of your displays\n"
" (i.e. all the X displays on the local machine that you\n" " (i.e. all the X displays on the local machine that you\n"
" have access rights to).\n" " have access rights to). x11vnc then exits.\n"
"\n" "\n"
"-findauth [disp] Apply the -find/-finddpy heuristics to try to guess\n" "-findauth [disp] Apply the -find/-finddpy heuristics to try to guess\n"
" the XAUTHORITY file for DISPLAY 'disp'. If 'disp'\n" " the XAUTHORITY file for DISPLAY 'disp'. If 'disp'\n"
" is not supplied, then the value in the -display on\n" " is not supplied, then the value in the -display on\n"
" the cmdline is used; failing that $DISPLAY is used;\n" " the cmdline is used; failing that $DISPLAY is used;\n"
" and failing that \":0\" is used.\n" " and failing that \":0\" is used. x11vnc then exits.\n"
"\n" "\n"
" If nothing is printed out, that means no XAUTHORITY was\n" " If nothing is printed out, that means no XAUTHORITY was\n"
" found for 'disp'; i.e. failure. If \"XAUTHORITY=\"\n" " found for 'disp'; i.e. failure. If \"XAUTHORITY=\"\n"
@ -1454,8 +1465,19 @@ void print_help(int mode) {
" if the viewer-side supplied value is not completely\n" " if the viewer-side supplied value is not completely\n"
" composed of alphanumeric or '_' or '-' characters.\n" " composed of alphanumeric or '_' or '-' characters.\n"
"\n" "\n"
" User preferences file: Instead of having the user type\n"
" in geom=WxH,... etc. every time he logs in to find\n"
" or create his X session, if you set FD_USERPREFS to\n"
" a string that does not contain the \"/\" character,\n"
" then the user's home directory is prepended to that\n"
" string and if the file exists its first line is read\n"
" and appended to any options he supplied at the login:\n"
" prompt. For example -env FD_USERPREFS=.x11vnc_create\n"
" and the user put \"geom=1600x1200\" in his\n"
" ~/.x11vnc_create file.\n"
"\n"
" To troubleshoot the FINDCREATEDISPLAY mechanism,\n" " To troubleshoot the FINDCREATEDISPLAY mechanism,\n"
" set the following env. var. to an ouput log file,\n" " set the following env. var. to an output log file,\n"
" e.g -env CREATE_DISPLAY_OUTPUT=/tmp/mydebug.txt\n" " e.g -env CREATE_DISPLAY_OUTPUT=/tmp/mydebug.txt\n"
"\n" "\n"
" To disable the option setting set the environment\n" " To disable the option setting set the environment\n"
@ -1544,6 +1566,8 @@ void print_help(int mode) {
"\n" "\n"
" It will start looking for an open display number at :20\n" " It will start looking for an open display number at :20\n"
" Override via X11VNC_CREATE_STARTING_DISPLAY_NUMBER=n\n" " Override via X11VNC_CREATE_STARTING_DISPLAY_NUMBER=n\n"
" By default 80 X displays are allowed (i.e. going to :99)\n"
" Override via X11VNC_CREATE_MAX_DISPLAYS=n\n"
"\n" "\n"
" By default FINDCREATEDISPLAY will try Xvfb and then\n" " By default FINDCREATEDISPLAY will try Xvfb and then\n"
" Xdummy:\n" " Xdummy:\n"
@ -2066,6 +2090,7 @@ void print_help(int mode) {
"\n" "\n"
"-sslGenCA [dir] Generate your own Certificate Authority private key,\n" "-sslGenCA [dir] Generate your own Certificate Authority private key,\n"
" certificate, and other files in directory [dir].\n" " certificate, and other files in directory [dir].\n"
" x11vnc then exits.\n"
"\n" "\n"
" If [dir] is not supplied, a -ssldir setting is used,\n" " If [dir] is not supplied, a -ssldir setting is used,\n"
" or otherwise ~/.vnc/certs is used.\n" " or otherwise ~/.vnc/certs is used.\n"
@ -2076,7 +2101,7 @@ void print_help(int mode) {
" in PATH.\n" " in PATH.\n"
"\n" "\n"
" After the CA files and directories are created the\n" " After the CA files and directories are created the\n"
" command exits; the VNC server is not run.\n" " x11vnc command exits; the VNC server is not run.\n"
"\n" "\n"
" You will be prompted for information to put into the CA\n" " You will be prompted for information to put into the CA\n"
" certificate. The info does not have to be accurate just\n" " certificate. The info does not have to be accurate just\n"
@ -2104,8 +2129,8 @@ void print_help(int mode) {
" -sslGenCA. The openssl(1) program must be installed\n" " -sslGenCA. The openssl(1) program must be installed\n"
" on the system and available in PATH.\n" " on the system and available in PATH.\n"
"\n" "\n"
" After the Certificate is generated the command exits;\n" " After the Certificate is generated x11vnc exits; the\n"
" the VNC server is not run.\n" " VNC server is not run.\n"
"\n" "\n"
" The type of key to be generated is the string \"type\".\n" " The type of key to be generated is the string \"type\".\n"
" It is either \"server\" (i.e. for use by x11vnc) or\n" " It is either \"server\" (i.e. for use by x11vnc) or\n"
@ -2225,7 +2250,7 @@ void print_help(int mode) {
" scp ~/.vnc/certs/clients/roger.pem somehost:.\n" " scp ~/.vnc/certs/clients/roger.pem somehost:.\n"
" rm ~/.vnc/certs/clients/roger.pem\n" " rm ~/.vnc/certs/clients/roger.pem\n"
"\n" "\n"
" x11vnc is then started with the the option -sslverify\n" " x11vnc is then started with the option -sslverify\n"
" ~/.vnc/certs/clients/roger.crt (or simply -sslverify\n" " ~/.vnc/certs/clients/roger.crt (or simply -sslverify\n"
" roger), and on the viewer user on somehost could do\n" " roger), and on the viewer user on somehost could do\n"
" for example:\n" " for example:\n"
@ -2248,7 +2273,7 @@ void print_help(int mode) {
"\n" "\n"
" The openssl(1) program must be installed on the system\n" " The openssl(1) program must be installed on the system\n"
" and available in PATH. After the Key file is encrypted\n" " and available in PATH. After the Key file is encrypted\n"
" the command exits; the VNC server is not run.\n" " the x11vnc command exits; the VNC server is not run.\n"
"\n" "\n"
" Examples:\n" " Examples:\n"
" x11vnc -sslEncKey /path/to/foo.pem\n" " x11vnc -sslEncKey /path/to/foo.pem\n"
@ -2260,6 +2285,9 @@ void print_help(int mode) {
" The openssl(1) program must be in PATH. Basically the\n" " The openssl(1) program must be in PATH. Basically the\n"
" command \"openssl x509 -text\" is run on the pem.\n" " command \"openssl x509 -text\" is run on the pem.\n"
"\n" "\n"
" After the info is printed the x11vnc command exits;\n"
" the VNC server is not run.\n"
"\n"
" The \"SAVE\" notation described under -ssl applies\n" " The \"SAVE\" notation described under -ssl applies\n"
" as well.\n" " as well.\n"
"\n" "\n"
@ -2285,13 +2313,13 @@ void print_help(int mode) {
" also be lowercase, e.g. \"list\".\n" " also be lowercase, e.g. \"list\".\n"
"\n" "\n"
"-sslDelCert pem Prompts you to delete all .crt .pem .key .req files\n" "-sslDelCert pem Prompts you to delete all .crt .pem .key .req files\n"
" associated with [pem]. \"SAVE\" and lookups as in\n" " associated with [pem]. x11vnc then exits. \"SAVE\"\n"
" -sslCertInfo apply as well.\n" " and lookups as in -sslCertInfo apply as well.\n"
"\n" "\n"
"-sslScripts Prints out both the 'genCA' and 'genCert' x11vnc\n" "-sslScripts Prints out both the 'genCA' and 'genCert' x11vnc\n"
" openssl wrapper scripts for you to examine, modify, etc.\n" " openssl wrapper scripts for you to examine, modify, etc.\n"
" The scripts are printed to stdout and then the program\n" " The scripts are printed to stdout and then the x11vnc\n"
" exits.\n" " program exits.\n"
"\n" "\n"
"\n" "\n"
"-stunnel [pem] Use the stunnel(8) (stunnel.mirt.net) to provide an\n" "-stunnel [pem] Use the stunnel(8) (stunnel.mirt.net) to provide an\n"
@ -2860,6 +2888,9 @@ void print_help(int mode) {
" just use 1 shm tile for polling. Limits shm segments\n" " just use 1 shm tile for polling. Limits shm segments\n"
" used to 3.\n" " used to 3.\n"
"\n" "\n"
" To disable any automatic shm reduction set the\n"
" env. var. X11VNC_NO_LIMIT_SHM.\n"
"\n"
"-solid [color] To improve performance, when VNC clients are connected\n" "-solid [color] To improve performance, when VNC clients are connected\n"
" try to change the desktop background to a solid color.\n" " try to change the desktop background to a solid color.\n"
" The [color] is optional: the default color is \"cyan4\".\n" " The [color] is optional: the default color is \"cyan4\".\n"
@ -3109,7 +3140,7 @@ void print_help(int mode) {
" the wire and are applied correctly to the x11vnc-side\n" " the wire and are applied correctly to the x11vnc-side\n"
" X server. Note this mode probably won't do what you\n" " X server. Note this mode probably won't do what you\n"
" want in -nomodtweak mode. Also, a kludge for KP_n\n" " want in -nomodtweak mode. Also, a kludge for KP_n\n"
" digits is always done it this mode: they are mapped to\n" " digits is always done in this mode: they are mapped to\n"
" regular digit keysyms. See also -capslock above.\n" " regular digit keysyms. See also -capslock above.\n"
" The default is -noskip_lockkeys.\n" " The default is -noskip_lockkeys.\n"
"\n" "\n"
@ -3392,6 +3423,34 @@ void print_help(int mode) {
" enabled by default if XINERAMA is found to be active.\n" " enabled by default if XINERAMA is found to be active.\n"
" To prevent this, use -noxwarppointer.\n" " To prevent this, use -noxwarppointer.\n"
"\n" "\n"
"-always_inject Even if there is no displacement (dx = dy = 0) for a\n"
" VNC mouse event force the pointer to the indicated x,y\n"
" position anyway. Recent (2009) gui toolkits (gnome)\n"
" have problems with x11vnc's original mouse input\n"
" injection method. So x11vnc's mouse input injection\n"
" method has been modified. To regain the OLD behavior\n"
" use this option: -always_inject. Then x11vnc will\n"
" always force positioning the mouse to the x,y position\n"
" even if that position has not changed since the previous\n"
" VNC input event.\n"
"\n"
" The first place this problem was noticed was in gnome\n"
" terminal: if you pressed and released mouse button 3, a\n"
" menu was posted and then its first element 'New Terminal\n"
" Window' was activated. This was because x11vnc injected\n"
" the mouse position twice: once on ButtonPress and again\n"
" on ButtonRelease. The toolkit interpreted the 2nd one\n"
" as mouse motion even though the mouse hadn't moved.\n"
" So now by default x11vnc tries to avoid injecting the\n"
" 2nd one.\n"
"\n"
" Note that with the new default x11vnc will be oblivious\n"
" to applications moving the pointer (warping) or the\n"
" user at the physical display moving it. So it might,\n"
" e.g., inject ButtonRelease at the wrong position.\n"
" If this (or similar scenarios) causes problems in your\n"
" environment, specify -always_inject for the old method.\n"
"\n"
"-buttonmap string String to remap mouse buttons. Format: IJK-LMN, this\n" "-buttonmap string String to remap mouse buttons. Format: IJK-LMN, this\n"
" maps buttons I -> L, etc., e.g. -buttonmap 13-31\n" " maps buttons I -> L, etc., e.g. -buttonmap 13-31\n"
"\n" "\n"
@ -3851,7 +3910,7 @@ void print_help(int mode) {
" the whole-server grabbing application expects mouse or\n" " the whole-server grabbing application expects mouse or\n"
" keyboard input before releasing the grab. It is usually\n" " keyboard input before releasing the grab. It is usually\n"
" a window manager that does this. x11vnc takes care to\n" " a window manager that does this. x11vnc takes care to\n"
" avoid the the problem, but if caught x11vnc will freeze.\n" " avoid the problem, but if caught x11vnc will freeze.\n"
" Without -grab_buster, the only solution is to go the\n" " Without -grab_buster, the only solution is to go the\n"
" physical display and give it some input to satisfy the\n" " physical display and give it some input to satisfy the\n"
" grabbing app. Or manually kill and restart the window\n" " grabbing app. Or manually kill and restart the window\n"
@ -4689,7 +4748,7 @@ void print_help(int mode) {
"-macuskbd For the native MacOSX server, use the original\n" "-macuskbd For the native MacOSX server, use the original\n"
" keystroke insertion code based on a US keyboard.\n" " keystroke insertion code based on a US keyboard.\n"
"\n" "\n"
"-gui [gui-opts] Start up a simple tcl/tk gui based on the the remote\n" "-gui [gui-opts] Start up a simple tcl/tk gui based on the remote\n"
" control options -remote/-query described below.\n" " control options -remote/-query described below.\n"
" Requires the \"wish\" program to be installed on the\n" " Requires the \"wish\" program to be installed on the\n"
" machine. \"gui-opts\" is not required: the default\n" " machine. \"gui-opts\" is not required: the default\n"
@ -4819,9 +4878,9 @@ void print_help(int mode) {
" x11vnc server. \"-R\" and \"-r\" are aliases for\n" " x11vnc server. \"-R\" and \"-r\" are aliases for\n"
" \"-remote\". After the remote control command is\n" " \"-remote\". After the remote control command is\n"
" sent to the running server the 'x11vnc -remote ...'\n" " sent to the running server the 'x11vnc -remote ...'\n"
" command exits. You can often use the -query command\n" " x11vnc command exits. You can often use the -query\n"
" (see below) to see if the x11vnc server processed your\n" " command (see below) to see if the x11vnc server\n"
" -remote command.\n" " processed your -remote command.\n"
"\n" "\n"
" The default communication channel is that of X\n" " The default communication channel is that of X\n"
" properties (specifically X11VNC_REMOTE), and so this\n" " properties (specifically X11VNC_REMOTE), and so this\n"
@ -5082,6 +5141,8 @@ void print_help(int mode) {
" nocursorpos enable -nocursorpos mode.\n" " nocursorpos enable -nocursorpos mode.\n"
" xwarp enable -xwarppointer mode.\n" " xwarp enable -xwarppointer mode.\n"
" noxwarp disable -xwarppointer mode.\n" " noxwarp disable -xwarppointer mode.\n"
" always_inject enable -always_inject mode.\n"
" noalways_inject disable -always_inject mode.\n"
" buttonmap:str set -buttonmap \"str\", empty to disable\n" " buttonmap:str set -buttonmap \"str\", empty to disable\n"
" dragging disable -nodragging mode.\n" " dragging disable -nodragging mode.\n"
" nodragging enable -nodragging mode.\n" " nodragging enable -nodragging mode.\n"
@ -5404,11 +5465,11 @@ void print_help(int mode) {
" nosetprimary clipboard noclipboard setclipboard\n" " nosetprimary clipboard noclipboard setclipboard\n"
" nosetclipboard seldir cursorshape nocursorshape\n" " nosetclipboard seldir cursorshape nocursorshape\n"
" cursorpos nocursorpos cursor_drag nocursor_drag cursor\n" " cursorpos nocursorpos cursor_drag nocursor_drag cursor\n"
" show_cursor noshow_cursor nocursor arrow xfixes\n" " show_cursor noshow_cursor nocursor arrow xfixes noxfixes\n"
" noxfixes xdamage noxdamage xd_area xd_mem alphacut\n" " xdamage noxdamage xd_area xd_mem alphacut alphafrac\n"
" alphafrac alpharemove noalpharemove alphablend\n" " alpharemove noalpharemove alphablend noalphablend\n"
" noalphablend xwarppointer xwarp noxwarppointer\n" " xwarppointer xwarp noxwarppointer noxwarp always_inject\n"
" noxwarp buttonmap dragging nodragging ncache_cr\n" " noalways_inject buttonmap dragging nodragging ncache_cr\n"
" noncache_cr ncache_no_moveraise noncache_no_moveraise\n" " noncache_cr ncache_no_moveraise noncache_no_moveraise\n"
" ncache_no_dtchange noncache_no_dtchange\n" " ncache_no_dtchange noncache_no_dtchange\n"
" ncache_no_rootpixmap noncache_no_rootpixmap\n" " ncache_no_rootpixmap noncache_no_rootpixmap\n"
@ -5830,7 +5891,7 @@ void nopassword_warning_msg(int gotloc) {
char str4[] = char str4[] =
"#@ @#\n" "#@ @#\n"
"#@ To disable this warning use the -nopw option, or put @#\n" "#@ To disable this warning use the -nopw option, or put @#\n"
"#@ the setting in your ~/.x11vncrc file. @#\n" "#@ 'nopw' on a line in your ~/.x11vncrc file. @#\n"
"#@ @#\n" "#@ @#\n"
"#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#\n" "#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#\n"
"###############################################################\n" "###############################################################\n"
@ -5845,7 +5906,7 @@ void nopassword_warning_msg(int gotloc) {
fprintf(stderr, "%s", str1); fprintf(stderr, "%s", str1);
fflush(stderr); fflush(stderr);
#if !PASSWD_REQUIRED #if !PASSWD_REQUIRED
usleep(1000 * 1000); usleep(750 * 1000);
#endif #endif
if (!quiet) { if (!quiet) {
fprintf(stderr, "%s", str2); fprintf(stderr, "%s", str2);
@ -5858,7 +5919,7 @@ void nopassword_warning_msg(int gotloc) {
} }
fflush(stderr); fflush(stderr);
#if !PASSWD_REQUIRED #if !PASSWD_REQUIRED
usleep(500 * 1000); usleep(250 * 1000);
#endif #endif
} }

@ -347,7 +347,7 @@ char *ident_username(rfbClientPtr client) {
if (ret > 0) { if (ret > 0) {
int i; int i;
char *q, *p; char *q, *p;
for (i=0; i < sizeof(msg); i++) { for (i=0; i < (int) sizeof(msg); i++) {
msg[i] = '\0'; msg[i] = '\0';
} }
usleep(250*1000); usleep(250*1000);

@ -1325,7 +1325,7 @@ xkbmodifiers[] For the KeySym bound to this (keycode,group,level) store
* loop over all possible (keycode, group, level) triples * loop over all possible (keycode, group, level) triples
* and record what we find for it: * and record what we find for it:
*/ */
if (debug_keyboard > 1) { if (debug_keyboard) {
rfbLog("initialize_xkb_modtweak: XKB keycode -> keysyms " rfbLog("initialize_xkb_modtweak: XKB keycode -> keysyms "
"mapping info:\n"); "mapping info:\n");
} }
@ -1502,7 +1502,7 @@ xkbmodifiers[] For the KeySym bound to this (keycode,group,level) store
xkbignore[kc][grp][lvl] = mods_save | ms2; xkbignore[kc][grp][lvl] = mods_save | ms2;
} }
if (debug_keyboard > 1) { if (debug_keyboard) {
char *str; char *str;
fprintf(stderr, " %03d G%d L%d mod=%s ", fprintf(stderr, " %03d G%d L%d mod=%s ",
kc, grp+1, lvl+1, bitprint(ms, 8)); kc, grp+1, lvl+1, bitprint(ms, 8));
@ -1560,7 +1560,7 @@ xkbmodifiers[] For the KeySym bound to this (keycode,group,level) store
} }
free(str); free(str);
} }
if (debug_keyboard > 1) { if (debug_keyboard) {
fprintf(stderr, "grp_max=%d lvl_max=%d\n", grp_max, lvl_max); fprintf(stderr, "grp_max=%d lvl_max=%d\n", grp_max, lvl_max);
} }
} }
@ -2898,9 +2898,9 @@ static void pipe_keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) {
t[1] = '\0'; t[1] = '\0';
if (sscanf(t, "%d", &butt) == 1) { if (sscanf(t, "%d", &butt) == 1) {
mask = 1<<(butt-1); mask = 1<<(butt-1);
pointer(mask, x, y, client); pointer_event(mask, x, y, client);
mask = 0; mask = 0;
pointer(mask, x, y, client); pointer_event(mask, x, y, client);
} }
b++; b++;
} }

@ -725,6 +725,11 @@ sub xfer_both {
} }
} }
sub fsleep {
my ($time) = @_;
select(undef, undef, undef, $time) if $time;
}
sub cleanup { sub cleanup {
close $client_listen if $client_listen; close $client_listen if $client_listen;
close $client_listen6 if $client_listen6; close $client_listen6 if $client_listen6;

@ -258,6 +258,7 @@ int cursor_drag_changes = CURSOR_DRAG;
int cursor_pos_updates = 1; /* cursor position updates -cursorpos */ int cursor_pos_updates = 1; /* cursor position updates -cursorpos */
int cursor_shape_updates = 1; /* cursor shape updates -nocursorshape */ int cursor_shape_updates = 1; /* cursor shape updates -nocursorshape */
int use_xwarppointer = 0; /* use XWarpPointer instead of XTestFake... */ int use_xwarppointer = 0; /* use XWarpPointer instead of XTestFake... */
int always_inject = 0; /* inject new mouse coordinates even if dx=dy=0 */
int show_dragging = 1; /* process mouse movement events */ int show_dragging = 1; /* process mouse movement events */
#ifndef WIREFRAME #ifndef WIREFRAME
#define WIREFRAME 1 #define WIREFRAME 1

@ -222,6 +222,7 @@ extern int cursor_drag_changes;
extern int cursor_pos_updates; extern int cursor_pos_updates;
extern int cursor_shape_updates; extern int cursor_shape_updates;
extern int use_xwarppointer; extern int use_xwarppointer;
extern int always_inject;
extern int show_dragging; extern int show_dragging;
extern int wireframe; extern int wireframe;
extern int wireframe_local; extern int wireframe_local;

@ -54,7 +54,7 @@ int pointer_queued_sent = 0;
void initialize_pointer_map(char *pointer_remap); void initialize_pointer_map(char *pointer_remap);
void do_button_mask_change(int mask, int button); void do_button_mask_change(int mask, int button);
void pointer(int mask, int x, int y, rfbClientPtr client); void pointer_event(int mask, int x, int y, rfbClientPtr client);
void initialize_pipeinput(void); void initialize_pipeinput(void);
int check_pipeinput(void); int check_pipeinput(void);
void update_x11_pointer_position(int x, int y); void update_x11_pointer_position(int x, int y);
@ -342,20 +342,11 @@ void update_x11_pointer_position(int x, int y) {
return; return;
#else #else
int rc; int rc;
static int watch_dx_dy = -1;
RAWFB_RET_VOID RAWFB_RET_VOID
if (watch_dx_dy == -1) {
if (getenv("X11VNC_WATCH_DX_DY")) {
watch_dx_dy = 1;
} else {
watch_dx_dy = 0;
}
}
X_LOCK; X_LOCK;
if (watch_dx_dy && cursor_x == x && cursor_y == y) { if (!always_inject && cursor_x == x && cursor_y == y) {
; ;
} else if (use_xwarppointer) { } else if (use_xwarppointer) {
/* /*
@ -668,7 +659,7 @@ static void pipe_pointer(int mask, int x, int y, rfbClientPtr client) {
* This may queue pointer events rather than sending them immediately * This may queue pointer events rather than sending them immediately
* to the X server. (see update_x11_pointer*()) * to the X server. (see update_x11_pointer*())
*/ */
void pointer(int mask, int x, int y, rfbClientPtr client) { void pointer_event(int mask, int x, int y, rfbClientPtr client) {
allowed_input_t input; allowed_input_t input;
int sent = 0, buffer_it = 0; int sent = 0, buffer_it = 0;
double now; double now;

@ -39,7 +39,7 @@ extern int pointer_queued_sent;
extern void initialize_pointer_map(char *pointer_remap); extern void initialize_pointer_map(char *pointer_remap);
extern void do_button_mask_change(int mask, int button); extern void do_button_mask_change(int mask, int button);
extern void pointer(int mask, int x, int y, rfbClientPtr client); extern void pointer_event(int mask, int x, int y, rfbClientPtr client);
extern int check_pipeinput(void); extern int check_pipeinput(void);
extern void initialize_pipeinput(void); extern void initialize_pipeinput(void);
extern void update_x11_pointer_position(int x, int y); extern void update_x11_pointer_position(int x, int y);

@ -3443,6 +3443,24 @@ char *process_remote_cmd(char *cmd, int stringonly) {
use_xwarppointer = 0; use_xwarppointer = 0;
goto done; goto done;
} }
if (strstr(p, "always_inject") == p) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, always_inject);
goto qry;
}
rfbLog("remote_cmd: turning on always_inject mode.\n");
always_inject = 1;
goto done;
}
if (strstr(p, "noalways_inject") == p) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, !always_inject);
goto qry;
}
rfbLog("remote_cmd: turning off always_inject mode.\n");
always_inject = 0;
goto done;
}
if (strstr(p, "buttonmap") == p) { if (strstr(p, "buttonmap") == p) {
COLON_CHECK("buttonmap:") COLON_CHECK("buttonmap:")
if (query) { if (query) {
@ -4426,9 +4444,9 @@ char *process_remote_cmd(char *cmd, int stringonly) {
p += strlen("ptr:"); p += strlen("ptr:");
rfbLog("remote_cmd: insert pointer event: %s\n", p); rfbLog("remote_cmd: insert pointer event: %s\n", p);
if (sscanf(p, "%d,%d,%d", &x, &y, &m) == 3) { if (sscanf(p, "%d,%d,%d", &x, &y, &m) == 3) {
pointer(m, x, y, NULL); pointer_event(m, x, y, NULL);
} else if (sscanf(p, "%d,%d", &x, &y) == 2) { } else if (sscanf(p, "%d,%d", &x, &y) == 2) {
pointer(m, x, y, NULL); pointer_event(m, x, y, NULL);
} else { } else {
rfbLog("remote_cmd: bad ptr:x,y,mask\n"); rfbLog("remote_cmd: bad ptr:x,y,mask\n");
} }
@ -4593,7 +4611,7 @@ char *process_remote_cmd(char *cmd, int stringonly) {
} else if (strstr(res, "GRAB_FAIL") && try < max_tries) { } else if (strstr(res, "GRAB_FAIL") && try < max_tries) {
rfbLog("bcx_xattach: failed grab check for '%s': %s. Retrying[%d]...\n", p, res, try); rfbLog("bcx_xattach: failed grab check for '%s': %s. Retrying[%d]...\n", p, res, try);
free(res); free(res);
pointer(0, dpy_x/2 + try, dpy_y/2 + try, NULL); pointer_event(0, dpy_x/2 + try, dpy_y/2 + try, NULL);
#if !NO_X11 #if !NO_X11
X_LOCK; X_LOCK;
XFlush_wr(dpy); XFlush_wr(dpy);

@ -3550,7 +3550,7 @@ int scan_for_updates(int count_only) {
fb_copy_in_progress = 0; fb_copy_in_progress = 0;
SCAN_FATAL(cs); SCAN_FATAL(cs);
if (use_threads && pointer_mode != 1) { if (use_threads && pointer_mode != 1) {
pointer(-1, 0, 0, NULL); pointer_event(-1, 0, 0, NULL);
} }
nap_check(tile_count); nap_check(tile_count);
return tile_count; return tile_count;
@ -3637,7 +3637,7 @@ if (tile_count) fprintf(stderr, "XX copytile: %.4f tile_count: %d\n", dnow() -
* tell the pointer handler it can process any queued * tell the pointer handler it can process any queued
* pointer events: * pointer events:
*/ */
pointer(-1, 0, 0, NULL); pointer_event(-1, 0, 0, NULL);
} }
if (blackouts) { if (blackouts) {

@ -1265,6 +1265,28 @@ void vnc_reflect_got_cursorshape(rfbClient *cl, int xhot, int yhot, int width, i
set_cursor(cursor_x, cursor_y, get_which_cursor()); set_cursor(cursor_x, cursor_y, get_which_cursor());
} }
rfbBool vnc_reflect_cursor_pos(rfbClient *cl, int x, int y) {
if (cl) {}
if (debug_pointer) {
rfbLog("vnc_reflect_cursor_pos: %d %d\n", x, y);
}
if (unixpw_in_progress) {
if (debug_pointer) {
rfbLog("vnc_reflect_cursor_pos: unixpw_in_progress%d\n", unixpw_in_progress);
}
return TRUE;
}
if (! all_clients_initialized()) {
rfbLog("vnc_reflect_cursor_pos: no send: uninitialized clients\n");
return TRUE; /* some clients initializing, cannot send */
}
cursor_position(x, y);
set_cursor(x, y, get_which_cursor());
return TRUE;
}
static void from_libvncclient_CopyRectangleFromRectangle(rfbClient* client, int src_x, int src_y, int w, int h, int dest_x, int dest_y) { static void from_libvncclient_CopyRectangleFromRectangle(rfbClient* client, int src_x, int src_y, int w, int h, int dest_x, int dest_y) {
int i,j; int i,j;
@ -1350,6 +1372,49 @@ rfbBool vnc_reflect_resize(rfbClient *cl) {
return cl->frameBuffer ? TRUE : FALSE; return cl->frameBuffer ? TRUE : FALSE;
} }
#ifdef rfbCredentialTypeX509
static rfbCredential* vnc_reflect_get_credential(rfbClient* client, int type) {
char *pass = getenv("X11VNC_REFLECT_PASSWORD");
char *user = getenv("X11VNC_REFLECT_USER");
char *cert = getenv("X11VNC_REFLECT_CACERT");
char *ccrl = getenv("X11VNC_REFLECT_CACRL");
char *clic = getenv("X11VNC_REFLECT_CLIENTCERT");
char *clik = getenv("X11VNC_REFLECT_CLIENTKEY");
int db = 0;
if (client) {}
if (db) fprintf(stderr, "type: %d\n", type);
#ifdef rfbCredentialTypeUser
if (type == rfbCredentialTypeUser) {
if (!pass && !user) {
return NULL;
} else {
rfbCredential *rc = (rfbCredential *) calloc(sizeof(rfbCredential), 1);
rc->userCredential.username = (user ? strdup(user) : NULL);
rc->userCredential.password = (pass ? strdup(pass) : NULL);
return rc;
}
}
#endif
if (type == rfbCredentialTypeX509) {
if (db) fprintf(stderr, "cert: %s\n", cert);
if (db) fprintf(stderr, "ccrl: %s\n", ccrl);
if (db) fprintf(stderr, "clic: %s\n", clic);
if (db) fprintf(stderr, "clik: %s\n", clik);
if (!cert && !ccrl && !clic && !clik) {
return NULL;
} else {
rfbCredential *rc = (rfbCredential *) calloc(sizeof(rfbCredential), 1);
rc->x509Credential.x509CACertFile = (cert ? strdup(cert) : NULL);
rc->x509Credential.x509CACrlFile = (ccrl ? strdup(ccrl) : NULL);
rc->x509Credential.x509ClientCertFile = (clic ? strdup(clic) : NULL);
rc->x509Credential.x509ClientKeyFile = (clik ? strdup(clik) : NULL);
return rc;
}
}
return NULL;
}
#endif
static char* vnc_reflect_get_password(rfbClient* client) { static char* vnc_reflect_get_password(rfbClient* client) {
char *q, *p, *str = getenv("X11VNC_REFLECT_PASSWORD"); char *q, *p, *str = getenv("X11VNC_REFLECT_PASSWORD");
int len = 110; int len = 110;
@ -1408,17 +1473,32 @@ char *vnc_reflect_guess(char *str, char **raw_fb_addr) {
} }
client->appData.useRemoteCursor = TRUE; client->appData.useRemoteCursor = TRUE;
client->canHandleNewFBSize = TRUE;
client->HandleCursorPos = vnc_reflect_cursor_pos;
client->GotFrameBufferUpdate = vnc_reflect_got_update;
client->MallocFrameBuffer = vnc_reflect_resize;
client->Bell = vnc_reflect_bell; client->Bell = vnc_reflect_bell;
#if 0
client->SoftCursorLockArea = NULL;
client->SoftCursorUnlockScreen = NULL;
client->FinishedFrameBufferUpdate = NULL;
client->HandleKeyboardLedState = NULL;
client->HandleTextChat = NULL;
#endif
client->GotXCutText = vnc_reflect_recv_cuttext; client->GotXCutText = vnc_reflect_recv_cuttext;
client->GotCopyRect = vnc_reflect_got_copyrect;
client->GotCursorShape = vnc_reflect_got_cursorshape; client->GotCursorShape = vnc_reflect_got_cursorshape;
client->MallocFrameBuffer = vnc_reflect_resize; client->GotCopyRect = vnc_reflect_got_copyrect;
client->canHandleNewFBSize = TRUE;
client->GotFrameBufferUpdate = vnc_reflect_got_update;
if (getenv("X11VNC_REFLECT_PASSWORD")) { if (getenv("X11VNC_REFLECT_PASSWORD")) {
client->GetPassword = vnc_reflect_get_password; client->GetPassword = vnc_reflect_get_password;
} }
#ifdef rfbCredentialTypeX509
client->GetCredential = NULL;
if (0 || getenv("LIBVNCCLIENT_GET_CREDENTIAL")) {
client->GetCredential = vnc_reflect_get_credential;
}
#endif
if (first) { if (first) {
argv[argc++] = "x11vnc_rawfb_vnc"; argv[argc++] = "x11vnc_rawfb_vnc";
@ -3538,7 +3618,7 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
/* event callbacks: */ /* event callbacks: */
screen->newClientHook = new_client; screen->newClientHook = new_client;
screen->kbdAddEvent = keyboard; screen->kbdAddEvent = keyboard;
screen->ptrAddEvent = pointer; screen->ptrAddEvent = pointer_event;
screen->setXCutText = xcut_receive; screen->setXCutText = xcut_receive;
screen->setTranslateFunction = set_xlate_wrapper; screen->setTranslateFunction = set_xlate_wrapper;

@ -4009,7 +4009,11 @@ void accept_openssl(int mode, int presock) {
rfbLog("helper[%d]:\n", pid); rfbLog("helper[%d]:\n", pid);
rfbLog("***********************************************************\n"); rfbLog("***********************************************************\n");
rfbLog("SSL: WARNING CLIENT ASKED FOR NONEXISTENT 'VncViewer.class'\n"); rfbLog("SSL: WARNING CLIENT ASKED FOR NONEXISTENT 'VncViewer.class'\n");
rfbLog("SSL: USER NEEDS TO **RESTART** HIS WEB BROWSER.\n"); rfbLog("SSL: USER NEEDS TO MAKE SURE THE JAVA PLUGIN IS INSTALLED\n");
rfbLog("SSL: AND WORKING PROPERLY (e.g. a test-java-plugin page.)\n");
rfbLog("SSL: AND/OR USER NEEDS TO **RESTART** HIS WEB BROWSER.\n");
rfbLog("SSL: SOMETIMES THE BROWSER 'REMEMBERS' FAILED APPLET DOWN-\n");
rfbLog("SSL: LOADS AND RESTARTING IT IS THE ONLY WAY TO FIX THINGS.\n");
rfbLog("***********************************************************\n"); rfbLog("***********************************************************\n");
rfbLog("\n"); rfbLog("\n");
} }

@ -1151,7 +1151,7 @@ char find_display[] =
" list=\"$list \"`xauth list | awk '{print $1}' | grep /unix | grep \"^${host}\" | sed -e 's/^.*:/:/' | sort -n | uniq`\n" " list=\"$list \"`xauth list | awk '{print $1}' | grep /unix | grep \"^${host}\" | sed -e 's/^.*:/:/' | sort -n | uniq`\n"
"\n" "\n"
" # check for gdm and kdm non-NFS cookies in /tmp: (and now /var/run/gdm)\n" " # check for gdm and kdm non-NFS cookies in /tmp: (and now /var/run/gdm)\n"
" for xa in /tmp/.gdm* /tmp/.Xauth* /var/run/gdm/auth-for-*/database /var/run/gdm/auth-cookie-*-for-*\n" " for xa in /tmp/.gdm* /tmp/.Xauth* /var/run/gdm*/auth-for-*/database /var/run/gdm*/auth-cookie-*-for-*\n"
" do\n" " do\n"
" # try to be somewhat careful about the real owner of the file:\n" " # try to be somewhat careful about the real owner of the file:\n"
" if [ \"X$am_root\" = \"X1\" ]; then\n" " if [ \"X$am_root\" = \"X1\" ]; then\n"
@ -1307,16 +1307,34 @@ char find_display[] =
" if [ \"X$p\" = \"X\" ]; then\n" " if [ \"X$p\" = \"X\" ]; then\n"
" continue\n" " continue\n"
" fi\n" " fi\n"
"\n"
" env \"$myenv\" xdpyinfo -display \"$p\" >/dev/null 2>&1\n" " env \"$myenv\" xdpyinfo -display \"$p\" >/dev/null 2>&1\n"
" rc=$?\n" " rc=$?\n"
" if [ $rc != 0 -a \"X$XAUTHLOCALHOSTNAME\" = \"X\" ]; then\n" "\n"
" if [ $rc != 0 ]; then\n"
" # guard against libxcb/desktop silliness: \n" " # guard against libxcb/desktop silliness: \n"
" env \"$myenv\" XAUTHLOCALHOSTNAME=localhost xdpyinfo -display \"$p\" >/dev/null 2>&1\n" " xalhn_save=$XAUTHLOCALHOSTNAME\n"
" rc=$?\n" "\n"
" if [ $rc = 0 ]; then\n" " if [ \"X$xalhn_save\" != \"X\" ]; then\n"
" # better export it for cmds below...\n" " # try it again unset\n"
" XAUTHLOCALHOSTNAME=localhost\n" " unset XAUTHLOCALHOSTNAME\n"
" export XAUTHLOCALHOSTNAME\n" " env \"$myenv\" xdpyinfo -display \"$p\" >/dev/null 2>&1\n"
" rc=$?\n"
" if [ $rc != 0 ]; then\n"
" # did not work; put it back\n"
" XAUTHLOCALHOSTNAME=$xalhn_save\n"
" export XAUTHLOCALHOSTNAME\n"
" fi\n"
" fi\n"
" if [ $rc != 0 -a \"X$xalhn_save\" != \"Xlocalhost\" ]; then\n"
" # try it again with localhost\n"
" env \"$myenv\" XAUTHLOCALHOSTNAME=localhost xdpyinfo -display \"$p\" >/dev/null 2>&1\n"
" rc=$?\n"
" if [ $rc = 0 ]; then\n"
" # better export it for cmds below...\n"
" XAUTHLOCALHOSTNAME=localhost\n"
" export XAUTHLOCALHOSTNAME\n"
" fi\n"
" fi\n" " fi\n"
" fi\n" " fi\n"
"\n" "\n"
@ -1460,11 +1478,14 @@ char create_display[] =
"\n" "\n"
"findfree() {\n" "findfree() {\n"
" try=20\n" " try=20\n"
" sry=99\n" " dpymax=79\n"
" if [ \"X$X11VNC_CREATE_STARTING_DISPLAY_NUMBER\" != \"X\" ]; then\n" " if [ \"X$X11VNC_CREATE_STARTING_DISPLAY_NUMBER\" != \"X\" ]; then\n"
" try=$X11VNC_CREATE_STARTING_DISPLAY_NUMBER\n" " try=$X11VNC_CREATE_STARTING_DISPLAY_NUMBER\n"
" sry=`expr $try + 99`\n"
" fi\n" " fi\n"
" if [ \"X$X11VNC_CREATE_MAX_DISPLAYS\" != \"X\" ]; then\n"
" dpymax=$X11VNC_CREATE_MAX_DISPLAYS\n"
" fi\n"
" sry=`expr $try + $dpymax`\n"
" n=\"\"\n" " n=\"\"\n"
" nsout=\"\"\n" " nsout=\"\"\n"
" if [ \"X$have_netstat\" != \"X\" ]; then\n" " if [ \"X$have_netstat\" != \"X\" ]; then\n"

@ -238,6 +238,7 @@ Pointer
buttonmap: buttonmap:
-- --
xwarppointer xwarppointer
always_inject
Misc Misc
=GD-C:full,icon,tray WindowView: =GD-C:full,icon,tray WindowView:

@ -249,6 +249,7 @@ char gui_code[] = "";
" buttonmap:\n" " buttonmap:\n"
" --\n" " --\n"
" xwarppointer\n" " xwarppointer\n"
" always_inject\n"
"\n" "\n"
"Misc\n" "Misc\n"
" =GD-C:full,icon,tray WindowView:\n" " =GD-C:full,icon,tray WindowView:\n"

@ -1512,6 +1512,52 @@ static void progress_skippy(void) {
usleep(50*1000); usleep(50*1000);
} }
void check_unixpw_userprefs(void) {
char *prefs = getenv("FD_USERPREFS");
if (keep_unixpw_user == NULL || keep_unixpw_opts == NULL) {
return;
}
#if LIBVNCSERVER_HAVE_PWD_H
if (prefs != NULL && !strchr(prefs, '/')) {
struct passwd *pw = getpwnam(keep_unixpw_user);
if (pw != NULL) {
char *file;
FILE *f;
file = (char *) malloc(strlen(pw->pw_dir) + 1 + strlen(prefs) + 1);
sprintf(file, "%s/%s", pw->pw_dir, prefs);
f = fopen(file, "r");
if (f) {
char *t, *q, buf[1024];
memset(buf, 0, sizeof(buf));
fgets(buf, 1024, f);
fclose(f);
q = strchr(buf, '\n');
if (q) *q = '\0';
q = strchr(buf, '\r');
if (q) *q = '\0';
rfbLog("read user prefs %s: %s\n", file, buf);
if (buf[0] == '#') buf[0] = '\0';
t = (char *) malloc(strlen(keep_unixpw_opts) + 1 + strlen(buf) + 1);
sprintf(t, "%s,%s", keep_unixpw_opts, buf);
free(keep_unixpw_opts);
keep_unixpw_opts = t;
} else {
rfbLog("could not read user prefs %s\n", file);
rfbLogPerror("fopen");
}
free(file);
}
}
#endif
}
void unixpw_verify_screen(char *user, char *pass) { void unixpw_verify_screen(char *user, char *pass) {
int x, y; int x, y;
@ -1569,7 +1615,9 @@ if (db) fprintf(stderr, "unixpw_verify: '%s' '%s'\n", user, db > 1 ? pass : "***
} else { } else {
keep_unixpw_opts = strdup(""); keep_unixpw_opts = strdup("");
} }
check_unixpw_userprefs();
} }
if (colon) *colon = ':'; if (colon) *colon = ':';
return; return;
@ -1759,6 +1807,7 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) {
} else { } else {
keep_unixpw_opts = strdup(""); keep_unixpw_opts = strdup("");
} }
check_unixpw_userprefs();
} }
unixpw_system_greeter_active = 2; unixpw_system_greeter_active = 2;
set_env("X11VNC_XDM_ONLY", "1"); set_env("X11VNC_XDM_ONLY", "1");

@ -1985,8 +1985,9 @@ static char *build_create_cmd(char *cmd, int *saw_xdmcp, char *usslpeer, char *t
fdxdmcpif[0] = '\0'; fdxdmcpif[0] = '\0';
cdout[0] = '\0'; cdout[0] = '\0';
if (unixpw && keep_unixpw_opts && keep_unixpw_opts[0] != '\0') { if (unixpw && keep_unixpw_opts && !getenv("X11VNC_NO_UNIXPW_OPTS")) {
char *q, *p, *t = strdup(keep_unixpw_opts); char *q, *p, *t = strdup(keep_unixpw_opts);
if (strstr(t, "gnome")) { if (strstr(t, "gnome")) {
sprintf(fdsess, "gnome"); sprintf(fdsess, "gnome");
} else if (strstr(t, "kde")) { } else if (strstr(t, "kde")) {

@ -3008,7 +3008,7 @@ if (db) fprintf(stderr, "check_xrecord: BUTTON-UP-KEEP-GOING: %.3f/%.3f %d/%d %
pointer_queued_sent = 0; pointer_queued_sent = 0;
last_x = cursor_x; last_x = cursor_x;
last_y = cursor_y; last_y = cursor_y;
pointer(-1, 0, 0, NULL); pointer_event(-1, 0, 0, NULL);
pointer_flush_delay = 0.0; pointer_flush_delay = 0.0;
if (xrecording && pointer_queued_sent && button_mask_save && if (xrecording && pointer_queued_sent && button_mask_save &&
@ -4565,7 +4565,7 @@ if (db) fprintf(stderr, "INTERIOR\n");
/* -threads support for check_wireframe() is rough... crash? */ /* -threads support for check_wireframe() is rough... crash? */
if (use_threads) { if (use_threads) {
/* purge any stored up pointer events: */ /* purge any stored up pointer events: */
pointer(-1, 0, 0, NULL); pointer_event(-1, 0, 0, NULL);
} }
if (cursor_noshape_updates_clients(screen)) { if (cursor_noshape_updates_clients(screen)) {

@ -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" "May 2010" "x11vnc " "User Commands" .TH X11VNC "1" "September 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.11, lastmod: 2010-05-08 version: 0.9.13, lastmod: 2010-09-10
.SH SYNOPSIS .SH SYNOPSIS
.B x11vnc .B x11vnc
[OPTION]... [OPTION]...
@ -487,6 +487,12 @@ disconnects, opposite of \fB-forever.\fR This is the Default.
.IP .IP
Keep listening for more connections rather than exiting Keep listening for more connections rather than exiting
as soon as the first client(s) disconnect. Same as \fB-many\fR as soon as the first client(s) disconnect. Same as \fB-many\fR
.IP
To get the standard non-shared VNC behavior where when
a new VNC client connects the existing VNC client is
dropped use: \fB-nevershared\fR \fB-forever\fR This method can
also be used to guard against hung TCP connections that
do not go away.
.PP .PP
\fB-loop\fR \fB-loop\fR
.IP .IP
@ -617,6 +623,11 @@ Rendezvous, Bonjour). Depending on your setup, you
may need to start avahi-daemon and open udp port 5353 may need to start avahi-daemon and open udp port 5353
in your firewall. in your firewall.
.IP .IP
You can set X11VNC_AVAHI_NAME, X11VNC_AVAHI_HOST,
and/or X11VNC_AVAHI_PORT environment variables
to override the default values. For example:
\fB-env\fR X11VNC_AVAHI_NAME=wally
.IP
If the avahi API cannot be found at build time, a helper If the avahi API cannot be found at build time, a helper
program like avahi- program like avahi-
.IR publish (1) .IR publish (1)
@ -1329,7 +1340,7 @@ virtual terminal of the X server.
.IP .IP
Have the FINDDISPLAY program list all of your displays Have the FINDDISPLAY program list all of your displays
(i.e. all the X displays on the local machine that you (i.e. all the X displays on the local machine that you
have access rights to). have access rights to). x11vnc then exits.
.PP .PP
\fB-findauth\fR \fI[disp]\fR \fB-findauth\fR \fI[disp]\fR
.IP .IP
@ -1337,7 +1348,7 @@ Apply the \fB-find/-finddpy\fR heuristics to try to guess
the XAUTHORITY file for DISPLAY 'disp'. If 'disp' the XAUTHORITY file for DISPLAY 'disp'. If 'disp'
is not supplied, then the value in the \fB-display\fR on is not supplied, then the value in the \fB-display\fR on
the cmdline is used; failing that $DISPLAY is used; the cmdline is used; failing that $DISPLAY is used;
and failing that ":0" is used. and failing that ":0" is used. x11vnc then exits.
.IP .IP
If nothing is printed out, that means no XAUTHORITY was If nothing is printed out, that means no XAUTHORITY was
found for 'disp'; i.e. failure. If "XAUTHORITY=" found for 'disp'; i.e. failure. If "XAUTHORITY="
@ -1611,8 +1622,19 @@ be ignored if the FD_TAG env. var. is already set or
if the viewer-side supplied value is not completely if the viewer-side supplied value is not completely
composed of alphanumeric or '_' or '-' characters. composed of alphanumeric or '_' or '-' characters.
.IP .IP
User preferences file: Instead of having the user type
in geom=WxH,... etc. every time he logs in to find
or create his X session, if you set FD_USERPREFS to
a string that does not contain the "/" character,
then the user's home directory is prepended to that
string and if the file exists its first line is read
and appended to any options he supplied at the login:
prompt. For example \fB-env\fR FD_USERPREFS=.x11vnc_create
and the user put "geom=1600x1200" in his
~/.x11vnc_create file.
.IP
To troubleshoot the FINDCREATEDISPLAY mechanism, To troubleshoot the FINDCREATEDISPLAY mechanism,
set the following env. var. to an ouput log file, set the following env. var. to an output log file,
e.g \fB-env\fR CREATE_DISPLAY_OUTPUT=/tmp/mydebug.txt e.g \fB-env\fR CREATE_DISPLAY_OUTPUT=/tmp/mydebug.txt
.IP .IP
To disable the option setting set the environment To disable the option setting set the environment
@ -1706,6 +1728,8 @@ The option "\fB-create\fR" is an alias for this mode.
.IP .IP
It will start looking for an open display number at :20 It will start looking for an open display number at :20
Override via X11VNC_CREATE_STARTING_DISPLAY_NUMBER=n Override via X11VNC_CREATE_STARTING_DISPLAY_NUMBER=n
By default 80 X displays are allowed (i.e. going to :99)
Override via X11VNC_CREATE_MAX_DISPLAYS=n
.IP .IP
By default FINDCREATEDISPLAY will try Xvfb and then By default FINDCREATEDISPLAY will try Xvfb and then
Xdummy: Xdummy:
@ -2268,6 +2292,7 @@ commands 'openssl ca \fB-revoke\fR ...' and 'openssl ca
.IP .IP
Generate your own Certificate Authority private key, Generate your own Certificate Authority private key,
certificate, and other files in directory [dir]. certificate, and other files in directory [dir].
x11vnc then exits.
.IP .IP
If [dir] is not supplied, a \fB-ssldir\fR setting is used, If [dir] is not supplied, a \fB-ssldir\fR setting is used,
or otherwise ~/.vnc/certs is used. or otherwise ~/.vnc/certs is used.
@ -2279,7 +2304,7 @@ program must be installed on the system and available
in PATH. in PATH.
.IP .IP
After the CA files and directories are created the After the CA files and directories are created the
command exits; the VNC server is not run. x11vnc command exits; the VNC server is not run.
.IP .IP
You will be prompted for information to put into the CA You will be prompted for information to put into the CA
certificate. The info does not have to be accurate just certificate. The info does not have to be accurate just
@ -2311,8 +2336,8 @@ key pair signed by the CA created previously with
program must be installed program must be installed
on the system and available in PATH. on the system and available in PATH.
.IP .IP
After the Certificate is generated the command exits; After the Certificate is generated x11vnc exits; the
the VNC server is not run. VNC server is not run.
.IP .IP
The type of key to be generated is the string \fItype\fR. The type of key to be generated is the string \fItype\fR.
It is either "server" (i.e. for use by x11vnc) or It is either "server" (i.e. for use by x11vnc) or
@ -2431,7 +2456,7 @@ x11vnc \fB-sslGenCert\fR client roger
scp ~/.vnc/certs/clients/roger.pem somehost:. scp ~/.vnc/certs/clients/roger.pem somehost:.
rm ~/.vnc/certs/clients/roger.pem rm ~/.vnc/certs/clients/roger.pem
.IP .IP
x11vnc is then started with the the option \fB-sslverify\fR x11vnc is then started with the option \fB-sslverify\fR
~/.vnc/certs/clients/roger.crt (or simply \fB-sslverify\fR ~/.vnc/certs/clients/roger.crt (or simply \fB-sslverify\fR
roger), and on the viewer user on somehost could do roger), and on the viewer user on somehost could do
for example: for example:
@ -2460,7 +2485,7 @@ The
.IR openssl (1) .IR openssl (1)
program must be installed on the system program must be installed on the system
and available in PATH. After the Key file is encrypted and available in PATH. After the Key file is encrypted
the command exits; the VNC server is not run. the x11vnc command exits; the VNC server is not run.
.IP .IP
Examples: Examples:
x11vnc \fB-sslEncKey\fR /path/to/foo.pem x11vnc \fB-sslEncKey\fR /path/to/foo.pem
@ -2476,6 +2501,9 @@ The
program must be in PATH. Basically the program must be in PATH. Basically the
command "openssl x509 \fB-text"\fR is run on the pem. command "openssl x509 \fB-text"\fR is run on the pem.
.IP .IP
After the info is printed the x11vnc command exits;
the VNC server is not run.
.IP
The "SAVE" notation described under \fB-ssl\fR applies The "SAVE" notation described under \fB-ssl\fR applies
as well. as well.
.IP .IP
@ -2503,15 +2531,15 @@ also be lowercase, e.g. "list".
\fB-sslDelCert\fR \fIpem\fR \fB-sslDelCert\fR \fIpem\fR
.IP .IP
Prompts you to delete all .crt .pem .key .req files Prompts you to delete all .crt .pem .key .req files
associated with [pem]. "SAVE" and lookups as in associated with [pem]. x11vnc then exits. "SAVE"
\fB-sslCertInfo\fR apply as well. and lookups as in \fB-sslCertInfo\fR apply as well.
.PP .PP
\fB-sslScripts\fR \fB-sslScripts\fR
.IP .IP
Prints out both the 'genCA' and 'genCert' x11vnc Prints out both the 'genCA' and 'genCert' x11vnc
openssl wrapper scripts for you to examine, modify, etc. openssl wrapper scripts for you to examine, modify, etc.
The scripts are printed to stdout and then the program The scripts are printed to stdout and then the x11vnc
exits. program exits.
.PP .PP
\fB-stunnel\fR \fI[pem]\fR \fB-stunnel\fR \fI[pem]\fR
.IP .IP
@ -3142,6 +3170,9 @@ endianness. Ignored unless \fB-noshm\fR is set.
Do not use the new copy_tiles() framebuffer mechanism, Do not use the new copy_tiles() framebuffer mechanism,
just use 1 shm tile for polling. Limits shm segments just use 1 shm tile for polling. Limits shm segments
used to 3. used to 3.
.IP
To disable any automatic shm reduction set the
env. var. X11VNC_NO_LIMIT_SHM.
.PP .PP
\fB-solid\fR \fI[color]\fR \fB-solid\fR \fI[color]\fR
.IP .IP
@ -3457,7 +3488,7 @@ Nevertheless your capitalized letters come in over
the wire and are applied correctly to the x11vnc-side the wire and are applied correctly to the x11vnc-side
X server. Note this mode probably won't do what you X server. Note this mode probably won't do what you
want in \fB-nomodtweak\fR mode. Also, a kludge for KP_n want in \fB-nomodtweak\fR mode. Also, a kludge for KP_n
digits is always done it this mode: they are mapped to digits is always done in this mode: they are mapped to
regular digit keysyms. See also \fB-capslock\fR above. regular digit keysyms. See also \fB-capslock\fR above.
The default is \fB-noskip_lockkeys.\fR The default is \fB-noskip_lockkeys.\fR
.PP .PP
@ -3818,6 +3849,36 @@ It is also sometimes needed on XINERAMA displays and is
enabled by default if XINERAMA is found to be active. enabled by default if XINERAMA is found to be active.
To prevent this, use \fB-noxwarppointer.\fR To prevent this, use \fB-noxwarppointer.\fR
.PP .PP
\fB-always_inject\fR
.IP
Even if there is no displacement (dx = dy = 0) for a
VNC mouse event force the pointer to the indicated x,y
position anyway. Recent (2009) gui toolkits (gnome)
have problems with x11vnc's original mouse input
injection method. So x11vnc's mouse input injection
method has been modified. To regain the OLD behavior
use this option: \fB-always_inject.\fR Then x11vnc will
always force positioning the mouse to the x,y position
even if that position has not changed since the previous
VNC input event.
.IP
The first place this problem was noticed was in gnome
terminal: if you pressed and released mouse button 3, a
menu was posted and then its first element 'New Terminal
Window' was activated. This was because x11vnc injected
the mouse position twice: once on ButtonPress and again
on ButtonRelease. The toolkit interpreted the 2nd one
as mouse motion even though the mouse hadn't moved.
So now by default x11vnc tries to avoid injecting the
2nd one.
.IP
Note that with the new default x11vnc will be oblivious
to applications moving the pointer (warping) or the
user at the physical display moving it. So it might,
e.g., inject ButtonRelease at the wrong position.
If this (or similar scenarios) causes problems in your
environment, specify \fB-always_inject\fR for the old method.
.PP
\fB-buttonmap\fR \fIstring\fR \fB-buttonmap\fR \fIstring\fR
.IP .IP
String to remap mouse buttons. Format: IJK-LMN, this String to remap mouse buttons. Format: IJK-LMN, this
@ -4336,7 +4397,7 @@ tiny window for XGrabServer deadlock. This is only if
the whole-server grabbing application expects mouse or the whole-server grabbing application expects mouse or
keyboard input before releasing the grab. It is usually keyboard input before releasing the grab. It is usually
a window manager that does this. x11vnc takes care to a window manager that does this. x11vnc takes care to
avoid the the problem, but if caught x11vnc will freeze. avoid the problem, but if caught x11vnc will freeze.
Without \fB-grab_buster,\fR the only solution is to go the Without \fB-grab_buster,\fR the only solution is to go the
physical display and give it some input to satisfy the physical display and give it some input to satisfy the
grabbing app. Or manually kill and restart the window grabbing app. Or manually kill and restart the window
@ -5334,7 +5395,7 @@ keystroke insertion code based on a US keyboard.
.PP .PP
\fB-gui\fR \fI[gui-opts]\fR \fB-gui\fR \fI[gui-opts]\fR
.IP .IP
Start up a simple tcl/tk gui based on the the remote Start up a simple tcl/tk gui based on the remote
control options \fB-remote/-query\fR described below. control options \fB-remote/-query\fR described below.
Requires the "wish" program to be installed on the Requires the "wish" program to be installed on the
machine. "gui-opts" is not required: the default machine. "gui-opts" is not required: the default
@ -5466,9 +5527,9 @@ Remotely control some aspects of an already running
x11vnc server. "\fB-R\fR" and "\fB-r\fR" are aliases for x11vnc server. "\fB-R\fR" and "\fB-r\fR" are aliases for
"\fB-remote\fR". After the remote control command is "\fB-remote\fR". After the remote control command is
sent to the running server the 'x11vnc \fB-remote\fR ...' sent to the running server the 'x11vnc \fB-remote\fR ...'
command exits. You can often use the \fB-query\fR command x11vnc command exits. You can often use the \fB-query\fR
(see below) to see if the x11vnc server processed your command (see below) to see if the x11vnc server
\fB-remote\fR command. processed your \fB-remote\fR command.
.IP .IP
The default communication channel is that of X The default communication channel is that of X
properties (specifically X11VNC_REMOTE), and so this properties (specifically X11VNC_REMOTE), and so this
@ -5886,6 +5947,10 @@ xwarp enable \fB-xwarppointer\fR mode.
.IP .IP
noxwarp disable \fB-xwarppointer\fR mode. noxwarp disable \fB-xwarppointer\fR mode.
.IP .IP
always_inject enable \fB-always_inject\fR mode.
.IP
noalways_inject disable \fB-always_inject\fR mode.
.IP
buttonmap:str set \fB-buttonmap\fR "str", empty to disable buttonmap:str set \fB-buttonmap\fR "str", empty to disable
.IP .IP
dragging disable \fB-nodragging\fR mode. dragging disable \fB-nodragging\fR mode.
@ -6376,11 +6441,11 @@ nobell sendbell sel nosel primary noprimary setprimary
nosetprimary clipboard noclipboard setclipboard nosetprimary clipboard noclipboard setclipboard
nosetclipboard seldir cursorshape nocursorshape nosetclipboard seldir cursorshape nocursorshape
cursorpos nocursorpos cursor_drag nocursor_drag cursor cursorpos nocursorpos cursor_drag nocursor_drag cursor
show_cursor noshow_cursor nocursor arrow xfixes show_cursor noshow_cursor nocursor arrow xfixes noxfixes
noxfixes xdamage noxdamage xd_area xd_mem alphacut xdamage noxdamage xd_area xd_mem alphacut alphafrac
alphafrac alpharemove noalpharemove alphablend alpharemove noalpharemove alphablend noalphablend
noalphablend xwarppointer xwarp noxwarppointer xwarppointer xwarp noxwarppointer noxwarp always_inject
noxwarp buttonmap dragging nodragging ncache_cr noalways_inject buttonmap dragging nodragging ncache_cr
noncache_cr ncache_no_moveraise noncache_no_moveraise noncache_cr ncache_no_moveraise noncache_no_moveraise
ncache_no_dtchange noncache_no_dtchange ncache_no_dtchange noncache_no_dtchange
ncache_no_rootpixmap noncache_no_rootpixmap ncache_no_rootpixmap noncache_no_rootpixmap

@ -992,6 +992,9 @@ static int limit_shm(void) {
if (UT.sysname == NULL) { if (UT.sysname == NULL) {
return 0; return 0;
} }
if (getenv("X11VNC_NO_LIMIT_SHM")) {
return 0;
}
if (!strcmp(UT.sysname, "SunOS")) { if (!strcmp(UT.sysname, "SunOS")) {
char *r = UT.release; char *r = UT.release;
if (*r == '5' && *(r+1) == '.') { if (*r == '5' && *(r+1) == '.') {
@ -1554,6 +1557,7 @@ static void print_settings(int try_http, int bg, char *gui_str) {
fprintf(stderr, " cursorshape:%d\n", cursor_shape_updates); fprintf(stderr, " cursorshape:%d\n", cursor_shape_updates);
fprintf(stderr, " cursorpos: %d\n", cursor_pos_updates); fprintf(stderr, " cursorpos: %d\n", cursor_pos_updates);
fprintf(stderr, " xwarpptr: %d\n", use_xwarppointer); fprintf(stderr, " xwarpptr: %d\n", use_xwarppointer);
fprintf(stderr, " alwaysinj: %d\n", always_inject);
fprintf(stderr, " buttonmap: %s\n", pointer_remap fprintf(stderr, " buttonmap: %s\n", pointer_remap
? pointer_remap : "null"); ? pointer_remap : "null");
fprintf(stderr, " dragging: %d\n", show_dragging); fprintf(stderr, " dragging: %d\n", show_dragging);
@ -2280,7 +2284,7 @@ int main(int argc, char* argv[]) {
} }
if (!strcmp(arg, "-reflect")) { if (!strcmp(arg, "-reflect")) {
CHECK_ARGC CHECK_ARGC
raw_fb_str = (char *) malloc(4 + strlen(argv[i]) + 1); raw_fb_str = (char *) malloc(4 + strlen(argv[i+1]) + 1);
sprintf(raw_fb_str, "vnc:%s", argv[++i]); sprintf(raw_fb_str, "vnc:%s", argv[++i]);
shared = 1; shared = 1;
continue; continue;
@ -3397,6 +3401,10 @@ int main(int argc, char* argv[]) {
got_noxwarppointer = 1; got_noxwarppointer = 1;
continue; continue;
} }
if (!strcmp(arg, "-always_inject")) {
always_inject = 1;
continue;
}
if (!strcmp(arg, "-buttonmap")) { if (!strcmp(arg, "-buttonmap")) {
CHECK_ARGC CHECK_ARGC
pointer_remap = strdup(argv[++i]); pointer_remap = strdup(argv[++i]);

@ -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.11 lastmod: 2010-05-08"; char lastmod[] = "0.9.13 lastmod: 2010-09-10";
/* X display info */ /* X display info */

@ -148,25 +148,34 @@ void initialize_clipboard_atom(void) {
18 gdm_string: Gdm-simple-greeter 18 gdm_string: Gdm-simple-greeter
24 gdm_string: metacity 24 gdm_string: metacity
36 gdm_string: gdm-simple-greeter 36 gdm_string: gdm-simple-greeter
kdmgreet
Kdmgreet
*/ */
static int gdm_string(char *str) { static int dm_string(char *str) {
char *s = getenv("DEBUG_WM_RUNNING");
if (str == NULL) { if (str == NULL) {
return 0; return 0;
} }
if (str[0] == '\0') { if (str[0] == '\0') {
return 0; return 0;
} }
if (0) fprintf(stderr, "gdm_string: %s\n", str); if (0) fprintf(stderr, "dm_string: %s\n", str);
if (strstr(str, "gdm-") == str || strstr(str, "Gdm-") == str) { if (strstr(str, "gdm-") == str || strstr(str, "Gdm-") == str) {
if (strstr(str, "-greeter") != NULL) { if (strstr(str, "-greeter") != NULL) {
if (s) rfbLog("dm_string: %s\n", str);
return 1; return 1;
} }
} }
if (!strcmp(str, "kdmgreet") || !strcmp(str, "Kdmgreet")) {
if (s) rfbLog("dm_string: %s\n", str);
return 1;
}
return 0; return 0;
} }
static int gdm_still_running(void) { static int dm_still_running(void) {
#if NO_X11 #if NO_X11
return 0; return 0;
#else #else
@ -195,7 +204,7 @@ static int gdm_still_running(void) {
char *name = NULL; char *name = NULL;
Window w = winlist[i]; Window w = winlist[i];
if (XFetchName(dpy, w, &name) && name != NULL) { if (XFetchName(dpy, w, &name) && name != NULL) {
saw_gdm_name += gdm_string(name); saw_gdm_name += dm_string(name);
XFree_wr(name); XFree_wr(name);
} }
classhint->res_name = NULL; classhint->res_name = NULL;
@ -203,12 +212,12 @@ static int gdm_still_running(void) {
if (XGetClassHint(dpy, w, classhint)) { if (XGetClassHint(dpy, w, classhint)) {
name = classhint->res_name; name = classhint->res_name;
if (name != NULL) { if (name != NULL) {
saw_gdm_name += gdm_string(name); saw_gdm_name += dm_string(name);
XFree_wr(name); XFree_wr(name);
} }
name = classhint->res_class; name = classhint->res_class;
if (name != NULL) { if (name != NULL) {
saw_gdm_name += gdm_string(name); saw_gdm_name += dm_string(name);
XFree_wr(name); XFree_wr(name);
} }
} }
@ -230,6 +239,7 @@ static int gdm_still_running(void) {
static int wm_running(void) { static int wm_running(void) {
char *s = getenv("DEBUG_WM_RUNNING"); char *s = getenv("DEBUG_WM_RUNNING");
int ret = 0;
RAWFB_RET(0) RAWFB_RET(0)
#if NO_X11 #if NO_X11
return 0; return 0;
@ -238,30 +248,36 @@ static int wm_running(void) {
* Unfortunately with recent GDM (v2.28), they run gnome-session, * Unfortunately with recent GDM (v2.28), they run gnome-session,
* dbus-launch, and metacity for the Login greeter! So the simple * dbus-launch, and metacity for the Login greeter! So the simple
* XInternAtom checks below no longer work. * XInternAtom checks below no longer work.
* We also see a similar thing with KDE.
*/ */
if (gdm_still_running()) { if (dm_still_running()) {
return 0; return 0;
} }
/* we are xlocked. */ /* we are xlocked. */
if (XInternAtom(dpy, "_NET_SUPPORTED", True) != None) { if (XInternAtom(dpy, "_NET_SUPPORTED", True) != None) {
if (s) rfbLog("wm is running (_NET_SUPPORTED).\n"); if (s) rfbLog("wm is running (_NET_SUPPORTED).\n");
return 1; ret++;
} }
if (XInternAtom(dpy, "_WIN_PROTOCOLS", True) != None) { if (XInternAtom(dpy, "_WIN_PROTOCOLS", True) != None) {
if (s) rfbLog("wm is running (_WIN_PROTOCOLS).\n"); if (s) rfbLog("wm is running (_WIN_PROTOCOLS).\n");
return 1; ret++;
} }
if (XInternAtom(dpy, "_XROOTPMAP_ID", True) != None) { if (XInternAtom(dpy, "_XROOTPMAP_ID", True) != None) {
if (s) rfbLog("wm is running (_XROOTPMAP_ID).\n"); if (s) rfbLog("wm is running (_XROOTPMAP_ID).\n");
return 1; ret++;
} }
if (XInternAtom(dpy, "_MIT_PRIORITY_COLORS", True) != None) { if (XInternAtom(dpy, "_MIT_PRIORITY_COLORS", True) != None) {
if (s) rfbLog("wm is running (_MIT_PRIORITY_COLORS).\n"); if (s) rfbLog("wm is running (_MIT_PRIORITY_COLORS).\n");
ret++;
}
if (!ret) {
if (s) rfbLog("wm is not running.\n");
return 0;
} else {
if (s) rfbLog("wm is running ret=%d.\n", ret);
return 1; return 1;
} }
if (s) rfbLog("wm is not running.\n");
return 0;
#endif /* NO_X11 */ #endif /* NO_X11 */
} }
@ -307,6 +323,9 @@ int guess_dm_gone(int t1, int t2) {
} }
X_UNLOCK; X_UNLOCK;
} }
if (getenv("DEBUG_WM_RUNNING")) {
rfbLog("guess_dm_gone: wait=%d\n", wait);
}
/* we assume they've logged in OK after wait seconds... */ /* we assume they've logged in OK after wait seconds... */
if (time(NULL) <= tcheck + wait) { if (time(NULL) <= tcheck + wait) {
return 0; return 0;
@ -365,7 +384,7 @@ static void initialize_xevents(int reset) {
* We try to delay creating selwin until we are past * We try to delay creating selwin until we are past
* any GDM, (or other KillInitClients=true) manager. * any GDM, (or other KillInitClients=true) manager.
*/ */
if (guess_dm_gone(5, 45)) { if (guess_dm_gone(8, 45)) {
X_LOCK; X_LOCK;
selwin = XCreateSimpleWindow(dpy, rootwin, 3, 2, 1, 1, 0, 0, 0); selwin = XCreateSimpleWindow(dpy, rootwin, 3, 2, 1, 1, 0, 0, 0);
X_UNLOCK; X_UNLOCK;
@ -400,7 +419,7 @@ static void initialize_xevents(int reset) {
* we are past the display manager, due to Xorg bug: * we are past the display manager, due to Xorg bug:
* http://bugs.freedesktop.org/show_bug.cgi?id=18451 * http://bugs.freedesktop.org/show_bug.cgi?id=18451
*/ */
if (guess_dm_gone(5, 45)) { if (guess_dm_gone(8, 45)) {
initialize_xfixes(); initialize_xfixes();
did_xfixes = 1; did_xfixes = 1;
if (! quiet) rfbLog("called initialize_xfixes()\n"); if (! quiet) rfbLog("called initialize_xfixes()\n");

@ -1320,22 +1320,25 @@ Display *XOpenDisplay_wr(char *display_name) {
d = XOpenDisplay(display_name); d = XOpenDisplay(display_name);
if (db) fprintf(stderr, "XOpenDisplay_wr: %s %p\n", display_name, (void *)d); if (db) fprintf(stderr, "XOpenDisplay_wr: %s %p\n", display_name, (void *)d);
if (d == NULL) { if (d == NULL && !getenv("NO_XAUTHLOCALHOSTNAME")) {
if (!getenv("NO_XAUTHLOCALHOSTNAME")) { char *xalhn = getenv("XAUTHLOCALHOSTNAME");
if (!getenv("XAUTHLOCALHOSTNAME")) { if (1 || !xalhn) {
rfbLog("XOpenDisplay(\"%s\") failed.\n", rfbLog("XOpenDisplay(\"%s\") failed.\n",
display_name ? display_name : ""); display_name ? display_name : "");
rfbLog("Trying again with XAUTHLOCALHOSTNAME=localhost ...\n"); rfbLog("Trying again with XAUTHLOCALHOSTNAME=localhost ...\n");
set_env("XAUTHLOCALHOSTNAME", "localhost"); set_env("XAUTHLOCALHOSTNAME", "localhost");
d = XOpenDisplay(display_name); d = XOpenDisplay(display_name);
if (0) { if (d == NULL && xalhn) {
char *ptr = getenv("XAUTHLOCALHOSTNAME"); char *ptr = getenv("XAUTHLOCALHOSTNAME");
if (ptr) { if (ptr) {
*(ptr-2) = '_'; /* yow */ *(ptr-2) = '_'; /* yow */
rfbLog("XOpenDisplay(\"%s\") failed.\n",
display_name ? display_name : "");
rfbLog("Trying again with unset XAUTHLOCALHOSTNAME ...\n");
d = XOpenDisplay(display_name);
} }
} }
} }
}
} }
xauth_raw(0); xauth_raw(0);

Loading…
Cancel
Save