diff options
author | runge <runge> | 2006-03-08 17:52:23 +0000 |
---|---|---|
committer | runge <runge> | 2006-03-08 17:52:23 +0000 |
commit | 5e72609631a1893acfe6a31d0129553ed3044a20 (patch) | |
tree | b75197718dc94f26c56cdfbb39d069c79f1cd767 /x11vnc | |
parent | c997e901c4c268438d063a78bdb121b8f5e8d585 (diff) | |
download | libtdevnc-5e72609631a1893acfe6a31d0129553ed3044a20.tar.gz libtdevnc-5e72609631a1893acfe6a31d0129553ed3044a20.zip |
x11vnc: do CLIPBOARD, reverse conn require passwds, -usepw, -debug_sel, -storepasswd homedir.
Diffstat (limited to 'x11vnc')
-rw-r--r-- | x11vnc/ChangeLog | 5 | ||||
-rw-r--r-- | x11vnc/README | 837 | ||||
-rw-r--r-- | x11vnc/connections.c | 6 | ||||
-rw-r--r-- | x11vnc/help.c | 85 | ||||
-rw-r--r-- | x11vnc/options.c | 2 | ||||
-rw-r--r-- | x11vnc/options.h | 2 | ||||
-rw-r--r-- | x11vnc/remote.c | 66 | ||||
-rw-r--r-- | x11vnc/screen.c | 9 | ||||
-rw-r--r-- | x11vnc/selection.c | 106 | ||||
-rw-r--r-- | x11vnc/selection.h | 11 | ||||
-rw-r--r-- | x11vnc/sslcmds.c | 8 | ||||
-rwxr-xr-x | x11vnc/tkx11vnc | 100 | ||||
-rw-r--r-- | x11vnc/tkx11vnc.h | 100 | ||||
-rw-r--r-- | x11vnc/unixpw.c | 6 | ||||
-rw-r--r-- | x11vnc/x11vnc.1 | 110 | ||||
-rw-r--r-- | x11vnc/x11vnc.c | 181 | ||||
-rw-r--r-- | x11vnc/x11vnc.h | 6 | ||||
-rw-r--r-- | x11vnc/x11vnc_defs.c | 2 | ||||
-rw-r--r-- | x11vnc/xevents.c | 188 | ||||
-rw-r--r-- | x11vnc/xevents.h | 1 |
20 files changed, 1304 insertions, 527 deletions
diff --git a/x11vnc/ChangeLog b/x11vnc/ChangeLog index cb34e28..182ea2b 100644 --- a/x11vnc/ChangeLog +++ b/x11vnc/ChangeLog @@ -1,3 +1,8 @@ +2006-03-08 Karl Runge <[email protected]> + * x11vnc: manage CLIPBOARD in addition to PRIMARY. -debug_sel + Make reverse connections require passwords. -usepw option. + -storepasswd w/o args prompts and writes ~/.vnc/passwd. + 2006-03-06 Karl Runge <[email protected]> * x11vnc: switch remote control to X11VNC_REMOTE property. Put in -unixpw constraints for reverse connections under -inetd. diff --git a/x11vnc/README b/x11vnc/README index ba8b723..779d129 100644 --- a/x11vnc/README +++ b/x11vnc/README @@ -1,5 +1,5 @@ -x11vnc README file Date: Mon Mar 6 10:24:41 EST 2006 +x11vnc README file Date: Wed Mar 8 10:57:30 EST 2006 The following information is taken from these URLs: @@ -1746,24 +1746,53 @@ display :0 Q-12: Are there any build-time customizations possible, e.g. change defaults, create a smaller binary, etc? - As of Mar/2004 in the libvncserver cvs there are a few such options. - They are enabled by adding something like -Dxxxx=1 to the CPPFLAGS - environment variable before running configure (see the [213]build - notes for general background). - * -DVNCSHARED=1 make -shared the default. - * -DFOREVER=1 make -forever the default. - * -DREMOTE_CONTROL=0 disable the remote control mechanism. - * -DPASSWD_REQUIRED=1 require a password be supplied (-rfbauth, - -passwdfile, ...) - * -DPASSWD_UNLESS_NOPW=1 require a password unless -nopw is - explicitly supplied. - * -DSMALL_FOOTPRINT=1 strip out help text, gui, etc to make a - smaller binary (e.g. for PDA or embedded system with low disk - space). Also be sure to strip(1) the binary. Set to 2 or 3 to cut - out even more. - - For example: - env CPPFLAGS="-DFOREVER=1" ./configure; make + There are some options. They are enabled by adding something like + -Dxxxx=1 to the CPPFLAGS environment variable before running configure + (see the [213]build notes for general background). +/* + * Mar/2006 + * Build-time customization via CPPFLAGS. + * + * Summary of options to include in CPPFLAGS for custom builds: + * + * -DVNCSHARED to have the vnc display shared by default. + * -DFOREVER to have -forever on by default. + * -DNOREPEAT=0 to have -repeat on by default. + * -DADDKEYSYMS=0 to have -noadd_keysyms the default. + * + * -DREMOTE_DEFAULT=0 to disable remote-control on by default (-yesremote). + * -DREMOTE_CONTROL=0 to disable remote-control mechanism completely. + * -DEXTERNAL_COMMANDS=0 to disable the running of all external commands. + * -DFILEXFER=0 disable filexfer. + * + * -DHARDWIRE_PASSWD=... hardwired passwords, quoting necessary. + * -DHARDWIRE_VIEWPASSWD=... + * -DNOPW=1 make -nopw the default (skip warning) + * -DPASSWD_REQUIRED=1 exit unless a password is supplied. + * -DPASSWD_UNLESS_NOPW=1 exit unless a password is supplied and no -nopw. + * + * -DWIREFRAME=0 to have -nowireframe as the default. + * -DWIREFRAME_COPYRECT=0 to have -nowirecopyrect as the default. + * -DWIREFRAME_PARMS=... set default -wirecopyrect parameters. + * -DSCROLL_COPYRECT=0 to have -noscrollcopyrect as the default. + * -DSCROLL_COPYRECT_PARMS=... set default -scrollcopyrect parameters. + * -DSCALING_COPYRECT=0 + * -DXDAMAGE=0 to have -noxdamage as the default. + * -DSKIPDUPS=0 to have -noskip_dups as the default or vice versa. + * + * -DPOINTER_MODE_DEFAULT={0,1,2,3,4} set default -pointer_mode. + * -DBOLDLY_CLOSE_DISPLAY=0 to not close X DISPLAY under -rawfb. + * -DSMALL_FOOTPRINT=1 for smaller binary size (no help, no gui, etc) + * use 2 or 3 for even smaller footprint. + * -DNOGUI do not include the gui tkx11vnc. + * -DPOLL_8TO24_DELAY=N + * -DDEBUG_XEVENTS=1 enable printout for X events. + * + * Set these in CPPFLAGS before running configure. E.g.: + * + * % env CPPFLAGS="-DFOREVER -DREMOTE_CONTROL=0" ./configure + * % make + */ If other things (e.g. "-I ...") are needed in CPPFLAGS add them as well. @@ -1779,15 +1808,7 @@ display :0 unintendeds. Perhaps this is of use in remote access for an embedded application, etc... - Let us know if more build-time customizations would be useful. Look - near the top of the source file for any additional customization - macros. Here is the current (Jul/2005) list: REMOTE_CONTROL, NOPW, - SMALL_FOOTPRINT, NOGUI, XDAMAGE, VNCSHARED, FOREVER, REMOTE_DEFAULT, - EXTERNAL_COMMANDS, VIEWONLY, WIREFRAME, WIREFRAME_PARMS, - WIREFRAME_COPYRECT, SCROLL_COPYRECT_PARMS, SCROLL_COPYRECT, - SCALING_COPYRECT, NOREPEAT, SKIPDUPS, ADDKEYSYMS, - POINTER_MODE_DEFAULT, DEBUG_XEVENTS, BOLDLY_CLOSE_DISPLAY, NOPW, - PASSWD_REQUIRED, PASSWD_UNLESS_NOPW + Let us know if more build-time customizations would be useful. [Win2VNC Related] @@ -2204,9 +2225,9 @@ TrueColor defdepth 24 scale:3/4", "x11vnc -Q modtweak", "x11vnc -R stop", "x11vnc -R disconnect:all", etc.. These commands do not start a x11vnc server, but rather communicate with one that is already running. The X display - (VNC_CONNECT property) is used as the communication channel, so the X - permissions and DISPLAY must be set up correctly for communication to - be possible. + (X11VNC_REMOTE property) is used as the communication channel, so the + X permissions and DISPLAY must be set up correctly for communication + to be possible. There is also a simple Tcl/Tk gui based on this remote control mechanism. See the [257]-gui option for more info. You will need to @@ -2744,9 +2765,11 @@ exit 1 There is also the [308]-unixpw_nis option for non-shadow-password (typically NIS environments, hence the name) systems where the - traditional getpwnam() and crypt() functions are used. The encrypted - user passwords must be accessible to the user running x11vnc in - -unixpw_nis mode. See ypcat(1) and shadow(5). + traditional getpwnam() and crypt() functions are used instead of + su(1). The encrypted user passwords must be accessible to the user + running x11vnc in -unixpw_nis mode, otherwise the logins will always + fail even when the correct password is supplied. See ypcat(1) and + shadow(5). Two settings are enforced in the -unixpw and -unixpw_nis modes to provide extra security: the 1) [309]-localhost and 2) [310]-stunnel @@ -2761,8 +2784,9 @@ exit 1 Tru64, FreeBSD, OpenBSD, and NetBSD. Additional testing is appreciated. For the last 4 it appears that su(1) will not prompt for a password if su-ing to oneself. Since x11vnc requires a password - prompt from su, those logins will fail. On *BSD it appears this can be - corrected by commenting out the pam_self.so entry in /etc/pam.d/su. + prompt from su, those logins will fail even when the correct password + is supplied. On *BSD it appears this can be corrected by commenting + out the pam_self.so entry in /etc/pam.d/su. Previous discussion: One approximate method involves starting x11vnc @@ -3234,12 +3258,25 @@ service x11vncservice starts up x11vnc with the [335]-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). If a file is specified instead: -connect /path/to/some/file - then that file is checked periodically (about once a second) for new - hosts to connect to. + is 5500). + + If a file is specified instead: -connect /path/to/some/file then that + file is checked periodically (about once a second) for new hosts to + connect to. + + The [336]-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 + + Note that as of Mar/2006 x11vnc requires password authentication for + reverse connections as well as for forward ones (assuming password + auth has been enabled, e.g. via -rfbauth, -passwdfile, etc). Many VNC + servers do not require any password for reverse connections. To regain + the old behavior set: X11VNC_REVERSE_CONNECTION_NO_AUTH=1 before + starting x11vnc. To use the vncconnect(1) program (from the core VNC package at - www.realvnc.com) specify the [336]-vncconnect option to x11vnc (Note: + www.realvnc.com) specify the [337]-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 @@ -3257,18 +3294,19 @@ xprop -root -f VNC_CONNECT 8s -set VNC_CONNECT "$1" display, but for a virtual one I keep around). You can, but you would not be doing this for performance reasons (for - virtual X sessions, Xvnc will give the fastest response). You may want - to do this because Xvnc does not support an X server extension you - desire, or you want to take advantage of one of x11vnc's unending - number of options and features. + virtual X sessions via VNC, Xvnc will give the fastest response). You + may want to do this because Xvnc does not support an X server + extension you desire, or you want to take advantage of one of x11vnc's + unending number of options and features. One way to acheive this is to have a Xvfb(1) virtual framebuffer X server running in the background and have x11vnc attached to it. Another method, faster and more accurate is to use the "dummy" Device Driver in XFree86/Xorg (see below). One could view this desktop both - remotely and locally using vncviewer. Make sure vncviewer's + remotely and also locally using vncviewer. Make sure vncviewer's "-encodings raw" is in effect for local viewing (compression seems to - slow things down locally). + slow things down locally). For local viewing you set up a "bare" + window manager that just starts up vncviewer and nothing else. Here is one way to start up Xvfb: xinit -- /usr/X11R6/bin/Xvfb :1 -screen 0 1024x768x16 @@ -3283,7 +3321,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 - [337]-add_keysyms option to have keysyms added automatically. Also, to + [338]-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" @@ -3305,11 +3343,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) [338]switching even though it + Linux Virtual Console/Terminal (VC/VT) [339]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 [339]Xdummy that allows you to + Jul/2005 we have an LD_PRELOAD script [340]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 @@ -3341,7 +3379,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 [340]this FAQ) and access it from + display via x11vnc (e.g. see [341]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 @@ -3384,7 +3422,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 [341]shm_clear to list and prompt for removal + Here is a shell script [342]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, @@ -3418,36 +3456,36 @@ ied) in /etc/system. See the next paragraph for more workarounds. To minimize the number of shm segments used by x11vnc try using the - [342]-onetile option (corresponds to only 3 shm segments used, and + [343]-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 - [343]-noshm option. Performance will be somewhat degraded but when + [344]-noshm option. Performance will be somewhat degraded but when done over local machine sockets it should be acceptable (see an - [344]earlier question discussing -noshm). + [345]earlier question discussing -noshm). Q-52: How can I make x11vnc use less system resources? - The [345]-nap and "[346]-wait n" (where n is the sleep between polls + The [346]-nap and "[347]-wait n" (where n is the sleep between polls in milliseconds, the default is 30 or so) option are good places to start. 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 - [347]-onetile option will use less memory and use fewer shared memory - slots (add [348]-fs 1.0 for one less slot). + [348]-onetile option will use less memory and use fewer shared memory + slots (add [349]-fs 1.0 for one less slot). Q-53: How can I make x11vnc use MORE system resources? - You can try [349]-threads and dial down the wait time (e.g. -wait 1) - and possibly dial down [350]-defer as well. Note that if you try to + You can try [350]-threads and dial down the wait time (e.g. -wait 1) + and possibly dial down [351]-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 [351]-id option) can be streamed over a LAN or wireless at + the x11vnc [352]-id option) can be streamed over a LAN or wireless at a reasonable frame rate. @@ -3463,16 +3501,16 @@ 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 - [352]-solid [color] option to try to do this automatically. + [353]-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 bandwidth" theme you can easily switch into and out of. * 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 [353]-scrollcopyrect is active and + problem in x11vnc 0.7.2 if [354]-scrollcopyrect is active and detecting scrolls for the application). - * If the [354]-wireframe option is not available (earlier than + * If the [355]-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) @@ -3492,7 +3530,7 @@ ied) noticed. VNC viewer parameters: - * Use a [355]TightVNC enabled viewer! (Actually, RealVNC 4.x viewer + * Use a [356]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 @@ -3515,28 +3553,28 @@ ied) file. x11vnc parameters: - * Try using [356]-nodragging (no screen updates when dragging mouse, + * Try using [357]-nodragging (no screen updates when dragging mouse, but sometimes you miss visual feedback) - * Make sure the [357]-wireframe option is active (it should be on by + * Make sure the [358]-wireframe option is active (it should be on by default) and you have Opaque Moves/Resizes Enabled in the window manager. - * Make sure the [358]-scrollcopyrect option is active (it should be + * Make sure the [359]-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. - * Set [359]-fs 1.0 (disables fullscreen updates) - * Try increasing [360]-wait or [361]-defer (reduces the maximum + * Set [360]-fs 1.0 (disables fullscreen updates) + * Try increasing [361]-wait or [362]-defer (reduces the maximum "frame rate", but won't help much for large screen changes) - * Try the [362]-progressive pixelheight mode with the block + * Try the [363]-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 [363]-id (cuts + * If you just want to watch one (simple) window use [364]-id (cuts down extraneous polling and updates, but can be buggy or insufficient) - * Set [364]-nosel (disables all clipboard selection exchange) - * Use [365]-nocursor and [366]-nocursorpos (repainting the remote + * Set [365]-nosel (disables all clipboard selection exchange) + * Use [366]-nocursor and [367]-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 - [367]-readtimeout n setting if it sometimes takes more than 20sec + [368]-readtimeout n setting if it sometimes takes more than 20sec to paint the full screen, etc. @@ -3558,7 +3596,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 [368]slow (e.g. + in main memory. So reading the fb is still painfully [369]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 @@ -3576,27 +3614,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 "[369]-xd_area A" option to adjust the size + skipped). You can use the "[370]-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 "[370]-xd_mem f" may also be of use in tuning the - algorithm. To disable using DAMAGE entirely use "[371]-noxdamage". + The option "[371]-xd_mem f" may also be of use in tuning the + algorithm. To disable using DAMAGE entirely use "[372]-noxdamage". Q-56: 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 [372]slow hardware read rates from + This problem is primarily due to [373]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 - [373]-pointer_mode option for more info. The next bottleneck is + [374]-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 @@ -3606,26 +3644,26 @@ ied) tree. The 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 "[374]-pointer_mode 1" option. + way via the "[375]-pointer_mode 1" option. - Also added was the [375]-nodragging option that disables all screen + Also added was the [376]-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 in the libvncserver CVS the [376]-pointer_mode n option + As of Dec/2004 in the libvncserver CVS the [377]-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 [377]-threads option can improve + Also, in some circumstances the [378]-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 in the libvncserver CVS two new options (see the - [378]wireframe FAQ and [379]scrollcopyrect FAQ below) provide schemes + [379]wireframe FAQ and [380]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. @@ -3641,8 +3679,8 @@ ied) shown. When 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 [380]slow video - card read rates (see [381]here too). A displacement, even a small one, + of the intermediate steps. BTW the lurching is due to [381]slow video + card read rates (see [382]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. @@ -3650,7 +3688,7 @@ ied) for -wireframe to do any good. The mode is currently on by default because most people are inflicted - with the problem. It can be disabled with the [382]-nowireframe option + with the problem. It can be disabled with the [383]-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 @@ -3695,13 +3733,13 @@ ied) * Maximum time to show a wireframe animation. * Minimum time between sending wireframe outlines. - See the [383]"-wireframe tweaks" option for more details. On a slow + See the [384]"-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 - [384]"-wirecopyrect mode" option. It is also on by default. This + [385]"-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 @@ -3749,7 +3787,7 @@ ied) 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 [385]slow). + the hardware framebuffer is [386]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. @@ -3771,10 +3809,10 @@ ied) the X server display: if one falls too far behind it could become a mess... - The initial implementation of [386]-scrollcopyrect option is useful in + The initial implementation of [387]-scrollcopyrect option is useful in that it detects many scrolls and thus gives a much nicer working - environment (especially when combined with the [387]-wireframe - [388]-wirecopyrect [389]options, which are also on by default; and if + environment (especially when combined with the [388]-wireframe + [389]-wirecopyrect [390]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. @@ -3807,10 +3845,10 @@ ied) 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: [390]-fixscreen + also: [391]-fixscreen * Some applications, notably OpenOffice, do XCopyArea scrolls in weird ways that assume ancestor window clipping is taking place. - See the [391]-scr_skip option for ways to tweak this on a + See the [392]-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 @@ -3827,7 +3865,7 @@ ied) 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 [392]-scale option there will be a quick CopyRect + * When using the [393]-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 @@ -3840,7 +3878,7 @@ ied) If you find the -scrollcopyrect behavior too approximate or distracting you can go back to the standard polling-only update method - with the [393]-noscrollcopyrect (or -noscr for short). If you find + with the [394]-noscrollcopyrect (or -noscr for short). If you find some extremely bad and repeatable behavior for -scrollcopyrect please report a bug. @@ -3879,16 +3917,16 @@ ied) 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 "[394]-cursor X" option that + A simple kludge is provided by the "[395]-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 "[395]-cursor some" option for + work for those cases. Also see the "[396]-cursor some" option for additional kludges. Note that as of Aug/2004 in the libvncserver CVS, on Solaris using the SUN_OVL overlay extension and IRIX, x11vnc can show the correct mouse - cursor when the [396]-overlay option is supplied. See [397]this FAQ + cursor when the [397]-overlay option is supplied. See [398]this FAQ for more info. Also as of Dec/2004 in the libvncserver CVS XFIXES X extension support @@ -3896,7 +3934,7 @@ ied) 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 [398]Solaris 10. + distros and [399]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 @@ -3904,7 +3942,7 @@ ied) 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. [399]Details can be found here. + hidden alpha channel data under 32bpp. [400]Details can be found here. Q-60: When using XFIXES cursorshape mode, some of the cursors look @@ -3937,17 +3975,17 @@ ied) 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 "[400]-alphacut n" option lets + course!) some tunable parameters. The "[401]-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 "[401]-alphafrac f" option tries to correct individual + 240. The "[402]-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 [402]-alpharemove that is useful for + Finally, there is an option [403]-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 @@ -3973,11 +4011,11 @@ ied) send the 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 [403]-nocursorshape x11vnc option. + disabled for all clients with the [404]-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 - [404]-noalphablend option to disable this behavior (always approximate + [405]-noalphablend option to disable this behavior (always approximate transparent cursors with opaque RGB values). The CursorShapeUpdates VNC extension complicates matters because the @@ -4005,9 +4043,9 @@ ied) Q-62: 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 [405]tightvnc extension + This default takes advantage of a [406]tightvnc extension (CursorShapeUpdates) that allows specifying a cursor image shape for - the local VNC viewer. You may disable it with the [406]-nocursor + the local VNC viewer. You may disable it with the [407]-nocursor option to x11vnc if your viewer does not have this extension. Note: as of Aug/2004 in the libvncserver CVS this should be fixed: the @@ -4021,18 +4059,18 @@ ied) clients (i.e. passive viewers can see the mouse cursor being moved around by another viewer)? - Use the [407]-cursorpos option when starting x11vnc. A VNC viewer must + Use the [408]-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 in the - libvncserver CVS -cursorpos is the default. See also [408]-nocursorpos - and [409]-nocursorshape. + libvncserver CVS -cursorpos is the default. See also [409]-nocursorpos + and [410]-nocursorshape. Q-64: 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: [410]-buttonmap + You can remap the mouse buttons via something like: [411]-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. @@ -4040,7 +4078,7 @@ ied) 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 [411]-debug_pointer option prints out much info for + Note that the [412]-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 @@ -4062,7 +4100,7 @@ ied) 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 [412]-buttonmap but rather configuring the X server + consider not using [413]-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"'). @@ -4092,7 +4130,7 @@ ied) Q-65: How can I get my AltGr and Shift modifiers to work between keyboards for different languages? - The option [413]-modtweak should help here. It is a mode that monitors + The option [414]-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. @@ -4101,17 +4139,17 @@ ied) default (use -nomodtweak 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 [414]this FAQ + and ">" it. This key does not exist on the keyboard (see [415]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 [415]FAQ about the -xkb option for a more powerful method + Also see the [416]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 - [416]-debug_keyboard option prints out much info for every keystroke + [417]-debug_keyboard option prints out much info for every keystroke and so can be useful debugging things. @@ -4123,9 +4161,9 @@ ied) (e.g. pc105 in the XF86Config file when it should be something else, say pc104). - Short Cut: Try the [417]-xkb or [418]-sloppy_keys options and see if + Short Cut: Try the [418]-xkb or [419]-sloppy_keys options and see if that helps the situation. The discussion below is a bit outdated (e.g. - [419]-modtweak is now the default) but is useful reference for various + [420]-modtweak is now the default) but is useful reference for various tricks and so is kept. @@ -4168,17 +4206,17 @@ ied) -remap less-comma These are convenient in that they do not modify the actual X server - settings. The former ([420]-modtweak) is a mode that monitors the + settings. The former ([421]-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 ([421]-remap less-comma) is an immediate remapping of the + The latter ([422]-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 [422]FAQ about the -xkb option as a possible workaround + See also the [423]FAQ about the -xkb option as a possible workaround using the XKEYBOARD extension. - Note that the [423]-debug_keyboard option prints out much info for + Note that the [424]-debug_keyboard option prints out much info for every keystroke to aid debugging keyboard problems. @@ -4186,13 +4224,13 @@ ied) (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 [424]keymapping + the Shift key before releasing the "<". Because of a [425]keymapping ambiguity the last event "< up" is interpreted as "," because that key unshifted is the comma. - This should not happen in [425]-xkb mode, because it works hard to + This should not happen in [426]-xkb mode, because it works hard to resolve the ambiguities. If you do not want to use -xkb, try the - option [426]-sloppy_keys to attempt a similar type of algorithm. + option [427]-sloppy_keys to attempt a similar type of algorithm. Q-68: I'm using an "international" keyboard (e.g. German "de", or @@ -4216,7 +4254,7 @@ ied) 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 [427]-modtweak + This all worked fine with x11vnc running with the [428]-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 @@ -4234,7 +4272,7 @@ ied) * there is a new option -xkb to use the XKEYBOARD extension API to do the Modifier key tweaking. - The [428]-xkb option seems to fix all of the missing keys: "@", "<", + The [429]-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 @@ -4242,7 +4280,7 @@ ied) debugging output (send it along with any problems you report). Update: as of Jun/2005 x11vnc will try to automatically enable - [429]-xkb if it appears that would be beneficial (e.g. if it sees any + [430]-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. @@ -4257,7 +4295,7 @@ ied) 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: - [430]-skip_keycodes 93 + [431]-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 @@ -4274,16 +4312,16 @@ ied) 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 [431]-remap x11vnc option: + created using the [432]-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 - [432]-add_keysyms option in the next paragraph. - Update: for convenience "[433]-remap DEAD" does many of these + [433]-add_keysyms option in the next paragraph. + Update: for convenience "[434]-remap DEAD" does many of these mappings at once. - * To complement the above workaround using the [434]-remap, an - option [435]-add_keysyms was added. This option instructs x11vnc + * To complement the above workaround using the [435]-remap, an + option [436]-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 @@ -4302,7 +4340,7 @@ ied) 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) [436]-norepeat x11vnc option. You will still + use the new (Jul/2004) [437]-norepeat x11vnc option. You will still have autorepeating because that is taken care of on your VNC viewer side. @@ -4326,7 +4364,7 @@ ied) 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 [437]-norepeat (which has since Dec/2004 been + needed, or to use the [438]-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 @@ -4337,7 +4375,7 @@ ied) keystrokes!! Are you using x11vnc to log in to an X session? (as described in - [438]this FAQ) If so, x11vnc is starting before your session and it + [439]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 trying to be @@ -4361,7 +4399,7 @@ ied) 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 "[439]-remap Super_R-Mode_switch" x11vnc option may + Something like "[440]-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)). @@ -4384,7 +4422,7 @@ ied) 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 [440]-remap Alt_L-Meta_L to x11vnc may be sufficient for ones + the [441]-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. @@ -4395,7 +4433,7 @@ ied) 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 [441]-remap + have x11vnc do the remapping. This can be done via the [442]-remap option using the fake "keysyms" Button1, Button2, etc. as the "to" keys (i.e. the ones after the "-") @@ -4404,7 +4442,7 @@ ied) button "paste" because (using XFree86/Xorg Emulate3Buttons) you have to click both buttons on the touch pad at the same time. This remapping: - [442]-remap Super_R-Button2 + [443]-remap Super_R-Button2 maps the Super_R "flag" key press to the Button2 click, thereby making X pasting a bit easier. @@ -4434,7 +4472,7 @@ ied) 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 - [443]this FAQ on x11vnc scaling. + [444]this FAQ on x11vnc scaling. Q-75: Does x11vnc support server-side framebuffer scaling? (E.g. to @@ -4442,7 +4480,7 @@ ied) As of Jun/2004 in the libvncserver CVS x11vnc provides basic server-side scaling. It is a global scaling of the desktop, not a - per-client setting. To enable it use the "[444]-scale fraction" + per-client setting. To enable it use the "[445]-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 2/3). Note that if fraction is greater than one the display is magnified. @@ -4463,7 +4501,7 @@ ied) 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 - [445]applications. Since with integer scale factors the framebuffers + [446]applications. Since with integer scale factors the framebuffers become huge and scaling operations time consuming, be sure to use ":nb" for the fastest response. @@ -4489,21 +4527,21 @@ ied) 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 ([446]-rfbport option, + different scalings listening on separate ports ([447]-rfbport option, etc.). BTW, whenever you run two or more x11vnc's on the same X display and - use the [447]GUI, then to avoid all of the x11vnc's simultaneously - answering the gui you will need to use something like [448]"-connect + use the [448]GUI, then to avoid all of the x11vnc's simultaneously + answering the gui you will need to use something like [449]"-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 - gui process. Otherwise they all share the same X property channel: - VNC_CONNECT. + gui process. Otherwise they all share the same X property channels: + VNC_CONNECT and X11VNC_REMOTE. Update: As of Mar/2005 in the libvncserver CVS x11vnc now scales the mouse cursor with the same scale factor as the screen. If you don't - want that, use the [449]"-scale_cursor frac" option to set the cursor + want that, use the [450]"-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). @@ -4525,16 +4563,16 @@ ied) 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 [450]-blackout x11vnc option + may be distracting to the viewer. The [451]-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 - [451]-xinerama x11vnc option can be used to have it automatically + [452]-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). 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 [452]-xwarppointer + of the large display. If this happens try using the [453]-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 @@ -4559,23 +4597,23 @@ ied) 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 [453]FAQ to increase the limit. It - is probably also a good idea to run with the [454]-onetile option in + /etc/system as mentioned in another [454]FAQ to increase the limit. It + is probably also a good idea to run with the [455]-onetile option in this case (to limit each x11vnc to 3 shm segments), or even - [455]-noshm to use no shm segments. + [456]-noshm to use no shm segments. Q-78: Can x11vnc show only a portion of the display? (E.g. for a special purpose rfb application). - As of Mar/2005 in the libvncserver CVS x11vnc has the "[456]-clip + As of Mar/2005 in the libvncserver CVS x11vnc has the "[457]-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 [457]Xinerama screen into two more managable smaller screens. + large [458]Xinerama screen into two more managable smaller screens. This also works to view a sub-region of a single application window if - the [458]-id or [459]-sid options are used. The offset is measured + the [459]-id or [460]-sid options are used. The offset is measured from the upper left corner of the selected window. @@ -4584,7 +4622,7 @@ ied) crash. As of Dec/2004 in the libvncserver CVS x11vnc supports XRANDR. You - enable it with the [460]-xrandr option to make x11vnc monitor XRANDR + enable it with the [461]-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. @@ -4594,7 +4632,7 @@ ied) 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 [461]-padgeom option to make the region big + viewers you can try the [462]-padgeom option to make the region big enough to hold all resizes and rotations. If you specify "-xrandr newfbsize" then vnc viewers that do not @@ -4618,12 +4656,13 @@ ied) in the active VC? This seems to have to do with how applications (the X server processes - in this case) must "play nicely" if they are not on the active VC. - That is, they should not read from the keyboard or mouse or manage the - video display unless they have the active VC. Given that it appears - the XGetImage() call must ultimately retrieve the framebuffer data - from the video hardware itself, it would make sense x11vnc's polling - wouldn't work unless the X session had active control of the VC. + in this case) must "play nicely" if they are not on the active VC + (sometimes called VT for virtual terminal). That is, they should not + read from the keyboard or mouse or manage the video display unless + they have the active VC. Given that it appears the XGetImage() call + must ultimately retrieve the framebuffer data from the video hardware + itself, it would make sense x11vnc's polling wouldn't work unless the + X session had active control of the VC. There does not seem to be an easy way to work around this. Even xwd(1) doesn't work in this case (try it). Something would need to be done at @@ -4648,9 +4687,9 @@ ied) * 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 [462]this FAQ + desktop in a separate Virtual Console (e.g. VC 8) (see [463]this FAQ on VC's for background). Unfortunately, this Fullscreen VC is not an X - server. So x11vnc cannot access it (however, [463]see this for a + server. So x11vnc cannot access it (however, [464]see this for a possible partial workaround). x11vnc works fine with "Normal X application window" and "Quick-Switch mode" because these use X. @@ -4667,13 +4706,13 @@ ied) 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 [464]is in the active VC. + as long as the VMWare X session [465]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 [465]-id windowid option. The + the VMWare menu buttons) by use of the [466]-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 @@ -4754,7 +4793,7 @@ ied) 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. Of course for the case - of Xvfb x11vnc can poll it much better via the [466]X API, but you get + of Xvfb x11vnc can poll it much better via the [467]X API, but you get the idea. By default in -rawfb mode x11vnc will actually close any X display it @@ -4807,7 +4846,7 @@ ied) 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 [467]active VC) one + view and interact with VC #2 (assuming it is the [468]active VC) one can run something like: x11vnc -rawfb map:/dev/fb0@1024x768x16 -pipeinput './vcinject.pl 2' @@ -4820,7 +4859,7 @@ ied) more accurate and faster LinuxVNC program. The only advantage x11vnc -rawfb might have is that it can presumably allow interaction with a non-text application, e.g. one based on svgalib. For example the - [468]VMWare Fullscreen mode is actually viewable under -rawfb. But + [469]VMWare Fullscreen mode is actually viewable under -rawfb. But this isn't much use until one figures out how to inject keystrokes and mouse events... @@ -4852,10 +4891,10 @@ ied) As of Jan/2004 in the libvncserver CVS x11vnc supports the "CutText" part of the rfb protocol. Furthermore, x11vnc is able to hold the PRIMARY selection (Xvnc does not seem to do this). If you don't want - the Clipboard/Selection exchanged use the [469]-nosel option. If you + the Clipboard/Selection exchanged use the [470]-nosel option. If you don't want the PRIMARY selection to be polled for changes use the - [470]-noprimary option. You can also fine-tune it a bit with the - [471]-seldir dir option. + [471]-noprimary option. You can also fine-tune it a bit with the + [472]-seldir dir option. You may need to watch out for desktop utilities such as KDE's "Klipper" that do odd things with the selection, clipboard, and @@ -4867,7 +4906,7 @@ ied) As of Oct/2005 x11vnc enables the TightVNC file transfer implementation that was added to libvncserver. This currently only works with TightVNC viewers (and Windows only it appears). It is on by - default, to disable it use the [472]-nofilexfer option. + default, to disable it use the [473]-nofilexfer option. Q-87: Why don't I hear the "Beeps" in my X session (e.g. when typing @@ -4878,7 +4917,7 @@ ied) not on by default 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 [473]-nobell option. If + If you don't want to hear the beeps use the [474]-nobell option. If you want to hear the audio from the remote applications, consider trying a redirector such as esd. @@ -5232,144 +5271,145 @@ References 333. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-httpdir 334. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-http 335. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-connect - 336. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-vncconnect - 337. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-add_keysyms - 338. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc - 339. http://www.karlrunge.com/x11vnc/Xdummy - 340. http://www.karlrunge.com/x11vnc/index.html#display-manager-continuously - 341. http://www.karlrunge.com/x11vnc/shm_clear - 342. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-onetile - 343. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noshm - 344. http://www.karlrunge.com/x11vnc/index.html#faq-noshm - 345. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nap - 346. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wait - 347. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-onetile - 348. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fs - 349. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-threads - 350. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-defer - 351. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id - 352. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-solid - 353. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect - 354. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe - 355. http://www.tightvnc.com/ - 356. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nodragging - 357. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe - 358. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect - 359. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fs - 360. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wait - 361. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-defer - 362. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-progressive - 363. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id - 364. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nosel - 365. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursor - 366. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorpos - 367. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-readtimeout - 368. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow - 369. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xd_area - 370. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xd_mem - 371. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noxdamage - 372. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow - 373. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pointer_mode + 336. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remote + 337. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-vncconnect + 338. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-add_keysyms + 339. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc + 340. http://www.karlrunge.com/x11vnc/Xdummy + 341. http://www.karlrunge.com/x11vnc/index.html#display-manager-continuously + 342. http://www.karlrunge.com/x11vnc/shm_clear + 343. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-onetile + 344. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noshm + 345. http://www.karlrunge.com/x11vnc/index.html#faq-noshm + 346. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nap + 347. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wait + 348. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-onetile + 349. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fs + 350. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-threads + 351. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-defer + 352. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id + 353. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-solid + 354. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect + 355. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe + 356. http://www.tightvnc.com/ + 357. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nodragging + 358. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe + 359. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect + 360. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fs + 361. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wait + 362. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-defer + 363. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-progressive + 364. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id + 365. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nosel + 366. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursor + 367. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorpos + 368. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-readtimeout + 369. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow + 370. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xd_area + 371. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xd_mem + 372. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noxdamage + 373. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow 374. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pointer_mode - 375. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nodragging - 376. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pointer_mode - 377. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-threads - 378. http://www.karlrunge.com/x11vnc/index.html#faq-wireframe - 379. http://www.karlrunge.com/x11vnc/index.html#faq-scrollcopyrect - 380. http://www.karlrunge.com/x11vnc/index.html#faq-pointer-mode - 381. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow - 382. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe + 375. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pointer_mode + 376. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nodragging + 377. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-pointer_mode + 378. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-threads + 379. http://www.karlrunge.com/x11vnc/index.html#faq-wireframe + 380. http://www.karlrunge.com/x11vnc/index.html#faq-scrollcopyrect + 381. http://www.karlrunge.com/x11vnc/index.html#faq-pointer-mode + 382. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow 383. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe 384. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe - 385. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow - 386. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect - 387. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe - 388. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wirecopyrect - 389. http://www.karlrunge.com/x11vnc/index.html#faq-wireframe - 390. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fixscreen - 391. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scr_skip - 392. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scale - 393. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect - 394. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursor + 385. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe + 386. http://www.karlrunge.com/x11vnc/index.html#fb_read_slow + 387. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect + 388. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wireframe + 389. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-wirecopyrect + 390. http://www.karlrunge.com/x11vnc/index.html#faq-wireframe + 391. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-fixscreen + 392. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scr_skip + 393. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scale + 394. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scrollcopyrect 395. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursor - 396. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-overlay - 397. http://www.karlrunge.com/x11vnc/index.html#the-overlay-mode - 398. http://www.karlrunge.com/x11vnc/index.html#solaris10-build - 399. http://www.karlrunge.com/x11vnc/index.html#faq-xfixes-alpha-hacks - 400. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-alphacut - 401. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-alphafrac - 402. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-alpharemove - 403. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorshape - 404. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noalphablend - 405. http://www.tightvnc.com/ - 406. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursor - 407. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursorpos - 408. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorpos - 409. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorshape - 410. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-buttonmap - 411. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-debug_pointer - 412. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-buttonmap - 413. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak - 414. http://www.karlrunge.com/x11vnc/index.html#faq-greaterless - 415. http://www.karlrunge.com/x11vnc/index.html#faq-xkbmodtweak - 416. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-debug_keyboard - 417. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb - 418. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sloppy_keys - 419. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak + 396. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursor + 397. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-overlay + 398. http://www.karlrunge.com/x11vnc/index.html#the-overlay-mode + 399. http://www.karlrunge.com/x11vnc/index.html#solaris10-build + 400. http://www.karlrunge.com/x11vnc/index.html#faq-xfixes-alpha-hacks + 401. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-alphacut + 402. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-alphafrac + 403. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-alpharemove + 404. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorshape + 405. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noalphablend + 406. http://www.tightvnc.com/ + 407. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursor + 408. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-cursorpos + 409. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorpos + 410. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nocursorshape + 411. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-buttonmap + 412. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-debug_pointer + 413. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-buttonmap + 414. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak + 415. http://www.karlrunge.com/x11vnc/index.html#faq-greaterless + 416. http://www.karlrunge.com/x11vnc/index.html#faq-xkbmodtweak + 417. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-debug_keyboard + 418. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb + 419. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sloppy_keys 420. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak - 421. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap - 422. http://www.karlrunge.com/x11vnc/index.html#faq-xkbmodtweak - 423. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-debug_keyboard - 424. http://www.karlrunge.com/x11vnc/index.html#faq-greaterless - 425. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb - 426. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sloppy_keys - 427. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak - 428. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb + 421. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak + 422. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 423. http://www.karlrunge.com/x11vnc/index.html#faq-xkbmodtweak + 424. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-debug_keyboard + 425. http://www.karlrunge.com/x11vnc/index.html#faq-greaterless + 426. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb + 427. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-sloppy_keys + 428. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-modtweak 429. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb - 430. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-skip_keycodes - 431. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap - 432. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-add_keysyms - 433. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 430. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xkb + 431. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-skip_keycodes + 432. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 433. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-add_keysyms 434. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap - 435. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-add_keysyms - 436. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-norepeat + 435. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 436. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-add_keysyms 437. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-norepeat - 438. http://www.karlrunge.com/x11vnc/index.html#faq-display-manager - 439. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 438. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-norepeat + 439. http://www.karlrunge.com/x11vnc/index.html#faq-display-manager 440. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap 441. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap 442. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap - 443. http://www.karlrunge.com/x11vnc/index.html#faq-scaling - 444. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scale - 445. http://www.cus.cam.ac.uk/~ssb22/source/vnc-magnification.html - 446. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbport - 447. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-gui - 448. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-connect - 449. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scale_cursor - 450. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-blackout - 451. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xinerama - 452. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xwarppointer - 453. http://www.karlrunge.com/x11vnc/index.html#faq-solshm - 454. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-onetile - 455. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noshm - 456. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-clip - 457. http://www.karlrunge.com/x11vnc/index.html#faq-xinerama - 458. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id + 443. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-remap + 444. http://www.karlrunge.com/x11vnc/index.html#faq-scaling + 445. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scale + 446. http://www.cus.cam.ac.uk/~ssb22/source/vnc-magnification.html + 447. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-rfbport + 448. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-gui + 449. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-connect + 450. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-scale_cursor + 451. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-blackout + 452. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xinerama + 453. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xwarppointer + 454. http://www.karlrunge.com/x11vnc/index.html#faq-solshm + 455. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-onetile + 456. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noshm + 457. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-clip + 458. http://www.karlrunge.com/x11vnc/index.html#faq-xinerama 459. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id - 460. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xrandr - 461. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-padgeom - 462. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc - 463. http://www.karlrunge.com/x11vnc/index.html#faq-rawfb - 464. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc - 465. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id - 466. http://www.karlrunge.com/x11vnc/index.html#faq-xvfb - 467. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc - 468. http://www.karlrunge.com/x11vnc/index.html#faq-vmware - 469. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nosel - 470. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noprimary - 471. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-seldir - 472. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nofilexfer - 473. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nobell + 460. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id + 461. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-xrandr + 462. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-padgeom + 463. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc + 464. http://www.karlrunge.com/x11vnc/index.html#faq-rawfb + 465. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc + 466. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-id + 467. http://www.karlrunge.com/x11vnc/index.html#faq-xvfb + 468. http://www.karlrunge.com/x11vnc/index.html#faq-linuxvc + 469. http://www.karlrunge.com/x11vnc/index.html#faq-vmware + 470. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nosel + 471. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-noprimary + 472. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-seldir + 473. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nofilexfer + 474. http://www.karlrunge.com/x11vnc/x11vnc_opts.html#opt-nobell ======================================================================= @@ -5382,7 +5422,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.1 lastmod: 2006-03-06 +x11vnc: allow VNC connections to real X11 displays. 0.8.1 lastmod: 2006-03-08 x11vnc options: -display disp -auth file @@ -5403,28 +5443,30 @@ x11vnc options: -viewpasswd string -passwdfile filename -unixpw [list] -unixpw_nis [list] -stunnel [pem] -stunnel3 [pem] - -nopw -storepasswd pass file - -accept string -afteraccept string - -gone string -users list - -noshm -flipbyteorder - -onetile -solid [color] - -blackout string -xinerama - -xtrap -xrandr [mode] - -padgeom WxH -o logfile - -flag file -rc filename - -norc -h, -help - -?, -opts -V, -version - -dbg -q - -bg -modtweak - -nomodtweak -xkb - -noxkb -skip_keycodes string - -sloppy_keys -skip_dups - -noskip_dups -add_keysyms - -noadd_keysyms -clear_mods - -clear_keys -remap string - -norepeat -repeat - -nofb -nobell - -nosel -noprimary + -usepw -storepasswd pass file + -nopw -accept string + -afteraccept string -gone string + -users list -noshm + -flipbyteorder -onetile + -solid [color] -blackout string + -xinerama -xtrap + -xrandr [mode] -padgeom WxH + -o logfile -flag file + -rc filename -norc + -h, -help -?, -opts + -V, -version -dbg + -q -bg + -modtweak -nomodtweak + -xkb -noxkb + -skip_keycodes string -sloppy_keys + -skip_dups -noskip_dups + -add_keysyms -noadd_keysyms + -clear_mods -clear_keys + -remap string -norepeat + -repeat -nofb + -nobell -nosel + -noprimary -nosetprimary + -noclipboard -nosetclipboard -seldir string -cursor [mode] -nocursor -arrow n -noxfixes -alphacut n @@ -5442,28 +5484,28 @@ x11vnc options: -scr_parms string -fixscreen string -debug_scroll -noxrecord -grab_buster -nograb_buster - -debug_grabs -pointer_mode n - -input_skip n -speeds rd,bw,lat - -wmdt string -debug_pointer - -debug_keyboard -defer time - -wait time -wait_ui factor - -nowait_bog -slow_fb time - -readtimeout n -nap - -nonap -sb time - -noxdamage -xd_area A - -xd_mem f -sigpipe string - -threads -nothreads - -fs f -gaps n - -grow n -fuzz n - -debug_tiles -snapfb - -rawfb string -pipeinput cmd - -gui [gui-opts] -remote command - -query variable -QD variable - -sync -noremote - -yesremote -unsafe - -safer -privremote - -nocmds -deny_all - + -debug_grabs -debug_sel + -pointer_mode n -input_skip n + -speeds rd,bw,lat -wmdt string + -debug_pointer -debug_keyboard + -defer time -wait time + -wait_ui factor -nowait_bog + -slow_fb time -readtimeout n + -nap -nonap + -sb time -noxdamage + -xd_area A -xd_mem f + -sigpipe string -threads + -nothreads -fs f + -gaps n -grow n + -fuzz n -debug_tiles + -snapfb -rawfb string + -pipeinput cmd -gui [gui-opts] + -remote command -query variable + -QD variable -sync + -noremote -yesremote + -unsafe -safer + -privremote -nocmds + -deny_all libvncserver options: -rfbport port TCP port for RFB protocol @@ -5495,7 +5537,7 @@ libvncserver-tight-extension options: % x11vnc -help -x11vnc: allow VNC connections to real X11 displays. 0.8.1 lastmod: 2006-03-06 +x11vnc: allow VNC connections to real X11 displays. 0.8.1 lastmod: 2006-03-08 Typical usage is: @@ -5784,11 +5826,19 @@ Options: the connection is made once at startup. Use commas for a list of host's and host:port's. + Note that unlike most vnc servers, x11vnc will require a + password for reverse as well as for forward connections. + (provided password auth has been enabled, -rfbauth, etc) + If you do not want to require a password for reverse + connections set X11VNC_REVERSE_CONNECTION_NO_AUTH=1 in + your environment before starting x11vnc. + If "string" contains "/" it is instead interpreted as a file to periodically check for new hosts. The first line is read and then the file is truncated. Be careful for this usage mode if x11vnc is running as root (e.g. via gdm(1), etc). + -vncconnect Monitor the VNC_CONNECT X property set by the standard -novncconnect VNC program vncconnect(1). When the property is set to "host" or "host:port" establish a reverse @@ -5985,10 +6035,11 @@ Options: be inaccessible unless run as root. This is called "NIS" mode simply because in most NIS setups the user encrypted passwords are accessible (e.g. "ypcat - passwd"). NIS is not required for this mode to - work, but it is unlikely it will work for any other - environment. All of the -unixpw options and contraints - apply. + passwd"). NIS is not required for this mode to work + (only that getpwnam(3) return the encrpyted password + is required), but it is unlikely it will work for any + other environment. All of the -unixpw options and + contraints apply. -stunnel [pem] Use the stunnel(1) (www.stunnel.org) to provide an encrypted SSL tunnel between viewers and x11vnc. @@ -6029,12 +6080,28 @@ Options: -stunnel3 [pem] Use version 3.x stunnel command line syntax instead of version 4.x --nopw Disable the big warning message when you use x11vnc - without some sort of password. +-usepw If no other password method was supplied on the command + line, first look for ~/.vnc/passwd and if found use it + with -rfbauth; next, look for ~/.vnc/passwdfile and + use it with -passwdfile; otherwise, prompt the user + for a password to create ~/.vnc/passwd and use it with + the -rfbauth option. If none of these succeed x11vnc + exits immediately. + + Note: -unixpw currently does not count as a password + method by this option. + -storepasswd pass file Store password "pass" as the VNC password in the file "file". Once the password is stored the program exits. Use the password via "-rfbauth file" + If called with no arguments, i.e., "-storepasswd", + the user is prompted for a password and it is stored + in the file ~/.vnc/passwd + +-nopw Disable the big warning message when you use x11vnc + without some sort of password. + -accept string Run a command (possibly to prompt the user at the X11 display) to decide whether an incoming client should be allowed to connect or not. "string" is @@ -6416,10 +6483,17 @@ Options: -nobell Do not watch for XBell events. (no beeps will be heard) Note: XBell monitoring requires the XKEYBOARD extension. -nosel Do not manage exchange of X selection/cutbuffer between - VNC viewers and the X server. + VNC viewers and the X server at all. -noprimary Do not poll the PRIMARY selection for changes to send back to clients. (PRIMARY is still set on received changes, however). +-nosetprimary Do not set the PRIMARY selection for changes received + from VNC clients. +-noclipboard Do not poll the CLIPBOARD selection for changes to send + back to clients. (CLIPBOARD is still set on received + changes, however). +-nosetclipboard Do not set the CLIPBOARD selection for changes + received from VNC clients. -seldir string If direction string is "send", only send the selection to viewers, and if it is "recv" only receive it from viewers. To work around apps setting the selection @@ -6899,6 +6973,9 @@ Options: -debug_grabs Turn on debugging info printout with respect to XGrabServer() deadlock for -scrollcopyrect mode. +-debug_sel Turn on debugging info printout with respect to + PRIMARY, CLIPBOARD, and CUTBUFFER0 selections. + -pointer_mode n Various pointer motion update schemes. "-pm" is an alias. The problem is pointer motion can cause rapid changes on the screen: consider the rapid @@ -7320,7 +7397,9 @@ n nodeny allow new connections, same as "unlock" connect:host do reverse connection to host, "host" may be a comma separated list of hosts - or host:ports. See -connect. + or host:ports. See -connect. Passwords + required as with fwd connections. + See X11VNC_REVERSE_CONNECTION_NO_AUTH=1 disconnect:host disconnect any clients from "host" same as "close:host". Use host "all" to close all current clients. @@ -7406,6 +7485,12 @@ n sel disable -nosel mode. noprimary enable -noprimary mode. primary disable -noprimary mode. + nosetprimary enable -nosetprimary mode. + setprimary disable -nosetprimary mode. + noclipboard enable -noclipboard mode. + clipboard disable -noclipboard mode. + nosetclipboard enable -nosetclipboard mode. + setclipboard disable -nosetclipboard mode. seldir:str set -seldir to "str" cursor:mode enable -cursor "mode". show_cursor enable showing a cursor. @@ -7508,6 +7593,8 @@ n nodebug_tiles disable -debug_tiles debug_grabs enable -debug_grabs nodebug_grabs disable -debug_grabs + debug_sel enable -debug_sel + nodebug_sel disable -debug_sel dbg enable -dbg crash shell nodbg disable -dbg crash shell @@ -7561,17 +7648,19 @@ n nofilexfer deny lock nodeny unlock connect allowonce allow localhost nolocalhost listen lookup nolookup accept afteraccept gone shm noshm flipbyteorder - noflipbyteorder onetile noonetile solid_color solid - nosolid blackout xinerama noxinerama xtrap noxtrap - xrandr noxrandr xrandr_mode padgeom quiet q noquiet - modtweak nomodtweak xkb noxkb skip_keycodes sloppy_keys - nosloppy_keys skip_dups noskip_dups add_keysyms - noadd_keysyms clear_mods noclear_mods clear_keys - noclear_keys remap repeat norepeat fb nofb bell - nobell sel nosel primary noprimary seldir cursorshape - nocursorshape cursorpos nocursorpos cursor show_cursor - noshow_cursor nocursor arrow xfixes noxfixes xdamage - noxdamage xd_area xd_mem alphacut alphafrac alpharemove + noflipbyteorder onetile noonetile solid_color + solid nosolid blackout xinerama noxinerama xtrap + noxtrap xrandr noxrandr xrandr_mode padgeom quiet q + noquiet modtweak nomodtweak xkb noxkb skip_keycodes + sloppy_keys nosloppy_keys skip_dups noskip_dups + add_keysyms noadd_keysyms clear_mods noclear_mods + clear_keys noclear_keys remap repeat norepeat fb nofb + bell nobell sel nosel primary noprimary setprimary + nosetprimary clipboard noclipboard setclipboard + nosetclipboard seldir cursorshape nocursorshape + cursorpos nocursorpos cursor show_cursor noshow_cursor + nocursor arrow xfixes noxfixes xdamage noxdamage + xd_area xd_mem alphacut alphafrac alpharemove noalpharemove alphablend noalphablend xwarppointer xwarp noxwarppointer noxwarp buttonmap dragging nodragging wireframe_mode wireframe wf nowireframe diff --git a/x11vnc/connections.c b/x11vnc/connections.c index d8dbea5..53231ee 100644 --- a/x11vnc/connections.c +++ b/x11vnc/connections.c @@ -1491,6 +1491,12 @@ static int do_reverse_connect(char *str) { return 0; } else { rfbLog("reverse_connect: %s/%s OK\n", str, cl->host); + /* let's see if anyone complains: */ + if (! getenv("X11VNC_REVERSE_CONNECTION_NO_AUTH")) { + rfbLog("reverse_connect: turning on auth for %s\n", + cl->host); + cl->reverseConnection = FALSE; + } return 1; } } diff --git a/x11vnc/help.c b/x11vnc/help.c index 293104b..65edf94 100644 --- a/x11vnc/help.c +++ b/x11vnc/help.c @@ -306,11 +306,19 @@ void print_help(int mode) { " the connection is made once at startup. Use commas\n" " for a list of host's and host:port's.\n" "\n" +" Note that unlike most vnc servers, x11vnc will require a\n" +" password for reverse as well as for forward connections.\n" +" (provided password auth has been enabled, -rfbauth, etc)\n" +" If you do not want to require a password for reverse\n" +" connections set X11VNC_REVERSE_CONNECTION_NO_AUTH=1 in\n" +" your environment before starting x11vnc.\n" +"\n" " If \"string\" contains \"/\" it is instead interpreted\n" " as a file to periodically check for new hosts.\n" " The first line is read and then the file is truncated.\n" " Be careful for this usage mode if x11vnc is running as\n" " root (e.g. via gdm(1), etc).\n" +"\n" "-vncconnect Monitor the VNC_CONNECT X property set by the standard\n" "-novncconnect VNC program vncconnect(1). When the property is\n" " set to \"host\" or \"host:port\" establish a reverse\n" @@ -507,10 +515,11 @@ void print_help(int mode) { " be inaccessible unless run as root. This is called\n" " \"NIS\" mode simply because in most NIS setups the\n" " user encrypted passwords are accessible (e.g. \"ypcat\n" -" passwd\"). NIS is not required for this mode to\n" -" work, but it is unlikely it will work for any other\n" -" environment. All of the -unixpw options and contraints\n" -" apply.\n" +" passwd\"). NIS is not required for this mode to work\n" +" (only that getpwnam(3) return the encrpyted password\n" +" is required), but it is unlikely it will work for any\n" +" other environment. All of the -unixpw options and\n" +" contraints apply.\n" "\n" "-stunnel [pem] Use the stunnel(1) (www.stunnel.org) to provide\n" " an encrypted SSL tunnel between viewers and x11vnc.\n" @@ -551,12 +560,28 @@ void print_help(int mode) { "-stunnel3 [pem] Use version 3.x stunnel command line syntax instead of\n" " version 4.x\n" "\n" -"-nopw Disable the big warning message when you use x11vnc\n" -" without some sort of password.\n" +"-usepw If no other password method was supplied on the command\n" +" line, first look for ~/.vnc/passwd and if found use it\n" +" with -rfbauth; next, look for ~/.vnc/passwdfile and\n" +" use it with -passwdfile; otherwise, prompt the user\n" +" for a password to create ~/.vnc/passwd and use it with\n" +" the -rfbauth option. If none of these succeed x11vnc\n" +" exits immediately.\n" +"\n" +" Note: -unixpw currently does not count as a password\n" +" method by this option.\n" +"\n" "-storepasswd pass file Store password \"pass\" as the VNC password in the\n" " file \"file\". Once the password is stored the\n" " program exits. Use the password via \"-rfbauth file\"\n" "\n" +" If called with no arguments, i.e., \"-storepasswd\",\n" +" the user is prompted for a password and it is stored\n" +" in the file ~/.vnc/passwd\n" +"\n" +"-nopw Disable the big warning message when you use x11vnc\n" +" without some sort of password.\n" +"\n" "-accept string Run a command (possibly to prompt the user at the\n" " X11 display) to decide whether an incoming client\n" " should be allowed to connect or not. \"string\" is\n" @@ -946,10 +971,17 @@ void print_help(int mode) { "-nobell Do not watch for XBell events. (no beeps will be heard)\n" " Note: XBell monitoring requires the XKEYBOARD extension.\n" "-nosel Do not manage exchange of X selection/cutbuffer between\n" -" VNC viewers and the X server.\n" +" VNC viewers and the X server at all.\n" "-noprimary Do not poll the PRIMARY selection for changes to send\n" " back to clients. (PRIMARY is still set on received\n" " changes, however).\n" +"-nosetprimary Do not set the PRIMARY selection for changes received\n" +" from VNC clients.\n" +"-noclipboard Do not poll the CLIPBOARD selection for changes to send\n" +" back to clients. (CLIPBOARD is still set on received\n" +" changes, however).\n" +"-nosetclipboard Do not set the CLIPBOARD selection for changes\n" +" received from VNC clients.\n" "-seldir string If direction string is \"send\", only send the selection\n" " to viewers, and if it is \"recv\" only receive it from\n" " viewers. To work around apps setting the selection\n" @@ -1429,6 +1461,9 @@ void print_help(int mode) { "-debug_grabs Turn on debugging info printout with respect to\n" " XGrabServer() deadlock for -scrollcopyrect mode.\n" "\n" +"-debug_sel Turn on debugging info printout with respect to\n" +" PRIMARY, CLIPBOARD, and CUTBUFFER0 selections.\n" +"\n" "-pointer_mode n Various pointer motion update schemes. \"-pm\" is\n" " an alias. The problem is pointer motion can cause\n" " rapid changes on the screen: consider the rapid\n" @@ -1853,7 +1888,9 @@ void print_help(int mode) { /* access, filename */ " connect:host do reverse connection to host, \"host\"\n" " may be a comma separated list of hosts\n" -" or host:ports. See -connect.\n" +" or host:ports. See -connect. Passwords\n" +" required as with fwd connections.\n" +" See X11VNC_REVERSE_CONNECTION_NO_AUTH=1\n" " disconnect:host disconnect any clients from \"host\"\n" " same as \"close:host\". Use host\n" " \"all\" to close all current clients.\n" @@ -1944,6 +1981,12 @@ void print_help(int mode) { " sel disable -nosel mode.\n" " noprimary enable -noprimary mode.\n" " primary disable -noprimary mode.\n" +" nosetprimary enable -nosetprimary mode.\n" +" setprimary disable -nosetprimary mode.\n" +" noclipboard enable -noclipboard mode.\n" +" clipboard disable -noclipboard mode.\n" +" nosetclipboard enable -nosetclipboard mode.\n" +" setclipboard disable -nosetclipboard mode.\n" " seldir:str set -seldir to \"str\"\n" " cursor:mode enable -cursor \"mode\".\n" " show_cursor enable showing a cursor.\n" @@ -2044,6 +2087,8 @@ void print_help(int mode) { " nodebug_tiles disable -debug_tiles\n" " debug_grabs enable -debug_grabs\n" " nodebug_grabs disable -debug_grabs\n" +" debug_sel enable -debug_sel\n" +" nodebug_sel disable -debug_sel\n" " dbg enable -dbg crash shell\n" " nodbg disable -dbg crash shell\n" "\n" @@ -2097,17 +2142,19 @@ void print_help(int mode) { " nofilexfer deny lock nodeny unlock connect allowonce\n" " allow localhost nolocalhost listen lookup nolookup\n" " accept afteraccept gone shm noshm flipbyteorder\n" -" noflipbyteorder onetile noonetile solid_color solid\n" -" nosolid blackout xinerama noxinerama xtrap noxtrap\n" -" xrandr noxrandr xrandr_mode padgeom quiet q noquiet\n" -" modtweak nomodtweak xkb noxkb skip_keycodes sloppy_keys\n" -" nosloppy_keys skip_dups noskip_dups add_keysyms\n" -" noadd_keysyms clear_mods noclear_mods clear_keys\n" -" noclear_keys remap repeat norepeat fb nofb bell\n" -" nobell sel nosel primary noprimary seldir cursorshape\n" -" nocursorshape cursorpos nocursorpos cursor show_cursor\n" -" noshow_cursor nocursor arrow xfixes noxfixes xdamage\n" -" noxdamage xd_area xd_mem alphacut alphafrac alpharemove\n" +" noflipbyteorder onetile noonetile solid_color\n" +" solid nosolid blackout xinerama noxinerama xtrap\n" +" noxtrap xrandr noxrandr xrandr_mode padgeom quiet q\n" +" noquiet modtweak nomodtweak xkb noxkb skip_keycodes\n" +" sloppy_keys nosloppy_keys skip_dups noskip_dups\n" +" add_keysyms noadd_keysyms clear_mods noclear_mods\n" +" clear_keys noclear_keys remap repeat norepeat fb nofb\n" +" bell nobell sel nosel primary noprimary setprimary\n" +" nosetprimary clipboard noclipboard setclipboard\n" +" nosetclipboard seldir cursorshape nocursorshape\n" +" cursorpos nocursorpos cursor show_cursor noshow_cursor\n" +" nocursor arrow xfixes noxfixes xdamage noxdamage\n" +" xd_area xd_mem alphacut alphafrac alpharemove\n" " noalpharemove alphablend noalphablend xwarppointer\n" " xwarp noxwarppointer noxwarp buttonmap dragging\n" " nodragging wireframe_mode wireframe wf nowireframe\n" diff --git a/x11vnc/options.c b/x11vnc/options.c index 114e851..0726526 100644 --- a/x11vnc/options.c +++ b/x11vnc/options.c @@ -116,6 +116,7 @@ int debug_xdamage = 0; /* -R debug_xdamage:1 or 2 ... */ int debug_wireframe = 0; int debug_tiles = 0; int debug_grabs = 0; +int debug_sel = 0; int xtrap_input = 0; /* -xtrap for user input insertion */ int xinerama = 0; /* -xinerama */ @@ -274,6 +275,7 @@ int ui_skip = 10; /* see watchloop. negative means ignore input */ int watch_selection = 1; /* normal selection/cutbuffer maintenance */ int watch_primary = 1; /* more dicey, poll for changes in PRIMARY */ +int watch_clipboard = 1; char *sel_direction = NULL; /* "send" or "recv" for one-way */ char *sigpipe = NULL; /* skip, ignore, exit */ diff --git a/x11vnc/options.h b/x11vnc/options.h index 959eaa3..3f167dd 100644 --- a/x11vnc/options.h +++ b/x11vnc/options.h @@ -91,6 +91,7 @@ extern int debug_xdamage; extern int debug_wireframe; extern int debug_tiles; extern int debug_grabs; +extern int debug_sel; extern int xtrap_input; extern int xinerama; @@ -203,6 +204,7 @@ extern int ui_skip; extern int watch_selection; extern int watch_primary; +extern int watch_clipboard; extern char *sel_direction; extern char *sigpipe; diff --git a/x11vnc/remote.c b/x11vnc/remote.c index 30e9a5b..7fd315a 100644 --- a/x11vnc/remote.c +++ b/x11vnc/remote.c @@ -22,6 +22,7 @@ #include "cursor.h" #include "userinput.h" #include "keyboard.h" +#include "selection.h" int send_remote_cmd(char *cmd, int query, int wait); int do_remote_query(char *remote_cmd, char *query_cmd, int remote_sync, @@ -2116,6 +2117,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: enabling watch selection+primary.\n"); watch_selection = 1; watch_primary = 1; + watch_clipboard = 1; } else if (!strcmp(p, "nosel")) { if (query) { @@ -2125,6 +2127,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: disabling watch selection+primary.\n"); watch_selection = 0; watch_primary = 0; + watch_clipboard = 0; } else if (!strcmp(p, "primary")) { if (query) { @@ -2142,6 +2145,54 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: disabling watch_primary.\n"); watch_primary = 0; + } else if (!strcmp(p, "setprimary")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, set_primary); + goto qry; + } + rfbLog("remote_cmd: enabling set_primary.\n"); + set_primary = 1; + + } else if (!strcmp(p, "nosetprimary")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, !set_primary); + goto qry; + } + rfbLog("remote_cmd: disabling set_primary.\n"); + set_primary = 0; + + } else if (!strcmp(p, "clipboard")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, watch_clipboard); + goto qry; + } + rfbLog("remote_cmd: enabling watch_clipboard.\n"); + watch_clipboard = 1; + + } else if (!strcmp(p, "noclipboard")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, !watch_clipboard); + goto qry; + } + rfbLog("remote_cmd: disabling watch_clipboard.\n"); + watch_clipboard = 0; + + } else if (!strcmp(p, "setclipboard")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, set_clipboard); + goto qry; + } + rfbLog("remote_cmd: enabling set_clipboard.\n"); + set_clipboard = 1; + + } else if (!strcmp(p, "nosetclipboard")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, !set_clipboard); + goto qry; + } + rfbLog("remote_cmd: disabling set_clipboard.\n"); + set_clipboard = 0; + } else if (strstr(p, "seldir") == p) { COLON_CHECK("seldir:") if (query) { @@ -3501,6 +3552,21 @@ char *process_remote_cmd(char *cmd, int stringonly) { debug_grabs = 0; rfbLog("set debug_grabs to: %d\n", debug_grabs); + } else if (!strcmp(p, "debug_sel")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, debug_sel); + goto qry; + } + debug_sel = 1; + rfbLog("set debug_sel to: %d\n", debug_sel); + } else if (!strcmp(p, "nodebug_sel")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, !debug_sel); + goto qry; + } + debug_sel = 0; + rfbLog("set debug_sel to: %d\n", debug_sel); + } else if (!strcmp(p, "dbg")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, crash_debug); diff --git a/x11vnc/screen.c b/x11vnc/screen.c index db72627..121a736 100644 --- a/x11vnc/screen.c +++ b/x11vnc/screen.c @@ -407,7 +407,7 @@ static char *raw_fb_orig_dpy = NULL; void set_raw_fb_params(int restore) { static int first = 1; - static int vo0, us0, sm0, ws0, wp0, wb0, na0, tn0; + static int vo0, us0, sm0, ws0, wp0, wc0, wb0, na0, tn0; static int xr0, sb0; static char *mc0; @@ -421,6 +421,7 @@ void set_raw_fb_params(int restore) { vo0 = view_only; ws0 = watch_selection; wp0 = watch_primary; + wc0 = watch_clipboard; wb0 = watch_bell; na0 = no_autorepeat; sb0 = use_solid_bg; @@ -438,6 +439,7 @@ void set_raw_fb_params(int restore) { view_only = vo0; watch_selection = ws0; watch_primary = wp0; + watch_clipboard = wc0; watch_bell = wb0; no_autorepeat = na0; use_solid_bg = sb0; @@ -493,6 +495,11 @@ void set_raw_fb_params(int restore) { "watch_primary\n"); watch_primary = 0; } + if (watch_clipboard) { + if (! quiet) rfbLog("rawfb: turning off " + "watch_clipboard\n"); + watch_clipboard = 0; + } if (watch_bell) { if (! quiet) rfbLog("rawfb: turning off watch_bell\n"); watch_bell = 0; diff --git a/x11vnc/selection.c b/x11vnc/selection.c index 8097057..599be08 100644 --- a/x11vnc/selection.c +++ b/x11vnc/selection.c @@ -9,19 +9,24 @@ * Selection/Cutbuffer/Clipboard handlers. */ -int own_selection = 0; /* whether we currently own PRIMARY or not */ +int own_primary = 0; /* whether we currently own PRIMARY or not */ +int set_primary = 1; +int own_clipboard = 0; /* whether we currently own CLIPBOARD or not */ +int set_clipboard = 1; int set_cutbuffer = 0; /* to avoid bouncing the CutText right back */ int sel_waittime = 15; /* some seconds to skip before first send */ Window selwin; /* special window for our selection */ +Atom clipboard_atom = None; /* * This is where we keep our selection: the string sent TO us from VNC * clients, and the string sent BY us to requesting X11 clients. */ -char *xcut_str = NULL; +char *xcut_str_primary = NULL; +char *xcut_str_clipboard = NULL; -void selection_request(XEvent *ev); +void selection_request(XEvent *ev, char *type); int check_sel_direction(char *dir, char *label, char *sel, int len); void cutbuffer_send(void); void selection_send(XEvent *ev); @@ -29,14 +34,14 @@ void selection_send(XEvent *ev); /* * Our callbacks instruct us to check for changes in the cutbuffer - * and PRIMARY selection on the local X11 display. + * and PRIMARY and CLIPBOARD selection on the local X11 display. * - * We store the new cutbuffer and/or PRIMARY selection data in this - * constant sized array selection_str[]. * TODO: check if malloc does not cause performance issues (esp. WRT * SelectionNotify handling). */ -static char selection_str[PROP_MAX+1]; +static char cutbuffer_str[PROP_MAX+1]; +static char primary_str[PROP_MAX+1]; +static char clipboard_str[PROP_MAX+1]; /* * An X11 (not VNC) client on the local display has requested the selection @@ -44,10 +49,11 @@ static char selection_str[PROP_MAX+1]; * * n.b.: our caller already has the X_LOCK. */ -void selection_request(XEvent *ev) { +void selection_request(XEvent *ev, char *type) { XSelectionEvent notify_event; XSelectionRequestEvent *req_event; XErrorHandler old_handler; + char *str; unsigned int length; unsigned char *data; #ifndef XA_LENGTH @@ -67,11 +73,24 @@ void selection_request(XEvent *ev) { } else { notify_event.property = req_event->property; } - if (xcut_str) { - length = strlen(xcut_str); + + if (!strcmp(type, "PRIMARY")) { + str = xcut_str_primary; + } else if (!strcmp(type, "CLIPBOARD")) { + str = xcut_str_clipboard; + } else { + return; + } + if (str) { + length = strlen(str); } else { length = 0; } + if (debug_sel) { + rfbLog("%s\trequest event: owner=0x%x requestor=0x%x sel=%03d targ=%d prop=%d\n", + type, req_event->owner, req_event->requestor, req_event->selection, + req_event->target, req_event->property); + } /* the window may have gone away, so trap errors */ trapped_xerror = 0; @@ -89,7 +108,7 @@ void selection_request(XEvent *ev) { } else { /* data request */ - data = (unsigned char *)xcut_str; + data = (unsigned char *)str; XChangeProperty(ev->xselectionrequest.display, ev->xselectionrequest.requestor, @@ -104,7 +123,7 @@ void selection_request(XEvent *ev) { } if (trapped_xerror) { rfbLog("selection_request: ignored XError while sending " - "PRIMARY selection to 0x%x.\n", req_event->requestor); + "%s selection to 0x%x.\n", type, req_event->requestor); } XSetErrorHandler(old_handler); trapped_xerror = 0; @@ -114,6 +133,9 @@ void selection_request(XEvent *ev) { int check_sel_direction(char *dir, char *label, char *sel, int len) { int db = 0, ok = 1; + if (debug_sel) { + db = 1; + } if (sel_direction) { if (strstr(sel_direction, "debug")) { db = 1; @@ -132,7 +154,7 @@ int check_sel_direction(char *dir, char *label, char *sel, int len) { if (len < n) { str[len] = '\0'; } - rfbLog("%s: %s...\n", label, str); + rfbLog("%s: '%s'\n", label, str); if (ok) { rfbLog("%s: %s-ing it.\n", label, dir); } else { @@ -154,10 +176,11 @@ void cutbuffer_send(void) { unsigned long nitems = 0, bytes_after = 0; unsigned char* data = NULL; - selection_str[0] = '\0'; + cutbuffer_str[0] = '\0'; slen = 0; - /* read the property value into selection_str: */ + + /* read the property value into cutbuffer_str: */ do { if (XGetWindowProperty(dpy, DefaultRootWindow(dpy), XA_CUT_BUFFER0, nitems/4, PROP_MAX/16, False, @@ -172,14 +195,18 @@ void cutbuffer_send(void) { XFree(data); break; } - memcpy(selection_str+slen, data, dlen); + memcpy(cutbuffer_str+slen, data, dlen); slen += dlen; - selection_str[slen] = '\0'; + cutbuffer_str[slen] = '\0'; XFree(data); } } while (bytes_after > 0); - selection_str[PROP_MAX] = '\0'; + cutbuffer_str[PROP_MAX] = '\0'; + + if (debug_sel) { + rfbLog("cutbuffer_send: '%s'\n", cutbuffer_str); + } if (! all_clients_initialized()) { rfbLog("cutbuffer_send: no send: uninitialized clients\n"); @@ -193,9 +220,9 @@ void cutbuffer_send(void) { if (!screen) { return; } - len = strlen(selection_str); - if (check_sel_direction("send", "cutbuffer_send", selection_str, len)) { - rfbSendServerCutText(screen, selection_str, len); + len = strlen(cutbuffer_str); + if (check_sel_direction("send", "cutbuffer_send", cutbuffer_str, len)) { + rfbSendServerCutText(screen, cutbuffer_str, len); } } @@ -219,18 +246,41 @@ void selection_send(XEvent *ev) { char before[CHKSZ], after[CHKSZ]; unsigned long nitems = 0, bytes_after = 0; unsigned char* data = NULL; + char *selection_str; /* * remember info about our last value of PRIMARY (or CUT_BUFFER0) * so we can check for any changes below. */ + if (ev->xselection.selection == XA_PRIMARY) { + if (! watch_primary) { + return; + } + selection_str = primary_str; + if (debug_sel) { + rfbLog("selection_send: event PRIMARY prop: %d requestor: 0x%x atom: %d\n", + ev->xselection.property, ev->xselection.requestor, ev->xselection.selection); + } + } else if (clipboard_atom && ev->xselection.selection == clipboard_atom) { + if (! watch_clipboard) { + return; + } + selection_str = clipboard_str; + if (debug_sel) { + rfbLog("selection_send: event CLIPBOARD prop: %d requestor: 0x%x atom: %d\n", + ev->xselection.property, ev->xselection.requestor, ev->xselection.selection); + } + } else { + return; + } + oldlen = strlen(selection_str); strncpy(before, selection_str, CHKSZ); selection_str[0] = '\0'; slen = 0; - /* read in the current value of PRIMARY: */ + /* read in the current value of PRIMARY or CLIPBOARD: */ do { if (XGetWindowProperty(dpy, ev->xselection.requestor, ev->xselection.property, nitems/4, PROP_MAX/16, True, @@ -248,9 +298,11 @@ void selection_send(XEvent *ev) { err = 5; } rfbLog("warning: truncating large PRIMARY" - " selection > %d bytes.\n", PROP_MAX); + "/CLIPBOARD selection > %d bytes.\n", + PROP_MAX); break; } +if (debug_sel) fprintf(stderr, "selection_send: data: '%s' dlen: %d nitems: %d ba: %d\n", data, dlen, nitems, bytes_after); memcpy(selection_str+slen, data, dlen); slen += dlen; selection_str[slen] = '\0'; @@ -269,6 +321,11 @@ void selection_send(XEvent *ev) { oldlen = -1; sent_one = 1; } + if (debug_sel) { + rfbLog("selection_send: %s '%s'\n", + ev->xselection.selection == XA_PRIMARY ? "PRIMARY " : "CLIPBOARD", + selection_str); + } /* look for changes in the new value */ newlen = strlen(selection_str); @@ -276,6 +333,9 @@ void selection_send(XEvent *ev) { if (oldlen == newlen && strncmp(before, after, CHKSZ) == 0) { /* evidently no change */ + if (debug_sel) { + rfbLog("selection_send: no change.\n"); + } return; } if (newlen == 0) { diff --git a/x11vnc/selection.h b/x11vnc/selection.h index 5ffab44..dbdecc6 100644 --- a/x11vnc/selection.h +++ b/x11vnc/selection.h @@ -3,13 +3,18 @@ /* -- selection.h -- */ -extern char *xcut_str; -extern int own_selection; +extern char *xcut_str_primary; +extern char *xcut_str_clipboard; +extern int own_primary; +extern int set_primary; +extern int own_clipboard; +extern int set_clipboard; extern int set_cutbuffer; extern int sel_waittime; extern Window selwin; +extern Atom clipboard_atom; -extern void selection_request(XEvent *ev); +extern void selection_request(XEvent *ev, char *type); extern int check_sel_direction(char *dir, char *label, char *sel, int len); extern void cutbuffer_send(void); extern void selection_send(XEvent *ev); diff --git a/x11vnc/sslcmds.c b/x11vnc/sslcmds.c index 1fc0144..63ffacf 100644 --- a/x11vnc/sslcmds.c +++ b/x11vnc/sslcmds.c @@ -96,6 +96,14 @@ int start_stunnel(int stunnel_port, int x11vnc_port) { return 0; } + if (no_external_cmds) { + rfbLogEnable(1); + rfbLog("start_stunnel: cannot run external commands in -nocmds mode:\n"); + rfbLog(" \"%s\"\n", stunnel_path); + rfbLog(" exiting.\n"); + clean_up_exit(1); + } + if (! quiet) { rfbLog("\n"); rfbLog("starting ssl tunnel: %s %d -> %d\n", stunnel_path, diff --git a/x11vnc/tkx11vnc b/x11vnc/tkx11vnc index c191662..4b493fc 100755 --- a/x11vnc/tkx11vnc +++ b/x11vnc/tkx11vnc @@ -95,18 +95,22 @@ Actions -- =RA ping =RA update-all - -- + =GAL Settings:: =GA save-settings =SFA load-settings: =SA defaults-all =0SA clear-all + -- + =F rc: + norc + =GAL LOFF -- D =DRA stop+quit =DGA Quit Help =DGA gui - =GA all + =DGA all Clients =DRQA current: @@ -119,10 +123,12 @@ Clients vncconnect -- D filexfer + =GAL Java-applet:: =D http httpdir: httpport: enablehttpproxy + =GAL LOFF Displays =D display: @@ -135,7 +141,6 @@ Screen =DRA refresh =RA reset =RA blacken - fixscreen: -- D =D scale: scale_cursor: @@ -163,14 +168,17 @@ Screen =-C:resize,newfbsize,exit xrandr_mode: padgeom: =GAL LOFF - -- + =GAL Clipping:: =P blackout: xinerama clip: - -- + =GAL LOFF + =GAL Misc-Screen:: + fixscreen: visual: rawfb: pipeinput: + =GAL LOFF Keyboard =D norepeat @@ -212,28 +220,26 @@ Misc -- D =GA all-settings =RA remote-cmd: - -- - =F rc: - norc - filexfer - -- - nofb - =D nobell - nolookup =GAL Selection:: =D nosel noprimary + nosetprimary + noclipboard + nosetclipboard seldir: =GAL LOFF - -- + =GAL X-ext:: xtrap xrecord =RQA reset_record + =GAL LOFF -- + nofb + =D nobell + nolookup bg =-C:ignore,exit sigpipe: =0 inetd - rfbwait: Debugging debug_pointer @@ -250,6 +256,7 @@ Debugging debug_scroll debug_tiles debug_grabs + debug_sel dbg =GAL LOFF =GA show-start-cmd @@ -258,39 +265,41 @@ Debugging Permissions =DRQA lock =DRQA unlock + =D shared + =D forever -- =DFP allow: =D localhost =RA allowonce: listen: -- D - =D shared - =D forever - timeout: - -- =D viewonly input: -- - safer - unsafe - =RA noremote - -- =GAL Passwords:: passwd: viewpasswd: =F passwdfile: =F rfbauth: + usepw + -- unixpw unixpw_list: unixpw_nis unixpw_nis_list: =0 storepasswd =GAL LOFF + =GAL Safe:: + safer + unsafe + =RA noremote + =GAL LOFF =GAL Misc-Perms:: =0S alwaysshared =0S nevershared =0S dontdisconnect =SQA deny_all + timeout: stunnel =F stunnel_pem: =GAL LOFF @@ -344,6 +353,7 @@ Tuning snapfb threads wmdt: + rfbwait: =GAL LOFF " } @@ -786,6 +796,7 @@ should never use them and just use x11vnc's -shared and -forever options instead (these give basically the same functionality and if you mixed them too much unexpected things may happen). " +#' set helptext(AlphaBlending:) " In this sub-menu we provide some tweak parameters for cursors (little @@ -808,6 +819,7 @@ The items in this sub-menu let you tweak x11vnc's approximation scheme for cursors with transparency. Hopefully you won't have to use them. Certain cursor \"themes\" may require adjustment however. " +#' set helptext(OverlayVisuals:) " In this sub-menu are some options that involve fixing color problems for \"Overlay\" or \"Multi-Depth\" visuals. This problem is rare @@ -925,6 +937,48 @@ as a speedup for its activities (the network is much slower than video hardware writes, and the video hardware reads that x11vnc uses to poll the screen are still slow today). " +#'" + + set helptext(Safe:) " +In this sub-menu are some options for making x11vnc operations +more, or less, safe. E.g. disable the running of external commands, etc. + +You can also turn off the Remote control channel (NOTE that doing that +will disable the GUI from being able to communicate with x11vnc). +" + + set helptext(X-ext:) " +In this sub-menu are a few rarely used options regarding some X extensions +used by x11vnc. +" + set helptext(Clipping:) " +In this sub-menu are some options regarding clipping or blacking out +portions of the Screen. E.g. under XINERAMA when the multiple monitors +are not the same size. + +" + set helptext(Misc-Screen:) " +In this sub-menu are some little used options modifying aspects of +the screen source. +" + + set helptext(Settings:) " +In this sub-menu are some options for saving and loading option settings. +The default file to store settings in is ~/.x11vncrc, but you can save +different \"profiles\" in other files for later use. + +" + set helptext(Java-applet:) " +In this sub-menu are some options for running the built-in HTTP server +that delivers the TightVNC Java VNC Viewer applet (VncViewer.jar) to +clients. The viewer runs in their Web browser. + +The default port listened on is 5800, so the URL is typically: + + http://hostname:5800/ + +but this can be altered by -httpport, etc. +" set helptext(ScrollCopyRect:) " This sub-menu has some options for the x11vnc Scroll detection and diff --git a/x11vnc/tkx11vnc.h b/x11vnc/tkx11vnc.h index e9f120b..506eda3 100644 --- a/x11vnc/tkx11vnc.h +++ b/x11vnc/tkx11vnc.h @@ -106,18 +106,22 @@ char gui_code[] = ""; " --\n" " =RA ping\n" " =RA update-all\n" -" --\n" +" =GAL Settings::\n" " =GA save-settings\n" " =SFA load-settings:\n" " =SA defaults-all\n" " =0SA clear-all\n" +" --\n" +" =F rc:\n" +" norc\n" +" =GAL LOFF\n" " -- D\n" " =DRA stop+quit \n" " =DGA Quit \n" "\n" "Help\n" " =DGA gui\n" -" =GA all\n" +" =DGA all\n" "\n" "Clients\n" " =DRQA current:\n" @@ -130,10 +134,12 @@ char gui_code[] = ""; " vncconnect\n" " -- D\n" " filexfer\n" +" =GAL Java-applet::\n" " =D http\n" " httpdir:\n" " httpport:\n" " enablehttpproxy\n" +" =GAL LOFF\n" "\n" "Displays\n" " =D display:\n" @@ -146,7 +152,6 @@ char gui_code[] = ""; " =DRA refresh\n" " =RA reset\n" " =RA blacken\n" -" fixscreen:\n" " -- D\n" " =D scale:\n" " scale_cursor:\n" @@ -174,14 +179,17 @@ char gui_code[] = ""; " =-C:resize,newfbsize,exit xrandr_mode:\n" " padgeom:\n" " =GAL LOFF\n" -" --\n" +" =GAL Clipping::\n" " =P blackout:\n" " xinerama\n" " clip:\n" -" --\n" +" =GAL LOFF\n" +" =GAL Misc-Screen::\n" +" fixscreen:\n" " visual:\n" " rawfb:\n" " pipeinput:\n" +" =GAL LOFF\n" "\n" "Keyboard\n" " =D norepeat\n" @@ -223,28 +231,26 @@ char gui_code[] = ""; " -- D\n" " =GA all-settings\n" " =RA remote-cmd:\n" -" --\n" -" =F rc:\n" -" norc\n" -" filexfer\n" -" --\n" -" nofb\n" -" =D nobell\n" -" nolookup\n" " =GAL Selection::\n" " =D nosel\n" " noprimary\n" +" nosetprimary\n" +" noclipboard\n" +" nosetclipboard\n" " seldir:\n" " =GAL LOFF\n" -" --\n" +" =GAL X-ext::\n" " xtrap\n" " xrecord\n" " =RQA reset_record\n" +" =GAL LOFF\n" " --\n" +" nofb\n" +" =D nobell\n" +" nolookup\n" " bg\n" " =-C:ignore,exit sigpipe:\n" " =0 inetd\n" -" rfbwait:\n" "\n" "Debugging\n" " debug_pointer\n" @@ -261,6 +267,7 @@ char gui_code[] = ""; " debug_scroll\n" " debug_tiles\n" " debug_grabs\n" +" debug_sel\n" " dbg\n" " =GAL LOFF\n" " =GA show-start-cmd\n" @@ -269,39 +276,41 @@ char gui_code[] = ""; "Permissions\n" " =DRQA lock\n" " =DRQA unlock\n" +" =D shared\n" +" =D forever\n" " --\n" " =DFP allow:\n" " =D localhost\n" " =RA allowonce:\n" " listen:\n" " -- D\n" -" =D shared\n" -" =D forever\n" -" timeout:\n" -" --\n" " =D viewonly\n" " input:\n" " --\n" -" safer\n" -" unsafe\n" -" =RA noremote\n" -" --\n" " =GAL Passwords::\n" " passwd:\n" " viewpasswd:\n" " =F passwdfile:\n" " =F rfbauth:\n" +" usepw\n" +" --\n" " unixpw\n" " unixpw_list:\n" " unixpw_nis\n" " unixpw_nis_list:\n" " =0 storepasswd\n" " =GAL LOFF\n" +" =GAL Safe::\n" +" safer\n" +" unsafe\n" +" =RA noremote\n" +" =GAL LOFF\n" " =GAL Misc-Perms::\n" " =0S alwaysshared\n" " =0S nevershared\n" " =0S dontdisconnect\n" " =SQA deny_all\n" +" timeout:\n" " stunnel\n" " =F stunnel_pem:\n" " =GAL LOFF\n" @@ -355,6 +364,7 @@ char gui_code[] = ""; " snapfb\n" " threads\n" " wmdt:\n" +" rfbwait:\n" " =GAL LOFF\n" "\"\n" "}\n" @@ -797,6 +807,7 @@ char gui_code[] = ""; "instead (these give basically the same functionality and if you mixed\n" "them too much unexpected things may happen).\n" "\"\n" +"#'\n" "\n" " set helptext(AlphaBlending:) \"\n" "In this sub-menu we provide some tweak parameters for cursors (little\n" @@ -819,6 +830,7 @@ char gui_code[] = ""; "for cursors with transparency. Hopefully you won't have to use them.\n" "Certain cursor \\\"themes\\\" may require adjustment however.\n" "\"\n" +"#'\n" " set helptext(OverlayVisuals:) \"\n" "In this sub-menu are some options that involve fixing color problems\n" "for \\\"Overlay\\\" or \\\"Multi-Depth\\\" visuals. This problem is rare\n" @@ -936,6 +948,48 @@ char gui_code[] = ""; "hardware writes, and the video hardware reads that x11vnc uses to poll\n" "the screen are still slow today).\n" "\"\n" +"#'\"\n" +"\n" +" set helptext(Safe:) \"\n" +"In this sub-menu are some options for making x11vnc operations\n" +"more, or less, safe. E.g. disable the running of external commands, etc.\n" +"\n" +"You can also turn off the Remote control channel (NOTE that doing that\n" +"will disable the GUI from being able to communicate with x11vnc).\n" +"\"\n" +"\n" +" set helptext(X-ext:) \"\n" +"In this sub-menu are a few rarely used options regarding some X extensions\n" +"used by x11vnc.\n" +"\"\n" +" set helptext(Clipping:) \"\n" +"In this sub-menu are some options regarding clipping or blacking out\n" +"portions of the Screen. E.g. under XINERAMA when the multiple monitors\n" +"are not the same size.\n" +"\n" +"\"\n" +" set helptext(Misc-Screen:) \"\n" +"In this sub-menu are some little used options modifying aspects of\n" +"the screen source.\n" +"\"\n" +"\n" +" set helptext(Settings:) \"\n" +"In this sub-menu are some options for saving and loading option settings.\n" +"The default file to store settings in is ~/.x11vncrc, but you can save\n" +"different \\\"profiles\\\" in other files for later use.\n" +"\n" +"\"\n" +" set helptext(Java-applet:) \"\n" +"In this sub-menu are some options for running the built-in HTTP server\n" +"that delivers the TightVNC Java VNC Viewer applet (VncViewer.jar) to\n" +"clients. The viewer runs in their Web browser.\n" +"\n" +"The default port listened on is 5800, so the URL is typically:\n" +"\n" +" http://hostname:5800/\n" +"\n" +"but this can be altered by -httpport, etc.\n" +"\"\n" "\n" " set helptext(ScrollCopyRect:) \"\n" "This sub-menu has some options for the x11vnc Scroll detection and\n" diff --git a/x11vnc/unixpw.c b/x11vnc/unixpw.c index d7848d7..bb09d60 100644 --- a/x11vnc/unixpw.c +++ b/x11vnc/unixpw.c @@ -371,6 +371,10 @@ int su_verify(char *user, char *pass) { return 0; } } + if (no_external_cmds) { + rfbLog("su_verify: cannot run external commands.\n"); + clean_up_exit(1); + } #define SU_DEBUG 0 #if SU_DEBUG @@ -710,6 +714,7 @@ if (db) fprintf(stderr, "unixpw_verify: '%s' '%s'\n", user, db > 1 ? pass : "*** unixpw_accept(user); return; } else { + rfbLog("unixpw_verify: crypt_verify login for %s failed.\n", user); usleep(3000*1000); } } else { @@ -717,6 +722,7 @@ if (db) fprintf(stderr, "unixpw_verify: '%s' '%s'\n", user, db > 1 ? pass : "*** unixpw_accept(user); return; } + rfbLog("unixpw_verify: su_verify login for %s failed.\n", user); } if (tries < 2) { diff --git a/x11vnc/x11vnc.1 b/x11vnc/x11vnc.1 index e229327..ce87bbc 100644 --- a/x11vnc/x11vnc.1 +++ b/x11vnc/x11vnc.1 @@ -2,7 +2,7 @@ .TH X11VNC "1" "March 2006" "x11vnc " "User Commands" .SH NAME x11vnc - allow VNC connections to real X11 displays - version: 0.8.1, lastmod: 2006-03-06 + version: 0.8.1, lastmod: 2006-03-08 .SH SYNOPSIS .B x11vnc [OPTION]... @@ -373,6 +373,13 @@ If \fIstring\fR has the form "host" or "host:port" the connection is made once at startup. Use commas for a list of host's and host:port's. .IP +Note that unlike most vnc servers, x11vnc will require a +password for reverse as well as for forward connections. +(provided password auth has been enabled, \fB-rfbauth,\fR etc) +If you do not want to require a password for reverse +connections set X11VNC_REVERSE_CONNECTION_NO_AUTH=1 in +your environment before starting x11vnc. +.IP If \fIstring\fR contains "/" it is instead interpreted as a file to periodically check for new hosts. The first line is read and then the file is truncated. @@ -620,10 +627,13 @@ be readable. Passwords stored in /etc/shadow will be inaccessible unless run as root. This is called "NIS" mode simply because in most NIS setups the user encrypted passwords are accessible (e.g. "ypcat -passwd"). NIS is not required for this mode to -work, but it is unlikely it will work for any other -environment. All of the \fB-unixpw\fR options and contraints -apply. +passwd"). NIS is not required for this mode to work +(only that +.IR getpwnam (3) +return the encrpyted password +is required), but it is unlikely it will work for any +other environment. All of the \fB-unixpw\fR options and +contraints apply. .PP \fB-stunnel\fR \fI[pem]\fR .IP @@ -670,16 +680,33 @@ for more examples. Use version 3.x stunnel command line syntax instead of version 4.x .PP -\fB-nopw\fR +\fB-usepw\fR .IP -Disable the big warning message when you use x11vnc -without some sort of password. +If no other password method was supplied on the command +line, first look for ~/.vnc/passwd and if found use it +with \fB-rfbauth;\fR next, look for ~/.vnc/passwdfile and +use it with \fB-passwdfile;\fR otherwise, prompt the user +for a password to create ~/.vnc/passwd and use it with +the \fB-rfbauth\fR option. If none of these succeed x11vnc +exits immediately. +.IP +Note: \fB-unixpw\fR currently does not count as a password +method by this option. .PP \fB-storepasswd\fR \fIpass\fR \fIfile\fR .IP Store password \fIpass\fR as the VNC password in the file \fIfile\fR. Once the password is stored the program exits. Use the password via "\fB-rfbauth\fR \fIfile\fR" +.IP +If called with no arguments, i.e., "\fB-storepasswd\fR", +the user is prompted for a password and it is stored +in the file ~/.vnc/passwd +.PP +\fB-nopw\fR +.IP +Disable the big warning message when you use x11vnc +without some sort of password. .PP \fB-accept\fR \fIstring\fR .IP @@ -1183,7 +1210,7 @@ Note: XBell monitoring requires the XKEYBOARD extension. \fB-nosel\fR .IP Do not manage exchange of X selection/cutbuffer between -VNC viewers and the X server. +VNC viewers and the X server at all. .PP \fB-noprimary\fR .IP @@ -1191,6 +1218,22 @@ Do not poll the PRIMARY selection for changes to send back to clients. (PRIMARY is still set on received changes, however). .PP +\fB-nosetprimary\fR +.IP +Do not set the PRIMARY selection for changes received +from VNC clients. +.PP +\fB-noclipboard\fR +.IP +Do not poll the CLIPBOARD selection for changes to send +back to clients. (CLIPBOARD is still set on received +changes, however). +.PP +\fB-nosetclipboard\fR +.IP +Do not set the CLIPBOARD selection for changes +received from VNC clients. +.PP \fB-seldir\fR \fIstring\fR .IP If direction string is "send", only send the selection @@ -1740,6 +1783,11 @@ experience a lot of grab deadlock, please report a bug. Turn on debugging info printout with respect to XGrabServer() deadlock for \fB-scrollcopyrect__mode_.\fR .PP +\fB-debug_sel\fR +.IP +Turn on debugging info printout with respect to +PRIMARY, CLIPBOARD, and CUTBUFFER0 selections. +.PP \fB-pointer_mode\fR \fIn\fR .IP Various pointer motion update schemes. "\fB-pm\fR" is @@ -2288,7 +2336,9 @@ nodeny allow new connections, same as "unlock" .IP connect:host do reverse connection to host, "host" may be a comma separated list of hosts -or host:ports. See \fB-connect.\fR +or host:ports. See \fB-connect.\fR Passwords +required as with fwd connections. +See X11VNC_REVERSE_CONNECTION_NO_AUTH=1 .IP disconnect:host disconnect any clients from "host" same as "close:host". Use host @@ -2434,6 +2484,18 @@ noprimary enable \fB-noprimary\fR mode. .IP primary disable \fB-noprimary\fR mode. .IP +nosetprimary enable \fB-nosetprimary\fR mode. +.IP +setprimary disable \fB-nosetprimary\fR mode. +.IP +noclipboard enable \fB-noclipboard\fR mode. +.IP +clipboard disable \fB-noclipboard\fR mode. +.IP +nosetclipboard enable \fB-nosetclipboard\fR mode. +.IP +setclipboard disable \fB-nosetclipboard\fR mode. +.IP seldir:str set \fB-seldir\fR to "str" .IP cursor:mode enable \fB-cursor\fR "mode". @@ -2627,6 +2689,10 @@ debug_grabs enable \fB-debug_grabs\fR .IP nodebug_grabs disable \fB-debug_grabs\fR .IP +debug_sel enable \fB-debug_sel\fR +.IP +nodebug_sel disable \fB-debug_sel\fR +.IP dbg enable \fB-dbg\fR crash shell .IP nodbg disable \fB-dbg\fR crash shell @@ -2700,17 +2766,19 @@ shared noshared forever noforever once timeout filexfer nofilexfer deny lock nodeny unlock connect allowonce allow localhost nolocalhost listen lookup nolookup accept afteraccept gone shm noshm flipbyteorder -noflipbyteorder onetile noonetile solid_color solid -nosolid blackout xinerama noxinerama xtrap noxtrap -xrandr noxrandr xrandr_mode padgeom quiet q noquiet -modtweak nomodtweak xkb noxkb skip_keycodes sloppy_keys -nosloppy_keys skip_dups noskip_dups add_keysyms -noadd_keysyms clear_mods noclear_mods clear_keys -noclear_keys remap repeat norepeat fb nofb bell -nobell sel nosel primary noprimary seldir cursorshape -nocursorshape cursorpos nocursorpos cursor show_cursor -noshow_cursor nocursor arrow xfixes noxfixes xdamage -noxdamage xd_area xd_mem alphacut alphafrac alpharemove +noflipbyteorder onetile noonetile solid_color +solid nosolid blackout xinerama noxinerama xtrap +noxtrap xrandr noxrandr xrandr_mode padgeom quiet q +noquiet modtweak nomodtweak xkb noxkb skip_keycodes +sloppy_keys nosloppy_keys skip_dups noskip_dups +add_keysyms noadd_keysyms clear_mods noclear_mods +clear_keys noclear_keys remap repeat norepeat fb nofb +bell nobell sel nosel primary noprimary setprimary +nosetprimary clipboard noclipboard setclipboard +nosetclipboard seldir cursorshape nocursorshape +cursorpos nocursorpos cursor show_cursor noshow_cursor +nocursor arrow xfixes noxfixes xdamage noxdamage +xd_area xd_mem alphacut alphafrac alpharemove noalpharemove alphablend noalphablend xwarppointer xwarp noxwarppointer noxwarp buttonmap dragging nodragging wireframe_mode wireframe wf nowireframe diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c index 540db93..26d78fa 100644 --- a/x11vnc/x11vnc.c +++ b/x11vnc/x11vnc.c @@ -140,6 +140,7 @@ #include "unixpw.h" #include "inet.h" #include "sslcmds.h" +#include "selection.h" /* * main routine for the x11vnc program @@ -950,6 +951,7 @@ static void quick_pw(char *str) { } fprintf(stdout, "password: "); + /* no_external_cmds does not apply */ system("stty -echo"); if(fgets(tmp, 128, stdin) == NULL) { fprintf(stdout, "\n"); @@ -1241,6 +1243,7 @@ static void check_loop_mode(int argc, char* argv[]) { perror("fork"); exit(1); } else { + /* no_external_cmds does not apply */ execvp(argv[0], argv2); exit(1); } @@ -1262,6 +1265,91 @@ static void check_loop_mode(int argc, char* argv[]) { #endif } } +static void store_homedir_passwd(void) { + char str1[32], str2[32], *p, *h, *f; + struct stat sbuf; + + str1[0] = '\0'; + str2[0] = '\0'; + + if (no_external_cmds) { + fprintf(stderr, "-nocmds cannot be used with -storepasswd\n"); + exit(1); + } + + fprintf(stderr, "Enter VNC password: "); + system("stty -echo"); + if (fgets(str1, 32, stdin) == NULL) { + system("stty echo"); + exit(1); + } + fprintf(stderr, "\n"); + + fprintf(stderr, "Verify password: "); + if (fgets(str2, 32, stdin) == NULL) { + system("stty echo"); + exit(1); + } + fprintf(stderr, "\n"); + system("stty echo"); + + if ((p = strchr(str1, '\n')) != NULL) { + *p = '\0'; + } + if ((p = strchr(str2, '\n')) != NULL) { + *p = '\0'; + } + if (strcmp(str1, str2)) { + fprintf(stderr, "** passwords differ.\n"); + exit(1); + } + if (str1[0] == '\0') { + fprintf(stderr, "** no password supplied.\n"); + exit(1); + } + + h = getenv("HOME"); + if (! h) { + fprintf(stderr, "** $HOME not set.\n"); + exit(1); + } + + f = (char *) malloc(strlen(h) + strlen("/.vnc/passwd") + 1); + sprintf(f, "%s/.vnc", h); + + if (stat(f, &sbuf) != 0) { + if (mkdir(f, 0755) != 0) { + fprintf(stderr, "** could not create directory %s\n", f); + perror("mkdir"); + exit(1); + } + } else if (! S_ISDIR(sbuf.st_mode)) { + fprintf(stderr, "** not a directory %s\n", f); + exit(1); + } + + sprintf(f, "%s/.vnc/passwd", h); + fprintf(stderr, "Write password to %s? [y]/n ", f); + + if (fgets(str2, 32, stdin) == NULL) { + exit(1); + } + if (str2[0] == 'n' || str2[0] == 'N') { + fprintf(stderr, "not creating password.\n"); + exit(1); + } + + if (rfbEncryptAndStorePasswd(str1, f) != 0) { + fprintf(stderr, "** error creating password.\n"); + perror("storepasswd"); + exit(1); + } + fprintf(stderr, "Password written to: %s\n", f); + if (stat(f, &sbuf) != 0) { + exit(1); + } + exit(0); +} #define SHOW_NO_PASSWORD_WARNING \ (!got_passwd && !got_rfbauth && (!got_passwdfile || !passwd_list) \ @@ -1284,6 +1372,7 @@ int main(int argc, char* argv[]) { int dt = 0, bg = 0; int got_rfbwait = 0; int got_httpdir = 0, try_http = 0; + int usepw = 0; /* used to pass args we do not know about to rfbGetScreen(): */ int argc_vnc = 1; char *argv_vnc[128]; @@ -1519,7 +1608,13 @@ int main(int argc, char* argv[]) { } } else if (!strcmp(arg, "-nopw")) { nopw = 1; + } else if (!strcmp(arg, "-usepw")) { + usepw = 1; } else if (!strcmp(arg, "-storepasswd")) { + if (i+1 >= argc) { + store_homedir_passwd(); + exit(0); + } if (i+2 >= argc || rfbEncryptAndStorePasswd(argv[i+1], argv[i+2]) != 0) { fprintf(stderr, "-storepasswd failed\n"); @@ -1667,8 +1762,15 @@ int main(int argc, char* argv[]) { } else if (!strcmp(arg, "-nosel")) { watch_selection = 0; watch_primary = 0; + watch_clipboard = 0; } else if (!strcmp(arg, "-noprimary")) { watch_primary = 0; + } else if (!strcmp(arg, "-nosetprimary")) { + set_primary = 0; + } else if (!strcmp(arg, "-noclipboard")) { + watch_clipboard = 0; + } else if (!strcmp(arg, "-nosetclipboard")) { + set_clipboard = 0; } else if (!strcmp(arg, "-seldir")) { CHECK_ARGC sel_direction = strdup(argv[++i]); @@ -1890,6 +1992,8 @@ int main(int argc, char* argv[]) { debug_tiles++; } else if (!strcmp(arg, "-debug_grabs")) { debug_grabs++; + } else if (!strcmp(arg, "-debug_sel")) { + debug_sel++; } else if (!strcmp(arg, "-grab_buster")) { grab_buster++; } else if (!strcmp(arg, "-nograb_buster")) { @@ -2109,6 +2213,83 @@ int main(int argc, char* argv[]) { } } + if (usepw && ! got_rfbauth && ! got_passwd && ! got_passwdfile) { + char *f, *h = getenv("HOME"); + struct stat sbuf; + int found = 0, set_rfbauth = 0; + + if (!h) { + rfbLog("HOME unset in -usepw mode.\n"); + exit(1); + } + f = (char *) malloc(strlen(h)+strlen("/.vnc/passwdfile") + 1); + + sprintf(f, "%s/.vnc/passwd", h); + if (stat(f, &sbuf) == 0) { + found = 1; + if (! quiet) { + rfbLog("-usepw: found %s\n", f); + } + got_rfbauth = 1; + set_rfbauth = 1; + } + + sprintf(f, "%s/.vnc/passwdfile", h); + if (! found && stat(f, &sbuf) == 0) { + found = 1; + if (! quiet) { + rfbLog("-usepw: found %s\n", f); + } + got_passwdfile = 1; + passwdfile = strdup(f); + } + +#if LIBVNCSERVER_HAVE_FORK +#if LIBVNCSERVER_HAVE_SYS_WAIT_H +#if LIBVNCSERVER_HAVE_WAITPID + if (! found) { + pid_t pid = fork(); + if (pid < 0) { + ; + } else if (pid == 0) { + execlp(argv[0], argv[0], "-storepasswd", + (char *) NULL); + exit(1); + } else { + int s; + waitpid(pid, &s, 0); + if (WIFEXITED(s) && WEXITSTATUS(s) == 0) { + got_rfbauth = 1; + set_rfbauth = 1; + found = 1; + } + } + } +#endif +#endif +#endif + + if (set_rfbauth) { + sprintf(f, "%s/.vnc/passwd", h); + if (argc_vnc < 100) { + argv_vnc[argc_vnc++] = strdup("-rfbauth"); + } else { + exit(1); + } + if (argc_vnc < 100) { + argv_vnc[argc_vnc++] = strdup(f); + } else { + exit(1); + } + } + if (! found) { + fprintf(stderr, "x11vnc -usepw: could not find" + " a password to use.\n"); + exit(1); + } + free(f); + } + if (got_rfbauth && (got_passwd || got_viewpasswd || got_passwdfile)) { fprintf(stderr, "option -rfbauth is incompatible with:\n"); fprintf(stderr, " -passwd, -viewpasswd, and -passwdfile\n"); diff --git a/x11vnc/x11vnc.h b/x11vnc/x11vnc.h index e52c414..10355b6 100644 --- a/x11vnc/x11vnc.h +++ b/x11vnc/x11vnc.h @@ -37,9 +37,10 @@ /****************************************************************************/ -/* Build-time customization via CPPFLAGS. */ /* + * Build-time customization via CPPFLAGS. + * * Summary of options to include in CPPFLAGS for custom builds: * * -DVNCSHARED to have the vnc display shared by default. @@ -63,6 +64,7 @@ * -DWIREFRAME_PARMS=... set default -wirecopyrect parameters. * -DSCROLL_COPYRECT=0 to have -noscrollcopyrect as the default. * -DSCROLL_COPYRECT_PARMS=... set default -scrollcopyrect parameters. + * -DSCALING_COPYRECT=0 * -DXDAMAGE=0 to have -noxdamage as the default. * -DSKIPDUPS=0 to have -noskip_dups as the default or vice versa. * @@ -71,6 +73,8 @@ * -DSMALL_FOOTPRINT=1 for smaller binary size (no help, no gui, etc) * use 2 or 3 for even smaller footprint. * -DNOGUI do not include the gui tkx11vnc. + * -DPOLL_8TO24_DELAY=N + * -DDEBUG_XEVENTS=1 enable printout for X events. * * Set these in CPPFLAGS before running configure. E.g.: * diff --git a/x11vnc/x11vnc_defs.c b/x11vnc/x11vnc_defs.c index f91ba49..9e090d1 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.1 lastmod: 2006-03-06"; +char lastmod[] = "0.8.1 lastmod: 2006-03-08"; /* X display info */ diff --git a/x11vnc/xevents.c b/x11vnc/xevents.c index 3e9401b..69c332f 100644 --- a/x11vnc/xevents.c +++ b/x11vnc/xevents.c @@ -19,6 +19,7 @@ int sync_tod_delay = 3; void initialize_vnc_connect_prop(void); void initialize_x11vnc_remote_prop(void); +void initialize_clipboard_atom(void); void spawn_grab_buster(void); void sync_tod_with_servertime(void); void check_keycode_state(void); @@ -45,11 +46,25 @@ void initialize_x11vnc_remote_prop(void) { x11vnc_remote_prop = XInternAtom(dpy, "X11VNC_REMOTE", False); } +void initialize_clipboard_atom(void) { + clipboard_atom = XInternAtom(dpy, "CLIPBOARD", False); + if (clipboard_atom == None) { + if (! quiet) rfbLog("could not find atom CLIPBOARD\n"); + if (watch_clipboard) { + watch_clipboard = 0; + } + if (set_clipboard) { + set_clipboard = 0; + } + } +} + static void initialize_xevents(void) { static int did_xselect_input = 0; static int did_xcreate_simple_window = 0; static int did_vnc_connect_prop = 0; static int did_x11vnc_remote_prop = 0; + static int did_clipboard_atom = 0; static int did_xfixes = 0; static int did_xdamage = 0; static int did_xrandr = 0; @@ -90,6 +105,10 @@ static void initialize_xevents(void) { kill(run_gui_pid, SIGUSR1); run_gui_pid = 0; } + if (!did_clipboard_atom) { + initialize_clipboard_atom(); + did_clipboard_atom = 1; + } if (xfixes_present && use_xfixes && !did_xfixes) { initialize_xfixes(); did_xfixes = 1; @@ -662,13 +681,13 @@ void check_xevents(void) { XEvent xev; int tmp, have_clients = 0; static int sent_some_sel = 0; - static time_t last_request = 0; static time_t last_call = 0; static time_t last_bell = 0; static time_t last_init_check = 0; static time_t last_sync = 0; static time_t last_time_sync = 0; time_t now = time(0); + static double last_request = 0.0; if (raw_fb && ! dpy) return; /* raw_fb hack */ @@ -798,56 +817,119 @@ void check_xevents(void) { #endif /* check for our PRIMARY request notification: */ - if (watch_primary) { + if (watch_primary || watch_clipboard) { + int doprimary = 1, doclipboard = 2, which, own; + double delay = 1.0; + Atom atom; + char *req; + if (XCheckTypedEvent(dpy, SelectionNotify, &xev)) { if (xev.type == SelectionNotify && xev.xselection.requestor == selwin && - xev.xselection.selection == XA_PRIMARY && xev.xselection.property != None && xev.xselection.target == XA_STRING) { - - /* go retrieve PRIMARY and check it */ - if (now > last_client + sel_waittime - || sent_some_sel) { - selection_send(&xev); + Atom s = xev.xselection.selection; + if (s == XA_PRIMARY || s == clipboard_atom) { + /* go retrieve it and check it */ + if (now > last_client + sel_waittime + || sent_some_sel) { + selection_send(&xev); + } } } } - if (now > last_request) { + /* + * Every second or so, request PRIMARY or CLIPBOARD, + * unless we already own it or there is no owner or we + * have no clients. + * TODO: even at this low rate we should look into + * and performance problems in odds cases (large text, + * modem, etc.) + */ + which = 0; + if (watch_primary && watch_clipboard && ! own_clipboard && + ! own_primary) { + delay = 0.6; + } + if (dnow() > last_request + delay) { /* - * Every second or two, request PRIMARY, unless we - * already own it or there is no owner or we have - * no clients. - * TODO: even at this low rate we should look into - * and performance problems in odds cases, etc. + * It is not a good idea to do both at the same + * time so we must choose one: */ - last_request = now; - if (! own_selection && have_clients && - XGetSelectionOwner(dpy, XA_PRIMARY) != None) { - XConvertSelection(dpy, XA_PRIMARY, XA_STRING, - XA_STRING, selwin, CurrentTime); + if (watch_primary && watch_clipboard) { + static int count = 0; + if (own_clipboard) { + which = doprimary; + } else if (own_primary) { + which = doclipboard; + } else if (count++ % 3 == 0) { + which = doclipboard; + } else { + which = doprimary; + } + } else if (watch_primary) { + which = doprimary; + } else if (watch_clipboard) { + which = doclipboard; + } + last_request = dnow(); + } + atom = None; + req = "none"; + if (which == doprimary) { + own = own_primary; + atom = XA_PRIMARY; + req = "PRIMARY"; + } else if (which == doclipboard) { + own = own_clipboard; + atom = clipboard_atom; + req = "CLIPBOARD"; + } + if (which != 0 && ! own && have_clients && + XGetSelectionOwner(dpy, atom) != None) { + XConvertSelection(dpy, atom, XA_STRING, XA_STRING, + selwin, CurrentTime); + if (debug_sel) { + rfbLog("request %s\n", req); } } } - if (own_selection) { - /* we own PRIMARY, see if someone requested it: */ + if (own_primary || own_clipboard) { + /* we own PRIMARY or CLIPBOARD, see if someone requested it: */ if (XCheckTypedEvent(dpy, SelectionRequest, &xev)) { - if (xev.type == SelectionRequest && + if (own_primary && xev.type == SelectionRequest && xev.xselectionrequest.selection == XA_PRIMARY) { - selection_request(&xev); + selection_request(&xev, "PRIMARY"); + } + if (own_clipboard && xev.type == SelectionRequest && + xev.xselectionrequest.selection == clipboard_atom) { + selection_request(&xev, "CLIPBOARD"); } } - /* we own PRIMARY, see if we no longer own it: */ + /* we own PRIMARY or CLIPBOARD, see if we no longer own it: */ if (XCheckTypedEvent(dpy, SelectionClear, &xev)) { - if (xev.type == SelectionClear && + if (own_primary && xev.type == SelectionClear && xev.xselectionclear.selection == XA_PRIMARY) { - - own_selection = 0; - if (xcut_str) { - free(xcut_str); - xcut_str = NULL; + own_primary = 0; + if (xcut_str_primary) { + free(xcut_str_primary); + xcut_str_primary = NULL; + } + if (debug_sel) { + rfbLog("Released PRIMARY.\n"); + } + } + if (own_clipboard && xev.type == SelectionClear && + xev.xselectionclear.selection == clipboard_atom) { + own_clipboard = 0; + if (xcut_str_clipboard) { + free(xcut_str_clipboard); + xcut_str_clipboard = NULL; + } + if (debug_sel) { + rfbLog("Released CLIPBOARD.\n"); } } } @@ -986,21 +1068,51 @@ void xcut_receive(char *text, int len, rfbClientPtr cl) { X_LOCK; /* associate this text with PRIMARY (and SECONDARY...) */ - if (! own_selection) { - own_selection = 1; + if (set_primary && ! own_primary) { + own_primary = 1; /* we need to grab the PRIMARY selection */ XSetSelectionOwner(dpy, XA_PRIMARY, selwin, CurrentTime); XFlush(dpy); + if (debug_sel) { + rfbLog("Own PRIMARY.\n"); + } + } + + if (set_clipboard && ! own_clipboard && clipboard_atom != None) { + own_clipboard = 1; + /* we need to grab the CLIPBOARD selection */ + XSetSelectionOwner(dpy, clipboard_atom, selwin, CurrentTime); + XFlush(dpy); + if (debug_sel) { + rfbLog("Own CLIPBOARD.\n"); + } } /* duplicate the text string for our own use. */ - if (xcut_str != NULL) { - free(xcut_str); - xcut_str = NULL; + if (set_primary) { + if (xcut_str_primary != NULL) { + free(xcut_str_primary); + xcut_str_primary = NULL; + } + xcut_str_primary = (char *) malloc((size_t) (len+1)); + strncpy(xcut_str_primary, text, len); + xcut_str_primary[len] = '\0'; /* make sure null terminated */ + if (debug_sel) { + rfbLog("Set PRIMARY '%s'\n", xcut_str_primary); + } + } + if (set_clipboard) { + if (xcut_str_clipboard != NULL) { + free(xcut_str_clipboard); + xcut_str_clipboard = NULL; + } + xcut_str_clipboard = (char *) malloc((size_t) (len+1)); + strncpy(xcut_str_clipboard, text, len); + xcut_str_clipboard[len] = '\0'; /* make sure null terminated */ + if (debug_sel) { + rfbLog("Set CLIPBOARD '%s'\n", xcut_str_clipboard); + } } - xcut_str = (char *) malloc((size_t) (len+1)); - strncpy(xcut_str, text, len); - xcut_str[len] = '\0'; /* make sure null terminated */ /* copy this text to CUT_BUFFER0 as well: */ XChangeProperty(dpy, rootwin, XA_CUT_BUFFER0, XA_STRING, 8, diff --git a/x11vnc/xevents.h b/x11vnc/xevents.h index 9c5a8dc..888891d 100644 --- a/x11vnc/xevents.h +++ b/x11vnc/xevents.h @@ -8,6 +8,7 @@ extern int sync_tod_delay; extern void initialize_vnc_connect_prop(void); extern void initialize_x11vnc_remote_prop(void); +extern void initialize_clipboard_atom(void); extern void spawn_grab_buster(void); extern void sync_tod_with_servertime(void); extern void check_keycode_state(void); |