diff options
Diffstat (limited to 'x11vnc')
-rw-r--r-- | x11vnc/8to24.c | 2 | ||||
-rw-r--r-- | x11vnc/ChangeLog | 17 | ||||
-rw-r--r-- | x11vnc/Makefile.am | 3 | ||||
-rw-r--r-- | x11vnc/README | 382 | ||||
-rw-r--r-- | x11vnc/avahi.c | 46 | ||||
-rw-r--r-- | x11vnc/avahi.h | 2 | ||||
-rw-r--r-- | x11vnc/cleanup.c | 8 | ||||
-rw-r--r-- | x11vnc/connections.c | 8 | ||||
-rw-r--r-- | x11vnc/help.c | 113 | ||||
-rw-r--r-- | x11vnc/inet.c | 2 | ||||
-rw-r--r-- | x11vnc/keyboard.c | 10 | ||||
-rwxr-xr-x | x11vnc/misc/ultravnc_repeater.pl | 5 | ||||
-rw-r--r-- | x11vnc/options.c | 1 | ||||
-rw-r--r-- | x11vnc/options.h | 1 | ||||
-rw-r--r-- | x11vnc/pointer.c | 15 | ||||
-rw-r--r-- | x11vnc/pointer.h | 2 | ||||
-rw-r--r-- | x11vnc/remote.c | 24 | ||||
-rw-r--r-- | x11vnc/scan.c | 4 | ||||
-rw-r--r-- | x11vnc/screen.c | 90 | ||||
-rw-r--r-- | x11vnc/sslhelper.c | 6 | ||||
-rw-r--r-- | x11vnc/ssltools.h | 41 | ||||
-rwxr-xr-x | x11vnc/tkx11vnc | 1 | ||||
-rw-r--r-- | x11vnc/tkx11vnc.h | 1 | ||||
-rw-r--r-- | x11vnc/unixpw.c | 49 | ||||
-rw-r--r-- | x11vnc/user.c | 3 | ||||
-rw-r--r-- | x11vnc/userinput.c | 4 | ||||
-rw-r--r-- | x11vnc/x11vnc.1 | 115 | ||||
-rw-r--r-- | x11vnc/x11vnc.c | 10 | ||||
-rw-r--r-- | x11vnc/x11vnc_defs.c | 2 | ||||
-rw-r--r-- | x11vnc/xevents.c | 47 | ||||
-rw-r--r-- | x11vnc/xwrappers.c | 13 |
31 files changed, 765 insertions, 262 deletions
diff --git a/x11vnc/8to24.c b/x11vnc/8to24.c index 4c55e02..75ab68a 100644 --- a/x11vnc/8to24.c +++ b/x11vnc/8to24.c @@ -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 - * info in the the 8bpp window table: + * info in the 8bpp window table: */ if (now > last_clear + 10) { last_clear = now; diff --git a/x11vnc/ChangeLog b/x11vnc/ChangeLog index 5e9a59c..8eb44c7 100644 --- a/x11vnc/ChangeLog +++ b/x11vnc/ChangeLog @@ -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> * x11vnc: set cd->unixname in apply_opts. Print message in vnc_reflect_resize. Some tweaks to prepare_x11vnc_dist.sh diff --git a/x11vnc/Makefile.am b/x11vnc/Makefile.am index c18f49d..163f930 100644 --- a/x11vnc/Makefile.am +++ b/x11vnc/Makefile.am @@ -30,7 +30,6 @@ INCLUDES_LIBVNCSERVER = @SYSTEM_LIBVNCSERVER_CFLAGS@ else INCLUDES_LIBVNCSERVER = 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) diff --git a/x11vnc/README b/x11vnc/README index d440a82..8666aad 100644 --- a/x11vnc/README +++ b/x11vnc/README @@ -2,7 +2,7 @@ Copyright (C) 2002-2010 Karl J. Runge <runge@karlrunge.com> 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: @@ -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 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 - link. As of May 2010, the x11vnc-0.9.10.tar.gz source package is - released (recommended download). The x11vnc 0.9.10 release notes. + link. As of Sep 2010, the x11vnc-0.9.12.tar.gz source package is + released (recommended download). The x11vnc 0.9.12 release notes. 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, - 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. 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. 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): (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 x11vnc-0.9.10 +# cd x11vnc-0.9.12 (run configure and then run make) # ./configure @@ -885,13 +885,13 @@ make I'd appreciate any additional testing very much. 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 - Summer 2010. + Please help test and debug the 0.9.13 version for release sometime in + Winter 2010. - The version 0.9.11 beta tarball is kept here: - x11vnc-0.9.11-dev.tar.gz + The version 0.9.13 beta tarball is kept here: + x11vnc-0.9.13-dev.tar.gz There are also some Linux, Solaris, Mac OS X, and other OS test binaries here. Please kick the tires and report bugs, performance @@ -908,11 +908,40 @@ make settings panel.) - Here are some features that will appear in the 0.9.11 release: - * Coming Soon. - - - Here are some features that appeared in the 0.9.10 release: + Here are some features that will appear in the 0.9.13 release: + * Coming Soon! + + + 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 SSL Certificates. The debugCerts=yes applet parameter aids 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 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 updates in x11vnc. @@ -5702,12 +5731,12 @@ ied) * On Firefox/Mozilla (and anything else) turn off "Smooth Scroll" animations. In Firefox put in the URL "about:config" and set general.smoothScroll to false. - * On XFree86 turn on the Shadow Framebuffer to speed up reading. - (Option "ShadowFB" "true" in the Device section of + * On Xorg/XFree86 turn on the Shadow Framebuffer to speed up + reading. (Option "ShadowFB" "true" in the Device section of /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 - situations. If the link is very slow, this speedup may not be - noticed. + display and so may not be worth it (if you play games, etc), but + could be of use in some situations. Note: If the network link is + very slow, this speedup may not be noticed. VNC viewer parameters: * 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, 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 - 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 file. @@ -6192,8 +6221,9 @@ EndSection shared) client-side caching is that one needs to extend the VNC 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 - main VNC viewers, patches accepted, etc... likely takes years before - they might be deployed in the field) + main VNC viewers, patches accepted, etc... likely takes many years + 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 scroll down and actually see the cached pixel data. So it looks like @@ -6292,13 +6322,14 @@ Section "Device" EndSection No problems like this have been observed with Windows VNC Viewers: - they all seem to keep their entire framebuffer in local memory. Gotcha - 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 - (64MB?). It fails quickly saying "The connection to the host has been - interrupted." The workaround for his 1280x1024 x11vnc-side display was - to run with "-ncache 10", i.e. a smaller value to be under the krdc - threshold. + they all seem to keep their entire framebuffer in local memory. + + Gotcha 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 (64MB?). It fails quickly saying "The connection to the + host has been interrupted." The workaround for his 1280x1024 + 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 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 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 updates in x11vnc. 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 - 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. As a workaround apply the -noxdamage option. As of Feb/2007 x11vnc 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 reported the problem and discovered the workaround. @@ -7361,6 +7392,10 @@ EndSection responsiveness (especially for typing) and also leads to unnecessary 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? 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 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 performance for the case of a large number of simultaneous VNC viewers (e.g. classroom broadcasting or a large demo)? @@ -8367,7 +8418,6 @@ rm -f $tmp * SingleWindow: "Select Single Window..." * TextChat: "Open Chat..." * 1/n Server Scaling - * rfbEncodingUltra compression encoding 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 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: @@ -11029,10 +11104,6 @@ Enhanced TightVNC Viewer (SSVNC: SSL/SSH VNC viewer) simplified Terminal-Services mode (tsvnc) for use with x11vnc on the 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. 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: - % gzip -dc ssvnc-1.0.28.tar.gz | tar xvf - + % gzip -dc ssvnc-1.0.29.tar.gz | tar xvf - Run the GUI: @@ -11225,7 +11296,7 @@ Unix and 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. 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.: - gzip -dc ssvnc-1.0.28.src.tar.gz | tar xvf - - cd ssvnc-1.0.28 + gzip -dc ssvnc-1.0.29.src.tar.gz | tar xvf - + cd ssvnc-1.0.29 make config make all make PREFIX=/my/install/dir install @@ -11285,7 +11356,7 @@ Windows: 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.: @@ -11297,7 +11368,7 @@ Windows: 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. 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). On Mac OS X? Use "ssvnc_no_windows". 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) - 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) - 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) - 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) - 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) - 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) - 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) 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) 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 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): - ssvnc_windows_only-1.0.28.zip - ssvnc_no_windows-1.0.28.tar.gz - ssvnc_unix_only-1.0.28.tar.gz - ssvnc_unix_minimal-1.0.28.tar.gz + ssvnc_windows_only-1.0.29.zip + ssvnc_no_windows-1.0.29.tar.gz + ssvnc_unix_only-1.0.29.tar.gz + ssvnc_unix_minimal-1.0.29.tar.gz - ssvnc-1.0.28.tar.gz - ssvnc-1.0.28.zip - ssvnc_all-1.0.28.zip + ssvnc-1.0.29.tar.gz + ssvnc-1.0.29.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) @@ -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.26 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 @@ -12100,7 +12172,7 @@ x11vnc: a VNC server for real X displays Here are all of x11vnc command line options: % 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: -display disp -auth file -N @@ -12162,41 +12234,42 @@ x11vnc options: -noxfixes -alphacut n -alphafrac fraction -alpharemove -noalphablend -nocursorshape -cursorpos -nocursorpos -xwarppointer - -noxwarppointer -buttonmap string -nodragging - -ncache n -ncache_cr -ncache_no_moveraise - -ncache_no_dtchange -ncache_no_rootpixmap -ncache_keep_anims - -ncache_old_wm -ncache_pad n -debug_ncache - -wireframe [str] -nowireframe -nowireframelocal - -wirecopyrect mode -nowirecopyrect -debug_wireframe - -scrollcopyrect mode -noscrollcopyrect -scr_area n - -scr_skip list -scr_inc list -scr_keys list - -scr_term list -scr_keyrepeat lo-hi -scr_parms string - -fixscreen string -debug_scroll -noxrecord - -grab_buster -nograb_buster -debug_grabs - -debug_sel -pointer_mode n -input_skip n - -allinput -input_eagerly -speeds rd,bw,lat - -wmdt string -debug_pointer -debug_keyboard - -defer time -wait time -extra_fbur n - -wait_ui factor -setdefer n -nowait_bog - -slow_fb time -xrefresh time -nap - -nonap -sb time -readtimeout n - -ping n -nofbpm -fbpm - -nodpms -dpms -forcedpms - -clientdpms -noserverdpms -noultraext - -chatwindow -noxdamage -xd_area A - -xd_mem f -sigpipe string -threads - -nothreads -fs f -gaps n - -grow n -fuzz n -debug_tiles - -snapfb -rawfb string -freqtab file - -pipeinput cmd -macnodim -macnosleep - -macnosaver -macnowait -macwheel n - -macnoswap -macnoresize -maciconanim n - -macmenu -macuskbd -gui [gui-opts] - -remote command -query variable -QD variable - -sync -query_retries str -remote_prefix str - -noremote -yesremote -unsafe - -safer -privremote -nocmds - -allowedcmds list -deny_all + -noxwarppointer -always_inject -buttonmap string + -nodragging -ncache n -ncache_cr + -ncache_no_moveraise -ncache_no_dtchange -ncache_no_rootpixmap + -ncache_keep_anims -ncache_old_wm -ncache_pad n + -debug_ncache -wireframe [str] -nowireframe + -nowireframelocal -wirecopyrect mode -nowirecopyrect + -debug_wireframe -scrollcopyrect mode -noscrollcopyrect + -scr_area n -scr_skip list -scr_inc list + -scr_keys list -scr_term list -scr_keyrepeat lo-hi + -scr_parms string -fixscreen string -debug_scroll + -noxrecord -grab_buster -nograb_buster + -debug_grabs -debug_sel -pointer_mode n + -input_skip n -allinput -input_eagerly + -speeds rd,bw,lat -wmdt string -debug_pointer + -debug_keyboard -defer time -wait time + -extra_fbur n -wait_ui factor -setdefer n + -nowait_bog -slow_fb time -xrefresh time + -nap -nonap -sb time + -readtimeout n -ping n -nofbpm + -fbpm -nodpms -dpms + -forcedpms -clientdpms -noserverdpms + -noultraext -chatwindow -noxdamage + -xd_area A -xd_mem f -sigpipe string + -threads -nothreads -fs f + -gaps n -grow n -fuzz n + -debug_tiles -snapfb -rawfb string + -freqtab file -pipeinput cmd -macnodim + -macnosleep -macnosaver -macnowait + -macwheel n -macnoswap -macnoresize + -maciconanim n -macmenu -macuskbd + -gui [gui-opts] -remote command -query variable + -QD variable -sync -query_retries str + -remote_prefix str -noremote -yesremote + -unsafe -safer -privremote + -nocmds -allowedcmds list -deny_all + LibVNCServer options: -rfbport port TCP port for RFB protocol @@ -12230,7 +12303,7 @@ libvncserver-tight-extension options: % 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.) @@ -12633,6 +12706,12 @@ Options: -forever Keep listening for more connections rather than exiting 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 whenever it terminates. -bg and -inetd are ignored in this mode (however see -loopbg below). @@ -12740,6 +12819,11 @@ Options: may need to start avahi-daemon and open udp port 5353 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 program like avahi-publish(1) or dns-sd(1) will be tried @@ -13366,13 +13450,13 @@ Options: virtual terminal of the X server. -listdpy Have the FINDDISPLAY program list all of your displays (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 the XAUTHORITY file for DISPLAY 'disp'. If 'disp' is not supplied, then the value in the -display on 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 found for 'disp'; i.e. failure. If "XAUTHORITY=" @@ -13608,8 +13692,19 @@ Options: if the viewer-side supplied value is not completely 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, - 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 To disable the option setting set the environment @@ -13699,6 +13794,8 @@ Options: It will start looking for an open display number at :20 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 Xdummy: @@ -14221,6 +14318,7 @@ Options: -sslGenCA [dir] Generate your own Certificate Authority private key, certificate, and other files in directory [dir]. + x11vnc then exits. If [dir] is not supplied, a -ssldir setting is used, or otherwise ~/.vnc/certs is used. @@ -14231,7 +14329,7 @@ Options: in PATH. 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 certificate. The info does not have to be accurate just @@ -14259,8 +14357,8 @@ Options: -sslGenCA. The openssl(1) program must be installed on the system and available in PATH. - After the Certificate is generated the command exits; - the VNC server is not run. + After the Certificate is generated x11vnc exits; the + VNC server is not run. The type of key to be generated is the string "type". It is either "server" (i.e. for use by x11vnc) or @@ -14379,7 +14477,7 @@ Options: scp ~/.vnc/certs/clients/roger.pem somehost:. 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 roger), and on the viewer user on somehost could do for example: @@ -14402,7 +14500,7 @@ Options: The openssl(1) program must be installed on the system 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: x11vnc -sslEncKey /path/to/foo.pem @@ -14414,6 +14512,9 @@ Options: The openssl(1) program must be in PATH. Basically the 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 as well. @@ -14439,13 +14540,13 @@ Options: also be lowercase, e.g. "list". -sslDelCert pem Prompts you to delete all .crt .pem .key .req files - associated with [pem]. "SAVE" and lookups as in - -sslCertInfo apply as well. + associated with [pem]. x11vnc then exits. "SAVE" + and lookups as in -sslCertInfo apply as well. -sslScripts Prints out both the 'genCA' and 'genCert' x11vnc openssl wrapper scripts for you to examine, modify, etc. - The scripts are printed to stdout and then the program - exits. + The scripts are printed to stdout and then the x11vnc + program exits. -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 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 try to change the desktop background to a solid color. The [color] is optional: the default color is "cyan4". @@ -15265,7 +15369,7 @@ t the wire and are applied correctly to the x11vnc-side X server. Note this mode probably won't do what you 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. The default is -noskip_lockkeys. @@ -15548,6 +15652,34 @@ t enabled by default if XINERAMA is found to be active. 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 maps buttons I -> L, etc., e.g. -buttonmap 13-31 @@ -16005,7 +16137,7 @@ t the whole-server grabbing application expects mouse or keyboard input before releasing the grab. It is usually 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 physical display and give it some input to satisfy the grabbing app. Or manually kill and restart the window @@ -16845,7 +16977,7 @@ er -macuskbd For the native MacOSX server, use the original 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. Requires the "wish" program to be installed on the machine. "gui-opts" is not required: the default @@ -16976,9 +17108,9 @@ n x11vnc server. "-R" and "-r" are aliases for "-remote". After the remote control command is sent to the running server the 'x11vnc -remote ...' - command exits. You can often use the -query command - (see below) to see if the x11vnc server processed your - -remote command. + x11vnc command exits. You can often use the -query + command (see below) to see if the x11vnc server + processed your -remote command. The default communication channel is that of X properties (specifically X11VNC_REMOTE), and so this @@ -17231,6 +17363,8 @@ n nocursorpos enable -nocursorpos mode. xwarp enable -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 dragging disable -nodragging mode. nodragging enable -nodragging mode. @@ -17555,11 +17689,11 @@ n nosetprimary clipboard noclipboard setclipboard nosetclipboard seldir cursorshape nocursorshape cursorpos nocursorpos cursor_drag nocursor_drag cursor - show_cursor noshow_cursor nocursor arrow xfixes - noxfixes xdamage noxdamage xd_area xd_mem alphacut - alphafrac alpharemove noalpharemove alphablend - noalphablend xwarppointer xwarp noxwarppointer - noxwarp buttonmap dragging nodragging ncache_cr + show_cursor noshow_cursor nocursor arrow xfixes noxfixes + xdamage noxdamage xd_area xd_mem alphacut alphafrac + alpharemove noalpharemove alphablend noalphablend + xwarppointer xwarp noxwarppointer noxwarp always_inject + noalways_inject buttonmap dragging nodragging ncache_cr noncache_cr ncache_no_moveraise noncache_no_moveraise ncache_no_dtchange noncache_no_dtchange ncache_no_rootpixmap noncache_no_rootpixmap diff --git a/x11vnc/avahi.c b/x11vnc/avahi.c index 7f38d57..7c646b7 100644 --- a/x11vnc/avahi.c +++ b/x11vnc/avahi.c @@ -37,7 +37,7 @@ so, delete this exception statement from your version. #include "cleanup.h" 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_cleanup(void); @@ -45,12 +45,13 @@ static pid_t avahi_pid = 0; static void kill_avahi_pid(void) { if (avahi_pid != 0) { + rfbLog("kill_avahi_pid: %d\n", (int) avahi_pid); kill(avahi_pid, SIGTERM); 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 char *cmd, *p, *path = getenv("PATH"), portstr[32]; int i; @@ -146,7 +147,12 @@ void avahi_initialise(void) { 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)) { rfbLog("avahi_advertise: no Avahi support at buildtime.\n"); avahi = 0; @@ -243,8 +249,8 @@ if (db) fprintf(stderr, " avahi_initialise: poll not null\n"); if (db) fprintf(stderr, "out avahi_initialise\n"); } -static void _avahi_create_services(const char *name, const char *host, - const uint16_t port); +static void _avahi_create_services(char *name, char *host, + uint16_t port); static void _avahi_entry_group_callback(AvahiEntryGroup *g, 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"); } -static void _avahi_create_services(const char *name, const char *host, - const uint16_t port) { +static void _avahi_create_services(char *name, char *host, uint16_t port) { avahi_service_t *svc = (avahi_service_t *)malloc(sizeof(avahi_service_t)); 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->host = host; 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"); } -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; -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 (db) fprintf(stderr, " avahi_advertise client null\n"); return; @@ -388,18 +398,34 @@ if (db) fprintf(stderr, " avahi_reset client/group null\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) { if (db) fprintf(stderr, "in avahi_cleanup\n"); if (!_client) { if (db) fprintf(stderr, " avahi_cleanup client null\n"); return; } +if (db) fprintf(stderr, " avahi_cleanup poll_lock\n"); 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); + alarm(0); + signal(SIGALRM, SIG_DFL); +if (db) fprintf(stderr, " avahi_cleanup client_free\n"); avahi_client_free(_client); _client = NULL; +if (db) fprintf(stderr, " avahi_cleanup poll_free\n"); avahi_threaded_poll_free(_poll); _poll = NULL; if (db) fprintf(stderr, "out avahi_cleanup\n"); diff --git a/x11vnc/avahi.h b/x11vnc/avahi.h index a8a07e3..7b7a6bc 100644 --- a/x11vnc/avahi.h +++ b/x11vnc/avahi.h @@ -36,7 +36,7 @@ so, delete this exception statement from your version. /* -- avahi.h -- */ 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_cleanup(void); diff --git a/x11vnc/cleanup.c b/x11vnc/cleanup.c index e9222b5..4ecef42 100644 --- a/x11vnc/cleanup.c +++ b/x11vnc/cleanup.c @@ -165,9 +165,6 @@ void clean_up_exit(int ret) { ssl_helper_pid(0, 0); /* killall */ } - if (avahi) { - avahi_cleanup(); - } if (ssh_pid > 0) { kill(ssh_pid, SIGTERM); ssh_pid = 0; @@ -242,6 +239,11 @@ void clean_up_exit(int ret) { rm_flagfile = NULL; } + if (avahi) { + avahi_cleanup(); + fflush(stderr); + } + exit(ret); } diff --git a/x11vnc/connections.c b/x11vnc/connections.c index d1af60e..abb7a27 100644 --- a/x11vnc/connections.c +++ b/x11vnc/connections.c @@ -932,11 +932,7 @@ void client_gone(rfbClientPtr client) { kill(gui_pid, SIGTERM); } CLIENT_UNLOCK; - if (connect_or_exit) { - clean_up_exit(1); - } else { - clean_up_exit(0); - } + clean_up_exit(0); } #ifdef MACOSX if (macosx_console && client_count == 0) { @@ -3149,7 +3145,7 @@ static void pmove(int x, int y) { return; } rfbLog("pmove: x y: %d %d\n", x, y); - pointer(0, x, y, NULL); + pointer_event(0, x, y, NULL); X_LOCK; XFlush_wr(dpy); X_UNLOCK; diff --git a/x11vnc/help.c b/x11vnc/help.c index 90dddfd..5eb80cc 100644 --- a/x11vnc/help.c +++ b/x11vnc/help.c @@ -467,6 +467,12 @@ void print_help(int mode) { "-forever Keep listening for more connections rather than exiting\n" " as soon as the first client(s) disconnect. Same as -many\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" " whenever it terminates. -bg and -inetd are ignored\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" " in your firewall.\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" " program like avahi-publish(1) or dns-sd(1) will be tried\n" "\n" @@ -1212,13 +1223,13 @@ void print_help(int mode) { " virtual terminal of the X server.\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" -" have access rights to).\n" +" have access rights to). x11vnc then exits.\n" "\n" "-findauth [disp] Apply the -find/-finddpy heuristics to try to guess\n" " the XAUTHORITY file for DISPLAY 'disp'. If 'disp'\n" " is not supplied, then the value in the -display on\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" " If nothing is printed out, that means no XAUTHORITY was\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" " composed of alphanumeric or '_' or '-' characters.\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" -" 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" "\n" " To disable the option setting set the environment\n" @@ -1544,6 +1566,8 @@ void print_help(int mode) { "\n" " It will start looking for an open display number at :20\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" " By default FINDCREATEDISPLAY will try Xvfb and then\n" " Xdummy:\n" @@ -2066,6 +2090,7 @@ void print_help(int mode) { "\n" "-sslGenCA [dir] Generate your own Certificate Authority private key,\n" " certificate, and other files in directory [dir].\n" +" x11vnc then exits.\n" "\n" " If [dir] is not supplied, a -ssldir setting is used,\n" " or otherwise ~/.vnc/certs is used.\n" @@ -2076,7 +2101,7 @@ void print_help(int mode) { " in PATH.\n" "\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" " You will be prompted for information to put into the CA\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" " on the system and available in PATH.\n" "\n" -" After the Certificate is generated the command exits;\n" -" the VNC server is not run.\n" +" After the Certificate is generated x11vnc exits; the\n" +" VNC server is not run.\n" "\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" @@ -2225,7 +2250,7 @@ void print_help(int mode) { " scp ~/.vnc/certs/clients/roger.pem somehost:.\n" " rm ~/.vnc/certs/clients/roger.pem\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" " roger), and on the viewer user on somehost could do\n" " for example:\n" @@ -2248,7 +2273,7 @@ void print_help(int mode) { "\n" " The openssl(1) program must be installed on the system\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" " Examples:\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" " command \"openssl x509 -text\" is run on the pem.\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" " as well.\n" "\n" @@ -2285,13 +2313,13 @@ void print_help(int mode) { " also be lowercase, e.g. \"list\".\n" "\n" "-sslDelCert pem Prompts you to delete all .crt .pem .key .req files\n" -" associated with [pem]. \"SAVE\" and lookups as in\n" -" -sslCertInfo apply as well.\n" +" associated with [pem]. x11vnc then exits. \"SAVE\"\n" +" and lookups as in -sslCertInfo apply as well.\n" "\n" "-sslScripts Prints out both the 'genCA' and 'genCert' x11vnc\n" " openssl wrapper scripts for you to examine, modify, etc.\n" -" The scripts are printed to stdout and then the program\n" -" exits.\n" +" The scripts are printed to stdout and then the x11vnc\n" +" program exits.\n" "\n" "\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" " used to 3.\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" " try to change the desktop background to a solid color.\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" " X server. Note this mode probably won't do what you\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" " The default is -noskip_lockkeys.\n" "\n" @@ -3392,6 +3423,34 @@ void print_help(int mode) { " enabled by default if XINERAMA is found to be active.\n" " To prevent this, use -noxwarppointer.\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" " maps buttons I -> L, etc., e.g. -buttonmap 13-31\n" "\n" @@ -3851,7 +3910,7 @@ void print_help(int mode) { " the whole-server grabbing application expects mouse or\n" " keyboard input before releasing the grab. It is usually\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" " physical display and give it some input to satisfy the\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" " keystroke insertion code based on a US keyboard.\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" " Requires the \"wish\" program to be installed on the\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" " \"-remote\". After the remote control command is\n" " sent to the running server the 'x11vnc -remote ...'\n" -" command exits. You can often use the -query command\n" -" (see below) to see if the x11vnc server processed your\n" -" -remote command.\n" +" x11vnc command exits. You can often use the -query\n" +" command (see below) to see if the x11vnc server\n" +" processed your -remote command.\n" "\n" " The default communication channel is that of X\n" " properties (specifically X11VNC_REMOTE), and so this\n" @@ -5082,6 +5141,8 @@ void print_help(int mode) { " nocursorpos enable -nocursorpos mode.\n" " xwarp enable -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" " dragging disable -nodragging mode.\n" " nodragging enable -nodragging mode.\n" @@ -5404,11 +5465,11 @@ void print_help(int mode) { " nosetprimary clipboard noclipboard setclipboard\n" " nosetclipboard seldir cursorshape nocursorshape\n" " cursorpos nocursorpos cursor_drag nocursor_drag cursor\n" -" show_cursor noshow_cursor nocursor arrow xfixes\n" -" noxfixes xdamage noxdamage xd_area xd_mem alphacut\n" -" alphafrac alpharemove noalpharemove alphablend\n" -" noalphablend xwarppointer xwarp noxwarppointer\n" -" noxwarp buttonmap dragging nodragging ncache_cr\n" +" show_cursor noshow_cursor nocursor arrow xfixes noxfixes\n" +" xdamage noxdamage xd_area xd_mem alphacut alphafrac\n" +" alpharemove noalpharemove alphablend noalphablend\n" +" xwarppointer xwarp noxwarppointer noxwarp always_inject\n" +" noalways_inject buttonmap dragging nodragging ncache_cr\n" " noncache_cr ncache_no_moveraise noncache_no_moveraise\n" " ncache_no_dtchange noncache_no_dtchange\n" " ncache_no_rootpixmap noncache_no_rootpixmap\n" @@ -5830,7 +5891,7 @@ void nopassword_warning_msg(int gotloc) { char str4[] = "#@ @#\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" @@ -5845,7 +5906,7 @@ void nopassword_warning_msg(int gotloc) { fprintf(stderr, "%s", str1); fflush(stderr); #if !PASSWD_REQUIRED - usleep(1000 * 1000); + usleep(750 * 1000); #endif if (!quiet) { fprintf(stderr, "%s", str2); @@ -5858,7 +5919,7 @@ void nopassword_warning_msg(int gotloc) { } fflush(stderr); #if !PASSWD_REQUIRED - usleep(500 * 1000); + usleep(250 * 1000); #endif } diff --git a/x11vnc/inet.c b/x11vnc/inet.c index a70ce24..a7410ee 100644 --- a/x11vnc/inet.c +++ b/x11vnc/inet.c @@ -347,7 +347,7 @@ char *ident_username(rfbClientPtr client) { if (ret > 0) { int i; char *q, *p; - for (i=0; i < sizeof(msg); i++) { + for (i=0; i < (int) sizeof(msg); i++) { msg[i] = '\0'; } usleep(250*1000); diff --git a/x11vnc/keyboard.c b/x11vnc/keyboard.c index edce680..9e9e044 100644 --- a/x11vnc/keyboard.c +++ b/x11vnc/keyboard.c @@ -1325,7 +1325,7 @@ xkbmodifiers[] For the KeySym bound to this (keycode,group,level) store * loop over all possible (keycode, group, level) triples * and record what we find for it: */ - if (debug_keyboard > 1) { + if (debug_keyboard) { rfbLog("initialize_xkb_modtweak: XKB keycode -> keysyms " "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; } - if (debug_keyboard > 1) { + if (debug_keyboard) { char *str; fprintf(stderr, " %03d G%d L%d mod=%s ", 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); } - if (debug_keyboard > 1) { + if (debug_keyboard) { 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'; if (sscanf(t, "%d", &butt) == 1) { mask = 1<<(butt-1); - pointer(mask, x, y, client); + pointer_event(mask, x, y, client); mask = 0; - pointer(mask, x, y, client); + pointer_event(mask, x, y, client); } b++; } diff --git a/x11vnc/misc/ultravnc_repeater.pl b/x11vnc/misc/ultravnc_repeater.pl index 00ade34..0c44a05 100755 --- a/x11vnc/misc/ultravnc_repeater.pl +++ b/x11vnc/misc/ultravnc_repeater.pl @@ -725,6 +725,11 @@ sub xfer_both { } } +sub fsleep { + my ($time) = @_; + select(undef, undef, undef, $time) if $time; +} + sub cleanup { close $client_listen if $client_listen; close $client_listen6 if $client_listen6; diff --git a/x11vnc/options.c b/x11vnc/options.c index 0ad72f9..890a8a4 100644 --- a/x11vnc/options.c +++ b/x11vnc/options.c @@ -258,6 +258,7 @@ int cursor_drag_changes = CURSOR_DRAG; int cursor_pos_updates = 1; /* cursor position updates -cursorpos */ int cursor_shape_updates = 1; /* cursor shape updates -nocursorshape */ 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 */ #ifndef WIREFRAME #define WIREFRAME 1 diff --git a/x11vnc/options.h b/x11vnc/options.h index 34ec6c1..cfe0cdd 100644 --- a/x11vnc/options.h +++ b/x11vnc/options.h @@ -222,6 +222,7 @@ extern int cursor_drag_changes; extern int cursor_pos_updates; extern int cursor_shape_updates; extern int use_xwarppointer; +extern int always_inject; extern int show_dragging; extern int wireframe; extern int wireframe_local; diff --git a/x11vnc/pointer.c b/x11vnc/pointer.c index 097a43c..c57d2d7 100644 --- a/x11vnc/pointer.c +++ b/x11vnc/pointer.c @@ -54,7 +54,7 @@ int pointer_queued_sent = 0; void initialize_pointer_map(char *pointer_remap); 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); int check_pipeinput(void); void update_x11_pointer_position(int x, int y); @@ -342,20 +342,11 @@ void update_x11_pointer_position(int x, int y) { return; #else int rc; - static int watch_dx_dy = -1; 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; - if (watch_dx_dy && cursor_x == x && cursor_y == y) { + if (!always_inject && cursor_x == x && cursor_y == y) { ; } 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 * 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; int sent = 0, buffer_it = 0; double now; diff --git a/x11vnc/pointer.h b/x11vnc/pointer.h index 558f381..1fe5e0b 100644 --- a/x11vnc/pointer.h +++ b/x11vnc/pointer.h @@ -39,7 +39,7 @@ extern int pointer_queued_sent; extern void initialize_pointer_map(char *pointer_remap); 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 void initialize_pipeinput(void); extern void update_x11_pointer_position(int x, int y); diff --git a/x11vnc/remote.c b/x11vnc/remote.c index 6b2903b..fef39af 100644 --- a/x11vnc/remote.c +++ b/x11vnc/remote.c @@ -3443,6 +3443,24 @@ char *process_remote_cmd(char *cmd, int stringonly) { use_xwarppointer = 0; 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) { COLON_CHECK("buttonmap:") if (query) { @@ -4426,9 +4444,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { p += strlen("ptr:"); rfbLog("remote_cmd: insert pointer event: %s\n", p); 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) { - pointer(m, x, y, NULL); + pointer_event(m, x, y, NULL); } else { 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) { rfbLog("bcx_xattach: failed grab check for '%s': %s. Retrying[%d]...\n", p, res, try); 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 X_LOCK; XFlush_wr(dpy); diff --git a/x11vnc/scan.c b/x11vnc/scan.c index 7ef931c..b8fa645 100644 --- a/x11vnc/scan.c +++ b/x11vnc/scan.c @@ -3550,7 +3550,7 @@ int scan_for_updates(int count_only) { fb_copy_in_progress = 0; SCAN_FATAL(cs); if (use_threads && pointer_mode != 1) { - pointer(-1, 0, 0, NULL); + pointer_event(-1, 0, 0, NULL); } nap_check(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 * pointer events: */ - pointer(-1, 0, 0, NULL); + pointer_event(-1, 0, 0, NULL); } if (blackouts) { diff --git a/x11vnc/screen.c b/x11vnc/screen.c index c41774c..6bada90 100644 --- a/x11vnc/screen.c +++ b/x11vnc/screen.c @@ -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()); } +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) { int i,j; @@ -1350,6 +1372,49 @@ rfbBool vnc_reflect_resize(rfbClient *cl) { 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) { char *q, *p, *str = getenv("X11VNC_REFLECT_PASSWORD"); int len = 110; @@ -1408,17 +1473,32 @@ char *vnc_reflect_guess(char *str, char **raw_fb_addr) { } 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; +#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->GotCopyRect = vnc_reflect_got_copyrect; client->GotCursorShape = vnc_reflect_got_cursorshape; - client->MallocFrameBuffer = vnc_reflect_resize; - client->canHandleNewFBSize = TRUE; - client->GotFrameBufferUpdate = vnc_reflect_got_update; + client->GotCopyRect = vnc_reflect_got_copyrect; if (getenv("X11VNC_REFLECT_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) { argv[argc++] = "x11vnc_rawfb_vnc"; @@ -3538,7 +3618,7 @@ void initialize_screen(int *argc, char **argv, XImage *fb) { /* event callbacks: */ screen->newClientHook = new_client; screen->kbdAddEvent = keyboard; - screen->ptrAddEvent = pointer; + screen->ptrAddEvent = pointer_event; screen->setXCutText = xcut_receive; screen->setTranslateFunction = set_xlate_wrapper; diff --git a/x11vnc/sslhelper.c b/x11vnc/sslhelper.c index a363eee..ca5168f 100644 --- a/x11vnc/sslhelper.c +++ b/x11vnc/sslhelper.c @@ -4009,7 +4009,11 @@ void accept_openssl(int mode, int presock) { rfbLog("helper[%d]:\n", pid); rfbLog("***********************************************************\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"); } diff --git a/x11vnc/ssltools.h b/x11vnc/ssltools.h index 89849a5..9c74d5f 100644 --- a/x11vnc/ssltools.h +++ b/x11vnc/ssltools.h @@ -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" "\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" " # try to be somewhat careful about the real owner of the file:\n" " if [ \"X$am_root\" = \"X1\" ]; then\n" @@ -1307,16 +1307,34 @@ char find_display[] = " if [ \"X$p\" = \"X\" ]; then\n" " continue\n" " fi\n" +"\n" " env \"$myenv\" xdpyinfo -display \"$p\" >/dev/null 2>&1\n" " rc=$?\n" -" if [ $rc != 0 -a \"X$XAUTHLOCALHOSTNAME\" = \"X\" ]; then\n" +"\n" +" if [ $rc != 0 ]; then\n" " # guard against libxcb/desktop silliness: \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" +" xalhn_save=$XAUTHLOCALHOSTNAME\n" +"\n" +" if [ \"X$xalhn_save\" != \"X\" ]; then\n" +" # try it again unset\n" +" unset 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" "\n" @@ -1460,11 +1478,14 @@ char create_display[] = "\n" "findfree() {\n" " try=20\n" -" sry=99\n" +" dpymax=79\n" " if [ \"X$X11VNC_CREATE_STARTING_DISPLAY_NUMBER\" != \"X\" ]; then\n" " try=$X11VNC_CREATE_STARTING_DISPLAY_NUMBER\n" -" sry=`expr $try + 99`\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" " nsout=\"\"\n" " if [ \"X$have_netstat\" != \"X\" ]; then\n" diff --git a/x11vnc/tkx11vnc b/x11vnc/tkx11vnc index afff89c..c87d753 100755 --- a/x11vnc/tkx11vnc +++ b/x11vnc/tkx11vnc @@ -238,6 +238,7 @@ Pointer buttonmap: -- xwarppointer + always_inject Misc =GD-C:full,icon,tray WindowView: diff --git a/x11vnc/tkx11vnc.h b/x11vnc/tkx11vnc.h index c38e600..46f4bbc 100644 --- a/x11vnc/tkx11vnc.h +++ b/x11vnc/tkx11vnc.h @@ -249,6 +249,7 @@ char gui_code[] = ""; " buttonmap:\n" " --\n" " xwarppointer\n" +" always_inject\n" "\n" "Misc\n" " =GD-C:full,icon,tray WindowView:\n" diff --git a/x11vnc/unixpw.c b/x11vnc/unixpw.c index 90c2e06..b610fa9 100644 --- a/x11vnc/unixpw.c +++ b/x11vnc/unixpw.c @@ -1512,6 +1512,52 @@ static void progress_skippy(void) { 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) { int x, y; @@ -1569,7 +1615,9 @@ if (db) fprintf(stderr, "unixpw_verify: '%s' '%s'\n", user, db > 1 ? pass : "*** } else { keep_unixpw_opts = strdup(""); } + check_unixpw_userprefs(); } + if (colon) *colon = ':'; return; @@ -1759,6 +1807,7 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) { } else { keep_unixpw_opts = strdup(""); } + check_unixpw_userprefs(); } unixpw_system_greeter_active = 2; set_env("X11VNC_XDM_ONLY", "1"); diff --git a/x11vnc/user.c b/x11vnc/user.c index 150ad37..e9028ba 100644 --- a/x11vnc/user.c +++ b/x11vnc/user.c @@ -1985,8 +1985,9 @@ static char *build_create_cmd(char *cmd, int *saw_xdmcp, char *usslpeer, char *t fdxdmcpif[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); + if (strstr(t, "gnome")) { sprintf(fdsess, "gnome"); } else if (strstr(t, "kde")) { diff --git a/x11vnc/userinput.c b/x11vnc/userinput.c index 8c83080..84bcb7b 100644 --- a/x11vnc/userinput.c +++ b/x11vnc/userinput.c @@ -3008,7 +3008,7 @@ if (db) fprintf(stderr, "check_xrecord: BUTTON-UP-KEEP-GOING: %.3f/%.3f %d/%d % pointer_queued_sent = 0; last_x = cursor_x; last_y = cursor_y; - pointer(-1, 0, 0, NULL); + pointer_event(-1, 0, 0, NULL); pointer_flush_delay = 0.0; 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? */ if (use_threads) { /* purge any stored up pointer events: */ - pointer(-1, 0, 0, NULL); + pointer_event(-1, 0, 0, NULL); } if (cursor_noshape_updates_clients(screen)) { diff --git a/x11vnc/x11vnc.1 b/x11vnc/x11vnc.1 index 7de21cb..cfab152 100644 --- a/x11vnc/x11vnc.1 +++ b/x11vnc/x11vnc.1 @@ -1,8 +1,8 @@ .\" 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 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 .B x11vnc [OPTION]... @@ -487,6 +487,12 @@ disconnects, opposite of \fB-forever.\fR This is the Default. .IP Keep listening for more connections rather than exiting 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 \fB-loop\fR .IP @@ -617,6 +623,11 @@ Rendezvous, Bonjour). Depending on your setup, you may need to start avahi-daemon and open udp port 5353 in your firewall. .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 program like avahi- .IR publish (1) @@ -1329,7 +1340,7 @@ virtual terminal of the X server. .IP Have the FINDDISPLAY program list all of your displays (i.e. all the X displays on the local machine that you -have access rights to). +have access rights to). x11vnc then exits. .PP \fB-findauth\fR \fI[disp]\fR .IP @@ -1337,7 +1348,7 @@ Apply the \fB-find/-finddpy\fR heuristics to try to guess the XAUTHORITY file for DISPLAY 'disp'. If 'disp' is not supplied, then the value in the \fB-display\fR on 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 If nothing is printed out, that means no XAUTHORITY was 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 composed of alphanumeric or '_' or '-' characters. .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, -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 .IP To disable the option setting set the environment @@ -1706,6 +1728,8 @@ The option "\fB-create\fR" is an alias for this mode. .IP It will start looking for an open display number at :20 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 By default FINDCREATEDISPLAY will try Xvfb and then Xdummy: @@ -2268,6 +2292,7 @@ commands 'openssl ca \fB-revoke\fR ...' and 'openssl ca .IP Generate your own Certificate Authority private key, certificate, and other files in directory [dir]. +x11vnc then exits. .IP If [dir] is not supplied, a \fB-ssldir\fR setting is used, or otherwise ~/.vnc/certs is used. @@ -2279,7 +2304,7 @@ program must be installed on the system and available in PATH. .IP 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 You will be prompted for information to put into the CA 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 on the system and available in PATH. .IP -After the Certificate is generated the command exits; -the VNC server is not run. +After the Certificate is generated x11vnc exits; the +VNC server is not run. .IP The type of key to be generated is the string \fItype\fR. 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:. rm ~/.vnc/certs/clients/roger.pem .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 roger), and on the viewer user on somehost could do for example: @@ -2460,7 +2485,7 @@ The .IR openssl (1) program must be installed on the system 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 Examples: x11vnc \fB-sslEncKey\fR /path/to/foo.pem @@ -2476,6 +2501,9 @@ The program must be in PATH. Basically the command "openssl x509 \fB-text"\fR is run on the pem. .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 as well. .IP @@ -2503,15 +2531,15 @@ also be lowercase, e.g. "list". \fB-sslDelCert\fR \fIpem\fR .IP Prompts you to delete all .crt .pem .key .req files -associated with [pem]. "SAVE" and lookups as in -\fB-sslCertInfo\fR apply as well. +associated with [pem]. x11vnc then exits. "SAVE" +and lookups as in \fB-sslCertInfo\fR apply as well. .PP \fB-sslScripts\fR .IP Prints out both the 'genCA' and 'genCert' x11vnc openssl wrapper scripts for you to examine, modify, etc. -The scripts are printed to stdout and then the program -exits. +The scripts are printed to stdout and then the x11vnc +program exits. .PP \fB-stunnel\fR \fI[pem]\fR .IP @@ -3142,6 +3170,9 @@ endianness. Ignored unless \fB-noshm\fR is set. Do not use the new copy_tiles() framebuffer mechanism, just use 1 shm tile for polling. Limits shm segments used to 3. +.IP +To disable any automatic shm reduction set the +env. var. X11VNC_NO_LIMIT_SHM. .PP \fB-solid\fR \fI[color]\fR .IP @@ -3457,7 +3488,7 @@ Nevertheless your capitalized letters come in over the wire and are applied correctly to the x11vnc-side X server. Note this mode probably won't do what you 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. The default is \fB-noskip_lockkeys.\fR .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. To prevent this, use \fB-noxwarppointer.\fR .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 .IP 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 keyboard input before releasing the grab. It is usually 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 physical display and give it some input to satisfy the grabbing app. Or manually kill and restart the window @@ -5334,7 +5395,7 @@ keystroke insertion code based on a US keyboard. .PP \fB-gui\fR \fI[gui-opts]\fR .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. Requires the "wish" program to be installed on the 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 "\fB-remote\fR". After the remote control command is sent to the running server the 'x11vnc \fB-remote\fR ...' -command exits. You can often use the \fB-query\fR command -(see below) to see if the x11vnc server processed your -\fB-remote\fR command. +x11vnc command exits. You can often use the \fB-query\fR +command (see below) to see if the x11vnc server +processed your \fB-remote\fR command. .IP The default communication channel is that of X properties (specifically X11VNC_REMOTE), and so this @@ -5886,6 +5947,10 @@ xwarp enable \fB-xwarppointer\fR mode. .IP noxwarp disable \fB-xwarppointer\fR mode. .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 .IP dragging disable \fB-nodragging\fR mode. @@ -6376,11 +6441,11 @@ nobell sendbell sel nosel primary noprimary setprimary nosetprimary clipboard noclipboard setclipboard nosetclipboard seldir cursorshape nocursorshape cursorpos nocursorpos cursor_drag nocursor_drag cursor -show_cursor noshow_cursor nocursor arrow xfixes -noxfixes xdamage noxdamage xd_area xd_mem alphacut -alphafrac alpharemove noalpharemove alphablend -noalphablend xwarppointer xwarp noxwarppointer -noxwarp buttonmap dragging nodragging ncache_cr +show_cursor noshow_cursor nocursor arrow xfixes noxfixes +xdamage noxdamage xd_area xd_mem alphacut alphafrac +alpharemove noalpharemove alphablend noalphablend +xwarppointer xwarp noxwarppointer noxwarp always_inject +noalways_inject buttonmap dragging nodragging ncache_cr noncache_cr ncache_no_moveraise noncache_no_moveraise ncache_no_dtchange noncache_no_dtchange ncache_no_rootpixmap noncache_no_rootpixmap diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c index 96238b6..3f965e2 100644 --- a/x11vnc/x11vnc.c +++ b/x11vnc/x11vnc.c @@ -992,6 +992,9 @@ static int limit_shm(void) { if (UT.sysname == NULL) { return 0; } + if (getenv("X11VNC_NO_LIMIT_SHM")) { + return 0; + } if (!strcmp(UT.sysname, "SunOS")) { char *r = UT.release; 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, " cursorpos: %d\n", cursor_pos_updates); fprintf(stderr, " xwarpptr: %d\n", use_xwarppointer); + fprintf(stderr, " alwaysinj: %d\n", always_inject); fprintf(stderr, " buttonmap: %s\n", pointer_remap ? pointer_remap : "null"); fprintf(stderr, " dragging: %d\n", show_dragging); @@ -2280,7 +2284,7 @@ int main(int argc, char* argv[]) { } if (!strcmp(arg, "-reflect")) { 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]); shared = 1; continue; @@ -3397,6 +3401,10 @@ int main(int argc, char* argv[]) { got_noxwarppointer = 1; continue; } + if (!strcmp(arg, "-always_inject")) { + always_inject = 1; + continue; + } if (!strcmp(arg, "-buttonmap")) { CHECK_ARGC pointer_remap = strdup(argv[++i]); diff --git a/x11vnc/x11vnc_defs.c b/x11vnc/x11vnc_defs.c index 9ef72e6..fc6215b 100644 --- a/x11vnc/x11vnc_defs.c +++ b/x11vnc/x11vnc_defs.c @@ -47,7 +47,7 @@ int xtrap_base_event_type = 0; int xdamage_base_event_type = 0; /* 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 */ diff --git a/x11vnc/xevents.c b/x11vnc/xevents.c index 4221090..2fc122d 100644 --- a/x11vnc/xevents.c +++ b/x11vnc/xevents.c @@ -148,25 +148,34 @@ void initialize_clipboard_atom(void) { 18 gdm_string: Gdm-simple-greeter 24 gdm_string: metacity 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) { return 0; } if (str[0] == '\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, "-greeter") != NULL) { + if (s) rfbLog("dm_string: %s\n", str); return 1; } } + if (!strcmp(str, "kdmgreet") || !strcmp(str, "Kdmgreet")) { + if (s) rfbLog("dm_string: %s\n", str); + return 1; + } return 0; } -static int gdm_still_running(void) { +static int dm_still_running(void) { #if NO_X11 return 0; #else @@ -195,7 +204,7 @@ static int gdm_still_running(void) { char *name = NULL; Window w = winlist[i]; if (XFetchName(dpy, w, &name) && name != NULL) { - saw_gdm_name += gdm_string(name); + saw_gdm_name += dm_string(name); XFree_wr(name); } classhint->res_name = NULL; @@ -203,12 +212,12 @@ static int gdm_still_running(void) { if (XGetClassHint(dpy, w, classhint)) { name = classhint->res_name; if (name != NULL) { - saw_gdm_name += gdm_string(name); + saw_gdm_name += dm_string(name); XFree_wr(name); } name = classhint->res_class; if (name != NULL) { - saw_gdm_name += gdm_string(name); + saw_gdm_name += dm_string(name); XFree_wr(name); } } @@ -230,6 +239,7 @@ static int gdm_still_running(void) { static int wm_running(void) { char *s = getenv("DEBUG_WM_RUNNING"); + int ret = 0; RAWFB_RET(0) #if NO_X11 return 0; @@ -238,30 +248,36 @@ static int wm_running(void) { * Unfortunately with recent GDM (v2.28), they run gnome-session, * dbus-launch, and metacity for the Login greeter! So the simple * XInternAtom checks below no longer work. + * We also see a similar thing with KDE. */ - if (gdm_still_running()) { + if (dm_still_running()) { return 0; } /* we are xlocked. */ if (XInternAtom(dpy, "_NET_SUPPORTED", True) != None) { if (s) rfbLog("wm is running (_NET_SUPPORTED).\n"); - return 1; + ret++; } if (XInternAtom(dpy, "_WIN_PROTOCOLS", True) != None) { if (s) rfbLog("wm is running (_WIN_PROTOCOLS).\n"); - return 1; + ret++; } if (XInternAtom(dpy, "_XROOTPMAP_ID", True) != None) { if (s) rfbLog("wm is running (_XROOTPMAP_ID).\n"); - return 1; + ret++; } if (XInternAtom(dpy, "_MIT_PRIORITY_COLORS", True) != None) { 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; } - if (s) rfbLog("wm is not running.\n"); - return 0; #endif /* NO_X11 */ } @@ -307,6 +323,9 @@ int guess_dm_gone(int t1, int t2) { } 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... */ if (time(NULL) <= tcheck + wait) { return 0; @@ -365,7 +384,7 @@ static void initialize_xevents(int reset) { * We try to delay creating selwin until we are past * any GDM, (or other KillInitClients=true) manager. */ - if (guess_dm_gone(5, 45)) { + if (guess_dm_gone(8, 45)) { X_LOCK; selwin = XCreateSimpleWindow(dpy, rootwin, 3, 2, 1, 1, 0, 0, 0); X_UNLOCK; @@ -400,7 +419,7 @@ static void initialize_xevents(int reset) { * we are past the display manager, due to Xorg bug: * http://bugs.freedesktop.org/show_bug.cgi?id=18451 */ - if (guess_dm_gone(5, 45)) { + if (guess_dm_gone(8, 45)) { initialize_xfixes(); did_xfixes = 1; if (! quiet) rfbLog("called initialize_xfixes()\n"); diff --git a/x11vnc/xwrappers.c b/x11vnc/xwrappers.c index 6037114..667957e 100644 --- a/x11vnc/xwrappers.c +++ b/x11vnc/xwrappers.c @@ -1320,22 +1320,25 @@ Display *XOpenDisplay_wr(char *display_name) { d = XOpenDisplay(display_name); if (db) fprintf(stderr, "XOpenDisplay_wr: %s %p\n", display_name, (void *)d); - if (d == NULL) { - if (!getenv("NO_XAUTHLOCALHOSTNAME")) { - if (!getenv("XAUTHLOCALHOSTNAME")) { + if (d == NULL && !getenv("NO_XAUTHLOCALHOSTNAME")) { + char *xalhn = getenv("XAUTHLOCALHOSTNAME"); + if (1 || !xalhn) { rfbLog("XOpenDisplay(\"%s\") failed.\n", display_name ? display_name : ""); rfbLog("Trying again with XAUTHLOCALHOSTNAME=localhost ...\n"); set_env("XAUTHLOCALHOSTNAME", "localhost"); d = XOpenDisplay(display_name); - if (0) { + if (d == NULL && xalhn) { char *ptr = getenv("XAUTHLOCALHOSTNAME"); if (ptr) { *(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); |