From 4a83f87609b9d53b2983806be58ccd02498a5cd3 Mon Sep 17 00:00:00 2001 From: runge Date: Mon, 13 Nov 2006 15:33:00 +0000 Subject: [PATCH] x11vnc: Native Mac OS X support. --- ChangeLog | 4 + configure.ac | 33 +- prepare_x11vnc_dist.sh | 2 +- x11vnc/8to24.c | 8 +- x11vnc/ChangeLog | 3 + x11vnc/Makefile.am | 7 +- x11vnc/README | 960 ++++++++++++++++++++++------------------- x11vnc/cleanup.c | 12 + x11vnc/connections.c | 21 +- x11vnc/cursor.c | 279 ++++++------ x11vnc/cursor.h | 2 + x11vnc/gui.c | 13 +- x11vnc/help.c | 10 +- x11vnc/keyboard.c | 12 +- x11vnc/linuxfb.c | 6 + x11vnc/macosx.c | 377 ++++++++++++++++ x11vnc/macosx.h | 19 + x11vnc/macosxCG.c | 508 ++++++++++++++++++++++ x11vnc/macosxCG.h | 23 + x11vnc/macosxCGP.c | 186 ++++++++ x11vnc/macosxCGP.h | 17 + x11vnc/macosxCGS.c | 156 +++++++ x11vnc/macosxCGS.h | 9 + x11vnc/options.c | 4 + x11vnc/options.h | 4 + x11vnc/params.h | 1 + x11vnc/pointer.c | 7 +- x11vnc/remote.c | 17 +- x11vnc/scan.c | 20 +- x11vnc/screen.c | 45 +- x11vnc/selection.c | 8 +- x11vnc/tkx11vnc | 37 +- x11vnc/tkx11vnc.h | 37 +- x11vnc/userinput.c | 32 +- x11vnc/win_utils.c | 35 +- x11vnc/x11vnc.1 | 20 +- x11vnc/x11vnc.c | 48 ++- x11vnc/x11vnc.h | 6 + x11vnc/x11vnc_defs.c | 2 +- x11vnc/xdamage.c | 130 +++++- x11vnc/xdamage.h | 1 + x11vnc/xevents.c | 4 +- x11vnc/xinerama.c | 4 +- x11vnc/xrandr.c | 1 - x11vnc/xrecord.c | 12 +- x11vnc/xwrappers.c | 60 +++ x11vnc/xwrappers.h | 7 + 47 files changed, 2555 insertions(+), 654 deletions(-) create mode 100644 x11vnc/macosx.c create mode 100644 x11vnc/macosx.h create mode 100644 x11vnc/macosxCG.c create mode 100644 x11vnc/macosxCG.h create mode 100644 x11vnc/macosxCGP.c create mode 100644 x11vnc/macosxCGP.h create mode 100644 x11vnc/macosxCGS.c create mode 100644 x11vnc/macosxCGS.h diff --git a/ChangeLog b/ChangeLog index cd91d83..ea63a93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-11-13 Karl Runge + * configure.ac: x11vnc warnings for no XTEST or SSL. + * prepare_x11vnc_dist.sh: to 0.8.4 + 2006-11-07 Karl Runge * configure.ac: clean up -R linker case, add --without-macosx-native * prepare_x11vnc_dist.sh: have "make rpm" work properly for diff --git a/configure.ac b/configure.ac index 8c21673..69ab8f3 100644 --- a/configure.ac +++ b/configure.ac @@ -126,7 +126,7 @@ elif test "$X_CFLAGS" != "-DX_DISPLAY_MISSING"; then AC_CHECK_LIB(Xtst, XTestFakeKeyEvent, X_PRELIBS="-lXtst $X_PRELIBS" - [AC_DEFINE(HAVE_XTEST)], , + [AC_DEFINE(HAVE_XTEST) HAVE_XTEST="true"], , $X_LIBS $X_PRELIBS -lX11 $X_EXTRA_LIBS) if test "x$with_xrecord" != "xno"; then @@ -216,6 +216,24 @@ and --x-libraries=DIR configure options or set the CPPFLAGS and LDFLAGS environment variables to indicate where the X window system header files and libraries may be found. On 64+32 bit machines you may need to point to lib64 or lib32 directories to pick up the correct word size. + +If you want to build x11vnc without X support (e.g. for -rawfb use only +or for native Mac OS X), specify the --without-x configure option. +========================================================================== +]) +fi + +if test "$PACKAGE_NAME" = "x11vnc" -a "x$HAVE_X" = "xtrue" -a "x$HAVE_XTEST" != "xtrue"; then + AC_MSG_WARN([ +========================================================================== +A working build environment for the XTEST extension was not found (libXtst). +An x11vnc built this way will be only barely usable. You will be able to +move the mouse but not click or type. There can also be deadlocks if an +application grabs the X server. + +It is recommended that you install the necessary development packages +for XTEST (perhaps it is named something like libxtst-dev) and run +configure again. ========================================================================== ]) fi @@ -261,6 +279,19 @@ if test "x$with_ssl" != "xno"; then fi AC_SUBST(SSL_LIBS) +if test "$PACKAGE_NAME" = "x11vnc"; then + if test "x$HAVE_LIBSSL" != "xtrue"; then + AC_MSG_WARN([ +========================================================================== +The openssl encryption library libssl.so was not found. An x11vnc built +this way will not support SSL encryption. To enable SSL install the +necessary development packages (perhaps it is named something like +libssl-dev) and run configure again. +========================================================================== +]) + fi +fi + if test "x$with_v4l" != "xno"; then AC_CHECK_HEADER(linux/videodev.h, [AC_DEFINE(HAVE_LINUX_VIDEODEV_H)],,) diff --git a/prepare_x11vnc_dist.sh b/prepare_x11vnc_dist.sh index 17a67a9..1681c04 100644 --- a/prepare_x11vnc_dist.sh +++ b/prepare_x11vnc_dist.sh @@ -1,6 +1,6 @@ #!/bin/bash -VERSION="0.8.3" +VERSION="0.8.4" cd "$(dirname "$0")" diff --git a/x11vnc/8to24.c b/x11vnc/8to24.c index 90dcc20..19061e6 100644 --- a/x11vnc/8to24.c +++ b/x11vnc/8to24.c @@ -434,7 +434,7 @@ if (db24 > 2) fprintf(stderr, " check_for_multivis: %.4f\n", now - last_call); old_handler = XSetErrorHandler(trap_xerror); trapped_xerror = 0; - rc = XQueryTree(dpy, win, &r, &parent, &list0, &nc0); + rc = XQueryTree_wr(dpy, win, &r, &parent, &list0, &nc0); XSetErrorHandler(old_handler); if (! rc || trapped_xerror) { @@ -460,7 +460,7 @@ if (db24 > 2) fprintf(stderr, " check_for_multivis: %.4f\n", now - last_call); old_handler = XSetErrorHandler(trap_xerror); trapped_xerror = 0; - rc = XQueryTree(dpy, win1, &r, &parent, &list1, &nc1); + rc = XQueryTree_wr(dpy, win1, &r, &parent, &list1, &nc1); XSetErrorHandler(old_handler); if (! rc || trapped_xerror) { @@ -479,11 +479,11 @@ if (db24 > 2) fprintf(stderr, " check_for_multivis: %.4f\n", now - last_call); /* more? Which wm does this? */ } if (nc1) { - XFree(list1); + XFree_wr(list1); } } if (nc0) { - XFree(list0); + XFree_wr(list0); } } X_UNLOCK; diff --git a/x11vnc/ChangeLog b/x11vnc/ChangeLog index 439ceb8..8429fcc 100644 --- a/x11vnc/ChangeLog +++ b/x11vnc/ChangeLog @@ -1,3 +1,6 @@ +2006-11-13 Karl Runge + * x11vnc: Native Mac OS X support. + 2006-11-07 Karl Runge * ssl_vncviewer: vnc:// direct connect, add -x to ssh, SSL_VNC_LISTEN variable for direct proxy. diff --git a/x11vnc/Makefile.am b/x11vnc/Makefile.am index 517e251..6bec182 100644 --- a/x11vnc/Makefile.am +++ b/x11vnc/Makefile.am @@ -1,6 +1,11 @@ AM_CFLAGS = -I $(top_srcdir) LDADD = ../libvncserver/libvncserver.a @WSOCKLIB@ +if OSX +x11vnc_LDFLAGS = -framework ApplicationServices -framework Carbon -framework IOKit -framework Cocoa +x11vnc_CFLAGS = -ObjC +endif + SUBDIRS = misc DIST_SUBDIRS = misc @@ -12,7 +17,7 @@ LD_CYGIPC=-lcygipc endif bin_PROGRAMS=x11vnc -x11vnc_SOURCES = 8to24.c cleanup.c connections.c cursor.c gui.c help.c inet.c keyboard.c linuxfb.c options.c pm.c pointer.c rates.c remote.c scan.c screen.c selection.c solid.c sslcmds.c sslhelper.c uinput.c unixpw.c user.c userinput.c util.c v4l.c win_utils.c x11vnc.c x11vnc_defs.c xdamage.c xevents.c xinerama.c xkb_bell.c xrandr.c xrecord.c xwrappers.c 8to24.h allowed_input_t.h blackout_t.h cleanup.h connections.h cursor.h enums.h gui.h help.h inet.h keyboard.h linuxfb.h nox11.h nox11_funcs.h options.h params.h pm.h pointer.h rates.h remote.h scan.h screen.h scrollevent_t.h selection.h solid.h sslcmds.h sslhelper.h ssltools.h tkx11vnc.h uinput.h unixpw.h user.h userinput.h util.h v4l.h win_utils.h winattr_t.h x11vnc.h xdamage.h xevents.h xinerama.h xkb_bell.h xrandr.h xrecord.h xwrappers.h +x11vnc_SOURCES = 8to24.c cleanup.c connections.c cursor.c gui.c help.c inet.c keyboard.c linuxfb.c macosx.c macosxCG.c macosxCGP.c macosxCGS.c options.c pm.c pointer.c rates.c remote.c scan.c screen.c selection.c solid.c sslcmds.c sslhelper.c uinput.c unixpw.c user.c userinput.c util.c v4l.c win_utils.c x11vnc.c x11vnc_defs.c xdamage.c xevents.c xinerama.c xkb_bell.c xrandr.c xrecord.c xwrappers.c 8to24.h allowed_input_t.h blackout_t.h cleanup.h connections.h cursor.h enums.h gui.h help.h inet.h keyboard.h linuxfb.h macosx.h macosxCG.h macosxCGP.h macosxCGS.h nox11.h nox11_funcs.h options.h params.h pm.h pointer.h rates.h remote.h scan.h screen.h scrollevent_t.h selection.h solid.h sslcmds.h sslhelper.h ssltools.h tkx11vnc.h uinput.h unixpw.h user.h userinput.h util.h v4l.h win_utils.h winattr_t.h x11vnc.h xdamage.h xevents.h xinerama.h xkb_bell.h xrandr.h xrecord.h xwrappers.h if HAVE_X INCLUDES=@X_CFLAGS@ x11vnc_LDADD=$(LDADD) @SSL_LIBS@ @CRYPT_LIBS@ @X_LIBS@ $(LD_CYGIPC) diff --git a/x11vnc/README b/x11vnc/README index 18ab442..96928fc 100644 --- a/x11vnc/README +++ b/x11vnc/README @@ -1,5 +1,5 @@ -x11vnc README file Date: Tue Nov 7 17:22:44 EST 2006 +x11vnc README file Date: Mon Nov 13 09:43:23 EST 2006 The following information is taken from these URLs: @@ -371,12 +371,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 CVS tree) from the above - link. As of Jul 2006, the [59]x11vnc-0.8.2.tar.gz source package is - released (recommended download). The [60]x11vnc 0.8.2 release notes. + link. As of Nov 2006, the [59]x11vnc-0.8.3.tar.gz source package is + released (recommended download). The [60]x11vnc 0.8.3 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 [61]x11vnc-0.8.3.tar.gz tarball to build the most up to + bleeding edge [61]x11vnc-0.8.4.tar.gz tarball to build the most up to date one. Precompiled Binaries/Packages: See the [62]FAQ below for information @@ -408,13 +408,13 @@ vncviewer -via $host localhost:0 # must be TightVNC vncviewer. Building x11vnc: If your OS has libjpeg.so and libz.so in standard locations you can - build as follows (example given for the 0.8.2 release of x11vnc: + build as follows (example given for the 0.8.3 release of x11vnc: replace with the version you downloaded): (un-tar the x11vnc+libvncserver tarball) -# gzip -dc x11vnc-0.8.2.tar.gz | tar -xvf - +# gzip -dc x11vnc-0.8.3.tar.gz | tar -xvf - (cd to the source directory) -# cd x11vnc-0.8.2 +# cd x11vnc-0.8.3 (run configure and then run make) # ./configure @@ -611,13 +611,13 @@ make I'd appreciate any additional testing very much! Thanks to those who suggested features and helped beta test x11vnc - 0.8.2 released in Jul 2006! + 0.8.3 released in Nov 2006! - Please help test and debug the 0.8.3 version for release sometime in - Summer/Fall 2006. + Please help test and debug the 0.8.4 version for release sometime in + Winter 2006. - The version 0.8.3 beta tarball is kept here: - [78]x11vnc-0.8.3.tar.gz + The version 0.8.4 beta tarball is kept here: + [78]x11vnc-0.8.4.tar.gz There are also some Linux, Solaris, and other OS test binaries [79]here. Please kick the tires and report bugs, performance @@ -633,7 +633,11 @@ make page. - Here are some features that will appear in the 0.8.3 release: + Here are some features that will appear in the 0.8.4 release: + * Native Mac OS X support. + + + Here are some features that appeared in the 0.8.3 release: * The [85]-ssl option provides SSL encryption and authentication natively via the [86]www.openssl.org library. One can use from a simple self-signed certificate server certificate up to full CA @@ -1344,8 +1348,26 @@ make Q-2: I can't get x11vnc and/or libvncserver to compile. - Make sure you have all of the required -devel packages installed. - These include X11/XFree86, libjpeg, libz, ... + Make sure you have gcc (or other C compiler) and all of the required + libraries and corresponding -dev/-devel packages installed. These + include Xorg/XFree86, libX11, libjpeg, libz, libssl, ... + + The most common build problem that people encounter is that the + necessary X11 libraries are installed on their system however it does + not have the corresponding -dev/-devel packages installed. These dev + packages include C header files and build-time .so symlink. It is a + shame the current trend in distros is to not install the dev package + by default when the the library runtime package is installed... + + As of Nov/2006 here is a list of libraries that x11vnc usually likes + to use: +libc.so libX11.so libXtst.so libXext.so +libXfixes.so libXdamage.so libXinerama.so libXrandr.so +libz.so libjpeg.so libpthread.so +libssl.so libcrypto.so libcrypt.so + + although x11vnc will be pretty usable with the subset: libc.so, + libX11.so, libXtst.so, libXext.so, libz.so, and libjpeg.so. After running the libvncserver configure, carefully examine the output and the messages in the config.log file looking for missing @@ -1356,8 +1378,13 @@ make checking for XineramaQueryScreens in -lXinerama... no checking for XTestFakeKeyEvent in -lXtst... no + or even worse: + checking for C compiler default output file name... configure: error: + C compiler cannot create executables + See `config.log' for more details. + there is quite a bit wrong with the build environment. Hopefully - simply adding -devel packages will fix it. + simply adding -dev packages and/or gcc will fix it. For Debian the list seems to be: gcc @@ -1371,14 +1398,24 @@ make x-dev xlibs-static-dev zlib1g-dev + libssl-dev For Redhat the list seems to be: gcc make glibc-devel libjpeg-devel - XFree86-devel or xorg-x11-devel + xorg-x11-devel or XFree86-devel zlib-devel + openssl097a + + For other distros or OS's the package names may not be the same but + will look similar. Also, distros tend to rename packages as well so + the above list may be out of date. + + Note: there is growing trend in Linux and other distros to slice up + core X11 software into more and smaller packages. So be prepared for + more headaches compiling software. Q-3: I just built x11vnc successfully, but when I use it my keystrokes @@ -1511,7 +1548,7 @@ typedef unsigned int in_addr_t; up the Java VNC Viewer jar file (either SSL enabled or regular one), then you will need to extract the classes subdirectory from the source tarball and point x11vnc to it via the [260]-httpdir option. E.g.: - x11vnc -httpdir /path/to/x11vnc-0.8.1/classes/ssl ... + x11vnc -httpdir /path/to/x11vnc-0.8.3/classes/ssl ... Q-6: Where can I get a VNC Viewer binary (or source code) for the @@ -3075,16 +3112,19 @@ connect = 5900 let you connect. Use the [424]-https option if you want a dedicated port for HTTPS connections instead of sharing the VNC port. + To see example x11vnc output for a successful https://host:5900/ + connection with the Java Applet see [425]This Page. + Notes on the VNC Viewer ssl_vncviewer wrapper script: If you want to use a native VNC Viewer with the SSL enabled x11vnc you will need to run an external SSL tunnel on the Viewer side. There do not seem to be any native SSL VNC Viewers outside of the x11vnc - package. The basic ideas of doing this were discussed [425]for + package. The basic ideas of doing this were discussed [426]for external tunnel utilities here. - The [426]ssl_vncviewer script provided with x11vnc can set up the + The [427]ssl_vncviewer script provided with x11vnc can set up the stunnel tunnel automatically on unix as long as the stunnel command is installed on the Viewer machine and available in PATH (and vncviewer too of course). Note that on Debian based system you will need to @@ -3116,14 +3156,14 @@ connect = 5900 The fifth one shows that Web proxies can be used if that is the only way to get out of the firewall. If the "double proxy" situation arises - separate the two by commas. See [427]this page for more information on + separate the two by commas. See [428]this page for more information on how Web proxies come into play. - If one uses a Certificate Authority (CA) scheme described [428]here, + If one uses a Certificate Authority (CA) scheme described [429]here, the wrapper script would use the CA cert instead of the server cert: 3') ssl_vncviewer -verify ./cacert.crt far-away.east:0 - Update Jul/2006: we now provide an [429]Enhanced TightVNC Viewer + Update Jul/2006: we now provide an [430]Enhanced TightVNC Viewer package that starts up STUNNEL automatically along with some other features. All binaries are provided in the package. @@ -3159,7 +3199,7 @@ connect = 5900 (instead of the unsigned one in https://yourmachine.com:5900/ that gives the default index.vnc) - Note that the [430]ssl_vncviewer stunnel wrapper script can use Web + Note that the [431]ssl_vncviewer stunnel wrapper script can use Web proxies as well. Proxies that limit CONNECT to ports 443 and 563: @@ -3188,7 +3228,7 @@ connect = 5900 https://yourmachine.com/proxy.vnc?PORT=443 this is cleaner because it avoids editing the file, but requires more - parameters in the URL. To use the GET [431]trick discussed above, do: + parameters in the URL. To use the GET [432]trick discussed above, do: https://yourmachine.com/proxy.vnc?PORT=443&GET=1 @@ -3196,7 +3236,7 @@ connect = 5900 SSL from the Internet with a Web browser to x11vnc running on their workstations behind a firewall? Yes. You will need to configure apache to forward these connections. - It is discussed [432]here. This provides a clean alternative to the + It is discussed [433]here. This provides a clean alternative to the traditional method where the user uses SSH to log in through the gateway to create the encrypted port redirection to x11vnc running on her desktop. @@ -3204,7 +3244,7 @@ connect = 5900 Q-50: Can I create and use my own SSL Certificate Authority (CA) with x11vnc? - Yes, see [433]this page for how to do this and the utility commands + Yes, see [434]this page for how to do this and the utility commands x11vnc provides to create and manage many types of certificates and private keys. @@ -3223,14 +3263,14 @@ connect = 5900 need to have sufficient permissions to connect to the X display. Here are some ideas: - * Use the description under "Continuously" in the [434]FAQ on x11vnc + * Use the description under "Continuously" in the [435]FAQ on x11vnc and Display Managers - * Use the description in the [435]FAQ on x11vnc and inetd(8) - * Use the description in the [436]FAQ on Unix user logins and + * Use the description in the [436]FAQ on x11vnc and inetd(8) + * Use the description in the [437]FAQ on Unix user logins and inetd(8) * Start x11vnc from your $HOME/.xsession (or $HOME/.xinitrc or autostart script or ...) - * Although less reliable, see the [437]x11vnc_loop rc.local hack + * Although less reliable, see the [438]x11vnc_loop rc.local hack below. The display manager scheme will not be specific to which user has the @@ -3252,7 +3292,7 @@ x11vnc -logfile $HOME/.x11vnc.log -rfbauth $HOME/.vnc/passwd -forever -bg X startup scripts (traditionally .xsession/.xinitrc) may have to be in a different directory or have a different basename. One user recommends the description under 'Running Scripts Automatically' at - [438]this link. + [439]this link. Q-52: How can I use x11vnc to connect to an X login screen like xdm, @@ -3267,7 +3307,7 @@ x11vnc -logfile $HOME/.x11vnc.log -rfbauth $HOME/.vnc/passwd -forever -bg while running x11vnc as root, e.g. for the gnome display manager, gdm: x11vnc -auth /var/gdm/:0.Xauth -display :0 - (the [439]-auth option sets the XAUTHORITY variable for you). + (the [440]-auth option sets the XAUTHORITY variable for you). There will be a similar thing for xdm using however a different auth directory path (perhaps something like @@ -3292,7 +3332,7 @@ x11vnc -logfile $HOME/.x11vnc.log -rfbauth $HOME/.vnc/passwd -forever -bg auth file should be in /var/dt), you'll also need to add something like Dtlogin*grabServer:False to the Xconfig file (/etc/dt/config/Xconfig or /usr/dt/config/Xconfig on Solaris, see - [440]the example at the end of this FAQ). Then restart dtlogin, e.g.: + [441]the example at the end of this FAQ). Then restart dtlogin, e.g.: /etc/init.d/dtlogin stop; /etc/init.d/dtlogin start or reboot. Continuously. Have x11vnc reattach each time the X server is @@ -3355,7 +3395,7 @@ x11vnc -logfile $HOME/.x11vnc.log -rfbauth $HOME/.vnc/passwd -forever -bg Then restart: /usr/sbin/gdm-restart (or reboot). The KillInitClients=false setting is important: without it x11vnc will be - killed immediately after the user logs in. Here are [441]full details + killed immediately after the user logs in. Here are [442]full details on how to configure gdm _________________________________________________________________ @@ -3397,14 +3437,14 @@ x11vnc -logfile $HOME/.x11vnc.log -rfbauth $HOME/.vnc/passwd -forever -bg If you do not want to deal with any display manager startup scripts, here is a kludgey script that can be run manually or out of a boot - file like rc.local: [442]x11vnc_loop It will need some local + file like rc.local: [443]x11vnc_loop It will need some local customization before running. Because the XAUTHORITY auth file must be guessed by this script, use of the display manager script method - described above is greatly preferred. There is also the [443]-loop + described above is greatly preferred. There is also the [444]-loop option that does something similar. If the machine is a traditional Xterminal you may want to read - [444]this FAQ. + [445]this FAQ. Q-53: Can I run x11vnc out of inetd(8)? How about xinetd(8)? @@ -3414,7 +3454,7 @@ x11vnc -logfile $HOME/.x11vnc.log -rfbauth $HOME/.vnc/passwd -forever -bg 5900 stream tcp nowait root /usr/sbin/tcpd /usr/local/bin/x11vnc_sh - where the shell script /usr/local/bin/x11vnc_sh uses the [445]-inetd + where the shell script /usr/local/bin/x11vnc_sh uses the [446]-inetd option and looks something like (you'll need to customize to your settings). #!/bin/sh @@ -3427,7 +3467,7 @@ x11vnc -logfile $HOME/.x11vnc.log -rfbauth $HOME/.vnc/passwd -forever -bg and that confuses it greatly, causing it to abort). If you do not use a wrapper script as above but rather call x11vnc directly in /etc/inetd.conf and do not redirect stderr to a file, then you must - specify the -q (aka [446]-quiet) option: "/usr/local/bin/x11vnc -q + specify the -q (aka [447]-quiet) option: "/usr/local/bin/x11vnc -q -inetd ...". When you supply both -q and -inet and no "-o logfile" then stderr will automatically be closed (to prevent, e.g. library stderr messages leaking out to the viewer). The recommended practice @@ -3435,12 +3475,12 @@ x11vnc -logfile $HOME/.x11vnc.log -rfbauth $HOME/.vnc/passwd -forever -bg script with "2>logfile" redirection because the errors and warnings printed out are very useful in troubleshooting problems. - Note also the need to set XAUTHORITY via [447]-auth to point to the + Note also the need to set XAUTHORITY via [448]-auth to point to the MIT-COOKIE auth file to get permission to connect to the X display (setting and exporting the XAUTHORITY variable accomplishes the same thing). See the x11vnc_loop file in the previous question for more ideas on what that auth file may be, etc. The scheme described in the - [448]FAQ on Unix user logins and inetd(8) works around the XAUTHORITY + [449]FAQ on Unix user logins and inetd(8) works around the XAUTHORITY issue nicely. Note: On Solaris you cannot have the bare number 5900 in @@ -3505,13 +3545,13 @@ service x11vncservice Q-54: Can I have x11vnc allow a user to log in with her UNIX password and then have it find her X display on that machine and connect to it? - The easiest way to do this is via [449]inetd(8) using the [450]-unixpw - and [451]-display WAIT options. The reason inetd(8) makes this easier + The easiest way to do this is via [450]inetd(8) using the [451]-unixpw + and [452]-display WAIT options. The reason inetd(8) makes this easier is that it starts a new x11vnc process for each new user connection. Otherwise a wrapper would have to listen for connections and spawn new - x11vnc's (see [452]this example). + x11vnc's (see [453]this example). - The [453]-display WAIT option makes x11vnc wait until a VNC viewer is + The [454]-display WAIT option makes x11vnc wait until a VNC viewer is connected before attaching to the X display. Additionally it can be used to run an external command that returns the DISPLAY and XAUTHORITY data. So one could supply "-display @@ -3554,7 +3594,7 @@ exit 0 as the first line and any remaining lines are either XAUTHORITY=file or raw xauth data (the above example does the latter). - The [454]-unixpw option allows [455]UNIX password logins. Here are a + The [455]-unixpw option allows [456]UNIX password logins. Here are a couple /etc/inetd.conf examples for this: 5900 stream tcp nowait nobody /usr/sbin/tcpd /usr/local/bin/x11vnc -inetd -unixpw \ @@ -3574,9 +3614,9 @@ xpw= directory will need to be set up to allow "nobody" to use them. In the second one x11vnc is run as root and switches to the user that - logs in due to the "[456]-users unixpw=" option. + logs in due to the "[457]-users unixpw=" option. - Note that [457]SSL is required for this mode because otherwise the + Note that [458]SSL is required for this mode because otherwise the unix password would be passed in clear text over the network. In general -unixpw is not required for this sort of scheme, but it is convenient because it determines exactly who the user is whose display @@ -3587,7 +3627,7 @@ xpw= Q-55: Can I have x11vnc restart itself after it terminates? One could do this in a shell script, but now there is an option - [458]-loop that makes it easier. Of course when x11vnc restarts it + [459]-loop that makes it easier. Of course when x11vnc restarts it needs to have permissions to connect to the (potentially new) X display. This mode could be useful if the X server restarts often. Use e.g. "-loop5000" to sleep 5000 ms between restarts. Also "-loop2000,5" @@ -3598,7 +3638,7 @@ xpw= web browser? To have x11vnc serve up a Java VNC viewer applet to any web browsers - that connect to it, run x11vnc with this [459]option: + that connect to it, run x11vnc with this [460]option: -httpdir /path/to/the/java/classes/dir (this directory will contain the files index.vnc and, for example, @@ -3617,7 +3657,7 @@ xpw= then you can connect to that URL with any Java enabled browser. Feel free to customize the default index.vnc file in the classes directory. - As of May/2005 the [460]-http option will try to guess where the Java + As of May/2005 the [461]-http option will try to guess where the Java classes jar file is by looking in expected locations and ones relative to the x11vnc binary. @@ -3633,7 +3673,7 @@ xpw= As of Mar/2004 x11vnc supports reverse connections. On Unix one starts the VNC viewer in listen mode: vncviewer -listen (see your documentation for Windows, etc), and then starts up x11vnc with the - [461]-connect option. To connect immediately at x11vnc startup time + [462]-connect option. To connect immediately at x11vnc startup time use the "-connect host:port" option (use commas for a list of hosts to connect to). The ":port" is optional (default is 5500). @@ -3641,7 +3681,7 @@ xpw= file is checked periodically (about once a second) for new hosts to connect to. - The [462]-remote control option (aka -R) can also be used to do this + The [463]-remote control option (aka -R) can also be used to do this during an active x11vnc session, e.g.: x11vnc -display :0 -R connect:hostname.domain @@ -3653,7 +3693,7 @@ x11vnc -display :0 -R connect:hostname.domain starting x11vnc. To use the vncconnect(1) program (from the core VNC package at - www.realvnc.com) specify the [463]-vncconnect option to x11vnc (Note: + www.realvnc.com) specify the [464]-vncconnect option to x11vnc (Note: as of Dec/2004 -vncconnect is now the default). vncconnect(1) must be pointed to the same X11 DISPLAY as x11vnc (since it uses X properties to communicate with x11vnc). If you do not have or do not want to get @@ -3698,7 +3738,7 @@ xprop -root -f VNC_CONNECT 8s -set VNC_CONNECT "$1" There are some annoyances WRT Xvfb though. The default keyboard mapping seems to be very poor. One should run x11vnc with - [464]-add_keysyms option to have keysyms added automatically. Also, to + [465]-add_keysyms option to have keysyms added automatically. Also, to add the Shift_R and Control_R modifiers something like this is needed: #!/bin/sh xmodmap -e "keycode any = Shift_R" @@ -3720,11 +3760,11 @@ xmodmap -e "add Control = Control_L Control_R" The main drawback to this method (besides requiring extra configuration and possibly root permission) is that it also does the - Linux Virtual Console/Terminal (VC/VT) [465]switching even though it + Linux Virtual Console/Terminal (VC/VT) [466]switching even though it does not need to (since it doesn't use a real framebuffer). There are some "dual headed" (actually multi-headed/multi-user) patches to the X server that turn off the VT usage in the X server. Update: As of - Jul/2005 we have an LD_PRELOAD script [466]Xdummy that allows you to + Jul/2005 we have an LD_PRELOAD script [467]Xdummy that allows you to use a stock (i.e. unpatched) Xorg or XFree86 server with the "dummy" driver and not have any VT switching problems! Currently Xdummy needs to be run as root, but with some luck that may be relaxed in the @@ -3756,7 +3796,7 @@ startx -- /path/to/Xdummy :1 An X server can be started on the headless machine (sometimes this requires configuring the X server to not fail if it cannot detect a keyboard or mouse, see the next paragraph). Then you can export that X - display via x11vnc (e.g. see [467]this FAQ) and access it from + display via x11vnc (e.g. see [468]this FAQ) and access it from anywhere on the network via a VNC viewer. Some tips on getting X servers to start on machines without keyboard @@ -3799,7 +3839,7 @@ startx -- /path/to/Xdummy :1 19/03/2004 10:10:58 error creating tile-row shm for len=4 19/03/2004 10:10:58 reverting to single_copytile mode - Here is a shell script [468]shm_clear to list and prompt for removal + Here is a shell script [469]shm_clear to list and prompt for removal of your unattached shm segments (attached ones are skipped). I use it while debugging x11vnc (I use "shm_clear -y" to assume "yes" for each prompt). If x11vnc is regularly not cleaning up its shm segments, @@ -3833,40 +3873,40 @@ ied) in /etc/system. See the next paragraph for more workarounds. To minimize the number of shm segments used by x11vnc try using the - [469]-onetile option (corresponds to only 3 shm segments used, and + [470]-onetile option (corresponds to only 3 shm segments used, and adding -fs 1.0 knocks it down to 2). If you are having much trouble with shm segments, consider disabling shm completely via the - [470]-noshm option. Performance will be somewhat degraded but when + [471]-noshm option. Performance will be somewhat degraded but when done over local machine sockets it should be acceptable (see an - [471]earlier question discussing -noshm). + [472]earlier question discussing -noshm). Q-61: How can I make x11vnc use less system resources? - The [472]-nap (now on by default) and "[473]-wait n" (where n is the + The [473]-nap (now on by default) and "[474]-wait n" (where n is the sleep between polls in milliseconds, the default is 30 or so) option - are good places to start. Something like "[474]-sb 15" will cause + are good places to start. Something like "[475]-sb 15" will cause x11vnc to go into a deep-sleep mode after 15 seconds of no activity (instead of the default 60). Reducing the X server bits per pixel depth (e.g. to 16bpp or even 8bpp) will further decrease memory I/O and network I/O. The ShadowFB - will make x11vnc's screen polling less severe. Using the [475]-onetile + will make x11vnc's screen polling less severe. Using the [476]-onetile option will use less memory and use fewer shared memory slots (add - [476]-fs 1.0 for one less slot). + [477]-fs 1.0 for one less slot). Q-62: How can I make x11vnc use MORE system resources? - You can try [477]-threads and dial down the wait time (e.g. -wait 1) - and possibly dial down [478]-defer as well. Note that if you try to + You can try [478]-threads and dial down the wait time (e.g. -wait 1) + and possibly dial down [479]-defer as well. Note that if you try to increase the "frame rate" too much you can bog down the server end with the extra work it needs to do compressing the framebuffer data, etc. That said, it is possible to "stream" video via x11vnc if the video window is small enough. E.g. a 256x192 xawtv TV capture window (using - the x11vnc [479]-id option) can be streamed over a LAN or wireless at + the x11vnc [480]-id option) can be streamed over a LAN or wireless at a reasonable frame rate. @@ -3882,7 +3922,7 @@ ied) * Use a smaller desktop size (e.g. 1024x768 instead of 1280x1024) * Make sure the desktop background is a solid color (the background is resent every time it is re-exposed). Consider using the - [480]-solid [color] option to try to do this automatically. + [481]-solid [color] option to try to do this automatically. * Configure your window manager or desktop "theme" to not use fancy images, shading, and gradients for the window decorations, etc. Disable window animations, etc. Maybe your desktop has a "low @@ -3891,9 +3931,9 @@ ied) -> Use Smooth Scrolling (deselect it). * Avoid small scrolls of large windows using the Arrow keys or scrollbar. Try to use PageUp/PageDown instead. (not so much of a - problem in x11vnc 0.7.2 if [481]-scrollcopyrect is active and + problem in x11vnc 0.7.2 if [482]-scrollcopyrect is active and detecting scrolls for the application). - * If the [482]-wireframe option is not available (earlier than + * If the [483]-wireframe option is not available (earlier than x11vnc 0.7.2 or you have disabled it via -nowireframe) then Disable Opaque Moves and Resizes in the window manager/desktop. * However if -wireframe is active (on by default in x11vnc 0.7.2) @@ -3916,7 +3956,7 @@ ied) noticed. VNC viewer parameters: - * Use a [483]TightVNC enabled viewer! (Actually, RealVNC 4.x viewer + * Use a [484]TightVNC enabled viewer! (Actually, RealVNC 4.x viewer with ZRLE encoding is not too bad either; some claim it is faster). * Make sure the tight (or zrle) encoding is being used (look at @@ -3938,37 +3978,37 @@ ied) file. x11vnc parameters: - * Make sure the [484]-wireframe option is active (it should be on by + * Make sure the [485]-wireframe option is active (it should be on by default) and you have Opaque Moves/Resizes Enabled in the window manager. - * Make sure the [485]-scrollcopyrect option is active (it should be + * Make sure the [486]-scrollcopyrect option is active (it should be on by default). This detects scrolls in many (but not all) applications an applies the CopyRect encoding for a big speedup. * Enforce a solid background when VNC viewers are connected via - [486]-solid - * Specify [487]-speeds modem to force the wireframe and + [487]-solid + * Specify [488]-speeds modem to force the wireframe and scrollcopyrect heuristic parameters (and any future ones) to those of a dialup modem connection (or supply the rd,bw,lat numerical values that characterize your link). * If wireframe and scrollcopyrect aren't working, try using the more - drastic [488]-nodragging (no screen updates when dragging mouse, + drastic [489]-nodragging (no screen updates when dragging mouse, but sometimes you miss visual feedback) - * Set [489]-fs 1.0 (disables fullscreen updates) - * Try increasing [490]-wait or [491]-defer (reduces the maximum + * Set [490]-fs 1.0 (disables fullscreen updates) + * Try increasing [491]-wait or [492]-defer (reduces the maximum "frame rate", but won't help much for large screen changes) - * Try the [492]-progressive pixelheight mode with the block + * Try the [493]-progressive pixelheight mode with the block pixelheight 100 or so (delays sending vertical blocks since they may change while viewer is receiving earlier ones) - * If you just want to watch one (simple) window use [493]-id (cuts + * If you just want to watch one (simple) window use [494]-id (cuts down extraneous polling and updates, but can be buggy or insufficient) - * Set [494]-nosel (disables all clipboard selection exchange) - * Use [495]-nocursor and [496]-nocursorpos (repainting the remote + * Set [495]-nosel (disables all clipboard selection exchange) + * Use [496]-nocursor and [497]-nocursorpos (repainting the remote cursor position and shape takes resources and round trips) * On very slow links (e.g. <= 28.8) you may need to increase the - [497]-readtimeout n setting if it sometimes takes more than 20sec + [498]-readtimeout n setting if it sometimes takes more than 20sec to paint the full screen, etc. - * Do not use [498]-fixscreen to automatically refresh the whole + * Do not use [499]-fixscreen to automatically refresh the whole screen, tap three Alt_L's then the screen has painting errors (rare problem). @@ -3991,7 +4031,7 @@ ied) Note that the DAMAGE extension does not speed up the actual reading of pixels from the video card framebuffer memory, by, say, mirroring them - in main memory. So reading the fb is still painfully [499]slow (e.g. + in main memory. So reading the fb is still painfully [500]slow (e.g. 5MB/sec), and so even using X DAMAGE when large changes occur on the screen the bulk of the time is still spent retrieving them. Not ideal, but use of the ShadowFB XFree86/Xorg option speeds up the reading @@ -4009,27 +4049,27 @@ ied) DAMAGE rectangles to contain real damage. The larger rectangles are only used as hints to focus the traditional scanline polling (i.e. if a scanline doesn't intersect a recent DAMAGE rectangle, the scan is - skipped). You can use the "[500]-xd_area A" option to adjust the size + skipped). You can use the "[501]-xd_area A" option to adjust the size of the trusted DAMAGE rectangles. The default is 20000 pixels (e.g. a 140x140 square, etc). Use "-xd_area 0" to disable the cutoff and trust all DAMAGE rectangles. - The option "[501]-xd_mem f" may also be of use in tuning the - algorithm. To disable using DAMAGE entirely use "[502]-noxdamage". + The option "[502]-xd_mem f" may also be of use in tuning the + algorithm. To disable using DAMAGE entirely use "[503]-noxdamage". Q-65: When I drag windows around with the mouse or scroll up and down things really bog down (unless I do the drag in a single, quick motion). Is there anything to do to improve things? - This problem is primarily due to [503]slow hardware read rates from + This problem is primarily due to [504]slow hardware read rates from video cards: as you scroll or move a large window around the screen changes are much too rapid for x11vnc to keep up them (it can usually only read the video card at about 5-10 MB/sec, so it can take a good fraction of a second to read the changes induce from moving a large window, if this to be done a number of times in succession the window or scroll appears to "lurch" forward). See the description in the - [504]-pointer_mode option for more info. The next bottleneck is + [505]-pointer_mode option for more info. The next bottleneck is compressing all of these changes and sending them out to connected viewers, however the VNC protocol is pretty much self-adapting with respect to that (updates are only packaged and sent when viewers ask @@ -4039,26 +4079,26 @@ ied) default should now be much better than before and dragging small windows around should no longer be a huge pain. If for some reason these changes make matters worse, you can go back to the old way via - the "[505]-pointer_mode 1" option. + the "[506]-pointer_mode 1" option. - Also added was the [506]-nodragging option that disables all screen + Also added was the [507]-nodragging option that disables all screen updates while dragging with the mouse (i.e. mouse motion with a button held down). This gives the snappiest response, but might be undesired in some circumstances when you want to see the visual feedback while dragging (e.g. menu traversal or text selection). - As of Dec/2004 the [507]-pointer_mode n option was introduced. n=1 is + As of Dec/2004 the [508]-pointer_mode n option was introduced. n=1 is the original mode, n=2 an improvement, etc.. See the -pointer_mode n help for more info. - Also, in some circumstances the [508]-threads option can improve + Also, in some circumstances the [509]-threads option can improve response considerably. Be forewarned that if more than one vncviewer is connected at the same time then libvncserver may not be thread safe (try to get the viewers to use different VNC encodings, e.g. tight and ZRLE). - As of Apr/2005 two new options (see the [509]wireframe FAQ and - [510]scrollcopyrect FAQ below) provide schemes to sweep this problem + As of Apr/2005 two new options (see the [510]wireframe FAQ and + [511]scrollcopyrect FAQ below) provide schemes to sweep this problem under the rug for window moves or resizes and for some (but not all) window scrolls. These are the preferred way of avoiding the "lurching" problem, contact me if they are not working. Note on SuSE and some @@ -4082,8 +4122,8 @@ EndSection the window move/resize stops, it returns to normal processing: you should only see the window appear in the new position. This spares you from interacting with a "lurching" window between all of the - intermediate steps. BTW the lurching is due to [511]slow video card - read rates (see [512]here too). A displacement, even a small one, of a + intermediate steps. BTW the lurching is due to [512]slow video card + read rates (see [513]here too). A displacement, even a small one, of a large window requires a non-negligible amount of time, a good fraction of a second, to read in from the hardware framebuffer. @@ -4091,7 +4131,7 @@ EndSection for -wireframe to do any good. The mode is currently on by default because most people are afflicted - with the problem. It can be disabled with the [513]-nowireframe option + with the problem. It can be disabled with the [514]-nowireframe option (aka -nowf). Why might one want to turn off the wireframing? Since x11vnc is merely guessing when windows are being moved/resized, it may guess poorly for your window-manager or desktop, or even for the way @@ -4136,13 +4176,13 @@ EndSection * Maximum time to show a wireframe animation. * Minimum time between sending wireframe outlines. - See the [514]"-wireframe tweaks" option for more details. On a slow + See the [515]"-wireframe tweaks" option for more details. On a slow link, e.g. dialup modem, the parameters may be automatically adjusted for better response. CopyRect encoding: In addition to the above there is the - [515]"-wirecopyrect mode" option. It is also on by default. This + [516]"-wirecopyrect mode" option. It is also on by default. This instructs x11vnc to not only show the wireframe animation, but to also instruct all connected VNC viewers to locally translate the window image data from the original position to the new position on the @@ -4190,7 +4230,7 @@ EndSection requiring the image data to be transmitted over the network. For fast links the speedup is primarily due to x11vnc not having to read the scrolled framebuffer data from the X server (recall that reading from - the hardware framebuffer is [516]slow). + the hardware framebuffer is [517]slow). To do this x11vnc uses the RECORD X extension to snoop the X11 protocol between the X client with the focus window and the X server. @@ -4217,10 +4257,10 @@ EndSection the X server display: if one falls too far behind it could become a mess... - The initial implementation of [517]-scrollcopyrect option is useful in + The initial implementation of [518]-scrollcopyrect option is useful in that it detects many scrolls and thus gives a much nicer working - environment (especially when combined with the [518]-wireframe - [519]-wirecopyrect [520]options, which are also on by default; and if + environment (especially when combined with the [519]-wireframe + [520]-wirecopyrect [521]options, which are also on by default; and if you are willing to enable the ShadowFB things are very fast). The fact that there aren't long delays or lurches during scrolling is the primary improvement. @@ -4253,10 +4293,10 @@ EndSection One can tap the Alt_L key (Left "Alt" key) 3 times in a row to signal x11vnc to refresh the screen to all viewers. Your VNC-viewer may have its own screen refresh hot-key or button. See - also: [521]-fixscreen + also: [522]-fixscreen * Some applications, notably OpenOffice, do XCopyArea scrolls in weird ways that assume ancestor window clipping is taking place. - See the [522]-scr_skip option for ways to tweak this on a + See the [523]-scr_skip option for ways to tweak this on a per-application basis. * Selecting text while dragging the mouse may be slower, especially if the Button-down event happens near the window's edge. This is @@ -4273,7 +4313,7 @@ EndSection because it fails to detect scrolls in it. Sometimes clicking inside the application window or selecting some text in it to force the focus helps. - * When using the [523]-scale option there will be a quick CopyRect + * When using the [524]-scale option there will be a quick CopyRect scroll, but it needs to be followed by a slower "cleanup" update. This is because for a fixed finite screen resolution (e.g. 75 dpi) scaling and copyrect-ing are not exactly independent. Scaling @@ -4286,7 +4326,7 @@ EndSection If you find the -scrollcopyrect behavior too approximate or distracting you can go back to the standard polling-only update method - with the [524]-noscrollcopyrect (or -noscr for short). If you find + with the [525]-noscrollcopyrect (or -noscr for short). If you find some extremely bad and repeatable behavior for -scrollcopyrect please report a bug. @@ -4325,23 +4365,23 @@ EndSection this is because the cursor shape is often downloaded to the graphics hardware (video card), but I could be mistaken. - A simple kludge is provided by the "[525]-cursor X" option that + A simple kludge is provided by the "[526]-cursor X" option that changes the cursor when the mouse is on the root background (or any window has the same cursor as the root background). Note that desktops like GNOME or KDE often cover up the root background, so this won't - work for those cases. Also see the "[526]-cursor some" option for + work for those cases. Also see the "[527]-cursor some" option for additional kludges. Note that as of Aug/2004 on Solaris using the SUN_OVL overlay extension and IRIX, x11vnc can show the correct mouse cursor when the - [527]-overlay option is supplied. See [528]this FAQ for more info. + [528]-overlay option is supplied. See [529]this FAQ for more info. Also as of Dec/2004 XFIXES X extension support has been added to allow exact extraction of the mouse cursor shape. XFIXES fixes the problem of the cursor-shape being write-only: x11vnc can now query the X server for the current shape and send it back to the connected viewers. XFIXES is available on recent Linux Xorg based distros and - [529]Solaris 10. + [530]Solaris 10. The only XFIXES issue is the handling of alpha channel transparency in cursors. If a cursor has any translucency then in general it must be @@ -4349,7 +4389,7 @@ EndSection situations where the cursor transparency can also handled exactly: when the VNC Viewer requires the cursor shape be drawn into the VNC framebuffer or if you apply a patch to your VNC Viewer to extract - hidden alpha channel data under 32bpp. [530]Details can be found here. + hidden alpha channel data under 32bpp. [531]Details can be found here. Q-69: When using XFIXES cursorshape mode, some of the cursors look @@ -4382,17 +4422,17 @@ EndSection for most cursor themes and you don't have to worry about it. In case it still looks bad for your cursor theme, there are (of - course!) some tunable parameters. The "[531]-alphacut n" option lets + course!) some tunable parameters. The "[532]-alphacut n" option lets you set the threshold "n" (between 0 and 255): cursor pixels with alpha values below n will be considered completely transparent while values equal to or above n will be completely opaque. The default is - 240. The "[532]-alphafrac f" option tries to correct individual + 240. The "[533]-alphafrac f" option tries to correct individual cursors that did not fare well with the default -alphacut value: if a cursor has less than fraction f (between 0.0 and 1.0) of its pixels selected by the default -alphacut, the threshold is lowered until f of its pixels are selected. The default fraction is 0.33. - Finally, there is an option [533]-alpharemove that is useful for + Finally, there is an option [534]-alpharemove that is useful for themes where many cursors are light colored (e.g. "whiteglass"). XFIXES returns the cursor data with the RGB values pre-multiplied by the alpha value. If the white cursors look too grey, specify @@ -4418,10 +4458,10 @@ EndSection alpha channel data to libvncserver. However, this data will only be used for VNC clients that do not support the CursorShapeUpdates VNC extension (or have disabled it). It can be disabled for all clients - with the [534]-nocursorshape x11vnc option. In this case the cursor is + with the [535]-nocursorshape x11vnc option. In this case the cursor is drawn, correctly blended with the background, into the VNC framebuffer before being sent out to the client. So the alpha blending is done on - the x11vnc side. Use the [535]-noalphablend option to disable this + the x11vnc side. Use the [536]-noalphablend option to disable this behavior (always approximate transparent cursors with opaque RGB values). @@ -4445,7 +4485,7 @@ EndSection example on how to change the Windows TightVNC viewer to achieve the same thing (send me the patch if you get that working). - This patch is applied to the [536]Enhanced TightVNC Viewer package we + This patch is applied to the [537]Enhanced TightVNC Viewer package we provide. [Mouse Pointer] @@ -4453,9 +4493,9 @@ EndSection Q-71: Why does the mouse arrow just stay in one corner in my vncviewer, whereas my cursor (that does move) is just a dot? - This default takes advantage of a [537]tightvnc extension + This default takes advantage of a [538]tightvnc extension (CursorShapeUpdates) that allows specifying a cursor image shape for - the local VNC viewer. You may disable it with the [538]-nocursor + the local VNC viewer. You may disable it with the [539]-nocursor option to x11vnc if your viewer does not have this extension. Note: as of Aug/2004 this should be fixed: the default for @@ -4469,17 +4509,17 @@ EndSection clients (i.e. passive viewers can see the mouse cursor being moved around by another viewer)? - Use the [539]-cursorpos option when starting x11vnc. A VNC viewer must + Use the [540]-cursorpos option when starting x11vnc. A VNC viewer must support the Cursor Positions Updates for the user to see the mouse motions (the TightVNC viewers support this). As of Aug/2004 -cursorpos - is the default. See also [540]-nocursorpos and [541]-nocursorshape. + is the default. See also [541]-nocursorpos and [542]-nocursorshape. Q-73: Is it possible to swap the mouse buttons (e.g. left-handed operation), or arbitrarily remap them? How about mapping button clicks to keystrokes, e.g. to partially emulate Mouse wheel scrolling? - You can remap the mouse buttons via something like: [542]-buttonmap + You can remap the mouse buttons via something like: [543]-buttonmap 13-31 (or perhaps 12-21). Also, note that xmodmap(1) lets you directly adjust the X server's button mappings, but in some circumstances it might be more desirable to have x11vnc do it. @@ -4487,7 +4527,7 @@ EndSection One user had an X server with only one mouse button(!) and was able to map all of the VNC client mouse buttons to it via: -buttonmap 123-111. - Note that the [543]-debug_pointer option prints out much info for + Note that the [544]-debug_pointer option prints out much info for every mouse/pointer event and is handy in solving problems. To map mouse button clicks to keystrokes you can use the alternate @@ -4509,7 +4549,7 @@ EndSection Exactly what keystroke "scrolling" events they should be bound to depends on one's taste. If this method is too approximate, one could - consider not using [544]-buttonmap but rather configuring the X server + consider not using [545]-buttonmap but rather configuring the X server to think it has a mouse with 5 buttons even though the physical mouse does not. (e.g. 'Option "ZAxisMapping" "4 5"'). @@ -4539,7 +4579,7 @@ EndSection Q-74: How can I get my AltGr and Shift modifiers to work between keyboards for different languages? - The option [545]-modtweak should help here. It is a mode that monitors + The option [546]-modtweak should help here. It is a mode that monitors the state of the Shift and AltGr Modifiers and tries to deduce the correct keycode to send, possibly by sending fake modifier key presses and releases in addition to the actual keystroke. @@ -4548,16 +4588,16 @@ EndSection to get the old behavior). This was done because it was noticed on newer XFree86 setups even on bland "us" keyboards like "pc104 us" XFree86 included a "ghost" key with both "<" and ">" it. This key does - not exist on the keyboard (see [546]this FAQ for more info). Without + not exist on the keyboard (see [547]this FAQ for more info). Without -modtweak there was then an ambiguity in the reverse map keysym => keycode, making it so the "<" symbol could not be typed. - Also see the [547]FAQ about the -xkb option for a more powerful method + Also see the [548]FAQ about the -xkb option for a more powerful method of modifier tweaking for use on X servers with the XKEYBOARD extension. When trying to resolve keyboard mapping problems, note that the - [548]-debug_keyboard option prints out much info for every keystroke + [549]-debug_keyboard option prints out much info for every keystroke and so can be useful debugging things. @@ -4569,9 +4609,9 @@ EndSection (e.g. pc105 in the XF86Config file when it should be something else, say pc104). - Short Cut: Try the [549]-xkb or [550]-sloppy_keys options and see if + Short Cut: Try the [550]-xkb or [551]-sloppy_keys options and see if that helps the situation. The discussion below is a bit outdated (e.g. - [551]-modtweak is now the default) but it is useful reference for + [552]-modtweak is now the default) but it is useful reference for various tricks and so is kept. @@ -4614,17 +4654,17 @@ EndSection -remap less-comma These are convenient in that they do not modify the actual X server - settings. The former ([552]-modtweak) is a mode that monitors the + settings. The former ([553]-modtweak) is a mode that monitors the state of the Shift and AltGr modifiers and tries to deduce the correct keycode sequence to send. Since Jul/2004 -modtweak is now the default. - The latter ([553]-remap less-comma) is an immediate remapping of the + The latter ([554]-remap less-comma) is an immediate remapping of the keysym less to the keysym comma when it comes in from a client (so when Shift is down the comma press will yield "<"). - See also the [554]FAQ about the -xkb option as a possible workaround + See also the [555]FAQ about the -xkb option as a possible workaround using the XKEYBOARD extension. - Note that the [555]-debug_keyboard option prints out much info for + Note that the [556]-debug_keyboard option prints out much info for every keystroke to aid debugging keyboard problems. @@ -4632,13 +4672,13 @@ EndSection (i.e. an extra comma). This is likely because you press "Shift" then "<" but then released - the Shift key before releasing the "<". Because of a [556]keymapping + the Shift key before releasing the "<". Because of a [557]keymapping ambiguity the last event "< up" is interpreted as "," because that key unshifted is the comma. - This should not happen in [557]-xkb mode, because it works hard to + This should not happen in [558]-xkb mode, because it works hard to resolve the ambiguities. If you do not want to use -xkb, try the - option [558]-sloppy_keys to attempt a similar type of algorithm. + option [559]-sloppy_keys to attempt a similar type of algorithm. Q-77: I'm using an "international" keyboard (e.g. German "de", or @@ -4662,7 +4702,7 @@ EndSection In both cases no AltGr is sent to the VNC server, but we know AltGr is needed on the physical international keyboard to type a "@". - This all worked fine with x11vnc running with the [559]-modtweak + This all worked fine with x11vnc running with the [560]-modtweak option (it figures out how to adjust the Modifier keys (Shift or AltGr) to get the "@"). However it fails under recent versions of XFree86 (and the X.org fork). These run the XKEYBOARD extension by @@ -4679,7 +4719,7 @@ EndSection * there is a new option -xkb to use the XKEYBOARD extension API to do the Modifier key tweaking. - The [560]-xkb option seems to fix all of the missing keys: "@", "<", + The [561]-xkb option seems to fix all of the missing keys: "@", "<", ">", etc.: it is recommended that you try it if you have this sort of problem. Let us know if there are any remaining problems (see the next paragraph for some known problems). If you specify the -debug_keyboard @@ -4687,7 +4727,7 @@ EndSection debugging output (send it along with any problems you report). Update: as of Jun/2005 x11vnc will try to automatically enable - [561]-xkb if it appears that would be beneficial (e.g. if it sees any + [562]-xkb if it appears that would be beneficial (e.g. if it sees any of "@", "<", ">", "[" and similar keys are mapped in a way that needs the -xkb to access them). To disable this automatic check use -noxkb. @@ -4702,7 +4742,7 @@ EndSection was attached to keycode 93 (no physical key generates this keycode) while ISO_Level3_Shift was attached to keycode 113. The keycode skipping option was used to disable the ghost key: - [562]-skip_keycodes 93 + [563]-skip_keycodes 93 * In implementing -xkb we noticed that some characters were still not getting through, e.g. "~" and "^". This is not really an XKEYBOARD problem. What was happening was the VNC viewer was @@ -4720,16 +4760,16 @@ EndSection What to do? In general the VNC protocol has not really solved this problem: what should be done if the VNC viewer sends a keysym not recognized by the VNC server side? Workarounds can possibly be - created using the [563]-remap x11vnc option: + created using the [564]-remap x11vnc option: -remap asciitilde-dead_tilde,asciicircum-dead_circumflex etc. Use -remap filename if the list is long. Please send us your workarounds for this problem on your keyboard. Perhaps we can have x11vnc adjust automatically at some point. Also see the - [564]-add_keysyms option in the next paragraph. - Update: for convenience "[565]-remap DEAD" does many of these + [565]-add_keysyms option in the next paragraph. + Update: for convenience "[566]-remap DEAD" does many of these mappings at once. - * To complement the above workaround using the [566]-remap, an - option [567]-add_keysyms was added. This option instructs x11vnc + * To complement the above workaround using the [567]-remap, an + option [568]-add_keysyms was added. This option instructs x11vnc to bind any unknown Keysyms coming in from VNC viewers to unused Keycodes in the X server. This modifies the global state of the X server. When x11vnc exits it removes the extra keymappings it @@ -4748,7 +4788,7 @@ EndSection Short answer: disable key autorepeating by running the command "xset r off" on the Xserver where x11vnc is run (restore via "xset r on") or - use the new (Jul/2004) [568]-norepeat x11vnc option. You will still + use the new (Jul/2004) [569]-norepeat x11vnc option. You will still have autorepeating because that is taken care of on your VNC viewer side. @@ -4772,7 +4812,7 @@ EndSection off", does the problem go away? The workaround is to manually apply "xset r off" and "xset r on" as - needed, or to use the [569]-norepeat (which has since Dec/2004 been + needed, or to use the [570]-norepeat (which has since Dec/2004 been made the default). Note that with X server autorepeat turned off the VNC viewer side of the connection will (nearly always) do its own autorepeating so there is no big loss here, unless someone is also @@ -4783,7 +4823,7 @@ EndSection keystrokes!! Are you using x11vnc to log in to an X session via display manager? - (as described in [570]this FAQ) If so, x11vnc is starting before your + (as described in [571]this FAQ) If so, x11vnc is starting before your session and it disables autorepeat when you connect, but then after you log in your session startup (GNOME, KDE, ...) could be resetting the autorepeat to be on. Or it could be something inside your desktop @@ -4807,7 +4847,7 @@ EndSection machine where I run the VNC viewer does not. Is there a way I can map a local unused key to send an AltGr? How about a Compose key as well? - Something like "[571]-remap Super_R-Mode_switch" x11vnc option may + Something like "[572]-remap Super_R-Mode_switch" x11vnc option may work. Note that Super_R is the "Right Windoze(tm) Flaggie" key; you may want to choose another. The -debug_keyboard option comes in handy in finding keysym names (so does xev(1)). @@ -4830,7 +4870,7 @@ EndSection Since xmodmap(1) modifies the X server mappings you may not want to do this (because it affects local work on that machine). Something like - the [572]-remap Alt_L-Meta_L to x11vnc may be sufficient for ones + the [573]-remap Alt_L-Meta_L to x11vnc may be sufficient for ones needs, and does not modify the X server environment. Note that you cannot send Alt_L in this case, maybe -remap Super_L-Meta_L would be a better choice if the Super_L key is typically unused in Unix. @@ -4841,7 +4881,7 @@ EndSection This can be done directly in some X servers using AccessX and Pointer_EnableKeys, but is a bit awkward. It may be more convenient to - have x11vnc do the remapping. This can be done via the [573]-remap + have x11vnc do the remapping. This can be done via the [574]-remap option using the fake "keysyms" Button1, Button2, etc. as the "to" keys (i.e. the ones after the "-") @@ -4850,7 +4890,7 @@ EndSection button "paste" because (using XFree86/Xorg Emulate3Buttons) you have to click both buttons on the touch pad at the same time. This remapping: - [574]-remap Super_R-Button2 + [575]-remap Super_R-Button2 maps the Super_R "flag" key press to the Button2 click, thereby making X pasting a bit easier. @@ -4869,10 +4909,10 @@ EndSection Caps_Lock in the viewer your local machine goes into the Caps_Lock on state and sends keysym "A" say when you press "a". x11vnc will then fake things up so that Shift is held down to generate "A". The - [575]-skip_lockkeys option should help to accomplish this. For finer - grain control use something like: "[576]-remap Caps_Lock-None". + [576]-skip_lockkeys option should help to accomplish this. For finer + grain control use something like: "[577]-remap Caps_Lock-None". - Also try the [577]-nomodtweak and [578]-capslock options. + Also try the [578]-nomodtweak and [579]-capslock options. [Screen Related Issues and Features] @@ -4895,7 +4935,7 @@ EndSection There may also be scaling viewers out there (e.g. TightVNC or UltraVNC on Windows) that automatically shrink or expand the remote framebuffer to fit the local display. Especially for hand-held devices. See also - [579]this FAQ on x11vnc scaling. + [580]this FAQ on x11vnc scaling. Q-85: Does x11vnc support server-side framebuffer scaling? (E.g. to @@ -4903,7 +4943,7 @@ EndSection As of Jun/2004 x11vnc provides basic server-side scaling. It is a global scaling of the desktop, not a per-client setting. To enable it - use the "[580]-scale fraction" option. "fraction" can either be a + use the "[581]-scale fraction" option. "fraction" can either be a floating point number (e.g. -scale 0.5) or the alternative m/n fraction notation (e.g. -scale 3/4). Note that if fraction is greater than one the display is magnified. @@ -4924,7 +4964,7 @@ EndSection One can also use the ":nb" with an integer scale factor (say "-scale 2:nb") to use x11vnc as a screen magnifier for vision impaired - [581]applications. Since with integer scale factors the framebuffers + [582]applications. Since with integer scale factors the framebuffers become huge and scaling operations time consuming, be sure to use ":nb" for the fastest response. @@ -4950,7 +4990,7 @@ EndSection If one desires per-client scaling for something like 1:1 from a workstation and 1:2 from a smaller device (e.g. handheld), currently the only option is to run two (or more) x11vnc processes with - different scalings listening on separate ports ([582]-rfbport option, + different scalings listening on separate ports ([583]-rfbport option, etc.). Update: As of May/2006 x11vnc also supports the UltraVNC server-side @@ -4960,8 +5000,8 @@ EndSection "-rfbversion 3.6" for this to be recognized by UltraVNC viewers. BTW, whenever you run two or more x11vnc's on the same X display and - use the [583]GUI, then to avoid all of the x11vnc's simultaneously - answering the gui you will need to use something like [584]"-connect + use the [584]GUI, then to avoid all of the x11vnc's simultaneously + answering the gui you will need to use something like [585]"-connect file1 -gui ..." with different connect files for each x11vnc you want to control via the gui (or remote-control). The "-connect file1" usage gives separate communication channels between a x11vnc proces and the @@ -4970,7 +5010,7 @@ EndSection Update: As of Mar/2005 x11vnc now scales the mouse cursor with the same scale factor as the screen. If you don't want that, use the - [585]"-scale_cursor frac" option to set the cursor scaling to a + [586]"-scale_cursor frac" option to set the cursor scaling to a different factor (e.g. use "-scale_cursor 1" to keep the cursor at its natural unscaled size). @@ -4992,17 +5032,17 @@ EndSection screen is not rectangular (e.g. 1280x1024 and 1024x768 monitors joined together), then there will be "non-existent" areas on the screen. The X server will return "garbage" image data for these areas and so they - may be distracting to the viewer. The [586]-blackout x11vnc option + may be distracting to the viewer. The [587]-blackout x11vnc option allows you to blacken-out rectangles by manually specifying their WxH+X+Y geometries. If your system has the libXinerama library, the - [587]-xinerama x11vnc option can be used to have it automatically + [588]-xinerama x11vnc option can be used to have it automatically determine the rectangles to be blackened out. (Note on 8bpp PseudoColor displays the fill color may not be black). Update: - [588]-xinerama is now on by default. + [589]-xinerama is now on by default. Some users have reported that the mouse does not behave properly for their Xinerama display: i.e. the mouse cannot be moved to all regions - of the large display. If this happens try using the [589]-xwarppointer + of the large display. If this happens try using the [590]-xwarppointer option. This instructs x11vnc to fake mouse pointer motions using the XWarpPointer function instead of the XTestFakeMotionEvent XTEST function. (This may be due to a bug in the X server for XTEST when @@ -5027,23 +5067,23 @@ EndSection Note: if you are running on Solaris 8 or earlier you can easily hit up against the maximum of 6 shm segments per process (for Xsun in this case) from running multiple x11vnc processes. You should modify - /etc/system as mentioned in another [590]FAQ to increase the limit. It - is probably also a good idea to run with the [591]-onetile option in + /etc/system as mentioned in another [591]FAQ to increase the limit. It + is probably also a good idea to run with the [592]-onetile option in this case (to limit each x11vnc to 3 shm segments), or even - [592]-noshm to use no shm segments. + [593]-noshm to use no shm segments. Q-88: Can x11vnc show only a portion of the display? (E.g. for a special purpose rfb application). - As of Mar/2005 x11vnc has the "[593]-clip WxH+X+Y" option to select a + As of Mar/2005 x11vnc has the "[594]-clip WxH+X+Y" option to select a rectangle of width W, height H and offset (X, Y). Thus the VNC screen will be the clipped sub-region of the display and be only WxH in size. - One user used -clip to split up a large [594]Xinerama screen into two + One user used -clip to split up a large [595]Xinerama screen into two more managable smaller screens. This also works to view a sub-region of a single application window if - the [595]-id or [596]-sid options are used. The offset is measured + the [596]-id or [597]-sid options are used. The offset is measured from the upper left corner of the selected window. @@ -5052,7 +5092,7 @@ EndSection crash. As of Dec/2004 x11vnc supports XRANDR. You enable it with the - [597]-xrandr option to make x11vnc monitor XRANDR events and also trap + [598]-xrandr option to make x11vnc monitor XRANDR events and also trap X server errors if the screen change occurred in the middle of an X call like XGetImage. Once it traps the screen change it will create a new framebuffer using the new screen. @@ -5062,9 +5102,9 @@ EndSection then the viewer will automatically resize. Otherwise, the new framebuffer is fit as best as possible into the original viewer size (portions of the screen may be clipped, unused, etc). For these - viewers you can try the [598]-padgeom option to make the region big + viewers you can try the [599]-padgeom option to make the region big enough to hold all resizes and rotations. We have fixed this problem - for the TightVNC Viewer on Unix: [599]enhanced_tightvnc_viewer + for the TightVNC Viewer on Unix: [600]enhanced_tightvnc_viewer If you specify "-xrandr newfbsize" then vnc viewers that do not support NewFBSize will be disconnected before the resize. If you @@ -5076,7 +5116,7 @@ EndSection reflect the screen that the VNC viewers see? (e.g. for a handheld whose screen is rotated 90 degrees). - As of Jul/2006 there is the [600]-rotate option allow this. E.g's: + As of Jul/2006 there is the [601]-rotate option allow this. E.g's: "-rotate +90", "-rotate -90", "-rotate x", etc. @@ -5139,9 +5179,9 @@ EndSection * Fullscreen mode The way VMWare does Fullscreen mode on Linux is to display the Guest - desktop in a separate Virtual Console (e.g. VC 8) (see [601]this FAQ + desktop in a separate Virtual Console (e.g. VC 8) (see [602]this FAQ on VC's for background). Unfortunately, this Fullscreen VC is not an X - server. So x11vnc cannot access it (however, [602]see this discussion + server. So x11vnc cannot access it (however, [603]see this discussion of -rawfb for a possible workaround). x11vnc works fine with "Normal X application window" and "Quick-Switch mode" because these use X. @@ -5162,13 +5202,13 @@ EndSection improve response. One can also cut the display depth (e.g. to 16bpp) in this 2nd X session to improve video performance. This 2nd X session emulates Fullscreen mode to some degree and can be viewed via x11vnc - as long as the VMWare X session [603]is in the active VC. + as long as the VMWare X session [604]is in the active VC. Also note that with a little bit of playing with "xwininfo -all -children" output one can extract the (non-toplevel) windowid of the of the Guest desktop only when VMWare is running as a normal X application. Then one can export just the guest desktop (i.e. without - the VMWare menu buttons) by use of the [604]-id windowid option. The + the VMWare menu buttons) by use of the [605]-id windowid option. The caveats are the X session VMWare is in must be in the active VC and the window must be fully visible, so this mode is not terribly convenient, but could be useful in some circumstances (e.g. running @@ -5181,10 +5221,10 @@ EndSection controlled) via VNC with x11vnc? As of Apr/2005 there is support for this. Two options were added: - "[605]-rawfb string" (to indicate the raw framembuffer device, file, - etc. and its parameters) and "[606]-pipeinput command" (to provide an + "[606]-rawfb string" (to indicate the raw framembuffer device, file, + etc. and its parameters) and "[607]-pipeinput command" (to provide an external program that will inject or otherwise process mouse and - keystroke input). Some useful [607]-pipeinput schemes, VID, CONSOLE, + keystroke input). Some useful [608]-pipeinput schemes, VID, CONSOLE, and UINPUT, have since been built into x11vnc for convenience. This non-X mode for x11vnc is somewhat experimental because it is so @@ -5222,9 +5262,9 @@ EndSection access method). Only use file if map isn't working. BTW, "mmap" is an alias for "map" and if you do not supply a type and the file exists, map is assumed (see the -help output and below for some exceptions to - this). The "snap:" setting applies the [608]-snapfb option with + this). The "snap:" setting applies the [609]-snapfb option with "file:" type reading (this is useful for exporting webcams or TV tuner - video; see [609]the next FAQ for more info). + video; see [610]the next FAQ for more info). Also, if the string is of the form "setup:cmd" then cmd is run and the first line of its output retrieved and used as the rawfb string. This @@ -5265,7 +5305,7 @@ EndSection screen to either shm or a mapped file. The format of these is XWD and so the initial header should be skipped. BTW, since XWD is not strictly RGB the view will only be approximate, but usable. Of course - for the case of Xvfb x11vnc can poll it much better via the [610]X + for the case of Xvfb x11vnc can poll it much better via the [611]X API, but you get the idea. By default in -rawfb mode x11vnc will actually close any X display it @@ -5294,13 +5334,13 @@ EndSection tty1-tty6), or X graphical display (usually starting at tty7). In addition to the text console other graphical ones may be viewed and interacted with as well, e.g. DirectFB or SVGAlib apps, VMWare non-X - fullscreen, or [611]Qt-embedded apps (PDAs/Handhelds). By default the + fullscreen, or [612]Qt-embedded apps (PDAs/Handhelds). By default the pipeinput mechanisms UINPUT and CONSOLE (keystrokes only) are automatically attempted in this mode under "-rawfb console". The Video4Linux Capture device, /dev/video0, etc is either a Webcam or a TV capture device and needs to have its driver enabled in the - kernel. See [612]this FAQ for details. If specified via "-rawfb Video" + kernel. See [613]this FAQ for details. If specified via "-rawfb Video" then the pipeinput method "VID" is applied (it lets you change video parameters dynamically via keystrokes). @@ -5308,10 +5348,10 @@ EndSection also useful in testing. - All of the above [613]-rawfb options are just for viewing the raw + All of the above [614]-rawfb options are just for viewing the raw framebuffer (although some of the aliases do imply keystroke and mouse pipeinput methods). That may be enough for certain applications of - this feature (e.g. suppose a [614]video camera mapped its framebuffer + this feature (e.g. suppose a [615]video camera mapped its framebuffer into memory and you just wanted to look at it via VNC). To handle the pointer and keyboard input from the viewer users the "-pipeinput cmd" option was added to indicate a helper program to @@ -5349,7 +5389,7 @@ EndSection keystrokes into the Linux console (e.g. the virtual consoles: /dev/tty1, /dev/tty2, etc) in x11vnc/misc/vcinject.pl. It is based on the vncterm/LinuxVNC.c program also in the libvncserver CVS. So to - view and interact with VC #2 (assuming it is the [615]active VC) one + view and interact with VC #2 (assuming it is the [616]active VC) one can run something like: x11vnc -rawfb map:/dev/fb0@1024x768x16 -pipeinput './vcinject.pl 2' @@ -5404,7 +5444,7 @@ EndSection better to use the more accurate and faster LinuxVNC program. The advantage x11vnc -rawfb might have is that it can allow interaction with a non-text application, e.g. one based on SVGAlib or - [616]Qt-embedded Also, for example the [617]VMWare Fullscreen mode is + [617]Qt-embedded Also, for example the [618]VMWare Fullscreen mode is actually viewable under -rawfb and can be interacted with if uinput is enabled. @@ -5424,9 +5464,9 @@ EndSection Q-96: Can I export via VNC a Webcam or TV tuner framebuffer using x11vnc? - Yes, this is possible to some degree with the [618]-rawfb option. + Yes, this is possible to some degree with the [619]-rawfb option. There is no X11 involved: snapshots from the video capture device are - used for the screen image data. See the [619]previous FAQ on -rawfb + used for the screen image data. See the [620]previous FAQ on -rawfb for background. For best results, use x11vnc version 0.8.1 or later. Roughly, one would do something like this: @@ -5438,7 +5478,7 @@ EndSection snapshot to a file that you point -rawfb to; ask me if it is not clear what to do). - The "snap:" enforces [620]-snapfb mode which appears to be necessary. + The "snap:" enforces [621]-snapfb mode which appears to be necessary. The read pointer for video capture devices cannot be repositioned (which would be needed for scanline polling), but you can read a full frame of data from the device. @@ -5460,7 +5500,7 @@ EndSection Many video4linux drivers tend to set the framebuffer to be 24bpp (as opposed to 32bpp). Since this can cause problems with VNC viewers, - etc, the [621]-24to32 option will be automatically imposed when in + etc, the [622]-24to32 option will be automatically imposed when in 24bpp. Note that by its very nature, video capture involves rapid change in @@ -5468,7 +5508,7 @@ EndSection wavering in brightness is always happening. This can lead to much network bandwidth consumption for the VNC traffic and also local CPU and I/O resource usage. You may want to experiment with "dialing down" - the framerate via the [622]-wait, [623]-slow_fb, or [624]-defer + the framerate via the [623]-wait, [624]-slow_fb, or [625]-defer options. Decreasing the window size and bpp also helps. @@ -5557,7 +5597,7 @@ EndSection format to HI240, RGB565, RGB24, RGB32, RGB555, and GREY respectively. See -rawfb video for details. - See also the [625]-freqtab option to supply your own xawtv channel to + See also the [626]-freqtab option to supply your own xawtv channel to frequency mappings for your country (only ntsc-cable-us is built into x11vnc). @@ -5566,7 +5606,7 @@ EndSection running on my handheld or PC using the Linux console framebuffer (i.e. not X11)? - Yes, the basic method for this is the [626]-rawfb scheme where the + Yes, the basic method for this is the [627]-rawfb scheme where the Linux console framebuffer (usually /dev/fb0) is polled and the uinput driver is used to inject keystrokes and mouse input. Often you will just have to type: @@ -5579,7 +5619,7 @@ EndSection x11vnc -rawfb /dev/fb0@640x480x16 Also, to force usage of the uinput injection method use "-pipeinput - UINPUT". See the [627]-pipeinput description for tunable parameters, + UINPUT". See the [628]-pipeinput description for tunable parameters, etc. One problem with the x11vnc uinput scheme is that it cannot guess the @@ -5595,7 +5635,7 @@ EndSection Even with the correct acceleration setting there is stil some drift (probably because of the mouse threshold where the acceleration kicks in) and so x11vnc needs to reposition the cursor from 0,0 about 5 - times a second. See the [628]-pipeinput UINPUT option for tuning + times a second. See the [629]-pipeinput UINPUT option for tuning parameters that can be set (there are some experimental thresh=N tuning parameters as well) @@ -5629,7 +5669,7 @@ EndSection Q-98: Now that non-X11 devices can be exported via VNC using x11vnc, can I build it with no dependencies on X11 header files and libraries? - Yes, as of Jul/2006 x11vnc enables building for [629]-rawfb only + Yes, as of Jul/2006 x11vnc enables building for [630]-rawfb only support. Just do something like when building: ./configure --without-x (plus any other flags) make @@ -5645,7 +5685,7 @@ EndSection Yes, it is possible with a number of tools that record VNC and transform it to swf format or others. One such popular tool is - [630]pyvnc2swf. There are a number of [631]tutorials on how to do + [631]pyvnc2swf. There are a number of [632]tutorials on how to do this. Another option is to use the vnc2mpg that comes in the LibVNCServer package. An important thing to remember when doing this is that tuning @@ -5662,11 +5702,11 @@ EndSection As of Jan/2004 x11vnc supports the "CutText" part of the rfb protocol. Furthermore, x11vnc is able to hold the PRIMARY and CLIPBOARD selection (Xvnc does not seem to do this). If you don't want the - Clipboard/Selection exchanged use the [632]-nosel option. If you don't + Clipboard/Selection exchanged use the [633]-nosel option. If you don't want the PRIMARY selection to be polled for changes use the - [633]-noprimary option. (with a similar thing for CLIPBOARD). You can - also fine-tune it a bit with the [634]-seldir dir option and also - [635]-input. + [634]-noprimary option. (with a similar thing for CLIPBOARD). You can + also fine-tune it a bit with the [635]-seldir dir option and also + [636]-input. You may need to watch out for desktop utilities such as KDE's "Klipper" that do odd things with the selection, clipboard, and @@ -5681,7 +5721,7 @@ EndSection (and Windows viewers only support filetransfer it appears). TightVNC file transfer is on by default, if you want to disable it use - the [636]-nofilexfer option. UltraVNC file transfer is currently off + the [637]-nofilexfer option. UltraVNC file transfer is currently off by default, to enable it use something like "-rfbversion 3.6 -permitfiletransfer" options (UltraVNC incorrectly uses the RFB protocol version to @@ -5697,7 +5737,7 @@ EndSection You will have to use an external network redirection for this. Filesystem mounting is not part of the VNC protocol. - We show a simple [637]Samba example here. + We show a simple [638]Samba example here. First you will need a tunnel to redirect the SMB requests from the remote machine to the one you sitting at. We use an ssh tunnel: @@ -5734,7 +5774,7 @@ d,ip=127.0.0.1,port=1139 far-away> smbumount /home/fred/smb-haystack-pub At some point we hope to fold some automation for SMB ssh redir setup - into the [638]Enhanced TightVNC Viewer package we provide (as of Sep + into the [639]Enhanced TightVNC Viewer package we provide (as of Sep 2006 it is there for testing). @@ -5744,7 +5784,7 @@ d,ip=127.0.0.1,port=1139 You will have to use an external network redirection for this. Printing is not part of the VNC protocol. - We show a simple Unix to Unix [639]CUPS example here. Non-CUPS port + We show a simple Unix to Unix [640]CUPS example here. Non-CUPS port redirections (e.g. LPD) should also be possible, but may be a bit more tricky. If you are viewing on Windows SMB and don't have a local cups server it may be trickier still (see below). @@ -5816,7 +5856,7 @@ d,ip=127.0.0.1,port=1139 "localhost". At some point we hope to fold some automation for CUPS ssh redir setup - into the [640]Enhanced TightVNC Viewer package we provide (as of Sep + into the [641]Enhanced TightVNC Viewer package we provide (as of Sep 2006 it is there for testing). @@ -5917,7 +5957,7 @@ or: the applications will fail to run because LD_PRELOAD will point to libraries of the wrong wordsize. * At some point we hope to fold some automation for esd or artsd ssh - redir setup into the [641]Enhanced TightVNC Viewer package we + redir setup into the [642]Enhanced TightVNC Viewer package we provide (as of Sep/2006 it is there for testing). @@ -5929,9 +5969,9 @@ or: in Solaris, see Xserver(1) for how to turn it on via +kb), and so you won't hear them if the extension is not present. - If you don't want to hear the beeps use the [642]-nobell option. If + If you don't want to hear the beeps use the [643]-nobell option. If you want to hear the audio from the remote applications, consider - trying a [643]redirector such as esd. + trying a [644]redirector such as esd. @@ -6006,9 +6046,9 @@ References 56. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-int 57. http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html 58. http://sourceforge.net/projects/libvncserver/ - 59. http://sourceforge.net/project/showfiles.php?group_id=32584&package_id=119006&release_id=431725 - 60. http://sourceforge.net/project/shownotes.php?release_id=431725&group_id=32584 - 61. http://www.karlrunge.com/x11vnc/x11vnc-0.8.3.tar.gz + 59. http://sourceforge.net/project/showfiles.php?group_id=32584&package_id=119006&release_id=463226 + 60. http://sourceforge.net/project/shownotes.php?release_id=463226&group_id=32584 + 61. http://www.karlrunge.com/x11vnc/x11vnc-0.8.4.tar.gz 62. http://www.karlrunge.com/x11vnc/index.html#faq-binaries 63. http://www.tightvnc.com/download.html 64. http://www.realvnc.com/download-free.html @@ -6025,7 +6065,7 @@ References 75. http://www.gzip.org/zlib/ 76. http://www.sunfreeware.com/ 77. http://www.karlrunge.com/x11vnc/index.html#faq-solaris251build - 78. http://www.karlrunge.com/x11vnc/x11vnc-0.8.3.tar.gz + 78. http://www.karlrunge.com/x11vnc/x11vnc-0.8.4.tar.gz 79. http://www.karlrunge.com/x11vnc/bins 80. mailto:x11vnc-beta@karlrunge.com 81. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-int @@ -6372,225 +6412,226 @@ References 422. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-https 423. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-portal 424. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-https - 425. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-ext - 426. http://www.karlrunge.com/x11vnc/ssl_vncviewer - 427. http://www.karlrunge.com/x11vnc/ssl-portal.html - 428. http://www.karlrunge.com/x11vnc/ssl.html - 429. http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html - 430. http://www.karlrunge.com/x11vnc/index.html#ssl_vncviewer - 431. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-viewers - 432. http://www.karlrunge.com/x11vnc/ssl-portal.html - 433. http://www.karlrunge.com/x11vnc/ssl.html - 434. http://www.karlrunge.com/x11vnc/index.html#display-manager-continuously - 435. http://www.karlrunge.com/x11vnc/index.html#faq-inetd - 436. http://www.karlrunge.com/x11vnc/index.html#faq-userlogin - 437. http://www.karlrunge.com/x11vnc/index.html#x11vnc_loop - 438. http://club.mandriva.com/xwiki/bin/view/KB/XwinXset - 439. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-auth - 440. http://www.karlrunge.com/x11vnc/index.html#dtlogin_solaris - 441. http://www.jirka.org/gdm-documentation/x241.html - 442. http://www.karlrunge.com/x11vnc/x11vnc_loop - 443. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-loop - 444. http://www.karlrunge.com/x11vnc/index.html#faq-xterminal-xauth - 445. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-inetd - 446. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-q - 447. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-auth - 448. http://www.karlrunge.com/x11vnc/index.html#faq-userlogin - 449. http://www.karlrunge.com/x11vnc/index.html#faq-inetd - 450. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw - 451. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-display_WAIT - 452. http://www.karlrunge.com/x11vnc/index.html#stunnel-inetd - 453. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-display_WAIT - 454. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw - 455. http://www.karlrunge.com/x11vnc/index.html#faq-unix-passwords - 456. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-users - 457. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-int - 458. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-loop - 459. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-httpdir - 460. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-http - 461. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-connect - 462. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remote - 463. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-vncconnect - 464. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-add_keysyms - 465. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc - 466. http://www.karlrunge.com/x11vnc/Xdummy - 467. http://www.karlrunge.com/x11vnc/index.html#display-manager-continuously - 468. http://www.karlrunge.com/x11vnc/shm_clear - 469. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-onetile - 470. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noshm - 471. http://www.karlrunge.com/x11vnc/index.html#faq-noshm - 472. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nap - 473. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wait - 474. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sb - 475. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-onetile - 476. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fs - 477. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-threads - 478. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-defer - 479. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id - 480. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-solid - 481. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect - 482. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe - 483. http://www.tightvnc.com/ - 484. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe - 485. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect - 486. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-solid - 487. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-speeds - 488. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nodragging - 489. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fs - 490. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wait - 491. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-defer - 492. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-progressive - 493. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id - 494. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nosel - 495. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursor - 496. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorpos - 497. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-readtimeout - 498. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fixscreen - 499. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow - 500. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xd_area - 501. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xd_mem - 502. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noxdamage - 503. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow - 504. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pointer_mode + 425. http://www.karlrunge.com/x11vnc/ssl-output.html + 426. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-ext + 427. http://www.karlrunge.com/x11vnc/ssl_vncviewer + 428. http://www.karlrunge.com/x11vnc/ssl-portal.html + 429. http://www.karlrunge.com/x11vnc/ssl.html + 430. http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html + 431. http://www.karlrunge.com/x11vnc/index.html#ssl_vncviewer + 432. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-viewers + 433. http://www.karlrunge.com/x11vnc/ssl-portal.html + 434. http://www.karlrunge.com/x11vnc/ssl.html + 435. http://www.karlrunge.com/x11vnc/index.html#display-manager-continuously + 436. http://www.karlrunge.com/x11vnc/index.html#faq-inetd + 437. http://www.karlrunge.com/x11vnc/index.html#faq-userlogin + 438. http://www.karlrunge.com/x11vnc/index.html#x11vnc_loop + 439. http://club.mandriva.com/xwiki/bin/view/KB/XwinXset + 440. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-auth + 441. http://www.karlrunge.com/x11vnc/index.html#dtlogin_solaris + 442. http://www.jirka.org/gdm-documentation/x241.html + 443. http://www.karlrunge.com/x11vnc/x11vnc_loop + 444. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-loop + 445. http://www.karlrunge.com/x11vnc/index.html#faq-xterminal-xauth + 446. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-inetd + 447. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-q + 448. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-auth + 449. http://www.karlrunge.com/x11vnc/index.html#faq-userlogin + 450. http://www.karlrunge.com/x11vnc/index.html#faq-inetd + 451. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw + 452. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-display_WAIT + 453. http://www.karlrunge.com/x11vnc/index.html#stunnel-inetd + 454. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-display_WAIT + 455. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw + 456. http://www.karlrunge.com/x11vnc/index.html#faq-unix-passwords + 457. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-users + 458. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-tunnel-int + 459. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-loop + 460. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-httpdir + 461. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-http + 462. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-connect + 463. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remote + 464. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-vncconnect + 465. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-add_keysyms + 466. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc + 467. http://www.karlrunge.com/x11vnc/Xdummy + 468. http://www.karlrunge.com/x11vnc/index.html#display-manager-continuously + 469. http://www.karlrunge.com/x11vnc/shm_clear + 470. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-onetile + 471. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noshm + 472. http://www.karlrunge.com/x11vnc/index.html#faq-noshm + 473. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nap + 474. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wait + 475. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sb + 476. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-onetile + 477. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fs + 478. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-threads + 479. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-defer + 480. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id + 481. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-solid + 482. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect + 483. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe + 484. http://www.tightvnc.com/ + 485. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe + 486. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect + 487. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-solid + 488. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-speeds + 489. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nodragging + 490. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fs + 491. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wait + 492. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-defer + 493. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-progressive + 494. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id + 495. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nosel + 496. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursor + 497. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorpos + 498. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-readtimeout + 499. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fixscreen + 500. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow + 501. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xd_area + 502. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xd_mem + 503. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noxdamage + 504. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow 505. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pointer_mode - 506. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nodragging - 507. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pointer_mode - 508. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-threads - 509. http://www.karlrunge.com/x11vnc/index.html#faq-wireframe - 510. http://www.karlrunge.com/x11vnc/index.html#faq-scrollcopyrect - 511. http://www.karlrunge.com/x11vnc/index.html#faq-pointer-mode - 512. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow - 513. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe + 506. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pointer_mode + 507. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nodragging + 508. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pointer_mode + 509. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-threads + 510. http://www.karlrunge.com/x11vnc/index.html#faq-wireframe + 511. http://www.karlrunge.com/x11vnc/index.html#faq-scrollcopyrect + 512. http://www.karlrunge.com/x11vnc/index.html#faq-pointer-mode + 513. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow 514. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe 515. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe - 516. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow - 517. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect - 518. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe - 519. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wirecopyrect - 520. http://www.karlrunge.com/x11vnc/index.html#faq-wireframe - 521. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fixscreen - 522. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scr_skip - 523. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scale - 524. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect - 525. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursor + 516. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe + 517. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow + 518. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect + 519. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe + 520. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wirecopyrect + 521. http://www.karlrunge.com/x11vnc/index.html#faq-wireframe + 522. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fixscreen + 523. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scr_skip + 524. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scale + 525. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect 526. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursor - 527. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-overlay - 528. http://www.karlrunge.com/x11vnc/index.html#the-overlay-mode - 529. http://www.karlrunge.com/x11vnc/index.html#solaris10-build - 530. http://www.karlrunge.com/x11vnc/index.html#faq-xfixes-alpha-hacks - 531. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-alphacut - 532. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-alphafrac - 533. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-alpharemove - 534. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorshape - 535. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noalphablend - 536. http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html - 537. http://www.tightvnc.com/ - 538. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursor - 539. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursorpos - 540. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorpos - 541. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorshape - 542. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-buttonmap - 543. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-debug_pointer - 544. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-buttonmap - 545. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak - 546. http://www.karlrunge.com/x11vnc/index.html#faq-greaterless - 547. http://www.karlrunge.com/x11vnc/index.html#faq-xkbmodtweak - 548. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-debug_keyboard - 549. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb - 550. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sloppy_keys - 551. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak + 527. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursor + 528. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-overlay + 529. http://www.karlrunge.com/x11vnc/index.html#the-overlay-mode + 530. http://www.karlrunge.com/x11vnc/index.html#solaris10-build + 531. http://www.karlrunge.com/x11vnc/index.html#faq-xfixes-alpha-hacks + 532. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-alphacut + 533. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-alphafrac + 534. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-alpharemove + 535. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorshape + 536. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noalphablend + 537. http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html + 538. http://www.tightvnc.com/ + 539. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursor + 540. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursorpos + 541. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorpos + 542. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorshape + 543. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-buttonmap + 544. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-debug_pointer + 545. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-buttonmap + 546. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak + 547. http://www.karlrunge.com/x11vnc/index.html#faq-greaterless + 548. http://www.karlrunge.com/x11vnc/index.html#faq-xkbmodtweak + 549. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-debug_keyboard + 550. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb + 551. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sloppy_keys 552. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak - 553. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap - 554. http://www.karlrunge.com/x11vnc/index.html#faq-xkbmodtweak - 555. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-debug_keyboard - 556. http://www.karlrunge.com/x11vnc/index.html#faq-greaterless - 557. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb - 558. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sloppy_keys - 559. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak - 560. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb + 553. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak + 554. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 555. http://www.karlrunge.com/x11vnc/index.html#faq-xkbmodtweak + 556. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-debug_keyboard + 557. http://www.karlrunge.com/x11vnc/index.html#faq-greaterless + 558. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb + 559. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sloppy_keys + 560. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak 561. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb - 562. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-skip_keycodes - 563. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap - 564. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-add_keysyms - 565. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 562. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb + 563. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-skip_keycodes + 564. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 565. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-add_keysyms 566. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap - 567. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-add_keysyms - 568. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-norepeat + 567. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 568. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-add_keysyms 569. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-norepeat - 570. http://www.karlrunge.com/x11vnc/index.html#faq-display-manager - 571. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 570. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-norepeat + 571. http://www.karlrunge.com/x11vnc/index.html#faq-display-manager 572. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap 573. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap 574. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap - 575. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-skip_lockkeys - 576. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap - 577. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nomodtweak - 578. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-capslock - 579. http://www.karlrunge.com/x11vnc/index.html#faq-scaling - 580. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scale - 581. http://www.cus.cam.ac.uk/~ssb22/source/vnc-magnification.html - 582. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbport - 583. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-gui - 584. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-connect - 585. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scale_cursor - 586. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-blackout - 587. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xinerama + 575. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 576. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-skip_lockkeys + 577. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 578. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nomodtweak + 579. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-capslock + 580. http://www.karlrunge.com/x11vnc/index.html#faq-scaling + 581. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scale + 582. http://www.cus.cam.ac.uk/~ssb22/source/vnc-magnification.html + 583. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbport + 584. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-gui + 585. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-connect + 586. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scale_cursor + 587. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-blackout 588. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xinerama - 589. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xwarppointer - 590. http://www.karlrunge.com/x11vnc/index.html#faq-solshm - 591. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-onetile - 592. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noshm - 593. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-clip - 594. http://www.karlrunge.com/x11vnc/index.html#faq-xinerama - 595. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id + 589. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xinerama + 590. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xwarppointer + 591. http://www.karlrunge.com/x11vnc/index.html#faq-solshm + 592. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-onetile + 593. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noshm + 594. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-clip + 595. http://www.karlrunge.com/x11vnc/index.html#faq-xinerama 596. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id - 597. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xrandr - 598. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-padgeom - 599. http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html - 600. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rotate - 601. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc - 602. http://www.karlrunge.com/x11vnc/index.html#faq-rawfb - 603. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc - 604. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id - 605. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rawfb - 606. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pipeinput + 597. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id + 598. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xrandr + 599. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-padgeom + 600. http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html + 601. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rotate + 602. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc + 603. http://www.karlrunge.com/x11vnc/index.html#faq-rawfb + 604. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc + 605. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id + 606. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rawfb 607. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pipeinput - 608. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-snapfb - 609. http://www.karlrunge.com/x11vnc/index.html#faq-video - 610. http://www.karlrunge.com/x11vnc/index.html#faq-xvfb - 611. http://www.karlrunge.com/x11vnc/index.html#faq-qt-embedded - 612. http://www.karlrunge.com/x11vnc/index.html#faq-video - 613. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rawfb - 614. http://www.karlrunge.com/x11vnc/index.html#faq-video - 615. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc - 616. http://www.karlrunge.com/x11vnc/index.html#faq-qt-embedded - 617. http://www.karlrunge.com/x11vnc/index.html#faq-vmware - 618. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rawfb - 619. http://www.karlrunge.com/x11vnc/index.html#faq-rawfb - 620. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-snapfb - 621. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-24to32 - 622. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wait - 623. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-slow_fb - 624. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-defer - 625. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-freqtab - 626. http://www.karlrunge.com/x11vnc/index.html#faq-rawfb - 627. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pipeinput + 608. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pipeinput + 609. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-snapfb + 610. http://www.karlrunge.com/x11vnc/index.html#faq-video + 611. http://www.karlrunge.com/x11vnc/index.html#faq-xvfb + 612. http://www.karlrunge.com/x11vnc/index.html#faq-qt-embedded + 613. http://www.karlrunge.com/x11vnc/index.html#faq-video + 614. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rawfb + 615. http://www.karlrunge.com/x11vnc/index.html#faq-video + 616. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc + 617. http://www.karlrunge.com/x11vnc/index.html#faq-qt-embedded + 618. http://www.karlrunge.com/x11vnc/index.html#faq-vmware + 619. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rawfb + 620. http://www.karlrunge.com/x11vnc/index.html#faq-rawfb + 621. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-snapfb + 622. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-24to32 + 623. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wait + 624. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-slow_fb + 625. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-defer + 626. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-freqtab + 627. http://www.karlrunge.com/x11vnc/index.html#faq-rawfb 628. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pipeinput - 629. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rawfb - 630. http://www.unixuser.org/~euske/vnc2swf/ - 631. http://wolphination.com/linux/2006/06/30/how-to-record-videos-of-your-desktop/ - 632. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nosel - 633. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noprimary - 634. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-seldir - 635. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-input - 636. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nofilexfer - 637. http://www.samba.org/ - 638. http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html - 639. http://www.cups.org/ - 640. http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html + 629. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pipeinput + 630. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rawfb + 631. http://www.unixuser.org/~euske/vnc2swf/ + 632. http://wolphination.com/linux/2006/06/30/how-to-record-videos-of-your-desktop/ + 633. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nosel + 634. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noprimary + 635. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-seldir + 636. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-input + 637. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nofilexfer + 638. http://www.samba.org/ + 639. http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html + 640. http://www.cups.org/ 641. http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html - 642. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nobell - 643. http://www.karlrunge.com/x11vnc/index.html#faq-sound + 642. http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html + 643. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nobell + 644. http://www.karlrunge.com/x11vnc/index.html#faq-sound ======================================================================= http://www.karlrunge.com/x11vnc/chainingssh.html: @@ -7578,15 +7619,18 @@ t:563/ in the global config section. + To see example x11vnc output for a successful https://host:5900/ + connection with the Java Applet see [6]This Page. + Some Ideas for adding extra authentication, etc. for the paranoid: - * VNC passwords: [6]-rfbauth, [7]-passwdfile, or [8]-usepw. Even + * VNC passwords: [7]-rfbauth, [8]-passwdfile, or [9]-usepw. Even adding a simple company-wide VNC password helps block unwanted access. - * Unix passwords: [9]-unixpw - * SSL Client certificates: [10]-sslverify + * Unix passwords: [10]-unixpw + * SSL Client certificates: [11]-sslverify * Apache AuthUserFile directive: .htaccess, etc. - * Use Port-knocking on your firewall as described in: [11]Enhanced + * Use Port-knocking on your firewall as described in: [12]Enhanced TightVNC Viewer. * Add proxy password authentication (requires Viewer changes?) * Run a separate instance of Apache that provides this VNC service @@ -7597,14 +7641,14 @@ t:563/ Using non-Java viewers with this scheme: - The [12]ssl_vncviewer stunnel wrapper script for VNC viewers has the + The [13]ssl_vncviewer stunnel wrapper script for VNC viewers has the -proxy option that can take advantage of this method. For the case of the "double proxy" situation (see below) supply both separated by a comma. ssl_vncviewer -proxy www.gateway.east:563 mach1:15 ssl_vncviewer -proxy proxy1.foobar.com:8080,www.gateway.east:563 mach1:15 - For the [13]Enhanced TightVNC Viewer GUI (it uses ssl_vncviewer on + For the [14]Enhanced TightVNC Viewer GUI (it uses ssl_vncviewer on Unix) enter these into the 'VNC Server' entry box: mach1:15 www.gateway.east:563 mach1:15 proxy1.foobar.com:8080,www.gateway.east:563 @@ -7617,11 +7661,11 @@ t:563/ To have the Java applet downloaded to the user's Web Browser via an encrypted (and evidently safer) SSL connection the Apache webserver - should be configured for SSL via [14]mod_ssl (this is probably not + should be configured for SSL via [15]mod_ssl (this is probably not absolutely necessary; show us how you did it). - It is actually possible to use the x11vnc [15]Key Management utility - "[16]-sslGenCert" to generate your Apache/SSL .crt and .key files. (In + It is actually possible to use the x11vnc [16]Key Management utility + "[17]-sslGenCert" to generate your Apache/SSL .crt and .key files. (In brief, run something like "x11vnc -sslGenCert server self:apache" then copy the resulting self:apache.crt file to conf/ssl.crt/server.crt and extract the private key part from self:apache.pem and paste it into @@ -7749,7 +7793,7 @@ RT=563&forceProxy=yes [R,NE] -inetd -oa /var/log/x11vnc-15.log -http_ssl -display WAIT:cmd=HTTPONCE where the long inetd.conf line has been split. Note how the - [17]-http_ssl tries to automatically find the .../classes/ssl + [18]-http_ssl tries to automatically find the .../classes/ssl subdirectory. Also note the use of "-ssl SAVE" above. This way a saved server.pem is @@ -7884,18 +7928,19 @@ References 3. http://www.karlrunge.com/x11vnc/ssl-portal.html#inetd 4. http://www.karlrunge.com/x11vnc/index.html#faq-ssl-java-viewer-proxy 5. http://www.karlrunge.com/x11vnc/ssl-portal.html#tricks - 6. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbauth - 7. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-passwdfile - 8. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-usepw - 9. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw - 10. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sslverify - 11. http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html - 12. http://www.karlrunge.com/x11vnc/index.html#ssl_vncviewer - 13. http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html - 14. http://httpd.apache.org/docs/2.0/mod/mod_ssl.html - 15. http://www.karlrunge.com/x11vnc/ssl.html - 16. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sslGenCert - 17. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-http_ssl + 6. http://www.karlrunge.com/x11vnc/ssl-output.html + 7. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbauth + 8. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-passwdfile + 9. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-usepw + 10. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-unixpw + 11. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sslverify + 12. http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html + 13. http://www.karlrunge.com/x11vnc/index.html#ssl_vncviewer + 14. http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html + 15. http://httpd.apache.org/docs/2.0/mod/mod_ssl.html + 16. http://www.karlrunge.com/x11vnc/ssl.html + 17. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sslGenCert + 18. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-http_ssl ======================================================================= http://www.karlrunge.com/x11vnc/enhanced_tightvnc_viewer.html: @@ -8312,7 +8357,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.8.3 lastmod: 2006-11-06 +x11vnc: allow VNC connections to real X11 displays. 0.8.4 lastmod: 2006-11-13 x11vnc options: -display disp -auth file -id windowid @@ -8375,6 +8420,7 @@ x11vnc options: -fs f -gaps n -grow n -fuzz n -debug_tiles -snapfb -rawfb string -freqtab file -pipeinput cmd + -macnodim -macnosleep -macnosaver -gui [gui-opts] -remote command -query variable -QD variable -sync -noremote -yesremote -unsafe -safer @@ -8413,7 +8459,7 @@ libvncserver-tight-extension options: % x11vnc -help -x11vnc: allow VNC connections to real X11 displays. 0.8.3 lastmod: 2006-11-06 +x11vnc: allow VNC connections to real X11 displays. 0.8.4 lastmod: 2006-11-13 (type "x11vnc -opts" to just list the options.) @@ -11227,6 +11273,10 @@ Options: You can also set the env. var X11VNC_UINPUT_DEBUG=1 or higher to get debugging output for UINPUT mode. +-macnodim For the native Mac OS X server, disable dimming. +-macnosleep For the native Mac OS X server, disable display sleep. +-macnosaver For the native Mac OS X server, disable screensaver. + -gui [gui-opts] Start up a simple tcl/tk gui based on the the remote control options -remote/-query described below. Requires the "wish" program to be installed on the @@ -11590,6 +11640,8 @@ n desktop:str set -desktop name to str for new clients . rfbport:n set -rfbport to n. + macnosaver enable -macnosaver mode. + macsaver disable -macnosaver mode. httpport:n set -httpport to n. httpdir:dir set -httpdir to dir (and enable http). enablehttpproxy enable -enablehttpproxy mode. @@ -11700,7 +11752,7 @@ n debug_wireframe debug_scroll nodebug_scroll debug_scroll debug_tiles dbt nodebug_tiles nodbt debug_tiles debug_grabs nodebug_grabs debug_sel nodebug_sel dbg - nodbg noremote + nodbg macnosaver macsaver noremote aro= noop display vncdisplay desktopname guess_desktop http_url auth xauth users rootshift clipshift diff --git a/x11vnc/cleanup.c b/x11vnc/cleanup.c index 38edec3..bd0d91f 100644 --- a/x11vnc/cleanup.c +++ b/x11vnc/cleanup.c @@ -126,6 +126,18 @@ void clean_up_exit (int ret) { ssl_helper_pid(0, 0); /* killall */ } +#ifdef MACOSX + if (client_connect_file) { + if (strstr(client_connect_file, "/tmp/x11vnc-macosx-channel.") + == client_connect_file) { + unlink(client_connect_file); + } + } + if (! dpy) { + macosxCG_fini(); + } +#endif + if (! dpy) exit(ret); /* raw_rb hack */ /* X keyboard cleanups */ diff --git a/x11vnc/connections.c b/x11vnc/connections.c index 5ceb510..71608ec 100644 --- a/x11vnc/connections.c +++ b/x11vnc/connections.c @@ -16,6 +16,7 @@ #include "sslhelper.h" #include "xwrappers.h" #include "xevents.h" +#include "macosxCG.h" /* * routines for handling incoming, outgoing, etc connections @@ -746,6 +747,11 @@ void client_gone(rfbClientPtr client) { rfbLog("viewer exited.\n"); clean_up_exit(0); } +#ifdef MACOSX + if (! dpy && client_count == 0) { + macosxCG_refresh_callback_off(); + } +#endif } /* @@ -1204,7 +1210,7 @@ static unsigned char t2x2_bits[] = { ret = out; XSelectInput(dpy, awin, 0); XUnmapWindow(dpy, awin); - XFreeGC(dpy, gc); + XFree_wr(gc); XDestroyWindow(dpy, awin); XFlush_wr(dpy); break; @@ -1773,13 +1779,13 @@ void read_vnc_connect_prop(int nomsg) { /* too big */ rfbLog("warning: truncating large VNC_CONNECT" " string > %d bytes.\n", VNC_CONNECT_MAX); - XFree(data); + XFree_wr(data); break; } memcpy(vnc_connect_str+slen, data, dlen); slen += dlen; vnc_connect_str[slen] = '\0'; - XFree(data); + XFree_wr(data); } } while (bytes_after > 0); @@ -1823,13 +1829,13 @@ void read_x11vnc_remote_prop(int nomsg) { /* too big */ rfbLog("warning: truncating large X11VNC_REMOTE" " string > %d bytes.\n", X11VNC_REMOTE_MAX); - XFree(data); + XFree_wr(data); break; } memcpy(x11vnc_remote_str+slen, data, dlen); slen += dlen; x11vnc_remote_str[slen] = '\0'; - XFree(data); + XFree_wr(data); } } while (bytes_after > 0); @@ -2101,6 +2107,11 @@ enum rfbNewClientAction new_client(rfbClientPtr client) { */ autorepeat(0, 0); } +#ifdef MACOSX + if (! dpy && client_count == 1) { + macosxCG_refresh_callback_on(); + } +#endif if (use_solid_bg && client_count == 1) { solid_bg(0); } diff --git a/x11vnc/cursor.c b/x11vnc/cursor.c index 01dc5fa..12cb08c 100644 --- a/x11vnc/cursor.c +++ b/x11vnc/cursor.c @@ -33,6 +33,8 @@ void set_no_cursor(void); void set_warrow_cursor(void); int set_cursor(int x, int y, int which); int check_x11_pointer(void); +int store_cursor(int serial, unsigned long *data, int w, int h, int cbpp, int xhot, int yhot); +unsigned long get_cursor_serial(int mode); typedef struct win_str_info { @@ -57,7 +59,7 @@ static void set_rfb_cursor(int which); static void tree_descend_cursor(int *depth, Window *w, win_str_info_t *winfo); static rfbCursorPtr pixels2curs(unsigned long *pixels, int w, int h, int xhot, int yhot, int Bpp); -static int get_xfixes_cursor(int init); +static int get_exact_cursor(int init); static void set_cursor_was_changed(rfbScreenInfoPtr s); @@ -618,7 +620,7 @@ static void setup_cursors(void) { } /* clear any xfixes cursor cache (no freeing is done) */ - get_xfixes_cursor(1); + get_exact_cursor(1); /* manually fill in the data+masks: */ cur_empty.data = curs_empty_data; @@ -876,7 +878,7 @@ static void tree_descend_cursor(int *depth, Window *w, win_str_info_t *winfo) { break; } /* TBD: query_pointer() */ - XQueryPointer(dpy, c, &r, &c, &rx, &ry, &wx, &wy, &mask); + XQueryPointer_wr(dpy, c, &r, &c, &rx, &ry, &wx, &wy, &mask); } if (nm_info) { @@ -898,7 +900,7 @@ static void tree_descend_cursor(int *depth, Window *w, win_str_info_t *winfo) { strcpy(winfo->wm_name, name); got_wm_name = 1; } - XFree(name); + XFree_wr(name); } } if (classhint && (! got_res_name || ! got_res_class)) { @@ -910,7 +912,7 @@ static void tree_descend_cursor(int *depth, Window *w, win_str_info_t *winfo) { strcpy(winfo->res_name, p); got_res_name = 1; } - XFree(p); + XFree_wr(p); classhint->res_name = NULL; } p = classhint->res_class; @@ -919,7 +921,7 @@ static void tree_descend_cursor(int *depth, Window *w, win_str_info_t *winfo) { strcpy(winfo->res_class, p); got_res_class = 1; } - XFree(p); + XFree_wr(p); classhint->res_class = NULL; } } @@ -1215,11 +1217,20 @@ static rfbCursorPtr pixels2curs(unsigned long *pixels, int w, int h, return c; } -static int get_xfixes_cursor(int init) { - static unsigned long last_cursor = 0; - static int last_index = 0; - static time_t curs_times[CURS_MAX]; - static unsigned long curs_index[CURS_MAX]; +static unsigned long last_cursor = 0; +static int last_index = 0; +static time_t curs_times[CURS_MAX]; +static unsigned long curs_index[CURS_MAX]; + +unsigned long get_cursor_serial(int mode) { + if (mode == 0) { + return last_cursor; + } else if (mode == 1) { + return (unsigned long) last_index; + } +} + +static int get_exact_cursor(int init) { int which = CURS_ARROW; if (init) { @@ -1234,12 +1245,21 @@ static int get_xfixes_cursor(int init) { return -1; } +#ifdef MACOSX + if (! dpy) { + return macosx_get_cursor(); + } +#endif + if (xfixes_present && dpy) { #if LIBVNCSERVER_HAVE_LIBXFIXES - int use, oldest, i; - time_t oldtime, now; + int last_idx = (int) get_cursor_serial(1); XFixesCursorImage *xfc; + if (last_idx) { + which = last_idx; + } + if (! got_xfixes_cursor_notify && xfixes_base_event_type) { /* try again for XFixesCursorNotify event */ XEvent xev; @@ -1252,11 +1272,7 @@ static int get_xfixes_cursor(int init) { } if (! got_xfixes_cursor_notify) { /* evidently no cursor change, just return last one */ - if (last_index) { - return last_index; - } else { - return CURS_ARROW; - } + return which; } got_xfixes_cursor_notify = 0; @@ -1266,113 +1282,112 @@ static int get_xfixes_cursor(int init) { X_UNLOCK; if (! xfc) { /* failure. */ - return(which); + return which; } - if (xfc->cursor_serial == last_cursor) { - /* same serial index: no change */ - X_LOCK; - XFree(xfc); - X_UNLOCK; - if (last_index) { - return last_index; - } else { - return CURS_ARROW; - } - } + which = store_cursor(xfc->cursor_serial, xfc->pixels, + xfc->width, xfc->height, 32, xfc->xhot, xfc->yhot); + + X_LOCK; + XFree_wr(xfc); + X_UNLOCK; +#endif + } + return(which); +} + +int store_cursor(int serial, unsigned long *data, int w, int h, int cbpp, + int xhot, int yhot) { + int which = CURS_ARROW; + int use, oldest, i; + time_t oldtime, now; - oldest = CURS_DYN_MIN; - if (screen && screen->cursor == cursors[oldest]->rfb) { - oldest++; +#if 0 +fprintf(stderr, "sc: %d %d/%d %d - %d %d\n", serial, w, h, cbpp, xhot, yhot); +#endif + + oldest = CURS_DYN_MIN; + if (screen && screen->cursor == cursors[oldest]->rfb) { + oldest++; + } + oldtime = curs_times[oldest]; + now = time(NULL); + for (i = CURS_DYN_MIN; i <= CURS_DYN_MAX; i++) { + if (screen && screen->cursor == cursors[i]->rfb) { + ; + } else if (curs_times[i] < oldtime) { + /* watch for oldest one to overwrite */ + oldest = i; + oldtime = curs_times[i]; } - oldtime = curs_times[oldest]; - now = time(NULL); - for (i = CURS_DYN_MIN; i <= CURS_DYN_MAX; i++) { - if (screen && screen->cursor == cursors[i]->rfb) { - ; - } else if (curs_times[i] < oldtime) { - /* watch for oldest one to overwrite */ - oldest = i; - oldtime = curs_times[i]; - } - if (xfc->cursor_serial == curs_index[i]) { - /* - * got a hit with an existing cursor, - * use that one. - */ - last_cursor = curs_index[i]; - curs_times[i] = now; - last_index = i; - X_LOCK; - XFree(xfc); - X_UNLOCK; - return last_index; - } + if (serial == curs_index[i]) { + /* + * got a hit with an existing cursor, + * use that one. + */ + last_cursor = curs_index[i]; + curs_times[i] = now; + last_index = i; + return last_index; } + } - /* we need to create the cursor and overwrite oldest */ - use = oldest; - if (cursors[use]->rfb) { - /* clean up oldest if it exists */ - if (cursors[use]->rfb->richSource) { - free(cursors[use]->rfb->richSource); - cursors[use]->rfb->richSource = NULL; - } - if (cursors[use]->rfb->alphaSource) { - free(cursors[use]->rfb->alphaSource); - cursors[use]->rfb->alphaSource = NULL; - } - if (cursors[use]->rfb->source) { - free(cursors[use]->rfb->source); - cursors[use]->rfb->source = NULL; - } - if (cursors[use]->rfb->mask) { - free(cursors[use]->rfb->mask); - cursors[use]->rfb->mask = NULL; - } - free(cursors[use]->rfb); - cursors[use]->rfb = NULL; + /* we need to create the cursor and overwrite oldest */ + use = oldest; + if (cursors[use]->rfb) { + /* clean up oldest if it exists */ + if (cursors[use]->rfb->richSource) { + free(cursors[use]->rfb->richSource); + cursors[use]->rfb->richSource = NULL; + } + if (cursors[use]->rfb->alphaSource) { + free(cursors[use]->rfb->alphaSource); + cursors[use]->rfb->alphaSource = NULL; } + if (cursors[use]->rfb->source) { + free(cursors[use]->rfb->source); + cursors[use]->rfb->source = NULL; + } + if (cursors[use]->rfb->mask) { + free(cursors[use]->rfb->mask); + cursors[use]->rfb->mask = NULL; + } + free(cursors[use]->rfb); + cursors[use]->rfb = NULL; + } - if (rotating && rotating_cursors) { - char *dst; - int tx, ty; - int w = xfc->width; - int h = xfc->height; + if (rotating && rotating_cursors) { + char *dst; + int tx, ty; - dst = (char *) malloc(w * h * 4); - rotate_curs(dst, (char *) xfc->pixels, w, h, 4); + dst = (char *) malloc(w * h * cbpp/8); + rotate_curs(dst, (char *) data, w, h, cbpp/8); - memcpy(xfc->pixels, dst, w * h * 4); - free(dst); + memcpy(data, dst, w * h * cbpp/8); + free(dst); - rotate_coords(xfc->xhot, xfc->yhot, &tx, &ty, w, h); - xfc->xhot = tx; - xfc->yhot = ty; - if (! rotating_same) { - xfc->width = h; - xfc->height = w; - } + rotate_coords(xhot, yhot, &tx, &ty, w, h); + xhot = tx; + yhot = ty; + if (! rotating_same) { + int tmp = w; + w = h; + h = tmp; } + } - /* place cursor into our collection */ - cursors[use]->rfb = pixels2curs(xfc->pixels, xfc->width, - xfc->height, xfc->xhot, xfc->yhot, bpp/8); + /* place cursor into our collection */ + cursors[use]->rfb = pixels2curs(data, w, h, xhot, yhot, bpp/8); - /* update time and serial index: */ - curs_times[use] = now; - curs_index[use] = xfc->cursor_serial; - last_index = use; - last_cursor = xfc->cursor_serial; + /* update time and serial index: */ + curs_times[use] = now; + curs_index[use] = serial; + last_index = use; + last_cursor = serial; - which = last_index; + which = last_index; - X_LOCK; - XFree(xfc); - X_UNLOCK; -#endif - } - return(which); + return which; } int known_cursors_mode(char *s) { @@ -1465,9 +1480,15 @@ int get_which_cursor(void) { mode = 3; } - if (mode == 3 && xfixes_present && use_xfixes) { - if (db) fprintf(stderr, "get_which_cursor call get_xfixes_cursor\n"); - return get_xfixes_cursor(0); + if (mode == 3) { + int try_macosx = 0; +#ifdef MACOSX + if (! dpy) try_macosx = 1; +#endif + if ((xfixes_present && use_xfixes) || try_macosx) { + if (db) fprintf(stderr, "get_which_cursor call get_exact_cursor\n"); + return get_exact_cursor(0); + } } if (depth_cutoff < 0) { @@ -1518,7 +1539,7 @@ int get_which_cursor(void) { #endif /* NO_X11 */ } if (which == which0) { - /* the string "term" mean I-beam. */ + /* the string "term" means I-beam. */ char *name, *class; lowercase(winfo.res_name); lowercase(winfo.res_class); @@ -1821,22 +1842,39 @@ int set_cursor(int x, int y, int which) { */ int check_x11_pointer(void) { Window root_w, child_w; - rfbBool ret; + rfbBool ret = 0; int root_x, root_y, win_x, win_y; int x, y; unsigned int mask; + int macosx_rawfb_ret = 0; + + if (unixpw_in_progress) return 0; +#ifdef MACOSX + if (macosx_rawfb_ret) { + RAWFB_RET(0) + } + if (dpy) { + ; + } else { + ret = macosx_get_cursor_pos(&root_x, &root_y); + } +#else RAWFB_RET(0) #if NO_X11 return 0; -#else +#endif +#endif - if (unixpw_in_progress) return 0; - X_LOCK; - ret = XQueryPointer(dpy, rootwin, &root_w, &child_w, &root_x, &root_y, - &win_x, &win_y, &mask); - X_UNLOCK; +#if ! NO_X11 + if (dpy) { + X_LOCK; + ret = XQueryPointer_wr(dpy, rootwin, &root_w, &child_w, &root_x, &root_y, + &win_x, &win_y, &mask); + X_UNLOCK; + } +#endif /* NO_X11 */ if (! ret) { return 0; @@ -1860,6 +1898,5 @@ int check_x11_pointer(void) { /* change the cursor shape if necessary */ return set_cursor(x, y, get_which_cursor()); -#endif /* NO_X11 */ } diff --git a/x11vnc/cursor.h b/x11vnc/cursor.h index 193aa23..8dbe9dc 100644 --- a/x11vnc/cursor.h +++ b/x11vnc/cursor.h @@ -30,5 +30,7 @@ extern void set_no_cursor(void); extern void set_warrow_cursor(void); extern int set_cursor(int x, int y, int which); extern int check_x11_pointer(void); +extern int store_cursor(int serial, unsigned long *data, int w, int h, int cbpp, int xhot, int yhot); +extern unsigned long get_cursor_serial(int mode); #endif /* _X11VNC_CURSOR_H */ diff --git a/x11vnc/gui.c b/x11vnc/gui.c index a02bd52..3e27783 100644 --- a/x11vnc/gui.c +++ b/x11vnc/gui.c @@ -60,7 +60,7 @@ static Window tweak_tk_window_id(Window win) { } } if (name != NULL) { - XFree(name); + XFree_wr(name); } return new; #endif /* NO_X11 */ @@ -256,6 +256,9 @@ if (0) fprintf(stderr, "run_gui: %s -- %d %d\n", gui_xdisplay, connect_to_x11vnc if (! dpy) { rfbLog("gui: could not open x11vnc " "display: %s\n", NONUL(x11vnc_xdisplay)); +#ifdef MACOSX + goto macjump; +#endif exit(1); } scr = DefaultScreen(dpy); @@ -263,6 +266,8 @@ if (0) fprintf(stderr, "run_gui: %s -- %d %d\n", gui_xdisplay, connect_to_x11vnc initialize_vnc_connect_prop(); initialize_x11vnc_remote_prop(); } + + macjump: signal(SIGUSR1, sigusr1); got_sigusr1 = 0; @@ -572,6 +577,10 @@ void do_gui(char *opts, int sleep) { connect_to_x11vnc = 1; } +#ifdef MACOSX + goto startit; +#endif + if (icon_mode && !got_gui_xdisplay) { /* for tray mode, prefer the polled DISPLAY */ if (use_dpy) { @@ -620,6 +629,8 @@ void do_gui(char *opts, int sleep) { } XCloseDisplay_wr(test_dpy); + startit: + if (start_x11vnc) { #if LIBVNCSERVER_HAVE_FORK diff --git a/x11vnc/help.c b/x11vnc/help.c index 21f6f12..78aeecf 100644 --- a/x11vnc/help.c +++ b/x11vnc/help.c @@ -2848,6 +2848,10 @@ void print_help(int mode) { " You can also set the env. var X11VNC_UINPUT_DEBUG=1 or\n" " higher to get debugging output for UINPUT mode.\n" "\n" +"-macnodim For the native Mac OS X server, disable dimming. \n" +"-macnosleep For the native Mac OS X server, disable display sleep.\n" +"-macnosaver For the native Mac OS X server, disable screensaver.\n" +"\n" "-gui [gui-opts] Start up a simple tcl/tk gui based on the the remote\n" " control options -remote/-query described below.\n" " Requires the \"wish\" program to be installed on the\n" @@ -3216,6 +3220,8 @@ void print_help(int mode) { " height parameter to n.\n" " desktop:str set -desktop name to str for new clients.\n" " rfbport:n set -rfbport to n.\n" +" macnosaver enable -macnosaver mode.\n" +" macsaver disable -macnosaver mode.\n" /* access */ " httpport:n set -httpport to n.\n" " httpdir:dir set -httpdir to dir (and enable http).\n" @@ -3327,7 +3333,7 @@ void print_help(int mode) { " debug_wireframe debug_scroll nodebug_scroll debug_scroll\n" " debug_tiles dbt nodebug_tiles nodbt debug_tiles\n" " debug_grabs nodebug_grabs debug_sel nodebug_sel dbg\n" -" nodbg noremote\n" +" nodbg macnosaver macsaver noremote\n" "\n" " aro= noop display vncdisplay desktopname guess_desktop\n" " http_url auth xauth users rootshift clipshift\n" @@ -3665,7 +3671,7 @@ void nopassword_warning_msg(int gotloc) { fprintf(stderr, "%s", str1); fflush(stderr); #if !PASSWD_REQUIRED - usleep(2500 * 1000); + usleep(1000 * 1000); #endif if (!quiet) { fprintf(stderr, "%s", str2); diff --git a/x11vnc/keyboard.c b/x11vnc/keyboard.c index bef2cec..ae056ab 100644 --- a/x11vnc/keyboard.c +++ b/x11vnc/keyboard.c @@ -129,7 +129,7 @@ void clear_modifiers(int init) { kcount++; } } - XFree((void *) keymap); + XFree_wr((void *) keymap); first = 0; } if (init) { @@ -458,7 +458,7 @@ int add_keysym(KeySym keysym) { ret = kc; break; } - XFree(keymap); + XFree_wr(keymap); return ret; #endif /* NO_X11 */ } @@ -491,7 +491,7 @@ static void delete_keycode(KeyCode kc, int bequiet) { kc, ksym, str ? str : "null"); } - XFree(keymap); + XFree_wr(keymap); XFlush_wr(dpy); #endif /* NO_X11 */ } @@ -994,7 +994,7 @@ void switch_to_xkb_if_better(void) { } n = k; - XFree(keymap); + XFree_wr(keymap); if (missing_noxkb == 0 && syms_gt_4 >= 8) { if (! raw_fb_str) { rfbLog("XKEYBOARD: number of keysyms per keycode %d " @@ -2300,7 +2300,7 @@ void initialize_modtweak(void) { iso_level3_code = XKeysymToKeycode(dpy, XK_ISO_Level3_Shift); #endif - XFree ((void *) keymap); + XFree_wr ((void *) keymap); X_UNLOCK; #endif /* NO_X11 */ @@ -2531,6 +2531,8 @@ static void pipe_keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { console_key_command(down, keysym, client); } else if (pipeinput_int == PIPEINPUT_UINPUT) { uinput_key_command(down, keysym, client); + } else if (pipeinput_int == PIPEINPUT_MACOSX) { + macosx_key_command(down, keysym, client); } if (pipeinput_fh == NULL) { return; diff --git a/x11vnc/linuxfb.c b/x11vnc/linuxfb.c index 878d87f..a884acc 100644 --- a/x11vnc/linuxfb.c +++ b/x11vnc/linuxfb.c @@ -9,6 +9,7 @@ #include "allowed_input_t.h" #include "uinput.h" #include "keyboard.h" +#include "macosx.h" #if LIBVNCSERVER_HAVE_SYS_IOCTL_H #include @@ -26,6 +27,11 @@ char *console_guess(char *str, int *fd) { char *atparms = NULL, *file = NULL; int do_input, have_uinput, tty = -1; +#ifdef MACOSX + return macosx_console_guess(str, fd); +#endif + + if (strstr(in, "/dev/fb") == in) { free(in); in = (char *) malloc(strlen("console:") + strlen(str) + 1); diff --git a/x11vnc/macosx.c b/x11vnc/macosx.c new file mode 100644 index 0000000..b2d799d --- /dev/null +++ b/x11vnc/macosx.c @@ -0,0 +1,377 @@ +/* -- macosx.c -- */ + +#include "rfb/rfbconfig.h" +#if (defined(__MACH__) && defined(__APPLE__) && defined(LIBVNCSERVER_HAVE_MACOSX_NATIVE_DISPLAY)) + +#define DOMAC 1 + +#else + +#define DOMAC 0 + +#endif + +#include "x11vnc.h" +#include "cleanup.h" +#include "scan.h" +#include "screen.h" +#include "pointer.h" +#include "allowed_input_t.h" +#include "keyboard.h" +#include "cursor.h" +#include "macosxCG.h" +#include "macosxCGP.h" +#include "macosxCGS.h" + +char *macosx_console_guess(char *str, int *fd); +void macosx_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client); +void macosx_pointer_command(int mask, int x, int y, rfbClientPtr client); +char *macosx_get_fb_addr(void); +int macosx_get_cursor(void); +int macosx_get_cursor_pos(int *, int *); +int macosx_valid_window(Window, XWindowAttributes*); + +Status macosx_xquerytree(Window w, Window *root_return, Window *parent_return, + Window **children_return, unsigned int *nchildren_return); + +#if (! DOMAC) + +void macosx_event_loop(void) { + return; +} +char *macosx_console_guess(char *str, int *fd) { + return NULL; +} +void macosx_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { + return; +} +void macosx_pointer_command(int mask, int x, int y, rfbClientPtr client) { + return; +} +char *macosx_get_fb_addr(void) { + return NULL; +} +int macosx_get_cursor(void) { + return 0; +} +int macosx_get_cursor_pos(int *x, int *y) { + return 0; +} +int macosx_valid_window(Window w, XWindowAttributes* a) { + return 0; +} +Status macosx_xquerytree(Window w, Window *root_return, Window *parent_return, + Window **children_return, unsigned int *nchildren_return) { + return (Status) 0; +} + + +int dragum(void) {return 1;} + +#else + +void macosx_event_loop(void) { + macosxCG_event_loop(); +} + +char *macosx_get_fb_addr(void) { + macosxCG_init(); + return macosxCG_get_fb_addr(); +} + +char *macosx_console_guess(char *str, int *fd) { + char *q, *in = strdup(str); + char *atparms = NULL, *file = NULL; + + macosxCG_init(); + + if (strstr(in, "console") != in) { + rfbLog("console_guess: unrecognized console/fb format: %s\n", str); + free(in); + return NULL; + } + + *fd = -1; + + q = strrchr(in, '@'); + if (q) { + atparms = strdup(q+1); + *q = '\0'; + } + q = strrchr(in, ':'); + if (q) { + file = strdup(q+1); + *q = '\0'; + } + if (! file || file[0] == '\0') { + file = strdup("/dev/null"); + } + rfbLog("console_guess: file is %s\n", file); + + if (! pipeinput_str) { + pipeinput_str = strdup("MACOSX"); + initialize_pipeinput(); + } + + if (! atparms) { + int w, h, b, bps, dep; + unsigned long rm = 0, gm = 0, bm = 0; + + w = macosxCG_CGDisplayPixelsWide(); + h = macosxCG_CGDisplayPixelsHigh(); + b = macosxCG_CGDisplayBitsPerPixel(); + + bps = macosxCG_CGDisplayBitsPerSample(); + dep = macosxCG_CGDisplaySamplesPerPixel() * bps; + + rm = (1 << bps) - 1; + gm = (1 << bps) - 1; + bm = (1 << bps) - 1; + rm = rm << 2 * bps; + gm = gm << 1 * bps; + bm = bm << 0 * bps; + + if (b == 8 && rm == 0xff && gm == 0xff && bm == 0xff) { + /* I don't believe it... */ + rm = 0x07; + gm = 0x38; + bm = 0xc0; + } + + /* @66666x66666x32:0xffffffff:... */ + atparms = (char *) malloc(200); + sprintf(atparms, "%dx%dx%d:%lx/%lx/%lx", + w, h, b, rm, gm, bm); + } + if (atparms) { + int gw, gh, gb; + if (sscanf(atparms, "%dx%dx%d", &gw, &gh, &gb) == 3) { + fb_x = gw; + fb_y = gh; + fb_b = gb; + } + } + if (! atparms) { + rfbLog("console_guess: could not get @ parameters.\n"); + return NULL; + } + + q = (char *) malloc(strlen("map:macosx:") + strlen(file) + 1 + strlen(atparms) + 1); + sprintf(q, "map:macosx:%s@%s", file, atparms); + return q; +} + +void macosx_pointer_command(int mask, int x, int y, rfbClientPtr client) { + allowed_input_t input; + int rc; + + if (0) fprintf(stderr, "macosx_pointer_command: %d %d - %d\n", x, y, mask); + + if (mask >= 0) { + got_pointer_calls++; + } + + if (view_only) { + return; + } + + get_allowed_input(client, &input); + + if (! input.motion || ! input.button) { + /* XXX fix me with last_x, last_y, etc. */ + return; + } + + if (mask >= 0) { + got_user_input++; + got_pointer_input++; + last_pointer_client = client; + last_pointer_time = time(NULL); + } + + macosxCG_pointer_inject(mask, x, y); + + cursor_x = x; + cursor_y = y; + + /* record the x, y position for the rfb screen as well. */ + cursor_position(x, y); + + /* change the cursor shape if necessary */ + rc = set_cursor(x, y, get_which_cursor()); + cursor_changes += rc; + + last_event = last_input = last_pointer_input = time(NULL); +} + +void init_key_table(void) { + macosxCG_init_key_table(); +} + +void macosx_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { + static int control = 0, alt = 0; + allowed_input_t input; + if (debug_keyboard) fprintf(stderr, "macosx_key_command: %d %s\n", (int) keysym, down ? "down" : "up"); + + if (view_only) { + return; + } + get_allowed_input(client, &input); + if (! input.keystroke) { + return; + } + + init_key_table(); + macosxCG_key_inject((int) down, (unsigned int) keysym); + +} + +int macosx_get_cursor_pos(int *x, int *y) { + macosxCG_get_cursor_pos(x, y); + return 1; +} + +int macosx_get_cursor(void) { + return macosxCG_get_cursor(); +} + +typedef struct windat { + int win; + int x, y; + int width, height; + int level; +} windat_t; + +extern int macwinmax; +extern windat_t macwins[]; + +int macosx_get_wm_frame_pos(int *px, int *py, int *x, int *y, int *w, int *h, + Window *frame, Window *win) { + static int last_idx = -1; + int x1, x2, y1, y2; + int idx = -1, i, k; + macosxCGS_get_all_windows(); + macosxCG_get_cursor_pos(px, py); + + for (i = -1; i= 0 && last_idx < macwinmax) { + k = last_idx; + } else { + last_idx = -1; + continue; + } + } + x1 = macwins[k].x; + x2 = macwins[k].x + macwins[k].width; + y1 = macwins[k].y; + y2 = macwins[k].y + macwins[k].height; +if (debug_wireframe) fprintf(stderr, "%d/%d: %d %d %d - %d %d %d\n", k, macwins[k].win, x1, *px, x2, y1, *py, y2); + if (x1 <= *px && *px < x2) { + if (y1 <= *py && *py < y2) { + idx = k; + break; + } + } + } + if (idx < 0) { + return 0; + } + + *x = macwins[idx].x; + *y = macwins[idx].y; + *w = macwins[idx].width; + *h = macwins[idx].height; + *frame = (Window) macwins[idx].win; + if (win != NULL) { + *win = *frame; + } + + last_idx = idx; + + return 1; +} + +int macosx_valid_window(Window w, XWindowAttributes* a) { + static int last_idx = -1; + int win = (int) w; + int i, k, idx = -1; + + for (i = -1; i= 0 && last_idx < macwinmax) { + k = last_idx; + } else { + last_idx = -1; + continue; + } + } + if (macwins[k].win == win) { + idx = k; + break; + } + } + if (idx < 0) { + return 0; + } + + a->x = macwins[idx].x; + a->y = macwins[idx].y; + a->width = macwins[idx].width; + a->height = macwins[idx].height; + a->depth = depth; + a->border_width = 0; + a->backing_store = 0; + a->map_state = IsViewable; + + last_idx = idx; + + return 1; +} + +#define QTMAX 2048 +static Window cret[QTMAX]; + +extern int CGS_levelmax; +extern int CGS_levels[]; + +Status macosx_xquerytree(Window w, Window *root_return, Window *parent_return, + Window **children_return, unsigned int *nchildren_return) { + + int i, n, k, swap; + int win1, win2; + + *root_return = (Window) 0; + *parent_return = (Window) 0; + +#if 0 +fprintf(stderr, "macosx_xquerytree in.\n"); +#endif + + macosxCGS_get_all_windows(); + +#if 0 +fprintf(stderr, "macosx_xquerytree got windows.\n"); +#endif + + n = 0; + for (k = 0; k < CGS_levelmax; k++) { + for (i = macwinmax - 1; i >= 0; i--) { + if (macwins[i].level == CGS_levels[k]) { +#if 0 +fprintf(stderr, "k=%d i=%d n=%d\n", k, i, n); +#endif + cret[n++] = (Window) macwins[i].win; + } + } + } + *children_return = cret; + *nchildren_return = (unsigned int) macwinmax; + + return (Status) 1; +} + +#endif /* LIBVNCSERVER_HAVE_MACOSX_NATIVE_DISPLAY */ + diff --git a/x11vnc/macosx.h b/x11vnc/macosx.h new file mode 100644 index 0000000..77c6e4a --- /dev/null +++ b/x11vnc/macosx.h @@ -0,0 +1,19 @@ +#ifndef _X11VNC_MACOSX_H +#define _X11VNC_MACOSX_H + +/* -- macosx.h -- */ + +extern char *macosx_console_guess(char *str, int *fd); +extern char *macosx_get_fb_addr(void); +extern void macosx_key_command(rfbBool down, rfbKeySym keysym, rfbClientPtr client); +extern void macosx_pointer_command(int mask, int x, int y, rfbClientPtr client); +extern void macosx_event_loop(void); +extern int macosx_get_cursor(void); +extern int macosx_get_cursor_pos(int *, int *); +extern int macosx_valid_window(Window, XWindowAttributes*); +extern Status macosx_xquerytree(Window w, Window *root_return, Window *parent_return, + Window **children_return, unsigned int *nchildren_return); + + + +#endif /* _X11VNC_MACOSX_H */ diff --git a/x11vnc/macosxCG.c b/x11vnc/macosxCG.c new file mode 100644 index 0000000..4ecf2c2 --- /dev/null +++ b/x11vnc/macosxCG.c @@ -0,0 +1,508 @@ +/* -- macosxCG.c -- */ + +/* + * We need to keep this separate from nearly everything else, e.g. rfb.h + * and the other stuff, otherwise it does not work properly, mouse drags + * will not work!! + */ + +#if (defined(__MACH__) && defined(__APPLE__)) + +#include +#include +#include + +void macosxCG_init(void); +void macosxCG_event_loop(void); +char *macosxCG_get_fb_addr(void); + +int macosxCG_CGDisplayPixelsWide(void); +int macosxCG_CGDisplayPixelsHigh(void); +int macosxCG_CGDisplayBitsPerPixel(void); +int macosxCG_CGDisplayBitsPerSample(void); +int macosxCG_CGDisplaySamplesPerPixel(void); +int macosxCG_CGDisplayBytesPerRow(void); + +void macosxCG_pointer_inject(int mask, int x, int y); +int macosxCG_get_cursor_pos(int *x, int *y); +int macosxCG_get_cursor(void); +void macosxCG_init_key_table(void); +void macosxCG_key_inject(int down, unsigned int keysym); + +CGDirectDisplayID displayID = NULL; + +extern int collect_macosx_damage(int x_in, int y_in, int w_in, int h_in, int call); + +static void macosxCG_callback(CGRectCount n, const CGRect *rects, void *dum) { + int i, db = 0; + if (db) fprintf(stderr, "macosx_callback: n=%d\n", (int) n); + for (i=0; i < n; i++) { + if (db > 1) fprintf(stderr, " : %g %g - %g %g\n", rects[i].origin.x, rects[i].origin.y, rects[i].size.width, rects[i].size.height); + collect_macosx_damage( (int) rects[i].origin.x, (int) rects[i].origin.y, + (int) rects[i].size.width, (int) rects[i].size.height, 1); + } +} + +int dragum(void) { + int x =200, y = 150, dy = 10, i; + CGPoint loc; + + CGDirectDisplayID displayID2 = kCGDirectMainDisplay; + (void) GetMainDevice(); + + for (i=0; i< 50; i++) { + usleep(1000*100); + loc.x = x; + loc.y = y + i*dy; + CGPostMouseEvent(loc, TRUE, 1, TRUE); + } + CGPostMouseEvent(loc, TRUE, 1, FALSE); + usleep(4*1000*1000); + return 0; +} + +static int callback_set = 0; +extern int nofb; + +void macosxCG_refresh_callback_on(void) { + if (nofb) { + return; + } + + if (! callback_set) { + if (1) fprintf(stderr, "macosxCG_callback: register\n"); + CGRegisterScreenRefreshCallback(macosxCG_callback, NULL); + } + callback_set = 1; +} + +void macosxCG_refresh_callback_off(void) { + if (callback_set) { + if (1) fprintf(stderr, "macosxCG_callback: unregister\n"); + CGUnregisterScreenRefreshCallback(macosxCG_callback, NULL); + } + callback_set = 0; +} + +extern int macosx_noscreensaver; + +void macosxCG_init(void) { + if (displayID == NULL) { + fprintf(stderr, "macosxCG_init: initializing display.\n"); + //dragum(); + + displayID = kCGDirectMainDisplay; + (void) GetMainDevice(); + + CGSetLocalEventsSuppressionInterval(0.0); + CGSetLocalEventsFilterDuringSupressionState( + kCGEventFilterMaskPermitAllEvents, + kCGEventSupressionStateSupressionInterval); + CGSetLocalEventsFilterDuringSupressionState( + kCGEventFilterMaskPermitAllEvents, + kCGEventSupressionStateRemoteMouseDrag); + + macosxCGP_init_dimming(); + if (macosx_noscreensaver) { + macosxCGP_screensaver_timer_on(); + } + } +} + +void macosxCG_fini(void) { + macosxCGP_dim_shutdown(); + if (macosx_noscreensaver) { + macosxCGP_screensaver_timer_off(); + } + macosxCG_refresh_callback_off(); +} + +extern int dpy_x, dpy_y; +extern int client_count; +extern void do_new_fb(int); + +void macosxCG_event_loop(void) { + OSStatus rc; + rc = RunCurrentEventLoop(kEventDurationSecond/30); + if (client_count) { + macosxCG_refresh_callback_on(); + } else { + macosxCG_refresh_callback_off(); + } + if (dpy_x != (int) CGDisplayPixelsWide(displayID)) { + if (dpy_y != (int) CGDisplayPixelsHigh(displayID)) { + do_new_fb(1); + } + } +} + +char *macosxCG_get_fb_addr(void) { + macosxCG_init(); + return (char *) CGDisplayBaseAddress(displayID); +} + +int macosxCG_CGDisplayPixelsWide(void) { + return (int) CGDisplayPixelsWide(displayID); +} +int macosxCG_CGDisplayPixelsHigh(void) { + return (int) CGDisplayPixelsHigh(displayID); +} +int macosxCG_CGDisplayBitsPerPixel(void) { + return (int) CGDisplayBitsPerPixel(displayID); +} +int macosxCG_CGDisplayBitsPerSample(void) { + return (int) CGDisplayBitsPerSample(displayID); +} +int macosxCG_CGDisplaySamplesPerPixel(void) { + return (int) CGDisplaySamplesPerPixel(displayID); +} +int macosxCG_CGDisplayBytesPerRow(void) { + return (int) CGDisplayBytesPerRow(displayID);; +} + +typedef int CGSConnectionRef; +static CGSConnectionRef conn = 0; +extern CGError CGSNewConnection(void*, CGSConnectionRef*); +extern CGError CGSReleaseConnection(CGSConnectionRef); +extern CGError CGSGetGlobalCursorDataSize(CGSConnectionRef, int*); +extern CGError CGSGetGlobalCursorData(CGSConnectionRef, unsigned char*, + int*, int*, CGRect*, CGPoint*, int*, int*, int*); +extern CGError CGSGetCurrentCursorLocation(CGSConnectionRef, CGPoint*); +extern int CGSCurrentCursorSeed(void); +extern int CGSHardwareCursorActive(); + +static CGPoint current_cursor_pos(void) { + CGPoint pos; + pos.x = 0; + pos.y = 0; + if (! conn) { + if (CGSNewConnection(NULL, &conn) != kCGErrorSuccess) { + fprintf(stderr, "CGSNewConnection error\n"); + } + } + if (CGSGetCurrentCursorLocation(conn, &pos) != kCGErrorSuccess) { + fprintf(stderr, "CGSGetCurrentCursorLocation error\n"); + } + return pos; +} + +int macosxCG_get_cursor_pos(int *x, int *y) { + CGPoint pos = current_cursor_pos(); + *x = pos.x; + *y = pos.y; + return 1; +} + +extern int get_cursor_serial(int); +extern int store_cursor(int serial, unsigned long *data, int w, int h, int cbpp, int xhot, int yhot); + +int macosxCG_get_cursor(void) { + int last_idx = (int) get_cursor_serial(1); + int which = 1; + static CGPoint pos, lastpos; + static foo = 0; + CGError err; + int datasize, masksize, row_bytes, cdepth, comps, bpcomp; + CGRect rect; + CGPoint hot; + unsigned char *data; + int res, cursor_seed; + + if (last_idx) { + which = last_idx; + } + + pos = current_cursor_pos(); + if (cursor_seed == CGSCurrentCursorSeed()) { + return which; + } + if (! conn) { + if (CGSNewConnection(NULL, &conn) != kCGErrorSuccess) { + fprintf(stderr, "CGSNewConnection error\n"); + return which; + } + } + if (CGSGetGlobalCursorDataSize(conn, &datasize) != kCGErrorSuccess) { + fprintf(stderr, "CGSGetGlobalCursorDataSize error\n"); + return which; + } + + data = (unsigned char*) malloc(datasize); + + err = CGSGetGlobalCursorData(conn, data, &datasize, &row_bytes, + &rect, &hot, &cdepth, &comps, &bpcomp); + if (err != kCGErrorSuccess) { + fprintf(stderr, "CGSGetGlobalCursorData error\n"); + return which; + } + + if (cdepth == 24) { + cdepth = 32; + } + cursor_seed = CGSCurrentCursorSeed(); + + which = store_cursor(cursor_seed, (unsigned long*) data, + (int) rect.size.width, (int) rect.size.height, cdepth, (int) hot.x, (int) hot.y); + + free(data); + return(which); +} + +void macosxCG_pointer_inject(int mask, int x, int y) { + int swap23 = 1, rc; + int s1 = 0, s2 = 1, s3 = 2, s4 = 3, s5 = 4; + CGPoint loc; + int wheel_distance = 10; + static int cnt = 0; + + loc.x = x; + loc.y = y; + + if (swap23) { + s2 = 2; + s3 = 1; + } + + if ((cnt++ % 10) == 0) { + macosxCGP_undim(); + } + + if ((mask & (1 << s4))) { + CGPostScrollWheelEvent(1, wheel_distance); + } + if ((mask & (1 << s5))) { + CGPostScrollWheelEvent(1, -wheel_distance); + } + + CGPostMouseEvent(loc, TRUE, 3, + (mask & (1 << s1)) ? TRUE : FALSE, + (mask & (1 << s2)) ? TRUE : FALSE, + (mask & (1 << s3)) ? TRUE : FALSE + ); +} + +#define keyTableSize 0xFFFF + +#include + +static int USKeyCodes[] = { + /* The alphabet */ + XK_A, 0, /* A */ + XK_B, 11, /* B */ + XK_C, 8, /* C */ + XK_D, 2, /* D */ + XK_E, 14, /* E */ + XK_F, 3, /* F */ + XK_G, 5, /* G */ + XK_H, 4, /* H */ + XK_I, 34, /* I */ + XK_J, 38, /* J */ + XK_K, 40, /* K */ + XK_L, 37, /* L */ + XK_M, 46, /* M */ + XK_N, 45, /* N */ + XK_O, 31, /* O */ + XK_P, 35, /* P */ + XK_Q, 12, /* Q */ + XK_R, 15, /* R */ + XK_S, 1, /* S */ + XK_T, 17, /* T */ + XK_U, 32, /* U */ + XK_V, 9, /* V */ + XK_W, 13, /* W */ + XK_X, 7, /* X */ + XK_Y, 16, /* Y */ + XK_Z, 6, /* Z */ + XK_a, 0, /* a */ + XK_b, 11, /* b */ + XK_c, 8, /* c */ + XK_d, 2, /* d */ + XK_e, 14, /* e */ + XK_f, 3, /* f */ + XK_g, 5, /* g */ + XK_h, 4, /* h */ + XK_i, 34, /* i */ + XK_j, 38, /* j */ + XK_k, 40, /* k */ + XK_l, 37, /* l */ + XK_m, 46, /* m */ + XK_n, 45, /* n */ + XK_o, 31, /* o */ + XK_p, 35, /* p */ + XK_q, 12, /* q */ + XK_r, 15, /* r */ + XK_s, 1, /* s */ + XK_t, 17, /* t */ + XK_u, 32, /* u */ + XK_v, 9, /* v */ + XK_w, 13, /* w */ + XK_x, 7, /* x */ + XK_y, 16, /* y */ + XK_z, 6, /* z */ + + /* Numbers */ + XK_0, 29, /* 0 */ + XK_1, 18, /* 1 */ + XK_2, 19, /* 2 */ + XK_3, 20, /* 3 */ + XK_4, 21, /* 4 */ + XK_5, 23, /* 5 */ + XK_6, 22, /* 6 */ + XK_7, 26, /* 7 */ + XK_8, 28, /* 8 */ + XK_9, 25, /* 9 */ + + /* Symbols */ + XK_exclam, 18, /* ! */ + XK_at, 19, /* @ */ + XK_numbersign, 20, /* # */ + XK_dollar, 21, /* $ */ + XK_percent, 23, /* % */ + XK_asciicircum, 22, /* ^ */ + XK_ampersand, 26, /* & */ + XK_asterisk, 28, /* * */ + XK_parenleft, 25, /* ( */ + XK_parenright, 29, /* ) */ + XK_minus, 27, /* - */ + XK_underscore, 27, /* _ */ + XK_equal, 24, /* = */ + XK_plus, 24, /* + */ + XK_grave, 50, /* ` */ /* XXX ? */ + XK_asciitilde, 50, /* ~ */ + XK_bracketleft, 33, /* [ */ + XK_braceleft, 33, /* { */ + XK_bracketright, 30, /* ] */ + XK_braceright, 30, /* } */ + XK_semicolon, 41, /* ; */ + XK_colon, 41, /* : */ + XK_apostrophe, 39, /* ' */ + XK_quotedbl, 39, /* " */ + XK_comma, 43, /* , */ + XK_less, 43, /* < */ + XK_period, 47, /* . */ + XK_greater, 47, /* > */ + XK_slash, 44, /* / */ + XK_question, 44, /* ? */ + XK_backslash, 42, /* \ */ + XK_bar, 42, /* | */ + // OS X Sends this (END OF MEDIUM) for Shift-Tab (with US Keyboard) + 0x0019, 48, /* Tab */ + XK_space, 49, /* Space */ +}; + +static int SpecialKeyCodes[] = { + /* "Special" keys */ + XK_Return, 36, /* Return */ + XK_Delete, 117, /* Delete */ + XK_Tab, 48, /* Tab */ + XK_Escape, 53, /* Esc */ + XK_Caps_Lock, 57, /* Caps Lock */ + XK_Num_Lock, 71, /* Num Lock */ + XK_Scroll_Lock, 107, /* Scroll Lock */ + XK_Pause, 113, /* Pause */ + XK_BackSpace, 51, /* Backspace */ + XK_Insert, 114, /* Insert */ + + /* Cursor movement */ + XK_Up, 126, /* Cursor Up */ + XK_Down, 125, /* Cursor Down */ + XK_Left, 123, /* Cursor Left */ + XK_Right, 124, /* Cursor Right */ + XK_Page_Up, 116, /* Page Up */ + XK_Page_Down, 121, /* Page Down */ + XK_Home, 115, /* Home */ + XK_End, 119, /* End */ + + /* Numeric keypad */ + XK_KP_0, 82, /* KP 0 */ + XK_KP_1, 83, /* KP 1 */ + XK_KP_2, 84, /* KP 2 */ + XK_KP_3, 85, /* KP 3 */ + XK_KP_4, 86, /* KP 4 */ + XK_KP_5, 87, /* KP 5 */ + XK_KP_6, 88, /* KP 6 */ + XK_KP_7, 89, /* KP 7 */ + XK_KP_8, 91, /* KP 8 */ + XK_KP_9, 92, /* KP 9 */ + XK_KP_Enter, 76, /* KP Enter */ + XK_KP_Decimal, 65, /* KP . */ + XK_KP_Add, 69, /* KP + */ + XK_KP_Subtract, 78, /* KP - */ + XK_KP_Multiply, 67, /* KP * */ + XK_KP_Divide, 75, /* KP / */ + + /* Function keys */ + XK_F1, 122, /* F1 */ + XK_F2, 120, /* F2 */ + XK_F3, 99, /* F3 */ + XK_F4, 118, /* F4 */ + XK_F5, 96, /* F5 */ + XK_F6, 97, /* F6 */ + XK_F7, 98, /* F7 */ + XK_F8, 100, /* F8 */ + XK_F9, 101, /* F9 */ + XK_F10, 109, /* F10 */ + XK_F11, 103, /* F11 */ + XK_F12, 111, /* F12 */ + + /* Modifier keys */ + XK_Alt_L, 55, /* Alt Left (-> Command) */ + XK_Alt_R, 55, /* Alt Right (-> Command) */ + XK_Shift_L, 56, /* Shift Left */ + XK_Shift_R, 56, /* Shift Right */ + XK_Meta_L, 58, /* Option Left (-> Option) */ + XK_Meta_R, 58, /* Option Right (-> Option) */ + XK_Super_L, 58, /* Option Left (-> Option) */ + XK_Super_R, 58, /* Option Right (-> Option) */ + XK_Control_L, 59, /* Ctrl Left */ + XK_Control_R, 59, /* Ctrl Right */ +}; + +CGKeyCode keyTable[keyTableSize]; +unsigned char keyTableMods[keyTableSize]; + +void macosxCG_init_key_table(void) { + static int init = 0; + int i; + if (init) { + return; + } + init = 1; + + for (i=0; i < keyTableSize; i++) { + keyTable[i] = 0xFFFF; + keyTableMods[i] = 0; + } + for (i=0; i< (sizeof(USKeyCodes) / sizeof(int)); i += 2) { + int j = USKeyCodes[i]; + keyTable[(unsigned short) j] = (CGKeyCode) USKeyCodes[i+1]; + } + for (i=0; i< (sizeof(SpecialKeyCodes) / sizeof(int)); i += 2) { + int j = SpecialKeyCodes[i]; + keyTable[(unsigned short) j] = (CGKeyCode) SpecialKeyCodes[i+1]; + } +} + +void macosxCG_key_inject(int down, unsigned int keysym) { + static int control = 0, alt = 0; + int pressModsForKeys = FALSE; + + CGKeyCode keyCode = keyTable[(unsigned short)keysym]; + CGCharCode keyChar = 0; + UInt32 modsForKey = keyTableMods[keysym] << 8; + + init_key_table(); + + if (keysym < 0xFF) { + keyChar = (CGCharCode) keysym; + } + if (keyCode == 0xFFFF) { + return; + } + macosxCGP_undim(); + CGPostKeyboardEvent(keyChar, keyCode, down); +} + +#endif /* __APPLE__ */ + + diff --git a/x11vnc/macosxCG.h b/x11vnc/macosxCG.h new file mode 100644 index 0000000..4fe9c2a --- /dev/null +++ b/x11vnc/macosxCG.h @@ -0,0 +1,23 @@ +#ifndef _X11VNC_MACOSXCG_H +#define _X11VNC_MACOSXCG_H + +/* -- macosxCG.h -- */ + +extern void macosxCG_init(void); +extern void macosxCG_event_loop(void); +extern char *macosxCG_get_fb_addr(void); + +extern int macosxCG_CGDisplayPixelsWide(void); +extern int macosxCG_CGDisplayPixelsHigh(void); +extern int macosxCG_CGDisplayBitsPerPixel(void); +extern int macosxCG_CGDisplayBitsPerSample(void); +extern int macosxCG_CGDisplaySamplesPerPixel(void); + +extern void macosxCG_pointer_inject(int mask, int x, int y); +extern int macosxCG_get_cursor_pos(int *x, int *y); +extern int macosxCG_get_cursor(void); +extern void macosxCG_init_key_table(void); +extern void macosxCG_key_inject(int down, unsigned int keysym); + + +#endif /* _X11VNC_MACOSXCG_H */ diff --git a/x11vnc/macosxCGP.c b/x11vnc/macosxCGP.c new file mode 100644 index 0000000..0366f81 --- /dev/null +++ b/x11vnc/macosxCGP.c @@ -0,0 +1,186 @@ +/* -- macosxCGP.c -- */ + +#if (defined(__MACH__) && defined(__APPLE__)) + +#include +#include +#include + +int macosxCGP_save_dim(void); +int macosxCGP_restore_dim(void); +int macosxCGP_save_sleep(void); +int macosxCGP_restore_sleep(void); +int macosxCGP_init_dimming(void); +int macosxCGP_undim(void); +int macosxCGP_dim_shutdown(void); +void macosxCGP_screensaver_timer_off(void); +void macosxCGP_screensaver_timer_on(void); + +#include +#include + +extern CGDirectDisplayID displayID; + +static unsigned long dim_time; +static unsigned long sleep_time; +static int dim_time_saved = 0; +static int sleep_time_saved = 0; +static int initialized = 0; +static mach_port_t master_dev_port; +static io_connect_t power_mgt; + +extern int client_count; +extern int macosx_nodimming; +extern int macosx_nosleep; +extern int macosx_noscreensaver; + +static EventLoopTimerUPP sstimerUPP; +static EventLoopTimerRef sstimer; + +void macosxCG_screensaver_timer(EventLoopTimerRef timer, void *data) { + if (0) fprintf(stderr, "macosxCG_screensaver_timer: %d\n", time(0)); + if (macosx_nosleep && client_count) { + if (0) fprintf(stderr, "UpdateSystemActivity: %d\n", time(0)); + UpdateSystemActivity(IdleActivity); + } +} + +void macosxCGP_screensaver_timer_off(void) { + if (0) fprintf(stderr, "macosxCGP_screensaver_timer_off: %d\n", time(0)); + RemoveEventLoopTimer(sstimer); + DisposeEventLoopTimerUPP(sstimerUPP); +} + +void macosxCGP_screensaver_timer_on(void) { + if (0) fprintf(stderr, "macosxCGP_screensaver_timer_on: %d\n", time(0)); + sstimerUPP = NewEventLoopTimerUPP(macosxCG_screensaver_timer); + InstallEventLoopTimer(GetMainEventLoop(), kEventDurationSecond * 30, + kEventDurationSecond * 30, sstimerUPP, NULL, &sstimer); +} + +int macosxCGP_save_dim(void) { + if (IOPMGetAggressiveness(power_mgt, kPMMinutesToDim, + &dim_time) != kIOReturnSuccess) { + return 0; + } + dim_time_saved = 1; + return 1; +} + +int macosxCGP_restore_dim(void) { + if (! dim_time_saved) { + return 0; + } + if (IOPMSetAggressiveness(power_mgt, kPMMinutesToDim, + dim_time) != kIOReturnSuccess) { + return 0; + } + dim_time_saved = 0; + dim_time = 0; + return 1; +} + +int macosxCGP_save_sleep(void) { + if (IOPMGetAggressiveness(power_mgt, kPMMinutesToSleep, + &sleep_time) != kIOReturnSuccess) { + return 0; + } + sleep_time_saved = 1; + return 1; +} + +int macosxCGP_restore_sleep(void) { + if (! sleep_time_saved) { + return 0; + } + if (IOPMSetAggressiveness(power_mgt, kPMMinutesToSleep, + dim_time) != kIOReturnSuccess) { + return 0; + } + sleep_time_saved = 0; + sleep_time = 0; + return 1; +} + +int macosxCGP_init_dimming(void) { + if (IOMasterPort(bootstrap_port, &master_dev_port) != + kIOReturnSuccess) { + return 0; + } + if (!(power_mgt = IOPMFindPowerManagement(master_dev_port))) { + return 0; + } + if (macosx_nodimming) { + if (! macosxCGP_save_dim()) { + return 0; + } + if (IOPMSetAggressiveness(power_mgt, kPMMinutesToDim, 0) + != kIOReturnSuccess) { + return 0; + } + } + if (macosx_nosleep) { + if (! macosxCGP_save_sleep()) { + return 0; + } + if (IOPMSetAggressiveness(power_mgt, kPMMinutesToSleep, 0) + != kIOReturnSuccess) { + return 0; + } + } + + initialized = 1; + return 1; +} + +int macosxCGP_undim(void) { + if (! initialized) { + return 0; + } + if (! macosx_nodimming) { + if (! macosxCGP_save_dim()) { + return 0; + } + if (IOPMSetAggressiveness(power_mgt, kPMMinutesToDim, 0) + != kIOReturnSuccess) { + return 0; + } + if (! macosxCGP_restore_dim()) { + return 0; + } + } + if (! macosx_nosleep) { + if (! macosxCGP_save_sleep()) { + return 0; + } + if (IOPMSetAggressiveness(power_mgt, kPMMinutesToSleep, 0) + != kIOReturnSuccess) { + return 0; + } + if (! macosxCGP_restore_sleep()) { + return 0; + } + } + return 1; +} + +int macosxCGP_dim_shutdown(void) { + if (! initialized) { + return 0; + } + if (dim_time_saved) { + if (! macosxCGP_restore_dim()) { + return 0; + } + } + if (sleep_time_saved) { + if (! macosxCGP_restore_sleep()) { + return 0; + } + } + return 1; +} + +#endif /* __APPLE__ */ + + diff --git a/x11vnc/macosxCGP.h b/x11vnc/macosxCGP.h new file mode 100644 index 0000000..c857c2f --- /dev/null +++ b/x11vnc/macosxCGP.h @@ -0,0 +1,17 @@ +#ifndef _X11VNC_MACOSXCGP_H +#define _X11VNC_MACOSXCGP_H + +/* -- macosxCGP.h -- */ + +extern int macosxCGP_save_dim(void); +extern int macosxCGP_restore_dim(void); +extern int macosxCGP_save_sleep(void); +extern int macosxCGP_restore_sleep(void); +extern int macosxCGP_init_dimming(void); +extern int macosxCGP_undim(void); +extern int macosxCGP_dim_shutdown(void); +extern void macosxCGP_screensaver_timer_off(void); +extern void macosxCGP_screensaver_timer_on(void); + + +#endif /* _X11VNC_MACOSXCGP_H */ diff --git a/x11vnc/macosxCGS.c b/x11vnc/macosxCGS.c new file mode 100644 index 0000000..77c1ff7 --- /dev/null +++ b/x11vnc/macosxCGS.c @@ -0,0 +1,156 @@ +/* -- macosxCGS.c -- */ + +/* + * We need to keep this separate from nearly everything else, e.g. rfb.h + * and the other stuff, otherwise it does not work properly, mouse drags + * will not work!! + */ + +#if (defined(__MACH__) && defined(__APPLE__)) + +#include +#include +#include + +extern CGDirectDisplayID displayID; + +void macosxCGS_get_all_windows(void); + +typedef CGError CGSError; +typedef long CGSWindowCount; +typedef void * CGSConnectionID; +typedef int CGSWindowID; +typedef CGSWindowID* CGSWindowIDList; +typedef CGWindowLevel CGSWindowLevel; +typedef NSRect CGSRect; + +extern CGSConnectionID _CGSDefaultConnection (); + +extern CGSError CGSGetOnScreenWindowList (CGSConnectionID cid, + CGSConnectionID owner, CGSWindowCount listCapacity, + CGSWindowIDList list, CGSWindowCount *listCount); + +extern CGSError CGSGetScreenRectForWindow (CGSConnectionID cid, + CGSWindowID wid, CGSRect *rect); + +extern CGWindowLevel CGSGetWindowLevel (CGSConnectionID cid, + CGSWindowID wid, CGSWindowLevel *level); + +typedef enum _CGSWindowOrderingMode { + kCGSOrderAbove = 1, // Window is ordered above target. + kCGSOrderBelow = -1, // Window is ordered below target. + kCGSOrderOut = 0 // Window is removed from the on-screen window list. +} CGSWindowOrderingMode; + +extern OSStatus CGSOrderWindow(const CGSConnectionID cid, + const CGSWindowID wid, CGSWindowOrderingMode place, CGSWindowID relativeToWindowID); + +static CGSConnectionID cid = NULL; + +int macwinmax = 0; +typedef struct windat { + int win; + int x, y; + int width, height; + int level; +} windat_t; + +#define MAXWINDAT 2048 +windat_t macwins[MAXWINDAT]; +static CGSWindowID _wins[MAXWINDAT]; + +extern double dnow(void); + +extern int dpy_x, dpy_y; + + +int CGS_levelmax; +int CGS_levels[16]; + +void macosxCGS_get_all_windows(void) { + static double last = 0.0; + static int first = 1; + double dt = 0.0, now = dnow(); + int i, db = 0; + CGSWindowCount cap = (CGSWindowCount) MAXWINDAT; + CGSWindowCount cnt = 0; + CGSError err; + + if (first) { + first = 0; + CGS_levelmax = 0; + CGS_levels[CGS_levelmax++] = (int) kCGDraggingWindowLevel; /* 500 */ + if (0) CGS_levels[CGS_levelmax++] = (int) kCGHelpWindowLevel; /* 102 */ + if (0) CGS_levels[CGS_levelmax++] = (int) kCGPopUpMenuWindowLevel; /* 101 */ + CGS_levels[CGS_levelmax++] = (int) kCGMainMenuWindowLevelKey; /* 24 */ + CGS_levels[CGS_levelmax++] = (int) kCGFloatingWindowLevel; /* 3 */ + CGS_levels[CGS_levelmax++] = (int) kCGNormalWindowLevel; /* 0 */ + } + + if (cid == NULL) { + cid = _CGSDefaultConnection(); + if (cid == NULL) { + return; + } + } + + if (dt > 0.0 && now < last + dt) { + return; + } + + err = CGSGetOnScreenWindowList(cid, NULL, cap, _wins, &cnt); + +if (db) fprintf(stderr, "cnt: %d err: %d\n", cnt, err); + + if (err != 0) { + return; + } + + last = now; + + macwinmax = 0; + + for (i=0; i < (int) cnt; i++) { + CGSRect rect; + CGSWindowLevel level; + int j, keepit = 0; + err = CGSGetScreenRectForWindow(cid, _wins[i], &rect); + if (err != 0) { + continue; + } + if (rect.origin.x == 0 && rect.origin.y == 0) { + if (rect.size.width == dpy_x) { + if (rect.size.height == dpy_y) { + continue; + } + } + } + err = CGSGetWindowLevel(cid, _wins[i], &level); + if (err != 0) { + continue; + } + for (j=0; jhost); /* ignore xrandr */ - RAWFB_RET_VOID - fb = XGetImage_wr(dpy, window, 0, 0, dpy_x, dpy_y, AllPlanes, ZPixmap); + + if (raw_fb && ! dpy) { + XImage raw; + fb = &raw; + fb->data = (char *)malloc(32); + } else { + fb = XGetImage_wr(dpy, window, 0, 0, dpy_x, dpy_y, AllPlanes, ZPixmap); + } main_fb = fb->data; rfb_fb = main_fb; screen->frameBuffer = rfb_fb; @@ -809,6 +818,7 @@ XImage *initialize_raw_fb(int reset) { static XImage ximage_struct; /* n.b.: not (XImage *) */ static XImage ximage_struct_snap; int closedpy = 1, i, m, db = 0; + int do_macosx = 0; static char *last_file = NULL; static int last_mode = 0; @@ -855,6 +865,12 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n"); } return NULL; } + +#ifdef MACOSX + if (raw_fb_addr != NULL && raw_fb_addr == macosx_get_fb_addr()) { + raw_fb_addr = NULL; + } +#endif if (raw_fb_addr || raw_fb_seek) { if (raw_fb_shm) { @@ -1129,6 +1145,13 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n"); q = strchr(str, ':'); q++; + if (strstr(q, "macosx:") == q) { + /* mmap:macosx:/dev/null@... */ + q += strlen("macosx:"); + do_macosx = 1; + do_mmap = 0; + } + last_file = strdup(q); fd = raw_fb_fd; @@ -1159,7 +1182,15 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n"); } } - if (do_mmap) { + if (do_macosx) { + raw_fb_addr = macosx_get_fb_addr(); + raw_fb_mmap = size; + rfbLog("rawfb: macosx fb: %s\n", q); + rfbLog(" w: %d h: %d b: %d addr: %p sz: %d\n", w, h, + b, raw_fb_addr, size); + last_mode = 0; + + } else if (do_mmap) { #if LIBVNCSERVER_HAVE_MMAP raw_fb_addr = mmap(0, size, PROT_READ, MAP_SHARED, fd, 0); @@ -1211,6 +1242,12 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n"); raw_fb_image->bytes_per_line = dpy_x*b/8; raw_fb_image->bitmap_unit = -1; +#ifdef MACOSX + if (do_macosx) { + raw_fb_image->bytes_per_line = macosxCG_CGDisplayBytesPerRow(); + } +#endif + if (use_snapfb && (raw_fb_seek || raw_fb_mmap)) { int b_use = b; if (snap_fb) { @@ -1556,7 +1593,7 @@ if (0) fprintf(stderr, "DefaultDepth: %d visial_id: %d\n", depth, (int) visual_ vinfo->bits_per_rgb); fprintf(stderr, "\n"); } - XFree(vinfo); + XFree_wr(vinfo); } if (! quiet) { diff --git a/x11vnc/selection.c b/x11vnc/selection.c index d4146e9..0d183dc 100644 --- a/x11vnc/selection.c +++ b/x11vnc/selection.c @@ -205,13 +205,13 @@ void cutbuffer_send(void) { /* too big */ rfbLog("warning: truncating large CUT_BUFFER0" " selection > %d bytes.\n", PROP_MAX); - XFree(data); + XFree_wr(data); break; } memcpy(cutbuffer_str+slen, data, dlen); slen += dlen; cutbuffer_str[slen] = '\0'; - XFree(data); + XFree_wr(data); } } while (bytes_after > 0); @@ -309,7 +309,7 @@ void selection_send(XEvent *ev) { if (slen + dlen > PROP_MAX) { /* too big */ toobig = 1; - XFree(data); + XFree_wr(data); if (err) { /* cut down on messages */ break; } else { @@ -324,7 +324,7 @@ if (debug_sel) fprintf(stderr, "selection_send: data: '%s' dlen: %d nitems: %lu memcpy(selection_str+slen, data, dlen); slen += dlen; selection_str[slen] = '\0'; - XFree(data); + XFree_wr(data); } } while (bytes_after > 0); diff --git a/x11vnc/tkx11vnc b/x11vnc/tkx11vnc index 40559f2..d81bb37 100755 --- a/x11vnc/tkx11vnc +++ b/x11vnc/tkx11vnc @@ -3607,11 +3607,14 @@ proc toggle_simple_gui {} { proc little_qs {m} { global bfont ffont beginner_mode global helpremote helptext helplabel - global tk_version + global tk_version osname if {$tk_version < 8.0} { return } + if {$osname == "Darwin"} { + return + } set n [$m index end] @@ -3856,6 +3859,7 @@ proc make_menu_items {} { } # Now make the little "(?)" help buttons + global osname foreach case [array names menu_m] { if {$case == "Help"} { continue; @@ -5224,7 +5228,12 @@ proc make_widgets {top} { } incr ul } - menubutton $menub -text "$case" -underline $ul \ + global osname + set tstr "$case" + if {$osname == "Darwin"} { + #set tstr " $case " + } + menubutton $menub -text "$tstr" -underline $ul \ -anchor w -menu $menu -background $fbg \ -font $bfont pack $menub -side top -fill x @@ -5296,30 +5305,42 @@ proc make_widgets {top} { bind $ef_entry {set entry_set 1} bind $ef_entry {set entry_set 0} + set ok_s "OK" + set cancel_s "Cancel" + set help_s "Help" + set browse_s "Browse..." + global osname + if {$osname == "Darwin"} { + set ok_s " OK " + set cancel_s " Cancel " + set help_s " Help " + set browse_s " Browse... " + } + # Entry OK button set bpx "1m" set bpy "1" set hlt "0" set ef_ok "$ef.ok" - button $ef_ok -text OK -pady $bpy -padx $bpx -command {set entry_set 1} \ + button $ef_ok -text $ok_s -pady $bpy -padx $bpx -command {set entry_set 1} \ -highlightthickness $hlt \ -font $bfont # Entry Skip button set ef_skip "$ef.skip" - button $ef_skip -text Cancel -pady $bpy -padx $bpx -command {set entry_set 0} \ + button $ef_skip -text $cancel_s -pady $bpy -padx $bpx -command {set entry_set 0} \ -highlightthickness $hlt \ -font $bfont # Entry Help button set ef_help "$ef.help" - button $ef_help -text Help -pady $bpy -padx $bpx -command \ + button $ef_help -text $help_s -pady $bpy -padx $bpx -command \ {menu_help $entry_dialog_item} -font $bfont \ -highlightthickness $hlt # Entry Browse button set ef_browse "$ef.browse" - button $ef_browse -text "Browse..." -pady $bpy -padx $bpx -font $bfont \ + button $ef_browse -text $browse_s -pady $bpy -padx $bpx -font $bfont \ -highlightthickness $hlt \ -command {entry_insert [tk_getOpenFile]} @@ -6453,6 +6474,10 @@ if {[regexp -nocase {IRIX} $osname]} { # IRIX "fixed" font is huge and doublespaced... set ffont $snfont } +if {[regexp -nocase {Darwin} $osname]} { + set ffont {Monaco 10} + set bfont {system} +} #puts [exec env] #puts "x11vnc_xdisplay: $x11vnc_xdisplay" diff --git a/x11vnc/tkx11vnc.h b/x11vnc/tkx11vnc.h index 37e54ce..3bf4e03 100644 --- a/x11vnc/tkx11vnc.h +++ b/x11vnc/tkx11vnc.h @@ -3618,11 +3618,14 @@ char gui_code[] = ""; "proc little_qs {m} {\n" " global bfont ffont beginner_mode\n" " global helpremote helptext helplabel\n" -" global tk_version\n" +" global tk_version osname\n" "\n" " if {$tk_version < 8.0} {\n" " return\n" " }\n" +" if {$osname == \"Darwin\"} {\n" +" return\n" +" }\n" "\n" " set n [$m index end]\n" "\n" @@ -3867,6 +3870,7 @@ char gui_code[] = ""; " }\n" "\n" " # Now make the little \"(?)\" help buttons\n" +" global osname\n" " foreach case [array names menu_m] {\n" " if {$case == \"Help\"} {\n" " continue;\n" @@ -5235,7 +5239,12 @@ char gui_code[] = ""; " }\n" " incr ul\n" " }\n" -" menubutton $menub -text \"$case\" -underline $ul \\\n" +" global osname\n" +" set tstr \"$case\"\n" +" if {$osname == \"Darwin\"} {\n" +" #set tstr \" $case \"\n" +" }\n" +" menubutton $menub -text \"$tstr\" -underline $ul \\\n" " -anchor w -menu $menu -background $fbg \\\n" " -font $bfont\n" " pack $menub -side top -fill x\n" @@ -5307,30 +5316,42 @@ char gui_code[] = ""; " bind $ef_entry {set entry_set 1}\n" " bind $ef_entry {set entry_set 0}\n" "\n" +" set ok_s \"OK\"\n" +" set cancel_s \"Cancel\"\n" +" set help_s \"Help\"\n" +" set browse_s \"Browse...\"\n" +" global osname\n" +" if {$osname == \"Darwin\"} {\n" +" set ok_s \" OK \"\n" +" set cancel_s \" Cancel \"\n" +" set help_s \" Help \"\n" +" set browse_s \" Browse... \"\n" +" }\n" +"\n" " # Entry OK button\n" " set bpx \"1m\"\n" " set bpy \"1\"\n" " set hlt \"0\"\n" " set ef_ok \"$ef.ok\"\n" -" button $ef_ok -text OK -pady $bpy -padx $bpx -command {set entry_set 1} \\\n" +" button $ef_ok -text $ok_s -pady $bpy -padx $bpx -command {set entry_set 1} \\\n" " -highlightthickness $hlt \\\n" " -font $bfont\n" "\n" " # Entry Skip button\n" " set ef_skip \"$ef.skip\"\n" -" button $ef_skip -text Cancel -pady $bpy -padx $bpx -command {set entry_set 0} \\\n" +" button $ef_skip -text $cancel_s -pady $bpy -padx $bpx -command {set entry_set 0} \\\n" " -highlightthickness $hlt \\\n" " -font $bfont\n" "\n" " # Entry Help button\n" " set ef_help \"$ef.help\"\n" -" button $ef_help -text Help -pady $bpy -padx $bpx -command \\\n" +" button $ef_help -text $help_s -pady $bpy -padx $bpx -command \\\n" " {menu_help $entry_dialog_item} -font $bfont \\\n" " -highlightthickness $hlt\n" "\n" " # Entry Browse button\n" " set ef_browse \"$ef.browse\"\n" -" button $ef_browse -text \"Browse...\" -pady $bpy -padx $bpx -font $bfont \\\n" +" button $ef_browse -text $browse_s -pady $bpy -padx $bpx -font $bfont \\\n" " -highlightthickness $hlt \\\n" " -command {entry_insert [tk_getOpenFile]} \n" "\n" @@ -6464,6 +6485,10 @@ char gui_code[] = ""; " # IRIX \"fixed\" font is huge and doublespaced... \n" " set ffont $snfont\n" "}\n" +"if {[regexp -nocase {Darwin} $osname]} {\n" +" set ffont {Monaco 10}\n" +" set bfont {system}\n" +"}\n" "\n" "#puts [exec env]\n" "#puts \"x11vnc_xdisplay: $x11vnc_xdisplay\"\n" diff --git a/x11vnc/userinput.c b/x11vnc/userinput.c index a0edb9a..ad7f67b 100644 --- a/x11vnc/userinput.c +++ b/x11vnc/userinput.c @@ -96,12 +96,19 @@ int get_wm_frame_pos(int *px, int *py, int *x, int *y, int *w, int *h, int rootx, rooty, wx, wy; unsigned int mask; +#ifdef MACOSX + if (! dpy) { + return macosx_get_wm_frame_pos(px, py, x, y, w, h, frame, win); + } +#endif + RAWFB_RET(0) #if NO_X11 return 0; #else - ret = XQueryPointer(dpy, rootwin, &r, &c, &rootx, &rooty, &wx, &wy, + + ret = XQueryPointer_wr(dpy, rootwin, &r, &c, &rootx, &rooty, &wx, &wy, &mask); *frame = c; @@ -2876,6 +2883,7 @@ static int try_copyrect(Window frame, int x, int y, int w, int h, int dx, int dy x -= off_x; y -= off_y; } +if (db2) fprintf(stderr, "try_copyrect: 0x%lx bad: %d stack_list_num: %d\n", frame, dt_bad, stack_list_num); if (dt_bad && wireframe_in_progress) { sraRegionPtr rect; @@ -2941,6 +2949,7 @@ if (db2) fprintf(stderr, "moved_win: %4d %3d, %4d %3d 0x%lx ---\n", } swin = stack_list[k].win; +if (db2) fprintf(stderr, "sw: %d/%lx\n", k, swin); if (swin == frame) { if (db2) { saw_me = 1; fprintf(stderr, " ----------\n"); @@ -2953,11 +2962,16 @@ fprintf(stderr, "bo: %d/%lx\n", k, swin); #endif /* skip some unwanted cases: */ +#ifdef MACOSX + if (0) { + ; +#else if (swin == None) { continue; } if (swin < 10) { ; /* blackouts */ +#endif } else if (! stack_list[k].fetched || stack_list[k].time > tm + 2.0) { if (!valid_window(swin, &attr, 1)) { @@ -3349,7 +3363,9 @@ int check_wireframe(void) { int try_it = 0; DB_SET +#ifndef MACOSX RAWFB_RET(0) +#endif if (unixpw_in_progress) return 0; @@ -3359,12 +3375,14 @@ int check_wireframe(void) { if (subwin) { return 0; /* don't even bother for -id case */ } +if (db > 1 && button_mask) fprintf(stderr, "check_wireframe: bm: %d gpi: %d\n", button_mask, got_pointer_input); if (! button_mask) { return 0; /* no button pressed down */ } if (!use_threads && !got_pointer_input) { return 0; /* need ptr input, e.g. button down, motion */ } +if (db > 1) fprintf(stderr, "check_wireframe: %d\n", db); if (db) fprintf(stderr, "\n*** button down!! x: %d y: %d\n", cursor_x, cursor_y); @@ -3375,12 +3393,12 @@ if (db) fprintf(stderr, "\n*** button down!! x: %d y: %d\n", cursor_x, cursor_ */ X_LOCK; if (! get_wm_frame_pos(&px, &py, &x, &y, &w, &h, &frame, NULL)) { -if (db) fprintf(stderr, "NO get_wm_frame_pos: 0x%lx\n", frame); +if (db) fprintf(stderr, "NO get_wm_frame_pos-1: 0x%lx\n", frame); X_UNLOCK; return 0; } X_UNLOCK; -if (db) fprintf(stderr, "a: %d wf: %.3f A: %d\n", w*h, wireframe_frac, (dpy_x*dpy_y)); +if (db) fprintf(stderr, "a: %d wf: %.3f A: %d frm: 0x%lx\n", w*h, wireframe_frac, (dpy_x*dpy_y), frame); /* * apply the percentage size criterion (allow opaque moves for @@ -3390,7 +3408,7 @@ if (db) fprintf(stderr, "a: %d wf: %.3f A: %d\n", w*h, wireframe_frac, (dpy_x* if (db) fprintf(stderr, "small window %.3f\n", ((double) w*h)/(dpy_x * dpy_y)); return 0; } -if (db) fprintf(stderr, " frame: x: %d y: %d w: %d h: %d px: %d py: %d fr: 0x%lx\n", x, y, w, h, px, py, orig_frame); +if (db) fprintf(stderr, " frame: x: %d y: %d w: %d h: %d px: %d py: %d fr: 0x%lx\n", x, y, w, h, px, py, frame); /* * see if the pointer is within range of the assumed wm frame @@ -3590,7 +3608,7 @@ if (db) fprintf(stderr, " ++pointer event!! [%02d] dt: %.3f x: %d y: %d mas if (! get_wm_frame_pos(&px, &py, &x, &y, &w, &h, &frame, NULL)) { frame = 0x0; -if (db) fprintf(stderr, "NO get_wm_frame_pos: 0x%lx\n", frame); +if (db) fprintf(stderr, "NO get_wm_frame_pos-2: 0x%lx\n", frame); } if (frame != orig_frame) { @@ -3754,7 +3772,7 @@ if (db || db2) fprintf(stderr, "NO button_mask\n"); sent_copyrect = try_copyrect(frame, x, y, w, h, dx, dy, &obscured, NULL, 0.15); -if (db) fprintf(stderr, "send_copyrect: %d\n", sent_copyrect); +if (db) fprintf(stderr, "sent_copyrect: %d - obs: %d frame: 0x%lx\n", sent_copyrect, obscured, frame); if (sent_copyrect) { /* try to push the changes to viewers: */ if (! obscured) { @@ -4361,7 +4379,9 @@ static void check_user_input4(double dt, double dtr, int tile_diffs) { int check_user_input(double dt, double dtr, int tile_diffs, int *cnt) { +#ifndef MACOSX RAWFB_RET(0) +#endif if (use_xrecord) { int rc = check_xrecord(); diff --git a/x11vnc/win_utils.c b/x11vnc/win_utils.c index eb147a8..aab05e7 100644 --- a/x11vnc/win_utils.c +++ b/x11vnc/win_utils.c @@ -43,7 +43,7 @@ Window parent_window(Window win, char **name) { old_handler = XSetErrorHandler(trap_xerror); trapped_xerror = 0; - rc = XQueryTree(dpy, win, &r, &parent, &list, &nchild); + rc = XQueryTree_wr(dpy, win, &r, &parent, &list, &nchild); XSetErrorHandler(old_handler); if (! rc || trapped_xerror) { @@ -53,7 +53,7 @@ Window parent_window(Window win, char **name) { trapped_xerror = 0; if (list) { - XFree(list); + XFree_wr(list); } if (parent && name) { XFetchName(dpy, parent, name); @@ -77,6 +77,11 @@ int valid_window(Window win, XWindowAttributes *attr_ret, int bequiet) { if (win == None) { return 0; } +#ifdef MACOSX + if (! dpy) { + return macosx_valid_window(win, attr_ret); + } +#endif RAWFB_RET(0) #if NO_X11 nox11_exit(1); @@ -179,14 +184,16 @@ void snapshot_stack_list(int free_only, double allowed_age) { stack_list_num = 0; last_free = now; +#ifndef MACOSX RAWFB_RET_VOID -#if NO_X11 +#endif +#if NO_X11 && !defined(MACOSX) return; #else X_LOCK; /* no need to trap error since rootwin */ - rc = XQueryTree(dpy, rootwin, &r, &w, &list, &ui); + rc = XQueryTree_wr(dpy, rootwin, &r, &w, &list, &ui); num = (int) ui; if (! rc) { @@ -213,6 +220,12 @@ void snapshot_stack_list(int free_only, double allowed_age) { j++; } for (i=0; ires_class) { - XFree(classhint->res_class); + XFree_wr(classhint->res_class); } if (classhint->res_name) { - XFree(classhint->res_name); + XFree_wr(classhint->res_name); } } } - if (! XQueryPointer(dpy, c, &r, &c, &rx, &ry, &wx, &wy, &m)) { + if (! XQueryPointer_wr(dpy, c, &r, &c, &rx, &ry, &wx, &wy, &m)) { break; } if (! c) { diff --git a/x11vnc/x11vnc.1 b/x11vnc/x11vnc.1 index 115276a..4d53ddd 100644 --- a/x11vnc/x11vnc.1 +++ b/x11vnc/x11vnc.1 @@ -2,7 +2,7 @@ .TH X11VNC "1" "November 2006" "x11vnc " "User Commands" .SH NAME x11vnc - allow VNC connections to real X11 displays - version: 0.8.3, lastmod: 2006-11-06 + version: 0.8.4, lastmod: 2006-11-13 .SH SYNOPSIS .B x11vnc [OPTION]... @@ -3331,6 +3331,18 @@ Example: You can also set the env. var X11VNC_UINPUT_DEBUG=1 or higher to get debugging output for UINPUT mode. .PP +\fB-macnodim\fR +.IP +For the native Mac OS X server, disable dimming. +.PP +\fB-macnosleep\fR +.IP +For the native Mac OS X server, disable display sleep. +.PP +\fB-macnosaver\fR +.IP +For the native Mac OS X server, disable screensaver. +.PP \fB-gui\fR \fI[gui-opts]\fR .IP Start up a simple tcl/tk gui based on the the remote @@ -3892,6 +3904,10 @@ desktop:str set \fB-desktop\fR name to str for new clients. .IP rfbport:n set \fB-rfbport\fR to n. .IP +macnosaver enable \fB-macnosaver\fR mode. +.IP +macsaver disable \fB-macnosaver\fR mode. +.IP httpport:n set \fB-httpport\fR to n. .IP httpdir:dir set \fB-httpdir\fR to dir (and enable http). @@ -4046,7 +4062,7 @@ debug_xdamage debug_wireframe nodebug_wireframe debug_wireframe debug_scroll nodebug_scroll debug_scroll debug_tiles dbt nodebug_tiles nodbt debug_tiles debug_grabs nodebug_grabs debug_sel nodebug_sel dbg -nodbg noremote +nodbg macnosaver macsaver noremote .IP aro= noop display vncdisplay desktopname guess_desktop http_url auth xauth users rootshift clipshift diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c index 7e897c0..8226856 100644 --- a/x11vnc/x11vnc.c +++ b/x11vnc/x11vnc.c @@ -530,6 +530,7 @@ static void watch_loop(void) { eat_viewonly_input(10, 3); } } else { + /* -threads here. */ if (wireframe && button_mask) { check_wireframe(); } @@ -1440,6 +1441,8 @@ static void store_homedir_passwd(char *file) { && !query_cmd && !remote_cmd && !unixpw && !got_gui_pw \ && ! ssl_verify && !inetd) +extern int dragum(void); + int main(int argc, char* argv[]) { int i, len, tmpi; @@ -1463,6 +1466,9 @@ int main(int argc, char* argv[]) { int argc_vnc_max = 1024; int argc_vnc = 1; char *argv_vnc[2048]; +//dragum(); + + /* check for -loop mode: */ check_loop_mode(argc, argv); @@ -2280,6 +2286,12 @@ int main(int argc, char* argv[]) { } else if (!strcmp(arg, "-pipeinput")) { CHECK_ARGC pipeinput_str = strdup(argv[++i]); + } else if (!strcmp(arg, "-macnodim")) { + macosx_nodimming = 1; + } else if (!strcmp(arg, "-macnosleep")) { + macosx_nosleep = 1; + } else if (!strcmp(arg, "-macnosaver")) { + macosx_noscreensaver = 1; } else if (!strcmp(arg, "-gui")) { launch_gui = 1; if (i < argc-1) { @@ -2434,8 +2446,23 @@ int main(int argc, char* argv[]) { if (launch_gui) { int sleep = 0; if (SHOW_NO_PASSWORD_WARNING && !nopw) { - sleep = 2; + sleep = 1; + } +#ifdef MACOSX + if (! use_dpy && getenv("DISPLAY") == NULL) { + /* we need this for gui since no X properties */ + if (! client_connect_file && ! client_connect) { + int fd; + char tmp[] = "/tmp/x11vnc-macosx-channel.XXXXXX"; + fd = mkstemp(tmp); + if (fd >= 0) { + close(fd); + client_connect_file = strdup(tmp); + rfbLog("MacOS X: set -connect file to %s\n", client_connect_file); + } + } } +#endif do_gui(gui_str, sleep); } if (logfile) { @@ -2952,6 +2979,12 @@ int main(int argc, char* argv[]) { dpy = XOpenDisplay_wr(""); } +#ifdef MACOSX + if (! dpy && ! raw_fb_str) { + raw_fb_str = strdup("console"); + } +#endif + if (! dpy && raw_fb_str) { rfbLog("continuing without X display in -rawfb mode, " "hold on tight..\n"); @@ -3355,6 +3388,19 @@ int main(int argc, char* argv[]) { raw_fb_pass_go_and_collect_200_dollars: +#ifdef MACOSX + if (! dpy) { + if (! multiple_cursors_mode) { + multiple_cursors_mode = strdup("most"); + } + initialize_cursors_mode(); + if (use_xdamage) { + xdamage_present = 1; + initialize_xdamage(); + } + } +#endif + if (! dt) { static char str[] = "-desktop"; argv_vnc[argc_vnc++] = str; diff --git a/x11vnc/x11vnc.h b/x11vnc/x11vnc.h index f86dc12..482343f 100644 --- a/x11vnc/x11vnc.h +++ b/x11vnc/x11vnc.h @@ -47,7 +47,9 @@ #else #define NO_X11 1 +#ifndef SKIP_NO_X11 #include "nox11.h" +#endif #include #endif @@ -308,6 +310,10 @@ extern int h_errno; (defined(__MACH__) && defined(__APPLE__)) _AIX */ +#if (defined(__MACH__) && defined(__APPLE__)) +#define MACOSX +#endif + #ifdef IRIX_OVERLAY #include diff --git a/x11vnc/x11vnc_defs.c b/x11vnc/x11vnc_defs.c index 2de1c5f..7194eff 100644 --- a/x11vnc/x11vnc_defs.c +++ b/x11vnc/x11vnc_defs.c @@ -15,7 +15,7 @@ int xtrap_base_event_type = 0; int xdamage_base_event_type = 0; /* date +'lastmod: %Y-%m-%d' */ -char lastmod[] = "0.8.3 lastmod: 2006-11-06"; +char lastmod[] = "0.8.4 lastmod: 2006-11-13"; /* X display info */ diff --git a/x11vnc/xdamage.c b/x11vnc/xdamage.c index 655b496..7b8b9b2 100644 --- a/x11vnc/xdamage.c +++ b/x11vnc/xdamage.c @@ -13,7 +13,13 @@ Damage xdamage = 0; #endif int use_xdamage = XDAMAGE; /* use the xdamage rects for scanline hints */ int xdamage_present = 0; + +#ifdef MACOSX +int xdamage_max_area = 50000; +#else int xdamage_max_area = 20000; /* pixels */ +#endif + double xdamage_memory = 1.0; /* in units of NSCAN */ int xdamage_tile_count = 0, xdamage_direct_count = 0; double xdamage_scheduled_mark = 0.0; @@ -24,6 +30,7 @@ int XD_skip = 0, XD_tot = 0, XD_des = 0; /* for stats */ void add_region_xdamage(sraRegionPtr new_region); void clear_xdamage_mark_region(sraRegionPtr markregion, int flush); +int collect_macosx_damage(int x_in, int y_in, int w_in, int h_in, int call); int collect_xdamage(int scancnt, int call); int xdamage_hint_skip(int y); void initialize_xdamage(void); @@ -31,7 +38,6 @@ void create_xdamage_if_needed(void); void destroy_xdamage_if_needed(void); void check_xdamage_state(void); - static void record_desired_xdamage_rect(int x, int y, int w, int h); @@ -158,7 +164,7 @@ void add_region_xdamage(sraRegionPtr new_region) { reg = xdamage_regions[prev_tick]; if (reg != NULL) { -if (0) fprintf(stderr, "add_region_xdamage: prev_tick: %d reg %p\n", prev_tick, (void *)reg); +if (debug_xdamage > 1) fprintf(stderr, "add_region_xdamage: prev_tick: %d reg %p\n", prev_tick, (void *)reg); sraRgnOr(reg, new_region); } } @@ -211,6 +217,125 @@ void clear_xdamage_mark_region(sraRegionPtr markregion, int flush) { #endif } +int collect_macosx_damage(int x_in, int y_in, int w_in, int h_in, int call) { + sraRegionPtr tmpregion; + sraRegionPtr reg; + static int rect_count = 0; + int nreg, ccount = 0, dcount = 0, ecount = 0; + static time_t last_rpt = 0; + time_t now; + double tm, dt; + int x, y, w, h, x2, y2; + +if (call && debug_xdamage > 1) fprintf(stderr, "collect_macosx_damage: %d %d %d %d - %d / %d\n", x_in, y_in, w_in, h_in, call, use_xdamage); + + if (! use_xdamage) { + return 0; + } + + dtime0(&tm); + + nreg = (xdamage_memory * NSCAN) + 1; + + if (call == 0) { + xdamage_ticker = (xdamage_ticker+1) % nreg; + xdamage_direct_count = 0; + reg = xdamage_regions[xdamage_ticker]; + sraRgnMakeEmpty(reg); + } else { + reg = xdamage_regions[xdamage_ticker]; + } + + if (x_in < 0) { + return 0; + } + + + x = x_in; + y = y_in; + w = w_in; + h = h_in; + + /* translate if needed */ + if (clipshift) { + /* set coords relative to fb origin */ + if (0 && rootshift) { + /* + * Note: not needed because damage is + * relative to subwin, not rootwin. + */ + x = x - off_x; + y = y - off_y; + } + if (clipshift) { + x = x - coff_x; + y = y - coff_y; + } + + x2 = x + w; /* upper point */ + x = nfix(x, dpy_x); /* place both in fb area */ + x2 = nfix(x2, dpy_x+1); + w = x2 - x; /* recompute w */ + + y2 = y + h; + y = nfix(y, dpy_y); + y2 = nfix(y2, dpy_y+1); + h = y2 - y; + + if (w <= 0 || h <= 0) { + return 0; + } + } + if (debug_xdamage > 2) { + fprintf(stderr, "xdamage: -> event %dx%d+%d+%d area:" + " %d dups: %d %s\n", w, h, x, y, w*h, dcount, + (w*h > xdamage_max_area) ? "TOO_BIG" : ""); + } + + record_desired_xdamage_rect(x, y, w, h); + + tmpregion = sraRgnCreateRect(x, y, x + w, y + h); + sraRgnOr(reg, tmpregion); + sraRgnDestroy(tmpregion); + rect_count++; + ccount++; + + if (0 && xdamage_direct_count) { + fb_push(); + } + + dt = dtime(&tm); + if ((debug_tiles > 1 && ecount) || (debug_tiles && ecount > 200) + || debug_xdamage > 1) { + fprintf(stderr, "collect_macosx_damage(%d): %.4f t: %.4f ev/dup/accept" + "/direct %d/%d/%d/%d\n", call, dt, tm - x11vnc_start, ecount, + dcount, ccount, xdamage_direct_count); + } + now = time(NULL); + if (! last_rpt) { + last_rpt = now; + } + if (now > last_rpt + 15) { + double rat = -1.0; + + if (XD_tot) { + rat = ((double) XD_skip)/XD_tot; + } + if (debug_tiles || debug_xdamage) { + fprintf(stderr, "xdamage: == scanline skip/tot: " + "%04d/%04d =%.3f rects: %d desired: %d\n", + XD_skip, XD_tot, rat, rect_count, XD_des); + } + + XD_skip = 0; + XD_tot = 0; + XD_des = 0; + rect_count = 0; + last_rpt = now; + } + return 0; +} + int collect_xdamage(int scancnt, int call) { #if LIBVNCSERVER_HAVE_LIBXDAMAGE XDamageNotifyEvent *dev; @@ -436,6 +561,7 @@ int xdamage_hint_skip(int y) { } } sraRgnDestroy(tmpl); +if (0) fprintf(stderr, "xdamage_hint_skip: %d -> %d\n", y, ret); return ret; } diff --git a/x11vnc/xdamage.h b/x11vnc/xdamage.h index ce895a8..7fa6d60 100644 --- a/x11vnc/xdamage.h +++ b/x11vnc/xdamage.h @@ -19,6 +19,7 @@ extern int XD_skip, XD_tot, XD_des; extern void add_region_xdamage(sraRegionPtr new_region); extern void clear_xdamage_mark_region(sraRegionPtr markregion, int flush); +extern int collect_macosx_damage(int x_in, int y_in, int w_in, int h_in, int call); extern int collect_xdamage(int scancnt, int call); extern int xdamage_hint_skip(int y); extern void initialize_xdamage(void); diff --git a/x11vnc/xevents.c b/x11vnc/xevents.c index e3fc192..9dbdd27 100644 --- a/x11vnc/xevents.c +++ b/x11vnc/xevents.c @@ -190,13 +190,13 @@ static void get_prop(char *str, int len, Atom prop) { dlen = nitems * (format/8); if (slen + dlen > len) { /* too big */ - XFree(data); + XFree_wr(data); break; } memcpy(str+slen, data, dlen); slen += dlen; str[slen] = '\0'; - XFree(data); + XFree_wr(data); } } while (bytes_after > 0); #endif /* NO_X11 */ diff --git a/x11vnc/xinerama.c b/x11vnc/xinerama.c index 8582dab..9042cfd 100644 --- a/x11vnc/xinerama.c +++ b/x11vnc/xinerama.c @@ -272,7 +272,7 @@ static void initialize_xinerama (void) { rfbLog("Xinerama: no blackouts needed (only one" " sub-screen)\n"); } - XFree(xineramas); + XFree_wr(xineramas); return; /* must be OK w/o change */ } @@ -293,7 +293,7 @@ static void initialize_xinerama (void) { sraRgnDestroy(tmp_region); sc++; } - XFree(xineramas); + XFree_wr(xineramas); if (sraRgnEmpty(black_region)) { rfbLog("Xinerama: no blackouts needed (screen fills" diff --git a/x11vnc/xrandr.c b/x11vnc/xrandr.c index 0420718..0c860ca 100644 --- a/x11vnc/xrandr.c +++ b/x11vnc/xrandr.c @@ -22,7 +22,6 @@ void initialize_xrandr(void); int check_xrandr_event(char *msg); int known_xrandr_mode(char *s); - static int handle_subwin_resize(char *msg); static void handle_xrandr_change(int new_x, int new_y); diff --git a/x11vnc/xrecord.c b/x11vnc/xrecord.c index b7bcbe5..ababb37 100644 --- a/x11vnc/xrecord.c +++ b/x11vnc/xrecord.c @@ -156,9 +156,9 @@ void initialize_xrecord(void) { RAWFB_RET_VOID #if LIBVNCSERVER_HAVE_RECORD - if (rr_CA) XFree(rr_CA); - if (rr_CW) XFree(rr_CW); - if (rr_GS) XFree(rr_GS); + if (rr_CA) XFree_wr(rr_CA); + if (rr_CW) XFree_wr(rr_CW); + if (rr_GS) XFree_wr(rr_GS); rr_CA = XRecordAllocRange(); rr_CW = XRecordAllocRange(); @@ -236,9 +236,9 @@ void shutdown_xrecord(void) { xserver_grabbed, dnowx()); } - if (rr_CA) XFree(rr_CA); - if (rr_CW) XFree(rr_CW); - if (rr_GS) XFree(rr_GS); + if (rr_CA) XFree_wr(rr_CA); + if (rr_CW) XFree_wr(rr_CW); + if (rr_GS) XFree_wr(rr_GS); rr_CA = NULL; rr_CW = NULL; diff --git a/x11vnc/xwrappers.c b/x11vnc/xwrappers.c index 2849d3d..77f3016 100644 --- a/x11vnc/xwrappers.c +++ b/x11vnc/xwrappers.c @@ -75,6 +75,12 @@ int xauth_raw(int on); Display *XOpenDisplay_wr(char *display_name); int XCloseDisplay_wr(Display *display); +Bool XQueryPointer_wr(Display *display, Window w, Window *root_return, + Window *child_return, int *root_x_return, int *root_y_return, + int *win_x_return, int *win_y_return, unsigned int *mask_return); + +int XFree_wr(void *data); + void copy_raw_fb(XImage *dest, int x, int y, unsigned int w, unsigned int h); static void upup_downdown_warning(KeyCode key, Bool down); @@ -1057,6 +1063,59 @@ int XCloseDisplay_wr(Display *display) { #endif /* NO_X11 */ } +Bool XQueryPointer_wr(Display *display, Window w, Window *root_return, + Window *child_return, int *root_x_return, int *root_y_return, + int *win_x_return, int *win_y_return, unsigned int *mask_return) { + +#if NO_X11 + return False; +#else + if (! display) { + return False; + } + return XQueryPointer(display, w, root_return, child_return, + root_x_return, root_y_return, win_x_return, win_y_return, + mask_return); +#endif /* NO_X11 */ +} + + +Status XQueryTree_wr(Display *display, Window w, Window *root_return, + Window *parent_return, Window **children_return, + unsigned int *nchildren_return) { + +#ifdef MACOSX + if (! display) { + return macosx_xquerytree(w, root_return, parent_return, + children_return, nchildren_return); + } +#endif +#if NO_X11 + return (Status) 0; +#else + if (! display) { + return (Status) 0; + } + return XQueryTree(display, w, root_return, parent_return, + children_return, nchildren_return); +#endif /* NO_X11 */ + +} + +int XFree_wr(void *data) { + if (data == NULL) { + return 1; + } + if (! dpy) { + return 1; + } +#if NO_X11 + return 1; +#else + return XFree(data); +#endif +} + void nox11_exit(int rc) { #if NO_X11 rfbLog("This x11vnc was not built with X11 support.\n"); @@ -1066,6 +1125,7 @@ void nox11_exit(int rc) { #endif } + #if NO_X11 #include "nox11_funcs.h" #endif diff --git a/x11vnc/xwrappers.h b/x11vnc/xwrappers.h index 38bb72b..6ee2805 100644 --- a/x11vnc/xwrappers.h +++ b/x11vnc/xwrappers.h @@ -72,4 +72,11 @@ extern int xauth_raw(int on); extern Display *XOpenDisplay_wr(char *display_name); extern int XCloseDisplay_wr(Display *display); +extern Bool XQueryPointer_wr(Display *display, Window w, Window *root_return, + Window *child_return, int *root_x_return, int *root_y_return, + int *win_x_return, int *win_y_return, unsigned int *mask_return); + +extern int XFree_wr(void *data); + + #endif /* _X11VNC_XWRAPPERS_H */