From 4b89306d17a56210cf7d8c4da93ff585b166b3fb Mon Sep 17 00:00:00 2001 From: runge Date: Mon, 27 Dec 2004 22:07:55 +0000 Subject: [PATCH] x11vnc: improve XFIXES cursor transparency, more remote-control cmds. --- ChangeLog | 4 + x11vnc/ChangeLog | 8 + x11vnc/README | 714 ++++++++++++++++++---------------- x11vnc/tkx11vnc | 187 +++++++-- x11vnc/tkx11vnc.h | 187 +++++++-- x11vnc/x11vnc.1 | 150 ++++++-- x11vnc/x11vnc.c | 946 +++++++++++++++++++++++++++++++++++++--------- 7 files changed, 1590 insertions(+), 606 deletions(-) diff --git a/ChangeLog b/ChangeLog index 339433f..547f1cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-12-27 Karl Runge + * x11vnc: improve alpha channel handling for XFIXES cursors. + * add more parameters to remote control. + 2004-12-20 Johannes E. Schindelin * released version 0.7 diff --git a/x11vnc/ChangeLog b/x11vnc/ChangeLog index 42b6aef..641ffa7 100644 --- a/x11vnc/ChangeLog +++ b/x11vnc/ChangeLog @@ -1,3 +1,11 @@ +2004-12-27 Karl Runge + * allow -DLIBVNCSERVER_HAVE_FOO=0 override everything + * get_xfixes_cursor() try to more carefully convert alpha channel + to opaque pixel. Options -alphacut, -alphafrac, -alpharemove + * more commands under remote control: rfbwait, rfbport, http, + httpport, httpdir, enablehttpproxy, desktop, alwaysshared, + dontdisconnect. Add to tkx11vnc. + 2004-12-22 Karl Runge * final polishing for 0.7 release, tkx11vnc tweaks * more careful rfbPE in pick_window, start check_user_input4() diff --git a/x11vnc/README b/x11vnc/README index c196ebf..41d4c29 100644 --- a/x11vnc/README +++ b/x11vnc/README @@ -1,5 +1,5 @@ -x11vnc README file Date: Thu Dec 23 00:52:20 EST 2004 +x11vnc README file Date: Mon Dec 27 17:23:28 EST 2004 The following information is taken from these URLs: @@ -271,24 +271,26 @@ vncviewer -via $host localhost:0 # must be TightVNC vncviewer. SourceForge.net. I use libvncserver for all of the VNC aspects; I couldn't have done without it. The full source code may be found and downloaded (either file-release tarball or CVS tree) from the above - link. As of Aug 2004, the [21]x11vnc-0.6.2.tar.gz source package is - released (recommended download) . The x11vnc package is the subset of - the libvncserver package needed to build the x11vnc program. Please do - not use the LibVNCServer-0.6 tarball: it contains an older, more buggy - version of x11vnc (Oct 2003) that you likely want to avoid. Also, you - can get a copy of my latest, bleeding edge [22]x11vnc.c file to - replace the one in the above packages or the one in the CVS tree and - then rebuild. If you have an older libvncserver source tree, you may - need to switch on the OLD_TREE near the top of the x11vnc.c file. - - See the [23]FAQ below for information about where you might obtain a + link. As of Dec 2004, the [21]x11vnc-0.7.tar.gz source package is + released (recommended download) . The [22]x11vnc 0.7 release notes. + The x11vnc package is the subset of the libvncserver package needed to + build the x11vnc program. Please do not use the LibVNCServer-0.6 + tarball: it contains an older, more buggy version of x11vnc (Oct 2003) + that you likely want to avoid. Also, you can get a copy of my latest, + bleeding edge [23]x11vnc.c file to replace the one in the above + packages or the one in the CVS tree and then rebuild. You can also + update the tcl/tk gui with the [24]tkx11vnc.h file. If you have an + older libvncserver source tree, you may need to switch on the OLD_TREE + near the top of the x11vnc.c file. + + See the [25]FAQ below for information about where you might obtain a precompiled x11vnc binary from 3rd parties. To obtain VNC viewers for the viewing side (Windows, Mac OS, or Unix) try here: - * [24]http://www.tightvnc.com/download.html - * [25]http://www.realvnc.com/download-free.html - * [26]http://sourceforge.net/projects/cotvnc/ + * [26]http://www.tightvnc.com/download.html + * [27]http://www.realvnc.com/download-free.html + * [28]http://sourceforge.net/projects/cotvnc/ More tools: Here is a rsh/ssh wrapper script rx11vnc that attempts to automatically do the above Steps 1-3 for you (provided you have @@ -298,20 +300,20 @@ vncviewer -via $host localhost:0 # must be TightVNC vncviewer. that attempts to tunnel the vnc traffic through an ssh port redirection (and does not assume port 5900 is free). Have a look at them to see what they do and customize as needed: - * [27]rx11vnc wrapper script - * [28]rx11vnc.pl wrapper script to tunnel traffic thru ssh + * [29]rx11vnc wrapper script + * [30]rx11vnc.pl wrapper script to tunnel traffic thru ssh _________________________________________________________________ Building x11vnc: If your OS has libjpeg.so and libz.so in standard locations you can - build as follows (example given for the 0.6.2 release of x11vnc: - replace with the version you downloaded): + build as follows (example given for the 0.7 release of x11vnc: replace + with the version you downloaded): (un-tar the x11vnc+libvncserver tarball) -# gzip -dc x11vnc-0.6.2.tar.gz | tar -xvf - +# gzip -dc x11vnc-0.7.tar.gz | tar -xvf - (cd to the source directory) -# cd x11vnc-0.6.2 +# cd x11vnc-0.7 (run configure and then run make) # ./configure @@ -341,9 +343,9 @@ vncviewer -via $host localhost:0 # must be TightVNC vncviewer. libjpeg is included in Solaris 9 and later (/usr/sfw/include and /usr/sfw/lib), and zlib in Solaris 8 and later (/usr/include and /usr/lib). To get the source for these libraries: libjpeg is available - at [29]ftp://ftp.uu.net/graphics/jpeg/ and zlib at - [30]http://www.gzip.org/zlib/. See also - [31]http://www.sunfreeware.com/ for Solaris binary packages of these + at [31]ftp://ftp.uu.net/graphics/jpeg/ and zlib at + [32]http://www.gzip.org/zlib/. See also + [33]http://www.sunfreeware.com/ for Solaris binary packages of these libraries. Here is a build script that indicates one way to pass the library @@ -406,7 +408,7 @@ ls -l ./x11vnc/x11vnc x11vnc/x11vnc.c file. (This problem has been fixed as of x11vnc 0.6.2 (Aug/2004)) - If you need to build on Solaris 2.5.1 or earlier, see [32]this + If you need to build on Solaris 2.5.1 or earlier, see [34]this workaround FAQ. Building on HP-UX: For jpeg and zlib you will need to do the same @@ -437,7 +439,7 @@ ls -l ./x11vnc/x11vnc a solid background while using x11vnc. You can turn the pretty background image back on when you are using the display directly. - I also find the [33]tightvnc encoding gives the best response for my + I also find the [35]tightvnc encoding gives the best response for my usage (Unix <-> Unix over cable modem). One needs a tightvnc-aware vncviewer to take advantage of this encoding. @@ -453,10 +455,10 @@ ls -l ./x11vnc/x11vnc option where NNNN is the desired port number. Options: x11vnc has (far too) many features that may be activated - via its [34]command line options. Useful options are -nap to use fewer + via its [36]command line options. Useful options are -nap to use fewer resources (it sleeps more between polls when activity is low) and -rfbauth passwd-file to use VNC password protection (the vncpasswd or - storepasswd programs, or the x11vnc [35]-storepasswd option can be + storepasswd programs, or the x11vnc [37]-storepasswd option can be used to create the password file). Algorithm: How does x11vnc do it? Rather brute-forcedly: it @@ -480,14 +482,14 @@ ls -l ./x11vnc/x11vnc first testing out the programs. You get an interesting "feedback" effect where vncviewer images keep popping up each one contained in the previous one and slightly shifted a bit by the window manager - decorations. There will be an [36]even more interesting effect if + decorations. There will be an [38]even more interesting effect if -scale is used. Also, if the XKEYBOARD is supported and the XBell "beeps" once, you get an infinite loop of beeps going off. Although all of this is mildly exciting it is not much use: you will normally run and display the viewer on a different machine! SunRay notes: You can run x11vnc on your (connected or disconnected) - [37]SunRay session (Please remember to use -nap and maybe -wait 200 to + [39]SunRay session (Please remember to use -nap and maybe -wait 200 to avoid being a resource hog! It also helps a bit to have a solid background color). You have to know the name of the machine your SunRay session X server is running on. You also need to know the X11 @@ -551,7 +553,8 @@ ls -l ./x11vnc/x11vnc supplied. A similar thing is done on IRIX as well when -overlay is supplied. As of Dec/2004 x11vnc supports the XFIXES extension (in Xorg and Solaris 10) to query the X server for the exact cursor - shape, this works pretty well. + shape, this works pretty well except that cursors with + transparency (alpha channel) need to approximated via dithering. * Audio from applications is of course not redirected (separate redirectors do exist, e.g. esd). The XBell() "beeps" will work if the X server supports the XKEYBOARD extension. (Note that on @@ -561,209 +564,209 @@ ls -l ./x11vnc/x11vnc Evidently a timing related bug and difficult to reproduce... * Using -threads can expose some bugs in libvncserver. - Please feel free to [38]contact me if you have any questions, + Please feel free to [40]contact me if you have any questions, problems, or comments about x11vnc, etc. _________________________________________________________________ x11vnc FAQ: - [39]Q-1: I can't get x11vnc to start up. It says "XOpenDisplay failed + [41]Q-1: I can't get x11vnc to start up. It says "XOpenDisplay failed ((null))" or "Xlib: connection to ":0.0" refused by server". What do I need to do? - [40]Q-2: I can't get x11vnc and/or libvncserver to compile. + [42]Q-2: I can't get x11vnc and/or libvncserver to compile. - [41]Q-3: Help, I need to run x11vnc on Solaris 2.5.1 and it doesn't + [43]Q-3: Help, I need to run x11vnc on Solaris 2.5.1 and it doesn't compile! If I try to run a binary built on Solaris 2.6 I get: relocation error: file x11vnc: symbol XConvertCase: referenced symbol not found - [42]Q-4: Where can I get a precompiled x11vnc binary for my Operating + [44]Q-4: Where can I get a precompiled x11vnc binary for my Operating System? - [43]Q-5: Where can I get a VNC Viewer binary (or source code) for the + [45]Q-5: Where can I get a VNC Viewer binary (or source code) for the Operating System I will be viewing from? - [44]Q-6: How can I see all of x11vnc's command line options and + [46]Q-6: How can I see all of x11vnc's command line options and documentation on how to use them? - [45]Q-7: I don't like typing arcane command line options every time I - start x11vnc. What can I do? Is there a config file? Is there a GUI? + [47]Q-7: I don't like typing arcane command line options every time I + start x11vnc. What can I do? Is there a config file? Or a GUI? - [46]Q-8: Why does x11vnc exit as soon as the VNC viewer disconnects? + [48]Q-8: Why does x11vnc exit as soon as the VNC viewer disconnects? And why doesn't it allow more than one VNC viewer to connect at the same time? - [47]Q-9: I have two separate machine displays in front of me, one + [49]Q-9: I have two separate machine displays in front of me, one Windows the other X11: can I use x11vnc in combination with Win2VNC in dual-screen mode to pass the keystrokes and mouse motions to the X11 display? - [48]Q-10: I am running Win2VNC on my windows machine and trying to + [50]Q-10: I am running Win2VNC on my windows machine and trying to create a dual-screen mode with my second display by running "x11vnc -nofb". Whenever I initiate the connection Win2VNC quickly disconnects and x11vnc says something like: rfbProcessClientNormalMessage: read: Connection reset by peer - [49]Q-11: The X display I run x11vnc on is only 8 bits per pixel (bpp) + [51]Q-11: The X display I run x11vnc on is only 8 bits per pixel (bpp) PseudoColor (i.e. only 256 distinct colors). The x11vnc colors may start out OK, but after a while the colors are incorrect in certain windows. - [50]Q-12: Color problems: Why are the colors for some windows messed + [52]Q-12: Color problems: Why are the colors for some windows messed up in x11vnc? BTW, I have an X display that has nice overlay/multi-depth visuals of different color depths: e.g. there are both depth 8 and 24 visuals available at the same time. - [51]Q-13: How do I figure out the window id to supply to the -id + [53]Q-13: How do I figure out the window id to supply to the -id windowid option? - [52]Q-14: Why don't menus or other transient windows come up when I am + [54]Q-14: Why don't menus or other transient windows come up when I am using the -id windowid option to view a single application window? - [53]Q-15: Can I use x11vnc to view and interact with an Xterminal + [55]Q-15: Can I use x11vnc to view and interact with an Xterminal (e.g. NCD) that is not running UNIX and so x11vnc cannot be run on it directly? - [54]Q-16: Can I make x11vnc more quiet and also go into the background + [56]Q-16: Can I make x11vnc more quiet and also go into the background after starting up? - [55]Q-17: How do I stop x11vnc once it is running in the background? + [57]Q-17: How do I stop x11vnc once it is running in the background? - [56]Q-18: Can I change settings in x11vnc without having to restart + [58]Q-18: Can I change settings in x11vnc without having to restart it? Is there a way to remote control it? - [57]Q-19: Can I limit which machines incoming VNC clients can connect + [59]Q-19: Can I limit which machines incoming VNC clients can connect from? - [58]Q-20: How do I build x11vnc/libvncserver with libwrap + [60]Q-20: How do I build x11vnc/libvncserver with libwrap (tcp_wrappers) support? - [59]Q-21: Can I prompt the user at the local X display whether the + [61]Q-21: Can I prompt the user at the local X display whether the incoming VNC client should be accepted or not? Can I decide to make some clients view-only? How about running an arbitrary program to make the decisions? - [60]Q-22: How do I create a VNC password for use with x11vnc? + [62]Q-22: How do I create a VNC password for use with x11vnc? - [61]Q-23: How can I tunnel my connection to x11vnc via an encrypted + [63]Q-23: How can I tunnel my connection to x11vnc via an encrypted SSH channel between two Unix machines? - [62]Q-24: How can I tunnel my connection to x11vnc via an encrypted + [64]Q-24: How can I tunnel my connection to x11vnc via an encrypted SSH channel from Windows using an SSH client like Putty? - [63]Q-25: Does x11vnc support Unix usernames and passwords? Can I + [65]Q-25: Does x11vnc support Unix usernames and passwords? Can I further limit the set of Unix usernames who can connect to the VNC desktop? - [64]Q-26: Can I have two passwords for VNC viewers, one for full + [66]Q-26: Can I have two passwords for VNC viewers, one for full access and the other for view-only access to the display? - [65]Q-27: I use a screen-lock when I leave my workstation (e.g. + [67]Q-27: I use a screen-lock when I leave my workstation (e.g. xscreensaver or xlock). When I remotely access my workstation desktop via x11vnc I can unlock the desktop fine, but I am worried people will see my activities on the physical monitor. What can I do to prevent this, or at least make it more difficult? - [66]Q-28: Can I have x11vnc automatically lock the screen when I + [68]Q-28: Can I have x11vnc automatically lock the screen when I disconnect the VNC viewer? - [67]Q-29: Are reverse connections (i.e. the VNC server connecting to + [69]Q-29: Are reverse connections (i.e. the VNC server connecting to the VNC viewer) using "vncviewer -listen" and vncconnect(1) supported? - [68]Q-30: Sometimes when a VNC viewer dies abruptly, x11vnc also dies + [70]Q-30: Sometimes when a VNC viewer dies abruptly, x11vnc also dies with the error message like: "Broken pipe". I'm using the -forever mode and I want x11vnc to keep running. - [69]Q-31: How can I use x11vnc to connect to an X login screen like + [71]Q-31: How can I use x11vnc to connect to an X login screen like xdm, GNOME gdm, KDE kdm, or CDE dtlogin? (i.e. nobody is logged into an X session yet). - [70]Q-32: Can I run x11vnc out of inetd(1)? + [72]Q-32: Can I run x11vnc out of inetd(1)? - [71]Q-33: How do I make x11vnc work with the Java VNC viewer applet in + [73]Q-33: How do I make x11vnc work with the Java VNC viewer applet in a web browser? - [72]Q-34: Why isn't the mouse cursor shape (the little icon shape + [74]Q-34: Why isn't the mouse cursor shape (the little icon shape where the mouse pointer is) correct as I move from window to window? - [73]Q-35: Why does the mouse arrow just stay in one corner in my + [75]Q-35: Why does the mouse arrow just stay in one corner in my vncviewer, whereas my cursor (that does move) is just a dot? - [74]Q-36: Can I take advantage of the TightVNC extension to the VNC + [76]Q-36: Can I take advantage of the TightVNC extension to the VNC protocol where Cursor Positions Updates are sent back to all connected clients (i.e. passive viewers can see the mouse cursor being moved around by another viewer)? - [75]Q-37: Is it possible to swap the mouse buttons (e.g. left-handed + [77]Q-37: 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? - [76]Q-38: When I drag windows around with the mouse or scroll up and + [78]Q-38: 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? - [77]Q-39: I have lots of memory, but why does x11vnc fail with + [79]Q-39: I have lots of memory, but why does x11vnc fail with shmget: No space left on device or Minor opcode of failed request: 1 (X_ShmAttach)? - [78]Q-40: How can I make x11vnc use less system resources? + [80]Q-40: How can I make x11vnc use less system resources? - [79]Q-41: How can I make x11vnc use MORE system resources? + [81]Q-41: How can I make x11vnc use MORE system resources? - [80]Q-42: I use x11vnc over a slow link with high latency (e.g. dialup + [82]Q-42: I use x11vnc over a slow link with high latency (e.g. dialup modem), is there anything I can do to speed things up? - [81]Q-43: How can I get my AltGr and Shift modifiers to work between + [83]Q-43: How can I get my AltGr and Shift modifiers to work between keyboards for different languages? - [82]Q-44: When I try to type a "<" (i.e. less than) instead I get ">" + [84]Q-44: When I try to type a "<" (i.e. less than) instead I get ">" (i.e. greater than)! Strangely, typing ">" works OK!! - [83]Q-45: I'm using an "international" keyboard (e.g. German "de", or + [85]Q-45: I'm using an "international" keyboard (e.g. German "de", or Danish "dk") and the -modtweak mode works well if the VNC viewer is run on a Unix/Linux machine with a similar keyboard. But if I run the VNC viewer on Unix/Linux with a different keyboard (e.g. "us") or Windows with any keyboard, I can't type some keys like: "@", "$", "<", ">", etc. How can I fix this? - [84]Q-46: When typing I sometimes get double, triple, or more of my + [86]Q-46: When typing I sometimes get double, triple, or more of my keystrokes repeated. I'm sure I only typed them once, what can I do? - [85]Q-47: The machine where I run x11vnc has an AltGr key, but the + [87]Q-47: The machine where I run x11vnc has an AltGr key, but the local 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? - [86]Q-48: I have a Sun machine I run x11vnc on. Its Sun keyboard has + [88]Q-48: I have a Sun machine I run x11vnc on. Its Sun keyboard has just one Alt key labelled "Alt" and two Meta keys labelled with little diamonds. The machine where I run the VNC viewer only has Alt keys. How can I send a Meta keypress? (e.g. emacs needs this) - [87]Q-49: Can I map a keystroke to a mouse button click on the remote + [89]Q-49: Can I map a keystroke to a mouse button click on the remote machine? - [88]Q-50: The remote display is larger (in number of pixels) than the + [90]Q-50: The remote display is larger (in number of pixels) than the local display I am running the vncviewer on. I don't like the vncviewer scrollbars, what I can do? - [89]Q-51: Does x11vnc support server-side framebuffer scaling? (E.g. + [91]Q-51: Does x11vnc support server-side framebuffer scaling? (E.g. to make the desktop smaller). - [90]Q-52: Does x11vnc work with Xinerama? (i.e. multiple monitors + [92]Q-52: Does x11vnc work with Xinerama? (i.e. multiple monitors joined together to form one big, single screen). - [91]Q-53: Can I use x11vnc on a multi-headed display that is not + [93]Q-53: Can I use x11vnc on a multi-headed display that is not Xinerama (i.e. separate screens :0.0, :0.1, ... for each monitor)? - [92]Q-54: Does x11vnc support the XRANDR (X Resize, Rotate and + [94]Q-54: Does x11vnc support the XRANDR (X Resize, Rotate and Reflection) extension? Whenever I rotate or resize the screen x11vnc just seems to crash. - [93]Q-55: Why is the view in my VNC viewer completely black? Or why is + [95]Q-55: Why is the view in my VNC viewer completely black? Or why is everything flashing around randomly? - [94]Q-56: I use Linux Virtual Consoles (VC's) to implement 'Fast User + [96]Q-56: I use Linux Virtual Consoles (VC's) to implement 'Fast User Switching' between users' sessions (e.g. Betty is on Ctrl-Alt-F7, Bobby is on Ctrl-Alt-F8, and Sid is on Ctrl-Alt-F1: they use those keystrokes to switch between their sessions). How come the view in a @@ -771,13 +774,13 @@ ls -l ./x11vnc/x11vnc otherwise all messed up unless the X session x11vnc is attached to is in the active VC? - [95]Q-57: Does the Clipboard/Selection get transferred between the + [97]Q-57: Does the Clipboard/Selection get transferred between the vncviewer and the X display? - [96]Q-58: Why don't I hear the "Beeps" in my X session (e.g. when + [98]Q-58: Why don't I hear the "Beeps" in my X session (e.g. when typing tput bel in an xterm)? - [97]Q-59: I am using x11vnc where my local machine has "popup/hidden + [99]Q-59: I am using x11vnc where my local machine has "popup/hidden taskbars" (e.g. GNOME or MacOS X) and the remote display where x11vnc runs also has "popup/hidden taskbars" (e.g. GNOME). When I move the mouse to the edge of the screen where the popups happen, the taskbars @@ -826,6 +829,7 @@ ls -l ./x11vnc/x11vnc when logged into the display machine remotely, use xdpyinfo (if you see the informational output about the display you know it connected to the X server successfully). + Important: if you cannot get your X11 permissions so that the xclock or xdpyinfo tests work, x11vnc also will not work (all of these X clients must be able to connect to the X server to function). @@ -877,7 +881,7 @@ ls -l ./x11vnc/x11vnc is a workaround for Solaris 2.5.1 (and perhaps earlier): First use the environment settings (CPPFLAGS, LDFLAGS, etc.) in the - above [98]Solaris build script to run the configure command. That + above [100]Solaris build script to run the configure command. That should succeed without failure. Then, you have to hand edit the autogenerated rfb/rfbconfig.h file in the source tree, and just before the last #endif at the bottom of that file insert these workaround @@ -914,18 +918,18 @@ typedef unsigned int in_addr_t; Q-4: Where can I get a precompiled x11vnc binary for my Operating System? - Hopefully the [99]build steps above and [100]FAQ provide enough info + Hopefully the [101]build steps above and [102]FAQ provide enough info for a painless compile for most environments. Please report problems with the x11vnc configure, make, etc. on your system (if your system is known to compile other GNU packages successfully). There are precompiled x11vnc binaries made by other groups available at the following locations: - Debian: (.deb) [101]http://packages.debian.org/x11vnc + Debian: (.deb) [103]http://packages.debian.org/x11vnc - Slackware: (.tgz) [102]http://www.linuxpackages.net/ Redhat/Fedora: - (.rpm) [103]http://dag.wieers.com/packages/x11vnc/ wwexptools: (.tgz) - [104]http://www.bell-labs.com/project/wwexptools/packages.html The + Slackware: (.tgz) [104]http://www.linuxpackages.net/ Redhat/Fedora: + (.rpm) [105]http://dag.wieers.com/packages/x11vnc/ wwexptools: (.tgz) + [106]http://www.bell-labs.com/project/wwexptools/packages.html The last one, wwexptools, provides a variety of Unix binaries (Linux, Solaris, HP-UX, Irix, ...) with the intent of being compatible on a wide range of OS releases. Find x11vnc near the bottom of that page @@ -937,7 +941,7 @@ typedef unsigned int in_addr_t; this by looking at the x11vnc output and if it says the encoding for a client is "hextile" then likely the fast compression encodings are missing. If you want optimal performance on your OS, you should see - the [105]build notes above for where to download libz and libjpeg, and + the [107]build notes above for where to download libz and libjpeg, and then build everything with gcc. If any of the above binaries don't work and building x11vnc on your OS @@ -961,17 +965,17 @@ typedef unsigned int in_addr_t; To obtain VNC viewers for the viewing side (Windows, Mac OS, or Unix) try here: - * [106]http://www.tightvnc.com/download.html - * [107]http://www.realvnc.com/download-free.html - * [108]http://sourceforge.net/projects/cotvnc/ + * [108]http://www.tightvnc.com/download.html + * [109]http://www.realvnc.com/download-free.html + * [110]http://sourceforge.net/projects/cotvnc/ Q-6: How can I see all of x11vnc's command line options and documentation on how to use them? - Run: x11vnc -help The output is listed [109]here as well. + Run: x11vnc -help The output is listed [111]here as well. Q-7: I don't like typing arcane command line options every time I - start x11vnc. What can I do? Is there a config file? Is there a GUI? + start x11vnc. What can I do? Is there a config file? Or a GUI? You could create a shell script that calls x11vnc with your options: #!/bin/sh @@ -1015,10 +1019,10 @@ display :0 -shared option to have x11vnc allow multiple clients to connect simultaneously. - Recommended additional safety measures include using ssh ([110]see + Recommended additional safety measures include using ssh ([112]see above), stunnel, or a VPN to authenticate and encrypt the viewer - connections or to at least use the -rfbauth passwd-file [111]option to - use VNC password protection (or [112]-passwdfile) It is up to you to + connections or to at least use the -rfbauth passwd-file [113]option to + use VNC password protection (or [114]-passwdfile) It is up to you to apply these security measures, they will not be done for you automatically. @@ -1032,16 +1036,16 @@ display :0 secondary display (X11). Then start up Win2VNC on the primary display (Windows) referring it to the secondary display. - This will also work X11 to X11 using [113]x2vnc, however you would + This will also work X11 to X11 using [115]x2vnc, however you would probably just want to avoid VNC and use x2x for that. For reference, here are some links to Win2VNC-like programs for multiple monitor setups: - * [114]Original Win2VNC - * [115]Enhanced Win2VNC and [116]sourceforge link - * [117]x2vnc - * [118]x2x also [119]here - * [120]zvnc (MorphOS) + * [116]Original Win2VNC + * [117]Enhanced Win2VNC and [118]sourceforge link + * [119]x2vnc + * [120]x2x also [121]here + * [122]zvnc (MorphOS) All of them (except x2x) will work with x11vnc. @@ -1095,7 +1099,7 @@ display :0 visuals of different color depths: e.g. there are both depth 8 and 24 visuals available at the same time. - You may want to review the [121]previous question regarding 8 bpp + You may want to review the [123]previous question regarding 8 bpp PseudoColor. If that isn't the problem, run xdpyinfo(1) to see what the default @@ -1167,7 +1171,7 @@ TrueColor defdepth 24 the desired application window. After clicking, it will print out much information, including the window id. Also, the visual and depth of the window printed out is often useful in debugging x11vnc - [122]problems. + [124]problems. When using -id windowid, note that some VNC viewers will have problems rendering screens that have a width that is not a multiple of 4. Try @@ -1224,12 +1228,18 @@ TrueColor defdepth 24 Q-17: How do I stop x11vnc once it is running in the background? - If the -forever option has not been supplied, x11vnc will - automatically exit after the first client disconnects. In general you - will have to kill the x11vnc process (however, see the remote-control - -R option below). This can be done via: "kill NNNNN" (where NNNNN is - the x11vnc process id number found from ps(1)), or "pkill x11vnc", or - "killall x11vnc" (Linux only, IIRC). + As of Dec/2004 in the libvncserver CVS there is a remote control + feature. It can change a huge amount of things on the fly: see the + -remote and -query options. To shut down the running x11vnc server + just type "x11vnc -R stop". To disconnect all clients do "x11vnc -R + disconnect:all", etc. + + For older versions: If the -forever option has not been supplied, + x11vnc will automatically exit after the first client disconnects. In + general you will have to kill the x11vnc process (however, see the + remote-control -R option below). This can be done via: "kill NNNNN" + (where NNNNN is the x11vnc process id number found from ps(1)), or + "pkill x11vnc", or "killall x11vnc" (Linux only). If you have not put x11vnc in the background via the -bg option or shell & operator, then simply press Ctrl-C in the shell where x11vnc @@ -1242,12 +1252,6 @@ TrueColor defdepth 24 Ctrl, Shift, and Alt. Alternatively, the -clear_mods and -clear_keys options can be used to release pressed keys at startup and exit. - As of Dec/2004 in the libvncserver CVS there is a remote control - feature. It can change a huge amount of things on the fly: see the - -remote and -query options. To shut down the running x11vnc server - just type "x11vnc -R stop". To disconnect all clients do "x11vnc -R - disconnect:all", etc. - Q-18: Can I change settings in x11vnc without having to restart it? Is there a way to remote control it? @@ -1295,7 +1299,7 @@ TrueColor defdepth 24 is "vnc", e.g.: vnc: 192.168.100.3 .example.com - Note that if you run x11vnc out of [123]inetd you do not need to build + Note that if you run x11vnc out of [125]inetd you do not need to build x11vnc with libwrap support because the /usr/sbin/tcpd reference in /etc/inetd.conf handles the tcp_wrappers stuff. @@ -1339,7 +1343,7 @@ TrueColor defdepth 24 program to prompt the user whether the client should be accepted or not. This requires that you have xmessage installed and available via PATH. In case it is not already on your system, the xmessage program - is available at [124]ftp://ftp.x.org/ + is available at [126]ftp://ftp.x.org/ To include view-only decisions for the external commands, prefix the command something like this: "yes:0,no:*,view:3 mycommand ..." This @@ -1378,7 +1382,7 @@ elif [ $rc = 4 ]; then fi exit 1 - Stefan Radman has written a nice dtksh script [125]dtVncPopup for use + Stefan Radman has written a nice dtksh script [127]dtVncPopup for use in CDE environments to do the same sort of thing. Information on how to use it is found at the top of the file. He encourages you to provide feedback to him to help improve the script. @@ -1414,14 +1418,14 @@ exit 1 out for the command winding up in your shell's history file (history -c is often a way to clear it). - x11vnc also has the [126]-passwdfile and -passwd/-viewpasswd plain + x11vnc also has the [128]-passwdfile and -passwd/-viewpasswd plain text (i.e. not obscured like the -rfbauth VNC passwords) password options. Q-23: How can I tunnel my connection to x11vnc via an encrypted SSH channel between two Unix machines? - See the description earlier on this page on [127]how to tunnel VNC via + See the description earlier on this page on [129]how to tunnel VNC via SSH from Unix to Unix. A number of ways are described along with some issues you may encounter. @@ -1431,7 +1435,7 @@ exit 1 Q-24: How can I tunnel my connection to x11vnc via an encrypted SSH channel from Windows using an SSH client like Putty? - [128]Above we described how to tunnel VNC via SSH from Unix to Unix, + [130]Above we described how to tunnel VNC via SSH from Unix to Unix, you may want to review it. To do this from Windows using Putty it would go something like this: * In the Putty dialog window under 'Session' enter the hostname or @@ -1464,7 +1468,7 @@ exit 1 you'll need to do a second login (ssh or rsh) to the workstation machine 'otherhost' and then start up x11vnc on it. - As discussed [129]above another option is to first start the VNC + As discussed [131]above another option is to first start the VNC viewer in "listen" mode, and then launch x11vnc with the "-connection localhost" option to establish the reverse connection. In this case a Remote port redirection (not Local) is needed for port 5500 instead of @@ -1485,7 +1489,7 @@ exit 1 connection to make it appear to emanate from the local machine. As discussed above, ssh is useful for this: ssh -l username -L 5900:localhost:5900 hostname ... See the ssh wrapper scripts mentioned - [130]elsewhere on this page. Of course a malicious user could allow + [132]elsewhere on this page. Of course a malicious user could allow other users to get in through his channel, but that is a problem with every method. Another thing to watch out for is a malicious user on the viewer side (where ssh is running) trying to sneak in through the @@ -1561,7 +1565,7 @@ exit 1 # reject it In any event, as of Jun/2004 there is an experimental utility to make it more difficult for nosey people to see your x11vnc activities. The - source for it is [131]blockdpy.c The idea behind it is simple (but + source for it is [133]blockdpy.c The idea behind it is simple (but obviously not bulletproof): when a VNC client attaches to x11vnc put the display monitor in the DPMS "off" state, if the DPMS state ever changes immediately start up the screen-lock program. The x11vnc user @@ -1630,7 +1634,7 @@ xprop -root -f VNC_CONNECT 8s -set VNC_CONNECT "$1" As of Apr/2004 the above fix only works for BSD signal systems (Linux, FreeBSD, ...) For SYSV systems there is a workaround in my - [132]x11vnc.c file. It also has an option -sigpipe exit to have x11vnc + [134]x11vnc.c file. It also has an option -sigpipe exit to have x11vnc clean up and exit upon receiving SIGPIPE. Q-31: How can I use x11vnc to connect to an X login screen like xdm, @@ -1641,16 +1645,13 @@ xprop -root -f VNC_CONNECT 8s -set VNC_CONNECT "$1" connect to it once: On Linux it seems it is possible to do this by just adjusting the - XAUTHORITY to point to the MIT-COOKIE auth file while running x11vnc - as root, e.g. for the gnome display manager, gdm: - env XAUTHORITY=/var/gdm/:0.Xauth x11vnc -display :0 - - or equivalently with newer x11vnc: + XAUTHORITY environment variable to point to the MIT-COOKIE auth file + while running x11vnc as root, e.g. for the gnome display manager, gdm: x11vnc -auth /var/gdm/:0.Xauth -display :0 - There will be a similar thing for xdm using however a different auth - directory path (perhaps something like - /var/lib/xdm/authdir/authfiles/A:0-XQvaJk for xdm or + (the -auth option sets XAUTHORITY). There will be a similar thing for + xdm using however a different auth directory path (perhaps something + like /var/lib/xdm/authdir/authfiles/A:0-XQvaJk for xdm or /var/lib/kdm/A:0-crWk72 for kdm, where the random characters in basename will vary a bit). @@ -1699,7 +1700,7 @@ xprop -root -f VNC_CONNECT 8s -set VNC_CONNECT "$1" If you do not want to deal with the display manager startup scripts, here is a kludgey script that can be run manually or out of a boot - file like rc.local. [133]x11vnc_loop It will need some local + file like rc.local. [135]x11vnc_loop It will need some local customization before running. Because the XAUTHORITY auth file must be guessed by this script, use of the display manager script above is preferred. @@ -1798,6 +1799,9 @@ mp/x11vnc_sh.log Q-34: Why isn't the mouse cursor shape (the little icon shape where the mouse pointer is) correct as I move from window to window? + On X servers supporting XFIXES or Overlay extensions this is possible. + See the paragraphs below. + As mentioned above, the X11 mouse cursor shape (i.e. little picture: an arrow, X, I-beam, resizer, etc) is one of the few write-only objects in X11. That is, an application can tell the X server what the @@ -1812,17 +1816,15 @@ mp/x11vnc_sh.log KDE often cover up the root background, so this won't work for those cases. Also see the "-cursor some" option for additional kludges. - It should be possible to apply some heuristics where x11vnc tries to - build up a table of cursors for the windows it sees, perhaps using a - user supplied hints file, but that has not been explored yet. - - Also note that as of Aug/2004 in the libvncserver CVS, on Solaris - using the SUN_OVL overlay extension, x11vnc can show the correct mouse + 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 -overlay is also supplied. (-overlay has some other - problems however, and can be slower). Also as of Dec/2004 in - libvncserver CVS XFIXES X extension support has been added to allow - exact extraction of the mouse cursor shape. This is the preferred way - of viewing the cursor shape, it is available on recent Linux Xorg + problems however, and can be slower). + + Also as of Dec/2004 in libvncserver CVS XFIXES X extension support has + been added to allow exact extraction of the mouse cursor shape. The + only issue is the handling of alpha channel transparency in cursors + (they must be approximated). XFIXES is available on recent Linux Xorg based distros and Solaris 10 express (on Solaris you will need to add "-L /usr/openwin/sfw/lib -R /usr/openwin/sfw/lib" to LDFLAGS for configure to enable it). @@ -1830,7 +1832,7 @@ mp/x11vnc_sh.log Q-35: 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 [134]tightvnc extension that allows + This default takes advantage of a [136]tightvnc extension that allows specifying a cursor image for the local VNC viewer. You may disable it with the -nocursor option to x11vnc if your viewer does not have this extension. @@ -1937,7 +1939,7 @@ mp/x11vnc_sh.log 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 [135]shm_clear to list and prompt for removal + Here is a shell script [137]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, @@ -1975,7 +1977,7 @@ ied) -fs 1.0 knocks it down to 2). If you are having much trouble with shm segments, consider disabling shm completely via the -noshm option. Performance will be somewhat degraded but when done over local machine - sockets it should be acceptable (see an [136]earlier question + sockets it should be acceptable (see an [138]earlier question discussing -noshm). Q-40: How can I make x11vnc use less system resources? @@ -2023,7 +2025,7 @@ ied) worth it, but could be of use in some situations. VNC viewer parameters: - * Use a [137]TightVNC enabled viewer! + * Use a [139]TightVNC enabled viewer! * Make sure the tight encoding is being used (look at vncviewer and x11vnc outputs) * Request 8 bits per pixel using -bgr233 (up to 4X speedup over @@ -2047,10 +2049,6 @@ ied) 100 or so (delays sending vertical blocks since they may change while viewer is receiving earlier ones) * Set -fs 1.0 (disables fullscreen updates) - * Enable server-side scaling via -scale m/n to make the VNC - frambuffer smaller. (less data needs to be sent, but image may not - be sharp and requires extra resources on the server end, may - actually slow down transfers of text due to poorer compression) * Try increasing -wait or -defer (reduces the maximum "frame rate", but won't help much for large screen changes) * If you just want to watch one (simple) window use -id (cuts down @@ -2071,12 +2069,12 @@ 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 [138]this FAQ + and ">" it. This key does not exist on the keyboard (see [140]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 [139]FAQ about the -xkb option for a more powerful method + Also see the [141]FAQ about the -xkb option for a more powerful method of modifier tweaking for use on X servers with the XKEYBOARD extension. @@ -2137,7 +2135,7 @@ ied) the keysym comma when it comes in from a client (so when Shift is down the comma press will yield "<"). - See also the [140]FAQ about the -xkb option as a possible workaround + See also the [142]FAQ about the -xkb option as a possible workaround using the XKEYBOARD extension. Note that of Jul/2004 in the libvncserver CVS the -modtweak option is now that default. @@ -2343,7 +2341,7 @@ ied) There may also be scaling viewers out there (e.g. TightVNC on Windows) that automatically shrink or expand the remote framebuffer to fit the - local display. Especially for hand-held devices. See also [141]this + local display. Especially for hand-held devices. See also [143]this FAQ Q-51: Does x11vnc support server-side framebuffer scaling? (E.g. to @@ -2438,7 +2436,7 @@ 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 [142]FAQ to increase the limit. It + /etc/system as mentioned in another [144]FAQ to increase the limit. It is probably also a good idea to run with the -onetile option in this case (to limit each x11vnc to 3 shm segments), or even -noshm to use no shm segments. @@ -2551,128 +2549,130 @@ References 18. http://www.karlrunge.com/x11vnc/index.html#allow_opt 19. http://www.karlrunge.com/x11vnc/index.html#tcp_wrappers 20. http://sourceforge.net/projects/libvncserver/ - 21. http://sourceforge.net/project/showfiles.php?group_id=32584&package_id=119006&release_id=257442 - 22. http://www.karlrunge.com/x11vnc/x11vnc.c - 23. http://www.karlrunge.com/x11vnc/index.html#binaries - 24. http://www.tightvnc.com/download.html - 25. http://www.realvnc.com/download-free.html - 26. http://sourceforge.net/projects/cotvnc/ - 27. http://www.karlrunge.com/x11vnc/rx11vnc - 28. http://www.karlrunge.com/x11vnc/rx11vnc.pl - 29. ftp://ftp.uu.net/graphics/jpeg/ - 30. http://www.gzip.org/zlib/ - 31. http://www.sunfreeware.com/ - 32. http://www.karlrunge.com/x11vnc/index.html#solaris251build - 33. http://www.tightvnc.com/ - 34. http://www.karlrunge.com/x11vnc/x11vnc_opts.html - 35. http://www.karlrunge.com/x11vnc/index.html#passwd - 36. http://www.karlrunge.com/x11vnc/recurse_x11vnc.jpg - 37. http://wwws.sun.com/sunray/index.html - 38. mailto:xvml@karlrunge.com - 39. http://www.karlrunge.com/x11vnc/index.html#FAQ-1 - 40. http://www.karlrunge.com/x11vnc/index.html#FAQ-2 - 41. http://www.karlrunge.com/x11vnc/index.html#FAQ-3 - 42. http://www.karlrunge.com/x11vnc/index.html#FAQ-4 - 43. http://www.karlrunge.com/x11vnc/index.html#FAQ-5 - 44. http://www.karlrunge.com/x11vnc/index.html#FAQ-6 - 45. http://www.karlrunge.com/x11vnc/index.html#FAQ-7 - 46. http://www.karlrunge.com/x11vnc/index.html#FAQ-8 - 47. http://www.karlrunge.com/x11vnc/index.html#FAQ-9 - 48. http://www.karlrunge.com/x11vnc/index.html#FAQ-10 - 49. http://www.karlrunge.com/x11vnc/index.html#FAQ-11 - 50. http://www.karlrunge.com/x11vnc/index.html#FAQ-12 - 51. http://www.karlrunge.com/x11vnc/index.html#FAQ-13 - 52. http://www.karlrunge.com/x11vnc/index.html#FAQ-14 - 53. http://www.karlrunge.com/x11vnc/index.html#FAQ-15 - 54. http://www.karlrunge.com/x11vnc/index.html#FAQ-16 - 55. http://www.karlrunge.com/x11vnc/index.html#FAQ-17 - 56. http://www.karlrunge.com/x11vnc/index.html#FAQ-18 - 57. http://www.karlrunge.com/x11vnc/index.html#FAQ-19 - 58. http://www.karlrunge.com/x11vnc/index.html#FAQ-20 - 59. http://www.karlrunge.com/x11vnc/index.html#FAQ-21 - 60. http://www.karlrunge.com/x11vnc/index.html#FAQ-22 - 61. http://www.karlrunge.com/x11vnc/index.html#FAQ-23 - 62. http://www.karlrunge.com/x11vnc/index.html#FAQ-24 - 63. http://www.karlrunge.com/x11vnc/index.html#FAQ-25 - 64. http://www.karlrunge.com/x11vnc/index.html#FAQ-26 - 65. http://www.karlrunge.com/x11vnc/index.html#FAQ-27 - 66. http://www.karlrunge.com/x11vnc/index.html#FAQ-28 - 67. http://www.karlrunge.com/x11vnc/index.html#FAQ-29 - 68. http://www.karlrunge.com/x11vnc/index.html#FAQ-30 - 69. http://www.karlrunge.com/x11vnc/index.html#FAQ-31 - 70. http://www.karlrunge.com/x11vnc/index.html#FAQ-32 - 71. http://www.karlrunge.com/x11vnc/index.html#FAQ-33 - 72. http://www.karlrunge.com/x11vnc/index.html#FAQ-34 - 73. http://www.karlrunge.com/x11vnc/index.html#FAQ-35 - 74. http://www.karlrunge.com/x11vnc/index.html#FAQ-36 - 75. http://www.karlrunge.com/x11vnc/index.html#FAQ-37 - 76. http://www.karlrunge.com/x11vnc/index.html#FAQ-38 - 77. http://www.karlrunge.com/x11vnc/index.html#FAQ-39 - 78. http://www.karlrunge.com/x11vnc/index.html#FAQ-40 - 79. http://www.karlrunge.com/x11vnc/index.html#FAQ-41 - 80. http://www.karlrunge.com/x11vnc/index.html#FAQ-42 - 81. http://www.karlrunge.com/x11vnc/index.html#FAQ-43 - 82. http://www.karlrunge.com/x11vnc/index.html#FAQ-44 - 83. http://www.karlrunge.com/x11vnc/index.html#FAQ-45 - 84. http://www.karlrunge.com/x11vnc/index.html#FAQ-46 - 85. http://www.karlrunge.com/x11vnc/index.html#FAQ-47 - 86. http://www.karlrunge.com/x11vnc/index.html#FAQ-48 - 87. http://www.karlrunge.com/x11vnc/index.html#FAQ-49 - 88. http://www.karlrunge.com/x11vnc/index.html#FAQ-50 - 89. http://www.karlrunge.com/x11vnc/index.html#FAQ-51 - 90. http://www.karlrunge.com/x11vnc/index.html#FAQ-52 - 91. http://www.karlrunge.com/x11vnc/index.html#FAQ-53 - 92. http://www.karlrunge.com/x11vnc/index.html#FAQ-54 - 93. http://www.karlrunge.com/x11vnc/index.html#FAQ-55 - 94. http://www.karlrunge.com/x11vnc/index.html#FAQ-56 - 95. http://www.karlrunge.com/x11vnc/index.html#FAQ-57 - 96. http://www.karlrunge.com/x11vnc/index.html#FAQ-58 - 97. http://www.karlrunge.com/x11vnc/index.html#FAQ-59 - 98. http://www.karlrunge.com/x11vnc/index.html#solarisbuilding - 99. http://www.karlrunge.com/x11vnc/index.html#building - 100. http://www.karlrunge.com/x11vnc/index.html#buildfaq - 101. http://packages.debian.org/x11vnc - 102. http://www.linuxpackages.net/search_view.php?by=name&name=x11vnc - 103. http://dag.wieers.com/packages/x11vnc/ - 104. http://www.bell-labs.com/project/wwexptools/packages.html - 105. http://www.karlrunge.com/x11vnc/index.html#solarisbuilding - 106. http://www.tightvnc.com/download.html - 107. http://www.realvnc.com/download-free.html - 108. http://sourceforge.net/projects/cotvnc/ - 109. http://www.karlrunge.com/x11vnc/x11vnc_opts.html - 110. http://www.karlrunge.com/x11vnc/index.html#tunnelling - 111. http://www.karlrunge.com/x11vnc/index.html#passwd - 112. http://www.karlrunge.com/x11vnc/index.html#passwdfile - 113. http://fredrik.hubbe.net/x2vnc.html - 114. http://www.hubbe.net/~hubbe/win2vnc.html - 115. http://www.deboer.gmxhome.de/ - 116. http://sourceforge.net/projects/win2vnc/ - 117. http://fredrik.hubbe.net/x2vnc.html - 118. http://freshmeat.net/projects/x2x/ - 119. http://ftp.digital.com/pub/Digital/SRC/x2x/ - 120. http://zapek.com/software/zvnc/ - 121. http://www.karlrunge.com/x11vnc/index.html#8bpp - 122. http://www.karlrunge.com/x11vnc/index.html#overlays - 123. http://www.karlrunge.com/x11vnc/index.html#inetd - 124. ftp://ftp.x.org/ - 125. http://www.karlrunge.com/x11vnc/dtVncPopup - 126. http://www.karlrunge.com/x11vnc/index.html#passwdfile - 127. http://www.karlrunge.com/x11vnc/index.html#tunnelling - 128. http://www.karlrunge.com/x11vnc/index.html#tunnelling + 21. http://sourceforge.net/project/showfiles.php?group_id=32584&package_id=119006&release_id=292078 + 22. http://sourceforge.net/project/shownotes.php?group_id=32584&release_id=292078 + 23. http://www.karlrunge.com/x11vnc/x11vnc.c + 24. http://www.karlrunge.com/x11vnc/tkx11vnc.h + 25. http://www.karlrunge.com/x11vnc/index.html#binaries + 26. http://www.tightvnc.com/download.html + 27. http://www.realvnc.com/download-free.html + 28. http://sourceforge.net/projects/cotvnc/ + 29. http://www.karlrunge.com/x11vnc/rx11vnc + 30. http://www.karlrunge.com/x11vnc/rx11vnc.pl + 31. ftp://ftp.uu.net/graphics/jpeg/ + 32. http://www.gzip.org/zlib/ + 33. http://www.sunfreeware.com/ + 34. http://www.karlrunge.com/x11vnc/index.html#solaris251build + 35. http://www.tightvnc.com/ + 36. http://www.karlrunge.com/x11vnc/x11vnc_opts.html + 37. http://www.karlrunge.com/x11vnc/index.html#passwd + 38. http://www.karlrunge.com/x11vnc/recurse_x11vnc.jpg + 39. http://wwws.sun.com/sunray/index.html + 40. mailto:xvml@karlrunge.com + 41. http://www.karlrunge.com/x11vnc/index.html#FAQ-1 + 42. http://www.karlrunge.com/x11vnc/index.html#FAQ-2 + 43. http://www.karlrunge.com/x11vnc/index.html#FAQ-3 + 44. http://www.karlrunge.com/x11vnc/index.html#FAQ-4 + 45. http://www.karlrunge.com/x11vnc/index.html#FAQ-5 + 46. http://www.karlrunge.com/x11vnc/index.html#FAQ-6 + 47. http://www.karlrunge.com/x11vnc/index.html#FAQ-7 + 48. http://www.karlrunge.com/x11vnc/index.html#FAQ-8 + 49. http://www.karlrunge.com/x11vnc/index.html#FAQ-9 + 50. http://www.karlrunge.com/x11vnc/index.html#FAQ-10 + 51. http://www.karlrunge.com/x11vnc/index.html#FAQ-11 + 52. http://www.karlrunge.com/x11vnc/index.html#FAQ-12 + 53. http://www.karlrunge.com/x11vnc/index.html#FAQ-13 + 54. http://www.karlrunge.com/x11vnc/index.html#FAQ-14 + 55. http://www.karlrunge.com/x11vnc/index.html#FAQ-15 + 56. http://www.karlrunge.com/x11vnc/index.html#FAQ-16 + 57. http://www.karlrunge.com/x11vnc/index.html#FAQ-17 + 58. http://www.karlrunge.com/x11vnc/index.html#FAQ-18 + 59. http://www.karlrunge.com/x11vnc/index.html#FAQ-19 + 60. http://www.karlrunge.com/x11vnc/index.html#FAQ-20 + 61. http://www.karlrunge.com/x11vnc/index.html#FAQ-21 + 62. http://www.karlrunge.com/x11vnc/index.html#FAQ-22 + 63. http://www.karlrunge.com/x11vnc/index.html#FAQ-23 + 64. http://www.karlrunge.com/x11vnc/index.html#FAQ-24 + 65. http://www.karlrunge.com/x11vnc/index.html#FAQ-25 + 66. http://www.karlrunge.com/x11vnc/index.html#FAQ-26 + 67. http://www.karlrunge.com/x11vnc/index.html#FAQ-27 + 68. http://www.karlrunge.com/x11vnc/index.html#FAQ-28 + 69. http://www.karlrunge.com/x11vnc/index.html#FAQ-29 + 70. http://www.karlrunge.com/x11vnc/index.html#FAQ-30 + 71. http://www.karlrunge.com/x11vnc/index.html#FAQ-31 + 72. http://www.karlrunge.com/x11vnc/index.html#FAQ-32 + 73. http://www.karlrunge.com/x11vnc/index.html#FAQ-33 + 74. http://www.karlrunge.com/x11vnc/index.html#FAQ-34 + 75. http://www.karlrunge.com/x11vnc/index.html#FAQ-35 + 76. http://www.karlrunge.com/x11vnc/index.html#FAQ-36 + 77. http://www.karlrunge.com/x11vnc/index.html#FAQ-37 + 78. http://www.karlrunge.com/x11vnc/index.html#FAQ-38 + 79. http://www.karlrunge.com/x11vnc/index.html#FAQ-39 + 80. http://www.karlrunge.com/x11vnc/index.html#FAQ-40 + 81. http://www.karlrunge.com/x11vnc/index.html#FAQ-41 + 82. http://www.karlrunge.com/x11vnc/index.html#FAQ-42 + 83. http://www.karlrunge.com/x11vnc/index.html#FAQ-43 + 84. http://www.karlrunge.com/x11vnc/index.html#FAQ-44 + 85. http://www.karlrunge.com/x11vnc/index.html#FAQ-45 + 86. http://www.karlrunge.com/x11vnc/index.html#FAQ-46 + 87. http://www.karlrunge.com/x11vnc/index.html#FAQ-47 + 88. http://www.karlrunge.com/x11vnc/index.html#FAQ-48 + 89. http://www.karlrunge.com/x11vnc/index.html#FAQ-49 + 90. http://www.karlrunge.com/x11vnc/index.html#FAQ-50 + 91. http://www.karlrunge.com/x11vnc/index.html#FAQ-51 + 92. http://www.karlrunge.com/x11vnc/index.html#FAQ-52 + 93. http://www.karlrunge.com/x11vnc/index.html#FAQ-53 + 94. http://www.karlrunge.com/x11vnc/index.html#FAQ-54 + 95. http://www.karlrunge.com/x11vnc/index.html#FAQ-55 + 96. http://www.karlrunge.com/x11vnc/index.html#FAQ-56 + 97. http://www.karlrunge.com/x11vnc/index.html#FAQ-57 + 98. http://www.karlrunge.com/x11vnc/index.html#FAQ-58 + 99. http://www.karlrunge.com/x11vnc/index.html#FAQ-59 + 100. http://www.karlrunge.com/x11vnc/index.html#solarisbuilding + 101. http://www.karlrunge.com/x11vnc/index.html#building + 102. http://www.karlrunge.com/x11vnc/index.html#buildfaq + 103. http://packages.debian.org/x11vnc + 104. http://www.linuxpackages.net/search_view.php?by=name&name=x11vnc + 105. http://dag.wieers.com/packages/x11vnc/ + 106. http://www.bell-labs.com/project/wwexptools/packages.html + 107. http://www.karlrunge.com/x11vnc/index.html#solarisbuilding + 108. http://www.tightvnc.com/download.html + 109. http://www.realvnc.com/download-free.html + 110. http://sourceforge.net/projects/cotvnc/ + 111. http://www.karlrunge.com/x11vnc/x11vnc_opts.html + 112. http://www.karlrunge.com/x11vnc/index.html#tunnelling + 113. http://www.karlrunge.com/x11vnc/index.html#passwd + 114. http://www.karlrunge.com/x11vnc/index.html#passwdfile + 115. http://fredrik.hubbe.net/x2vnc.html + 116. http://www.hubbe.net/~hubbe/win2vnc.html + 117. http://www.deboer.gmxhome.de/ + 118. http://sourceforge.net/projects/win2vnc/ + 119. http://fredrik.hubbe.net/x2vnc.html + 120. http://freshmeat.net/projects/x2x/ + 121. http://ftp.digital.com/pub/Digital/SRC/x2x/ + 122. http://zapek.com/software/zvnc/ + 123. http://www.karlrunge.com/x11vnc/index.html#8bpp + 124. http://www.karlrunge.com/x11vnc/index.html#overlays + 125. http://www.karlrunge.com/x11vnc/index.html#inetd + 126. ftp://ftp.x.org/ + 127. http://www.karlrunge.com/x11vnc/dtVncPopup + 128. http://www.karlrunge.com/x11vnc/index.html#passwdfile 129. http://www.karlrunge.com/x11vnc/index.html#tunnelling 130. http://www.karlrunge.com/x11vnc/index.html#tunnelling - 131. http://www.karlrunge.com/x11vnc/blockdpy.c - 132. http://www.karlrunge.com/x11vnc/x11vnc.c - 133. http://www.karlrunge.com/x11vnc/x11vnc_loop - 134. http://www.tightvnc.com/ - 135. http://www.karlrunge.com/x11vnc/shm_clear - 136. http://www.karlrunge.com/x11vnc/index.html#noshm - 137. http://www.tightvnc.com/ - 138. http://www.karlrunge.com/x11vnc/index.html#greaterless - 139. http://www.karlrunge.com/x11vnc/index.html#xkbmodtweak - 140. http://www.karlrunge.com/x11vnc/index.html#xkbmodtweak - 141. http://www.karlrunge.com/x11vnc/index.html#scaling - 142. http://www.karlrunge.com/x11vnc/index.html#solshm + 131. http://www.karlrunge.com/x11vnc/index.html#tunnelling + 132. http://www.karlrunge.com/x11vnc/index.html#tunnelling + 133. http://www.karlrunge.com/x11vnc/blockdpy.c + 134. http://www.karlrunge.com/x11vnc/x11vnc.c + 135. http://www.karlrunge.com/x11vnc/x11vnc_loop + 136. http://www.tightvnc.com/ + 137. http://www.karlrunge.com/x11vnc/shm_clear + 138. http://www.karlrunge.com/x11vnc/index.html#noshm + 139. http://www.tightvnc.com/ + 140. http://www.karlrunge.com/x11vnc/index.html#greaterless + 141. http://www.karlrunge.com/x11vnc/index.html#xkbmodtweak + 142. http://www.karlrunge.com/x11vnc/index.html#xkbmodtweak + 143. http://www.karlrunge.com/x11vnc/index.html#scaling + 144. http://www.karlrunge.com/x11vnc/index.html#solshm ======================================================================= @@ -2685,7 +2685,9 @@ x11vnc: a VNC server for real X displays Here are all of x11vnc command line options: % x11vnc -help -x11vnc: allow VNC connections to real X11 displays. 0.7pre lastmod: 2004-12-20 + +x11vnc: allow VNC connections to real X11 displays. 0.7.1pre lastmod: 2004-12-2 +7 Typical usage is: @@ -3083,6 +3085,13 @@ Options: default (see -noxfixes below). This can be disabled with -nocursor, and also some values of the "mode" option below. + + Note that under XFIXES cursors with transparency + (alpha channel) will not be exactly represented and + so Overlay may be preferred. See also the -alphacut + and -alphafrac options below as fudge factors to try + to improve the situation for cursors with transparency + for a given theme. The "mode" string can be used to fine-tune the displaying of cursor shapes. It can be used the @@ -3116,6 +3125,29 @@ Options: -noxfixes Do not use the XFIXES extension to draw the exact cursor shape even if it is available. +-alphacut n When using the XFIXES extension for the cursor shape, + cursors with transparency will not be displayed exactly + (but opaque ones will). This option sets n as a cutoff + for cursors that have transparency ("alpha channel" + with values ranging from 0 to 255) Any cursor pixel with + alpha value less than n becomes completely transparent. + Otherwise the pixel is completely opaque. Default 255 + + Note: the options -alphacut, -alphafrac, and -alphafrac + may be removed if a more accurate internal method for + handling cursor transparency is implemented. +-alphafrac fraction With the threshold in -alphacut some cursors will become + almost completely transparent because their alpha values + are not high enough. For those cursors adjust the + alpha threshold until fraction of the non-zero alpha + channel pixels become opaque. Default 0.33 +-alpharemove By default, XFIXES cursors pixels with transparency have + the alpha factor multiplied into the RGB color values + (i.e. that corresponding to blending the cursor with a + black background). Specify this option to remove the + alpha factor. (useful for light colored semi-transparent + cursors). + -nocursorshape Do not use the TightVNC CursorShapeUpdates extension even if clients support it. See -cursor above. -cursorpos Option -cursorpos enables sending the X cursor position @@ -3382,18 +3414,25 @@ Options: keymapping, use "-key1-key2" to delete. norepeat enable -norepeat mode. repeat disable -norepeat mode. + nofb enable -nofb mode. + fb disable -nofb mode. bell enable bell (if supported). nobell disable bell. - sel disable -nosel mode. + bell enable bell (if supported). nosel enable -nosel mode. - primary disable -noprimary mode. + sel disable -nosel mode. noprimary enable -noprimary mode. + primary disable -noprimary mode. cursor:mode enable -cursor "mode". show_cursor enable showing a cursor. noshow_cursor disable showing a cursor. (same as "nocursor") xfixes enable xfixes cursor shape mode. noxfixes disable xfixes cursor shape mode. + alphacut:n set -alphacut to n. + alphafrac:f set -alphafrac to f. + alpharemove enable -alpharemove mode. + noalpharemove disable -alpharemove mode. cursorshape disable -nocursorshape mode. nocursorshape enable -nocursorshape mode. cursorpos disable -nocursorpos mode. @@ -3411,6 +3450,7 @@ Options: nodebug_keyboard disable -debug_keyboard, same as "nodk" defer:n set -defer to n ms,same as deferupdate:n wait:n set -wait to n ms. + rfbwait:n set -rfbwait (rfbMaxClientWait) to n ms. nap enable -nap mode. nonap disable -nap mode. sb:n set -sb to n s, same as screen_blank:n @@ -3420,8 +3460,24 @@ Options: fuzz:n set -fuzz to n. progressive:n set libvncserver -progressive slice height parameter to n. - file:name run -remote commands from file "name", - one command per line,blank and # skipped + desktop:str set -desktop name to str for new clients +. + rfbport:n set -rfbport to n. + http enable http client connections. + nohttp disable http client connections. + httpport:n set -httpport to n. + httpdir:dir set -httpdir to dir (and enable http). + enablehttpproxy enable -enablehttpproxy mode. + noenablehttpproxy disable -enablehttpproxy mode. + alwaysshared enable -alwaysshared mode. + noalwaysshared disable -alwaysshared mode. + (may interfere with other options) + nevershared enable -nevershared mode. + nonevershared disable -nevershared mode. + (may interfere with other options) + dontdisconnect enable -dontdisconnect mode. + nodontdisconnect disable -dontdisconnect mode. + (may interfere with other options) noremote disable the -remote command processing, it cannot be turned back on. @@ -3461,38 +3517,43 @@ Options: the returned value corresponds to (hint: the ext_* variables correspond to the presence of X extensions): - ans= stop quit exit shutdown ping blacken zero refresh - reset close disconnect id sid flashcmap noflashcmap - truecolor notruecolor overlay nooverlay overlay_cursor - overlay_yescursor nooverlay_cursor overlay_nocursor + ans= stop quit exit shutdown ping blacken zero + refresh reset close disconnect id sid flashcmap + noflashcmap truecolor notruecolor overlay nooverlay + overlay_cursor overlay_yescursor nooverlay_nocursor + nooverlay_cursor nooverlay_yescursor overlay_nocursor visual scale viewonly noviewonly shared noshared - forever noforever once deny lock nodeny unlock connect - allowonce allow localhost nolocalhost accept gone shm - noshm flipbyteorder noflipbyteorder onetile noonetile - blackout xinerama noxinerama xrandr noxrandr xrandr_mode - padgeom quiet q noquiet modtweak nomodtweak xkb noxkb - skip_keycodes add_keysyms noadd_keysyms clear_mods - noclear_mods clear_keys noclear_keys remap repeat - norepeat bell nobell sel nosel primary noprimary - cursorshape nocursorshape cursorpos nocursorpos cursor - show_cursor noshow_cursor nocursor xfixes noxfixes xwarp - xwarppointer noxwarp noxwarppointer buttonmap dragging - nodragging pointer_mode input_skip debug_pointer dp - nodebug_pointer nodp debug_keyboard dk nodebug_keyboard - nodk deferupdate defer wait nap nonap sb screen_blank - fs gaps grow fuzz progressive noremote - - aro= display vncdisplay desktopname desktop auth - rootshift scale_str scaled_x scaled_y scale_numer - scale_denom scale_fac scaling_noblend scaling_nomult4 - scaling_pad scaling_interpolate inetd safer unsafe - passwdfile using_shm logfile o rc norc h help V version - lastmod bg nofb sigpipe threads clients client_count - pid ext_xtest ext_xkb ext_xshm ext_xinerama ext_overlay - ext_xfixes ext_xdamage ext_xrandr rootwin num_buttons - button_mask mouse_x mouse_y bpp depth indexed_color - dpy_x dpy_y rfbport rfbwait rfbauth passwd alwaysshared - dontdisconnect httpdir enablehttpproxy + forever noforever once deny lock nodeny unlock + connect allowonce allow localhost nolocalhost accept + gone shm noshm flipbyteorder noflipbyteorder onetile + noonetile blackout xinerama noxinerama xrandr noxrandr + xrandr_mode padgeom quiet q noquiet modtweak nomodtweak + xkb noxkb skip_keycodes add_keysyms noadd_keysyms + clear_mods noclear_mods clear_keys noclear_keys + remap repeat norepeat fb nofb bell nobell sel + nosel primary noprimary cursorshape nocursorshape + cursorpos nocursorpos cursor show_cursor noshow_cursor + nocursor xfixes noxfixes alphacut alphafrac alpharemove + noalpharemove xwarp xwarppointer noxwarp noxwarppointer + buttonmap dragging nodragging pointer_mode input_skip + debug_pointer dp nodebug_pointer nodp debug_keyboard + dk nodebug_keyboard nodk deferupdate defer wait + rfbwait nap nonap sb screen_blank fs gaps grow fuzz + progressive rfbport http nohttp httpport httpdir + enablehttpproxy noenablehttpproxy alwaysshared + noalwaysshared nevershared noalwaysshared dontdisconnect + nodontdisconnect desktop noremote + + aro= display vncdisplay desktopname auth rootshift + scale_str scaled_x scaled_y scale_numer scale_denom + scale_fac scaling_noblend scaling_nomult4 scaling_pad + scaling_interpolate inetd safer unsafe passwdfile + using_shm logfile o rc norc h help V version lastmod + bg sigpipe threads clients client_count pid ext_xtest + ext_xkb ext_xshm ext_xinerama ext_overlay ext_xfixes + ext_xdamage ext_xrandr rootwin num_buttons button_mask + mouse_x mouse_y bpp depth indexed_color dpy_x dpy_y + rfbauth passwd -sync By default -remote commands are run asynchronously, that is, the request is posted and the program immediately @@ -3565,8 +3626,7 @@ These options are passed to libvncserver: Pretty wild huh? [1]Contact me if you have any questions or problems. Personally, I use: -x11vnc -rfbauth $HOME/.vnc/passwd -nap -flashcmap -cursor X -norepeat -add_keys -yms +x11vnc -rfbauth $HOME/.vnc/passwd -nap -flashcmap -cursor X -add_keysyms (the -flashcmap only matters on old 8-bit X displays) diff --git a/x11vnc/tkx11vnc b/x11vnc/tkx11vnc index d2e3782..09e9782 100755 --- a/x11vnc/tkx11vnc +++ b/x11vnc/tkx11vnc @@ -89,6 +89,7 @@ Clients gone: vncconnect -- + http =F httpdir: httpport: enablehttpproxy @@ -167,6 +168,8 @@ Debugging debug_pointer debug_keyboard =F logfile: + =GA show-logfile + =GA tail-logfile quiet -- =GA show-start-cmd @@ -187,9 +190,9 @@ Permissions -- =RA noremote -- - alwaysshared - nevershared - dontdisconnect + =SA alwaysshared + =SA nevershared + =SA dontdisconnect -- viewpasswd: =F passwdfile: @@ -204,6 +207,9 @@ Tuning =-C:1,2,3,4 pointer_mode: input_skip: nodragging + alphacut: + alphafrac: + alpharemove -- =D noshm flipbyteorder @@ -289,6 +295,15 @@ a -Q query. Examples: \"zero:20,20,100,100\", \"Q:ext_xfixes\" set helptext(stop+quit) " Send the stop command to the x11vnc server, then terminate the tkx11vnc gui. +" + + set helptext(show-logfile) " +View the current contents of the logfile (if it exists and is accessible +by the gui process). +" + + set helptext(tail-logfile) " +Run the tail(1) command with -f option on the logfile in an xterm. " set helptext(Quit) " @@ -392,6 +407,20 @@ Key Bindings: Anywhere: Control-p invokes \"Actions -> ping\" Anywhere: Control-u and Control-r invoke \"Actions -> update-all\" +Misc: + +Since x11vnc has so many settings and to avoid further confusion, +the libvncserver options: + + -alwaysshared + -nevershared + -dontdisconnect + +are not available for changing in a running x11vnc (even though it +is feasible). These options overlap with the x11vnc options -shared +and -forever which are hopefully enough for most usage. They may be +specified for x11vnc startup if desired. + " } @@ -506,8 +535,8 @@ proc active_when_starting {item} { } proc help_win {item} { - global helptext helpremote - global query_ans query_aro; + global helptext helpremote menu_var + global query_ans query_aro set ok 0 set text "Help on $item:\n\n" @@ -551,6 +580,18 @@ proc help_win {item} { set ok 1 } + if {![is_action $item] && [info exists menu_var($item)]} { + global unset_str + append text "\n\n" + append text "==== current $item value: ====\n"; + append text "\n" + if {$menu_var($item) == ""} { + append text "$unset_str\n" + } else { + append text "$menu_var($item)\n" + } + } + if {$item == "start"} { set str [get_start_x11vnc_txt] append text $str @@ -799,15 +840,20 @@ proc menus_disable {} { # Entry box utilities: proc entry_state {x state} { global entry_box entry_label entry_ok entry_help entry_skip entry_browse + global old_labels if {$x == "all"} { - $entry_label configure -state $state + if {!$old_labels} { + $entry_label configure -state $state + } $entry_box configure -state $state $entry_ok configure -state $state $entry_skip configure -state $state $entry_help configure -state $state $entry_browse configure -state $state } elseif {$x == "label"} { - $entry_label configure -state $state + if {!$old_labels} { + $entry_label configure -state $state + } } elseif {$x == "box"} { $entry_box configure -state $state } elseif {$x == "ok"} { @@ -1336,7 +1382,11 @@ proc query_all {{quiet 0}} { } proc set_info {str} { - global info_str + global info_str info_label +#set w1 [$info_label cget -width] +#set w2 [winfo width $info_label] +#puts "set_info: w=$w1 winfo=$w2" +#append_text "$str\n" set info_str "$str" update } @@ -1360,6 +1410,55 @@ proc show_all_settings {} { textwin "Settings" "All Current Settings" $txt } +proc show_logfile {} { + global menu_var unset_str + set logfile $menu_var(logfile) + + if {$logfile == "" || $logfile == $unset_str} { + set txt "\nNo logfile has been specified.\n\n" + } elseif {![file exists $logfile]} { + set txt "\nLogfile \"$logfile\" does not exist.\n\n" + } else { + set fh "-3" + set err "" + catch {set fh [open $logfile "r"]} err + if {$fh == "-3"} { + set txt "\nError opening \"$logfile\" $err.\n\n" + } else { + set txt "\nLogfile \"$logfile\" current contents:\n" + while {[gets $fh line] > -1} { + append txt "$line\n" + } + close $fh + } + } + textwin "Logfile" "Logfile" $txt +} + +proc tail_logfile {} { + global menu_var unset_str + set logfile $menu_var(logfile) + + set txt "" + if {$logfile == "" || $logfile == $unset_str} { + set txt "\nNo logfile has been specified.\n\n" + } elseif {![file exists $logfile]} { + set txt "\nLogfile \"$logfile\" does not exist.\n\n" + } else { + set cmd "" + set xterm_cmd "xterm -geometry 80x45 -title x11vnc-logfile -e" + set cmd [split $xterm_cmd] + lappend cmd "tail" + lappend cmd "+1f" + lappend cmd $logfile + lappend cmd "&" + catch {[eval exec $cmd]} + } + if {$txt != ""} { + textwin "Logfile" "Logfile" $txt + } +} + proc set_connected {yesno} { global connected_to_x11vnc set orig $connected_to_x11vnc @@ -1422,6 +1521,12 @@ proc do_action {item} { } elseif {$item == "all-settings"} { show_all_settings return + } elseif {$item == "show-logfile"} { + show_logfile + return + } elseif {$item == "tail-logfile"} { + tail_logfile + return } elseif {$item == "stop+quit"} { push_new_value "stop" "stop" 1 0 set_connected no @@ -1666,7 +1771,7 @@ proc disconnect_dialog {client} { append_text "Invalid client info string: $client\n" return } - append msg "*** To disconnect this client press \"OK\", otherwise press \"Skip\"\n" + append msg "*** To *DISCONNECT* this client press \"OK\", otherwise press \"Skip\"\n" bell if [warning_dialog $msg "current"] { push_new_value "disconnect" "disconnect" $cid 1 @@ -1757,17 +1862,19 @@ proc make_widgets {} { global menu_b menu_m global item_opts item_bool item_case item_entry menu_var unset_str global item_cascade - global info_str x11_display vnc_display + global info_label info_str x11_display vnc_display global text_area global entry_box entry_str entry_set entry_label entry_ok entry_browse global entry_help entry_skip global bfont global helptext helpremote helplabel -set v 0 - - label .info -textvariable info_str -bd 2 -relief groove -anchor w - pack .info -side top -fill x + set label_width 80 + + set info_label .info + label $info_label -textvariable info_str -bd 2 -relief groove \ + -anchor w -width $label_width + pack $info_label -side top -fill x -expand 0 # Extract the Rows: set row 0; @@ -1869,7 +1976,7 @@ set v 0 set item_cascade($item) "" set item_entry($item) $menu_count($case) -if {$v} { puts "ITEM: $item - $opts - $case - $bool - $menu_count($case)" } + if {0} { puts "ITEM: $item - $opts - $case - $bool - $menu_count($case)" } set mvar 0 set m $menu_m($case) @@ -1947,8 +2054,6 @@ if {$v} { puts "ITEM: $item - $opts - $case - $bool - $menu_count($case)" } set m $menu_m($case); set n [$m index end] -if {$v} { puts "$case end: $n" } - for {set i 0} {$i <= $n} {incr i} { set type [$m type $i] if {$type == "separator"} { @@ -1966,13 +2071,6 @@ if {$v} { puts "$case end: $n" } $m add command -label $str \ -command "menu_help $label"; -if {$v} { - set ht ""; set hr "" - if {[info exists helptext($label)]} { set ht "YES" } - if {[info exists helpremote($label)]} { set hr "YES" } - puts "'$label'\tht='$ht' hr='$hr'" -} - if {$str == ""} { $m entryconfigure end -state disabled } @@ -1994,11 +2092,13 @@ if {$v} { set df_x11 "$df.xdisplay" no_x11_display - label $df_x11 -textvariable x11_display -width 35 -anchor w + + set lw [expr {$label_width / 2}] + label $df_x11 -textvariable x11_display -width $lw -anchor w set df_vnc "$df.vdisplay" no_vnc_display - label $df_vnc -textvariable vnc_display -width 35 -anchor w + label $df_vnc -textvariable vnc_display -width $lw -anchor w pack $df_x11 $df_vnc -side left pack $df -side top -fill x @@ -2016,7 +2116,7 @@ if {$v} { set ef .entryframe frame $ef -bd 1 -relief groove - # Label + # Entry Label set ef_label "$ef.label" label $ef_label -textvariable entry_str -anchor w -font $bfont @@ -2026,22 +2126,22 @@ if {$v} { bind $ef_entry {set entry_set 1} bind $ef_entry {set entry_set 0} - # OK button + # Entry OK button set ef_ok "$ef.ok" button $ef_ok -text OK -pady 1 -command {set entry_set 1} \ -font $bfont - # Skip button + # Entry Skip button set ef_skip "$ef.skip" button $ef_skip -text Skip -pady 0 -command {set entry_set 0} \ -font $bfont - # Help button + # Entry Help button set ef_help "$ef.help" button $ef_help -text Help -pady 0 -command \ {menu_help $entry_dialog_item} -font $bfont - # Browse button + # Entry Browse button set ef_browse "$ef.browse" button $ef_browse -text "Browse..." -pady 0 -font $bfont \ -command {entry_insert [tk_getOpenFile]} @@ -2063,6 +2163,11 @@ if {$v} { update wm minsize . [winfo width .] [winfo height .] + + #set w [winfo width .info] + #puts "w1: $w" + #set w [winfo reqwidth .info] + #puts "w2: $w" } proc menu_bindings {} { @@ -2329,13 +2434,13 @@ proc run_remote_cmd {opts} { lappend cmd "2>" lappend cmd "/dev/null" -if {0} { - set str [join $cmd] - puts "running: $str" - foreach word $cmd { - puts " word: $word" + if {0} { + set str [join $cmd] + puts "running: $str" + foreach word $cmd { + puts " word: $word" + } } -} set output "" menus_disable @@ -2414,7 +2519,7 @@ global helpall helptext helpremote helplabel hostname; global all_settings reply_xdisplay always_update global max_text_height max_text_width global menu_var unset_str menus_disabled -global bfont +global bfont old_labels global connected_to_x11vnc global delay_sleep extra_sleep extra_sleep_split global cache_all_query_vars @@ -2436,6 +2541,12 @@ set delay_sleep 350 set extra_sleep 1000 set extra_sleep_split 4 +if {[regexp {^[34]} $tk_version] || $tk_version == "8.0"} { + set old_labels 1 +} else { + set old_labels 0 +} + if {"$argv" == "-spit"} { set fh [open $argv0 r] puts "/*" diff --git a/x11vnc/tkx11vnc.h b/x11vnc/tkx11vnc.h index ddd5f23..cf4beb7 100644 --- a/x11vnc/tkx11vnc.h +++ b/x11vnc/tkx11vnc.h @@ -95,6 +95,7 @@ " gone:\n" " vncconnect\n" " --\n" +" http\n" " =F httpdir:\n" " httpport:\n" " enablehttpproxy\n" @@ -173,6 +174,8 @@ " debug_pointer\n" " debug_keyboard\n" " =F logfile:\n" +" =GA show-logfile\n" +" =GA tail-logfile\n" " quiet\n" " --\n" " =GA show-start-cmd\n" @@ -193,9 +196,9 @@ " --\n" " =RA noremote\n" " --\n" -" alwaysshared\n" -" nevershared\n" -" dontdisconnect\n" +" =SA alwaysshared\n" +" =SA nevershared\n" +" =SA dontdisconnect\n" " --\n" " viewpasswd:\n" " =F passwdfile:\n" @@ -210,6 +213,9 @@ " =-C:1,2,3,4 pointer_mode:\n" " input_skip:\n" " nodragging\n" +" alphacut:\n" +" alphafrac:\n" +" alpharemove\n" " --\n" " =D noshm\n" " flipbyteorder\n" @@ -297,6 +303,15 @@ "Send the stop command to the x11vnc server, then terminate the tkx11vnc gui.\n" "\"\n" "\n" +" set helptext(show-logfile) \"\n" +"View the current contents of the logfile (if it exists and is accessible\n" +"by the gui process).\n" +"\"\n" +"\n" +" set helptext(tail-logfile) \"\n" +"Run the tail(1) command with -f option on the logfile in an xterm.\n" +"\"\n" +"\n" " set helptext(Quit) \"\n" "Terminate the tkx11vnc gui. Any x11vnc servers will be left running.\n" "\"\n" @@ -398,6 +413,20 @@ " Anywhere: Control-p invokes \\\"Actions -> ping\\\"\n" " Anywhere: Control-u and Control-r invoke \\\"Actions -> update-all\\\"\n" "\n" +"Misc:\n" +"\n" +"Since x11vnc has so many settings and to avoid further confusion,\n" +"the libvncserver options:\n" +"\n" +" -alwaysshared\n" +" -nevershared\n" +" -dontdisconnect\n" +"\n" +"are not available for changing in a running x11vnc (even though it\n" +"is feasible). These options overlap with the x11vnc options -shared\n" +"and -forever which are hopefully enough for most usage. They may be\n" +"specified for x11vnc startup if desired.\n" +"\n" "\"\n" "}\n" "\n" @@ -512,8 +541,8 @@ "}\n" "\n" "proc help_win {item} {\n" -" global helptext helpremote\n" -" global query_ans query_aro;\n" +" global helptext helpremote menu_var\n" +" global query_ans query_aro\n" "\n" " set ok 0\n" " set text \"Help on $item:\\n\\n\"\n" @@ -557,6 +586,18 @@ " set ok 1\n" " }\n" "\n" +" if {![is_action $item] && [info exists menu_var($item)]} {\n" +" global unset_str\n" +" append text \"\\n\\n\"\n" +" append text \"==== current $item value: ====\\n\";\n" +" append text \"\\n\"\n" +" if {$menu_var($item) == \"\"} {\n" +" append text \"$unset_str\\n\"\n" +" } else {\n" +" append text \"$menu_var($item)\\n\"\n" +" }\n" +" }\n" +"\n" " if {$item == \"start\"} {\n" " set str [get_start_x11vnc_txt]\n" " append text $str\n" @@ -805,15 +846,20 @@ "# Entry box utilities:\n" "proc entry_state {x state} {\n" " global entry_box entry_label entry_ok entry_help entry_skip entry_browse\n" +" global old_labels\n" " if {$x == \"all\"} {\n" -" $entry_label configure -state $state\n" +" if {!$old_labels} {\n" +" $entry_label configure -state $state\n" +" }\n" " $entry_box configure -state $state\n" " $entry_ok configure -state $state\n" " $entry_skip configure -state $state\n" " $entry_help configure -state $state\n" " $entry_browse configure -state $state\n" " } elseif {$x == \"label\"} {\n" -" $entry_label configure -state $state\n" +" if {!$old_labels} {\n" +" $entry_label configure -state $state\n" +" }\n" " } elseif {$x == \"box\"} {\n" " $entry_box configure -state $state\n" " } elseif {$x == \"ok\"} {\n" @@ -1342,7 +1388,11 @@ "}\n" "\n" "proc set_info {str} {\n" -" global info_str\n" +" global info_str info_label\n" +"#set w1 [$info_label cget -width]\n" +"#set w2 [winfo width $info_label]\n" +"#puts \"set_info: w=$w1 winfo=$w2\"\n" +"#append_text \"$str\\n\"\n" " set info_str \"$str\"\n" " update\n" "}\n" @@ -1366,6 +1416,55 @@ " textwin \"Settings\" \"All Current Settings\" $txt\n" "}\n" "\n" +"proc show_logfile {} {\n" +" global menu_var unset_str\n" +" set logfile $menu_var(logfile)\n" +" \n" +" if {$logfile == \"\" || $logfile == $unset_str} {\n" +" set txt \"\\nNo logfile has been specified.\\n\\n\" \n" +" } elseif {![file exists $logfile]} {\n" +" set txt \"\\nLogfile \\\"$logfile\\\" does not exist.\\n\\n\"\n" +" } else {\n" +" set fh \"-3\"\n" +" set err \"\"\n" +" catch {set fh [open $logfile \"r\"]} err\n" +" if {$fh == \"-3\"} {\n" +" set txt \"\\nError opening \\\"$logfile\\\" $err.\\n\\n\"\n" +" } else {\n" +" set txt \"\\nLogfile \\\"$logfile\\\" current contents:\\n\"\n" +" while {[gets $fh line] > -1} {\n" +" append txt \"$line\\n\"\n" +" }\n" +" close $fh\n" +" }\n" +" }\n" +" textwin \"Logfile\" \"Logfile\" $txt\n" +"}\n" +"\n" +"proc tail_logfile {} {\n" +" global menu_var unset_str\n" +" set logfile $menu_var(logfile)\n" +" \n" +" set txt \"\"\n" +" if {$logfile == \"\" || $logfile == $unset_str} {\n" +" set txt \"\\nNo logfile has been specified.\\n\\n\" \n" +" } elseif {![file exists $logfile]} {\n" +" set txt \"\\nLogfile \\\"$logfile\\\" does not exist.\\n\\n\"\n" +" } else {\n" +" set cmd \"\"\n" +" set xterm_cmd \"xterm -geometry 80x45 -title x11vnc-logfile -e\"\n" +" set cmd [split $xterm_cmd]\n" +" lappend cmd \"tail\"\n" +" lappend cmd \"+1f\"\n" +" lappend cmd $logfile\n" +" lappend cmd \"&\"\n" +" catch {[eval exec $cmd]}\n" +" }\n" +" if {$txt != \"\"} {\n" +" textwin \"Logfile\" \"Logfile\" $txt\n" +" }\n" +"}\n" +"\n" "proc set_connected {yesno} {\n" " global connected_to_x11vnc\n" " set orig $connected_to_x11vnc\n" @@ -1428,6 +1527,12 @@ " } elseif {$item == \"all-settings\"} {\n" " show_all_settings\n" " return\n" +" } elseif {$item == \"show-logfile\"} {\n" +" show_logfile\n" +" return\n" +" } elseif {$item == \"tail-logfile\"} {\n" +" tail_logfile\n" +" return\n" " } elseif {$item == \"stop+quit\"} {\n" " push_new_value \"stop\" \"stop\" 1 0\n" " set_connected no\n" @@ -1672,7 +1777,7 @@ " append_text \"Invalid client info string: $client\\n\"\n" " return\n" " }\n" -" append msg \"*** To disconnect this client press \\\"OK\\\", otherwise press \\\"Skip\\\"\\n\"\n" +" append msg \"*** To *DISCONNECT* this client press \\\"OK\\\", otherwise press \\\"Skip\\\"\\n\"\n" " bell\n" " if [warning_dialog $msg \"current\"] {\n" " push_new_value \"disconnect\" \"disconnect\" $cid 1\n" @@ -1763,17 +1868,19 @@ " global menu_b menu_m\n" " global item_opts item_bool item_case item_entry menu_var unset_str\n" " global item_cascade\n" -" global info_str x11_display vnc_display\n" +" global info_label info_str x11_display vnc_display\n" " global text_area\n" " global entry_box entry_str entry_set entry_label entry_ok entry_browse\n" " global entry_help entry_skip\n" " global bfont\n" " global helptext helpremote helplabel\n" "\n" -"set v 0\n" -" \n" -" label .info -textvariable info_str -bd 2 -relief groove -anchor w \n" -" pack .info -side top -fill x \n" +" set label_width 80\n" +"\n" +" set info_label .info\n" +" label $info_label -textvariable info_str -bd 2 -relief groove \\\n" +" -anchor w -width $label_width\n" +" pack $info_label -side top -fill x -expand 0\n" "\n" " # Extract the Rows:\n" " set row 0;\n" @@ -1875,7 +1982,7 @@ " set item_cascade($item) \"\"\n" " set item_entry($item) $menu_count($case)\n" "\n" -"if {$v} { puts \"ITEM: $item - $opts - $case - $bool - $menu_count($case)\" }\n" +" if {0} { puts \"ITEM: $item - $opts - $case - $bool - $menu_count($case)\" }\n" "\n" " set mvar 0 \n" " set m $menu_m($case)\n" @@ -1953,8 +2060,6 @@ " set m $menu_m($case);\n" " set n [$m index end]\n" "\n" -"if {$v} { puts \"$case end: $n\" }\n" -"\n" " for {set i 0} {$i <= $n} {incr i} {\n" " set type [$m type $i]\n" " if {$type == \"separator\"} {\n" @@ -1972,13 +2077,6 @@ " $m add command -label $str \\\n" " -command \"menu_help $label\";\n" "\n" -"if {$v} {\n" -" set ht \"\"; set hr \"\"\n" -" if {[info exists helptext($label)]} { set ht \"YES\" }\n" -" if {[info exists helpremote($label)]} { set hr \"YES\" }\n" -" puts \"'$label'\\tht='$ht' hr='$hr'\"\n" -"}\n" -"\n" " if {$str == \"\"} {\n" " $m entryconfigure end -state disabled\n" " }\n" @@ -2000,11 +2098,13 @@ "\n" " set df_x11 \"$df.xdisplay\"\n" " no_x11_display\n" -" label $df_x11 -textvariable x11_display -width 35 -anchor w\n" +"\n" +" set lw [expr {$label_width / 2}]\n" +" label $df_x11 -textvariable x11_display -width $lw -anchor w\n" "\n" " set df_vnc \"$df.vdisplay\"\n" " no_vnc_display\n" -" label $df_vnc -textvariable vnc_display -width 35 -anchor w\n" +" label $df_vnc -textvariable vnc_display -width $lw -anchor w\n" "\n" " pack $df_x11 $df_vnc -side left \n" " pack $df -side top -fill x\n" @@ -2022,7 +2122,7 @@ " set ef .entryframe\n" " frame $ef -bd 1 -relief groove\n" "\n" -" # Label\n" +" # Entry Label\n" " set ef_label \"$ef.label\"\n" " label $ef_label -textvariable entry_str -anchor w -font $bfont\n" "\n" @@ -2032,22 +2132,22 @@ " bind $ef_entry {set entry_set 1}\n" " bind $ef_entry {set entry_set 0}\n" "\n" -" # OK button\n" +" # Entry OK button\n" " set ef_ok \"$ef.ok\"\n" " button $ef_ok -text OK -pady 1 -command {set entry_set 1} \\\n" " -font $bfont\n" "\n" -" # Skip button\n" +" # Entry Skip button\n" " set ef_skip \"$ef.skip\"\n" " button $ef_skip -text Skip -pady 0 -command {set entry_set 0} \\\n" " -font $bfont\n" "\n" -" # Help button\n" +" # Entry Help button\n" " set ef_help \"$ef.help\"\n" " button $ef_help -text Help -pady 0 -command \\\n" " {menu_help $entry_dialog_item} -font $bfont\n" "\n" -" # Browse button\n" +" # Entry Browse button\n" " set ef_browse \"$ef.browse\"\n" " button $ef_browse -text \"Browse...\" -pady 0 -font $bfont \\\n" " -command {entry_insert [tk_getOpenFile]} \n" @@ -2069,6 +2169,11 @@ "\n" " update\n" " wm minsize . [winfo width .] [winfo height .]\n" +"\n" +" #set w [winfo width .info]\n" +" #puts \"w1: $w\"\n" +" #set w [winfo reqwidth .info]\n" +" #puts \"w2: $w\"\n" "}\n" "\n" "proc menu_bindings {} {\n" @@ -2335,13 +2440,13 @@ " lappend cmd \"2>\"\n" " lappend cmd \"/dev/null\"\n" "\n" -"if {0} {\n" -" set str [join $cmd]\n" -" puts \"running: $str\"\n" -" foreach word $cmd {\n" -" puts \" word: $word\"\n" +" if {0} {\n" +" set str [join $cmd]\n" +" puts \"running: $str\"\n" +" foreach word $cmd {\n" +" puts \" word: $word\"\n" +" }\n" " }\n" -"}\n" "\n" " set output \"\"\n" " menus_disable\n" @@ -2420,7 +2525,7 @@ "global all_settings reply_xdisplay always_update\n" "global max_text_height max_text_width\n" "global menu_var unset_str menus_disabled\n" -"global bfont\n" +"global bfont old_labels\n" "global connected_to_x11vnc\n" "global delay_sleep extra_sleep extra_sleep_split\n" "global cache_all_query_vars\n" @@ -2442,6 +2547,12 @@ "set extra_sleep 1000\n" "set extra_sleep_split 4\n" "\n" +"if {[regexp {^[34]} $tk_version] || $tk_version == \"8.0\"} {\n" +" set old_labels 1\n" +"} else {\n" +" set old_labels 0\n" +"}\n" +"\n" "if {\"$argv\" == \"-spit\"} {\n" " set fh [open $argv0 r]\n" " puts \"/*\"\n" diff --git a/x11vnc/x11vnc.1 b/x11vnc/x11vnc.1 index 546f243..05b076c 100644 --- a/x11vnc/x11vnc.1 +++ b/x11vnc/x11vnc.1 @@ -2,7 +2,7 @@ .TH X11VNC "1" "December 2004" "x11vnc " "User Commands" .SH NAME x11vnc - allow VNC connections to real X11 displays - version: 0.7pre, lastmod: 2004-12-23 + version: 0.7.1pre, lastmod: 2004-12-27 .SH SYNOPSIS .B x11vnc [OPTION]... @@ -573,6 +573,13 @@ default (see \fB-noxfixes\fR below). This can be disabled with \fB-nocursor,\fR and also some values of the "mode" option below. .IP +Note that under XFIXES cursors with transparency +(alpha channel) will not be exactly represented and +so Overlay may be preferred. See also the \fB-alphacut\fR +and \fB-alphafrac\fR options below as fudge factors to try +to improve the situation for cursors with transparency +for a given theme. +.IP The "mode" string can be used to fine-tune the displaying of cursor shapes. It can be used the following ways: @@ -608,6 +615,37 @@ is not available, \fB-overlay\fR mode will be attempted. Do not use the XFIXES extension to draw the exact cursor shape even if it is available. .PP +\fB-alphacut\fR \fIn\fR +.IP +When using the XFIXES extension for the cursor shape, +cursors with transparency will not be displayed exactly +(but opaque ones will). This option sets n as a cutoff +for cursors that have transparency ("alpha channel" +with values ranging from 0 to 255) Any cursor pixel with +alpha value less than n becomes completely transparent. +Otherwise the pixel is completely opaque. Default 255 +.IP +Note: the options \fB-alphacut,\fR \fB-alphafrac,\fR and \fB-alphafrac\fR +may be removed if a more accurate internal method for +handling cursor transparency is implemented. +.PP +\fB-alphafrac\fR \fIfraction\fR +.IP +With the threshold in \fB-alphacut\fR some cursors will become +almost completely transparent because their alpha values +are not high enough. For those cursors adjust the +alpha threshold until fraction of the non-zero alpha +channel pixels become opaque. Default 0.33 +.PP +\fB-alpharemove\fR +.IP +By default, XFIXES cursors pixels with transparency have +the alpha factor multiplied into the RGB color values +(i.e. that corresponding to blending the cursor with a +black background). Specify this option to remove the +alpha factor. (useful for light colored semi-transparent +cursors). +.PP \fB-nocursorshape\fR .IP Do not use the TightVNC CursorShapeUpdates extension @@ -998,18 +1036,24 @@ norepeat enable \fB-norepeat\fR mode. .IP repeat disable \fB-norepeat\fR mode. .IP +nofb enable \fB-nofb\fR mode. +.IP +fb disable \fB-nofb\fR mode. +.IP bell enable bell (if supported). .IP nobell disable bell. .IP -sel disable \fB-nosel\fR mode. +bell enable bell (if supported). .IP nosel enable \fB-nosel\fR mode. .IP -primary disable \fB-noprimary\fR mode. +sel disable \fB-nosel\fR mode. .IP noprimary enable \fB-noprimary\fR mode. .IP +primary disable \fB-noprimary\fR mode. +.IP cursor:mode enable \fB-cursor\fR "mode". .IP show_cursor enable showing a cursor. @@ -1021,6 +1065,14 @@ xfixes enable xfixes cursor shape mode. .IP noxfixes disable xfixes cursor shape mode. .IP +alphacut:n set \fB-alphacut\fR to n. +.IP +alphafrac:f set \fB-alphafrac\fR to f. +.IP +alpharemove enable \fB-alpharemove\fR mode. +.IP +noalpharemove disable \fB-alpharemove\fR mode. +.IP cursorshape disable \fB-nocursorshape\fR mode. .IP nocursorshape enable \fB-nocursorshape\fR mode. @@ -1055,6 +1107,8 @@ defer:n set \fB-defer\fR to n ms,same as deferupdate:n .IP wait:n set \fB-wait\fR to n ms. .IP +rfbwait:n set \fB-rfbwait\fR (rfbMaxClientWait) to n ms. +.IP nap enable \fB-nap\fR mode. .IP nonap disable \fB-nap\fR mode. @@ -1072,8 +1126,36 @@ fuzz:n set \fB-fuzz\fR to n. progressive:n set libvncserver \fB-progressive\fR slice height parameter to n. .IP -file:name run \fB-remote\fR commands from file "name", - one command per line,blank and # skipped +desktop:str set \fB-desktop\fR name to str for new clients. +.IP +rfbport:n set \fB-rfbport\fR to n. +.IP +http enable http client connections. +.IP +nohttp disable http client connections. +.IP +httpport:n set \fB-httpport\fR to n. +.IP +httpdir:dir set \fB-httpdir\fR to dir (and enable http). +.IP +enablehttpproxy enable \fB-enablehttpproxy\fR mode. +.IP +noenablehttpproxy disable \fB-enablehttpproxy\fR mode. +.IP +alwaysshared enable \fB-alwaysshared\fR mode. +.IP +noalwaysshared disable \fB-alwaysshared\fR mode. + (may interfere with other options) +.IP +nevershared enable \fB-nevershared\fR mode. +.IP +nonevershared disable \fB-nevershared\fR mode. + (may interfere with other options) +.IP +dontdisconnect enable \fB-dontdisconnect\fR mode. +.IP +nodontdisconnect disable \fB-dontdisconnect\fR mode. + (may interfere with other options) .IP noremote disable the \fB-remote\fR command processing, it cannot be turned back on. @@ -1138,33 +1220,37 @@ noflashcmap truecolor notruecolor overlay nooverlay overlay_cursor overlay_yescursor nooverlay_nocursor nooverlay_cursor nooverlay_yescursor overlay_nocursor visual scale viewonly noviewonly shared noshared -forever noforever once deny lock nodeny unlock connect -allowonce allow localhost nolocalhost accept gone shm -noshm flipbyteorder noflipbyteorder onetile noonetile -blackout xinerama noxinerama xrandr noxrandr xrandr_mode -padgeom quiet q noquiet modtweak nomodtweak xkb noxkb -skip_keycodes add_keysyms noadd_keysyms clear_mods -noclear_mods clear_keys noclear_keys remap repeat -norepeat bell nobell sel nosel primary noprimary -cursorshape nocursorshape cursorpos nocursorpos cursor -show_cursor noshow_cursor nocursor xfixes noxfixes xwarp -xwarppointer noxwarp noxwarppointer buttonmap dragging -nodragging pointer_mode input_skip debug_pointer dp -nodebug_pointer nodp debug_keyboard dk nodebug_keyboard -nodk deferupdate defer wait nap nonap sb screen_blank -fs gaps grow fuzz progressive noremote -.IP -aro= display vncdisplay desktopname desktop auth -rootshift scale_str scaled_x scaled_y scale_numer -scale_denom scale_fac scaling_noblend scaling_nomult4 -scaling_pad scaling_interpolate inetd safer unsafe -passwdfile using_shm logfile o rc norc h help V version -lastmod bg nofb sigpipe threads clients client_count -pid ext_xtest ext_xkb ext_xshm ext_xinerama ext_overlay -ext_xfixes ext_xdamage ext_xrandr rootwin num_buttons -button_mask mouse_x mouse_y bpp depth indexed_color -dpy_x dpy_y rfbport rfbwait rfbauth passwd alwaysshared -dontdisconnect httpdir enablehttpproxy +forever noforever once deny lock nodeny unlock +connect allowonce allow localhost nolocalhost accept +gone shm noshm flipbyteorder noflipbyteorder onetile +noonetile blackout xinerama noxinerama xrandr noxrandr +xrandr_mode padgeom quiet q noquiet modtweak nomodtweak +xkb noxkb skip_keycodes add_keysyms noadd_keysyms +clear_mods noclear_mods clear_keys noclear_keys +remap repeat norepeat fb nofb bell nobell sel +nosel primary noprimary cursorshape nocursorshape +cursorpos nocursorpos cursor show_cursor noshow_cursor +nocursor xfixes noxfixes alphacut alphafrac alpharemove +noalpharemove xwarp xwarppointer noxwarp noxwarppointer +buttonmap dragging nodragging pointer_mode input_skip +debug_pointer dp nodebug_pointer nodp debug_keyboard +dk nodebug_keyboard nodk deferupdate defer wait +rfbwait nap nonap sb screen_blank fs gaps grow fuzz +progressive rfbport http nohttp httpport httpdir +enablehttpproxy noenablehttpproxy alwaysshared +noalwaysshared nevershared noalwaysshared dontdisconnect +nodontdisconnect desktop noremote +.IP +aro= display vncdisplay desktopname auth rootshift +scale_str scaled_x scaled_y scale_numer scale_denom +scale_fac scaling_noblend scaling_nomult4 scaling_pad +scaling_interpolate inetd safer unsafe passwdfile +using_shm logfile o rc norc h help V version lastmod +bg sigpipe threads clients client_count pid ext_xtest +ext_xkb ext_xshm ext_xinerama ext_overlay ext_xfixes +ext_xdamage ext_xrandr rootwin num_buttons button_mask +mouse_x mouse_y bpp depth indexed_color dpy_x dpy_y +rfbauth passwd .PP \fB-sync\fR .IP diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c index 959d42f..d556e97 100644 --- a/x11vnc/x11vnc.c +++ b/x11vnc/x11vnc.c @@ -118,6 +118,12 @@ #define OLD_TREE 0 #if OLD_TREE +/* + * if have a very old tree and get errors these may be needed as well: +#define oldCursorX cursorX +#define oldCursorY cursorY + */ + /* * If you are building in an older libvncserver tree with this newer * x11vnc.c file using OLD_TREE=1 you may need to set some of these lines @@ -129,14 +135,14 @@ * by setting them in LD_FLAGS before running configure. */ -#define LIBVNCSERVER_HAVE_XSHM -#define LIBVNCSERVER_HAVE_XTEST +#define LIBVNCSERVER_HAVE_XSHM 1 +#define LIBVNCSERVER_HAVE_XTEST 1 /* -#define LIBVNCSERVER_HAVE_LIBXINERAMA -#define LIBVNCSERVER_HAVE_XFIXES -#define LIBVNCSERVER_HAVE_XDAMAGE +#define LIBVNCSERVER_HAVE_LIBXINERAMA 1 +#define LIBVNCSERVER_HAVE_XFIXES 1 +#define LIBVNCSERVER_HAVE_XDAMAGE 1 */ -#endif +#endif /* OLD_TREE */ #include #include @@ -170,34 +176,36 @@ #define deferUpdateTime rfbDeferUpdateTime #define authPasswdData rfbAuthPasswdData #define rfbEncryptAndStorePasswd vncEncryptAndStorePasswd +#define maxClientWait rfbMaxClientWait +#define rfbHttpInitSockets httpInitSockets #endif -#ifdef LIBVNCSERVER_HAVE_XSHM +#if LIBVNCSERVER_HAVE_XSHM #include #include #include #endif -#ifdef LIBVNCSERVER_HAVE_XTEST +#if LIBVNCSERVER_HAVE_XTEST #include #endif -#ifdef LIBVNCSERVER_HAVE_XKEYBOARD +#if LIBVNCSERVER_HAVE_XKEYBOARD #include #endif -#ifdef LIBVNCSERVER_HAVE_LIBXINERAMA +#if LIBVNCSERVER_HAVE_LIBXINERAMA #include #endif -#ifdef LIBVNCSERVER_HAVE_SYS_SOCKET_H +#if LIBVNCSERVER_HAVE_SYS_SOCKET_H #include #endif #include extern int h_errno; -#ifdef LIBVNCSERVER_HAVE_NETINET_IN_H +#if LIBVNCSERVER_HAVE_NETINET_IN_H #include #include #include @@ -233,9 +241,9 @@ int overlay_present = 0; /* * Ditto for librandr. * (e.g. LDFLAGS=-lXrandr before configure). -#define LIBVNCSERVER_HAVE_LIBXRANDR +#define LIBVNCSERVER_HAVE_LIBXRANDR 1 */ -#ifdef LIBVNCSERVER_HAVE_LIBXRANDR +#if LIBVNCSERVER_HAVE_LIBXRANDR #include static int xrandr_base_event_type; #endif @@ -243,20 +251,23 @@ static int xrandr_base_event_type; int xfixes_present = 0; int use_xfixes = 1; int got_xfixes_cursor_notify = 0; +int alpha_threshold = 255; +double alpha_frac = 0.33; +int alpha_remove = 0; -#ifdef LIBVNCSERVER_HAVE_LIBXFIXES +#if LIBVNCSERVER_HAVE_LIBXFIXES #include static int xfixes_base_event_type; #endif int xdamage_present = 0; -#ifdef LIBVNCSERVER_HAVE_LIBXDAMAGE +#if LIBVNCSERVER_HAVE_LIBXDAMAGE #include static int xdamage_base_event_type; #endif /* date +'lastmod: %Y-%m-%d' */ -char lastmod[] = "0.7pre lastmod: 2004-12-23"; +char lastmod[] = "0.7.1pre lastmod: 2004-12-27"; /* X display info */ @@ -277,7 +288,7 @@ XImage *fullscreen; XImage **tile_row; /* for all possible row runs */ XImage *fb0; -#ifndef LIBVNCSERVER_HAVE_XSHM +#if !LIBVNCSERVER_HAVE_XSHM /* * for simplicity, define this struct since we'll never use them * under using_shm = 0. @@ -295,6 +306,7 @@ XShmSegmentInfo *tile_row_shm; /* for all possible row runs */ /* rfb screen info */ rfbScreenInfoPtr screen = NULL; char *rfb_desktop_name = NULL; +char *http_dir = NULL; char vnc_desktop_name[256]; char *main_fb; /* our copy of the X11 fb */ char *rfb_fb; /* same as main_fb unless transformation */ @@ -440,6 +452,8 @@ void set_offset(void); void set_rfb_cursor(int); void set_visual(char *vstring); void set_cursor(int, int, int); +void setup_cursors(void); +void first_cursor(void); void set_no_cursor(void); void set_cursor_was_changed(rfbScreenInfoPtr); int get_which_cursor(void); @@ -577,17 +591,17 @@ int visual_depth = 0; int overlay = 0; int overlay_cursor = 1; -#ifdef LIBVNCSERVER_HAVE_XSHM +#if LIBVNCSERVER_HAVE_XSHM int xshm_present = 1; #else int xshm_present = 0; #endif -#ifdef LIBVNCSERVER_HAVE_XTEST +#if LIBVNCSERVER_HAVE_XTEST int xtest_present = 1; #else int xtest_present = 0; #endif -#ifdef LIBVNCSERVER_HAVE_XKEYBOARD +#if LIBVNCSERVER_HAVE_XKEYBOARD int xkb_present = 1; #else int xkb_present = 0; @@ -613,11 +627,11 @@ int got_alwaysshared = 0; int got_nevershared = 0; /* threaded vs. non-threaded (default) */ -#if defined(LIBVNCSERVER_X11VNC_THREADED) && ! defined(X11VNC_THREADED) +#if LIBVNCSERVER_X11VNC_THREADED && ! defined(X11VNC_THREADED) #define X11VNC_THREADED #endif -#if defined(LIBVNCSERVER_HAVE_LIBPTHREAD) && defined(X11VNC_THREADED) +#if LIBVNCSERVER_HAVE_LIBPTHREAD && defined(X11VNC_THREADED) int use_threads = 1; #else int use_threads = 0; @@ -843,7 +857,7 @@ char *get_remote_host(int sock) { memset(&saddr, 0, sizeof(saddr)); saddr_port = -1; if (!getsockname(sock, (struct sockaddr *)&saddr, &saddr_len)) { -#ifdef LIBVNCSERVER_HAVE_NETINET_IN_H +#if LIBVNCSERVER_HAVE_NETINET_IN_H saddr_ip_str = inet_ntoa(saddr.sin_addr); #endif } @@ -875,7 +889,7 @@ char *get_local_host(int sock) { memset(&saddr, 0, sizeof(saddr)); saddr_port = -1; if (!getsockname(sock, (struct sockaddr *)&saddr, &saddr_len)) { -#ifdef LIBVNCSERVER_HAVE_NETINET_IN_H +#if LIBVNCSERVER_HAVE_NETINET_IN_H saddr_ip_str = inet_ntoa(saddr.sin_addr); #endif } @@ -952,7 +966,7 @@ Status XShmGetImage_wr(Display *disp, Drawable d, XImage *image, int x, int y, /* Note: the Solaris overlay stuff is all non-shm (using_shm = 0) */ -#ifdef LIBVNCSERVER_HAVE_XSHM +#if LIBVNCSERVER_HAVE_XSHM return XShmGetImage(disp, d, image, x, y, mask); #else return (Status) 0; @@ -963,7 +977,7 @@ XImage *XShmCreateImage_wr(Display* disp, Visual* vis, unsigned int depth, int format, char* data, XShmSegmentInfo* shminfo, unsigned int width, unsigned int height) { -#ifdef LIBVNCSERVER_HAVE_XSHM +#if LIBVNCSERVER_HAVE_XSHM return XShmCreateImage(disp, vis, depth, format, data, shminfo, width, height); #else @@ -972,7 +986,7 @@ XImage *XShmCreateImage_wr(Display* disp, Visual* vis, unsigned int depth, } Status XShmAttach_wr(Display *disp, XShmSegmentInfo *shminfo) { -#ifdef LIBVNCSERVER_HAVE_XSHM +#if LIBVNCSERVER_HAVE_XSHM return XShmAttach(disp, shminfo); #else return (Status) 0; @@ -980,7 +994,7 @@ Status XShmAttach_wr(Display *disp, XShmSegmentInfo *shminfo) { } Status XShmDetach_wr(Display *disp, XShmSegmentInfo *shminfo) { -#ifdef LIBVNCSERVER_HAVE_XSHM +#if LIBVNCSERVER_HAVE_XSHM return XShmDetach(disp, shminfo); #else return (Status) 0; @@ -988,7 +1002,7 @@ Status XShmDetach_wr(Display *disp, XShmSegmentInfo *shminfo) { } Bool XShmQueryExtension_wr(Display *disp) { -#ifdef LIBVNCSERVER_HAVE_XSHM +#if LIBVNCSERVER_HAVE_XSHM return XShmQueryExtension(disp); #else return False; @@ -1101,7 +1115,7 @@ void XTestFakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down, } else { last_keyboard_input = key; } -#ifdef LIBVNCSERVER_HAVE_XTEST +#if LIBVNCSERVER_HAVE_XTEST XTestFakeKeyEvent(dpy, key, down, delay); #endif } @@ -1111,7 +1125,7 @@ void XTestFakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press, if (! xtest_present) { return; } -#ifdef LIBVNCSERVER_HAVE_XTEST +#if LIBVNCSERVER_HAVE_XTEST XTestFakeButtonEvent(dpy, button, is_press, delay); #endif } @@ -1121,7 +1135,7 @@ void XTestFakeMotionEvent_wr(Display* dpy, int screen, int x, int y, if (! xtest_present) { return; } -#ifdef LIBVNCSERVER_HAVE_XTEST +#if LIBVNCSERVER_HAVE_XTEST XTestFakeMotionEvent(dpy, screen, x, y, delay); #endif } @@ -1130,7 +1144,7 @@ Bool XTestCompareCurrentCursorWithWindow_wr(Display* dpy, Window w) { if (! xtest_present) { return False; } -#ifdef LIBVNCSERVER_HAVE_XTEST +#if LIBVNCSERVER_HAVE_XTEST return XTestCompareCurrentCursorWithWindow(dpy, w); #else return False; @@ -1141,7 +1155,7 @@ Bool XTestCompareCursorWithWindow_wr(Display* dpy, Window w, Cursor cursor) { if (! xtest_present) { return False; } -#ifdef LIBVNCSERVER_HAVE_XTEST +#if LIBVNCSERVER_HAVE_XTEST return XTestCompareCursorWithWindow(dpy, w, cursor); #else return False; @@ -1152,7 +1166,7 @@ int XTestGrabControl_wr(Display* dpy, Bool impervious) { if (! xtest_present) { return 0; } -#ifdef LIBVNCSERVER_HAVE_XTEST +#if LIBVNCSERVER_HAVE_XTEST return XTestGrabControl(dpy, impervious); #else return 0; @@ -1161,7 +1175,7 @@ int XTestGrabControl_wr(Display* dpy, Bool impervious) { Bool XTestQueryExtension_wr(Display *dpy, int *ev, int *er, int *maj, int *min) { -#ifdef LIBVNCSERVER_HAVE_XTEST +#if LIBVNCSERVER_HAVE_XTEST return XTestQueryExtension(dpy, ev, er, maj, min); #else return False; @@ -1172,7 +1186,7 @@ void XTestDiscard_wr(Display *dpy) { if (! xtest_present) { return; } -#ifdef LIBVNCSERVER_HAVE_XTEST +#if LIBVNCSERVER_HAVE_XTEST XTestDiscard(dpy); #endif } @@ -3095,7 +3109,7 @@ static unsigned int xkbmodifiers[0x100][GRP][LVL]; static int multi_key[0x100], mode_switch[0x100], skipkeycode[0x100]; static int shift_keys[0x100]; -#ifndef LIBVNCSERVER_HAVE_XKEYBOARD +#if !LIBVNCSERVER_HAVE_XKEYBOARD /* empty functions for no xkb */ static void initialize_xkb_modtweak(void) {} @@ -4396,7 +4410,7 @@ void initialize_pointer_map(char *pointer_remap) { if (pointer_remap && *pointer_remap != '\0') { /* -buttonmap, format is like: 12-21=2 */ - char *p, *q, *remap = pointer_remap; + char *p, *q, *remap = strdup(pointer_remap); int n; if ((p = strchr(remap, '=')) != NULL) { @@ -4433,6 +4447,7 @@ void initialize_pointer_map(char *pointer_remap) { p++; } } + free(remap); } } @@ -4683,7 +4698,7 @@ void pointer(int mask, int x, int y, rfbClientPtr client) { /* * Bell event handling. Requires XKEYBOARD extension. */ -#ifdef LIBVNCSERVER_HAVE_XKEYBOARD +#if LIBVNCSERVER_HAVE_XKEYBOARD static int xkb_base_event_type; @@ -4823,7 +4838,7 @@ XErrorHandler old_getimage_handler; /* -- xrandr.c -- */ void initialize_xrandr(void) { -#ifdef LIBVNCSERVER_HAVE_LIBXRANDR +#if LIBVNCSERVER_HAVE_LIBXRANDR if (xrandr_present) { Rotation rot; @@ -4939,7 +4954,7 @@ int check_xrandr_event(char *msg) { if (subwin) { return handle_subwin_resize(msg); } -#ifdef LIBVNCSERVER_HAVE_LIBXRANDR +#if LIBVNCSERVER_HAVE_LIBXRANDR if (! xrandr || ! xrandr_present) { return 0; } @@ -5382,12 +5397,12 @@ void check_xevents(void) { } } -#ifdef LIBVNCSERVER_HAVE_LIBXRANDR +#if LIBVNCSERVER_HAVE_LIBXRANDR if (xrandr) { check_xrandr_event("check_xevents"); } #endif -#ifdef LIBVNCSERVER_HAVE_LIBXFIXES +#if LIBVNCSERVER_HAVE_LIBXFIXES if (XCheckTypedEvent(dpy, xfixes_base_event_type + XFixesCursorNotify, &xev)) { got_xfixes_cursor_notify++; @@ -5694,6 +5709,172 @@ void check_black_fb(void) { } } +int check_httpdir(void) { + if (http_dir) { + return 1; + } else { + char *prog, *httpdir, *q; + struct stat sbuf; + int len; + + rfbLog("check_httpdir: trying to guess httpdir...\n"); + if (program_name[0] == '/') { + prog = strdup(program_name); + } else { + char cwd[1024]; + getcwd(cwd, 1024); + len = strlen(cwd) + 1 + strlen(program_name) + 1; + prog = (char *) malloc(len); + snprintf(prog, len, "%s/%s", cwd, program_name); + if (stat(prog, &sbuf) != 0) { + char *path = strdup(getenv("PATH")); + char *p, *base; + base = strrchr(program_name, '/'); + if (base) { + base++; + } else { + base = program_name; + } + + p = strtok(path, ":"); + while(p) { + free(prog); + len = strlen(p) + 1 + strlen(base) + 1; + prog = (char *) malloc(len); + snprintf(prog, len, "%s/%s", p, base); + if (stat(prog, &sbuf) == 0) { + break; + } + p = strtok(NULL, ":"); + } + free(path); + } + } + /* + * /path/to/bin/x11vnc + * /path/to/bin/../share/x11vnc/classes + * 12345678901234567 + */ + if ((q = strrchr(prog, '/')) == NULL) { + rfbLog("check_httpdir: bad program path: %s\n", prog); + free(prog); + return 0; + } + len = strlen(prog) + 17 + 1; + *q = '\0'; + httpdir = (char *) malloc(len); + snprintf(httpdir, len, "%s/../share/x11vnc/classes", prog); + free(prog); + + if (stat(httpdir, &sbuf) == 0) { + /* good enough for me */ + rfbLog("check_httpdir: guessed: %s\n", httpdir); + http_dir = httpdir; + return 1; + } else { + /* try some hardwires: */ + if (stat("/usr/local/share/x11vnc/classes", &sbuf) == 0) { + http_dir = + strdup("/usr/local/share/x11vnc/classes"); + return 1; + } + if (stat("/usr/share/x11vnc/classes", &sbuf) == 0) { + http_dir = strdup("/usr/share/x11vnc/classes"); + return 1; + } + rfbLog("check_httpdir: bad guess: %s\n", httpdir); + return 0; + } + } +} + +void http_connections(int on) { + if (on) { + rfbLog("http_connections: turning on http service.\n"); + screen->httpInitDone = FALSE; + screen->httpDir = http_dir; + if (check_httpdir()) { + rfbHttpInitSockets(screen); + } + } else { + rfbLog("http_connections: turning off http service.\n"); + if (screen->httpListenSock > -1) { + close(screen->httpListenSock); + } + screen->httpListenSock = -1; + screen->httpDir = NULL; + } +} + +void reset_httpport(int old, int new) { + int hp = new; + if (hp < 0) { + rfbLog("reset_httpport: bad httpport: %d\n", hp); + } else if (hp == old) { + rfbLog("reset_httpport: unchanged httpport: %d\n", hp); + } else if (inetd) { + rfbLog("reset_httpport: cannot set httpport: %d" + " in inetd.\n", hp); + } else { + screen->httpPort = hp; + screen->httpInitDone = FALSE; + if (screen->httpListenSock > -1) { + close(screen->httpListenSock); + } + rfbLog("reset_httpport: setting httpport %d -> %d.\n", + old, hp); + rfbHttpInitSockets(screen); + } +} + +void reset_rfbport(int old, int new) { + int rp = new; + if (rp < 0) { + rfbLog("reset_rfbport: bad rfbport: %d\n", rp); + } else if (rp == old) { + rfbLog("reset_rfbport: unchanged rfbport: %d\n", rp); + } else if (inetd) { + rfbLog("reset_rfbport: cannot set rfbport: %d" + " in inetd.\n", rp); + } else { + rfbClientIteratorPtr iter; + rfbClientPtr cl; + int maxfd; + if (rp == 0) { + screen->autoPort = TRUE; + } else { + screen->autoPort = FALSE; + } + screen->port = rp; + screen->socketInitDone = FALSE; + + if (screen->listenSock > -1) { + close(screen->listenSock); + } + + rfbLog("reset_rfbport: setting rfbport %d -> %d.\n", + old, rp); + rfbInitSockets(screen); + + maxfd = screen->maxFd; + if (screen->udpSock > 0 && screen->udpSock > maxfd) { + maxfd = screen->udpSock; + } + iter = rfbGetClientIterator(screen); + while( (cl = rfbClientIteratorNext(iter)) ) { + if (cl->sock > -1) { + FD_SET(cl->sock, &(screen->allFds)); + if (cl->sock > maxfd) { + maxfd = cl->sock; + } + } + } + rfbReleaseClientIterator(iter); + + screen->maxFd = maxfd; + } +} + /* * Huge, ugly switch to handle all remote commands and queries * -remote/-R and -query/-Q. @@ -5752,7 +5933,6 @@ char *process_remote_cmd(char *cmd, int stringonly) { goto done; } - /* always call like: COLON_CHECK("foobar:") */ #define COLON_CHECK(str) \ if (strstr(p, str) != p) { \ @@ -5877,7 +6057,8 @@ char *process_remote_cmd(char *cmd, int stringonly) { ok = 1; } } else if (! scan_hexdec(p, &twin)) { - rfbLog("-id: skipping incorrect hex/dec number: %s\n", p); + rfbLog("-id: skipping incorrect hex/dec number:" + " %s\n", p); } else { ok = 1; } @@ -5947,7 +6128,8 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else if (!strcmp(p, "truecolor")) { int orig = force_indexed_color; if (query) { - snprintf(buf, bufn, "ans=%s:%d", p, !force_indexed_color); + snprintf(buf, bufn, "ans=%s:%d", p, + !force_indexed_color); goto qry; } rfbLog("process_remote_cmd: turning off notruecolor mode.\n"); @@ -5958,7 +6140,8 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else if (!strcmp(p, "notruecolor")) { int orig = force_indexed_color; if (query) { - snprintf(buf, bufn, "ans=%s:%d", p, force_indexed_color); + snprintf(buf, bufn, "ans=%s:%d", p, + force_indexed_color); goto qry; } rfbLog("process_remote_cmd: turning on notruecolor mode.\n"); @@ -6006,7 +6189,8 @@ char *process_remote_cmd(char *cmd, int stringonly) { } } else if (!strcmp(p, "overlay_cursor") || - !strcmp(p, "overlay_yescursor") || !strcmp(p, "nooverlay_nocursor")) { + !strcmp(p, "overlay_yescursor") || + !strcmp(p, "nooverlay_nocursor")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, overlay_cursor); goto qry; @@ -6023,7 +6207,8 @@ char *process_remote_cmd(char *cmd, int stringonly) { "cursors.\n"); } } else if (!strcmp(p, "nooverlay_cursor") || - !strcmp(p, "nooverlay_yescursor") || !strcmp(p, "overlay_nocursor")) { + !strcmp(p, "nooverlay_yescursor") || + !strcmp(p, "overlay_nocursor")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !overlay_cursor); goto qry; @@ -6057,7 +6242,8 @@ char *process_remote_cmd(char *cmd, int stringonly) { strstr(p, "scale:") == p) { /* skip-cmd-list */ COLON_CHECK("scale:") if (query) { - snprintf(buf, bufn, "ans=%s%s%s", p, co, NONUL(scale_str)); + snprintf(buf, bufn, "ans=%s%s%s", p, co, + NONUL(scale_str)); goto qry; } p += strlen("scale:"); @@ -6070,13 +6256,15 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else if (!strcmp(p, "viewonly")) { if (query) { - snprintf(buf, bufn, "ans=%s:%d", p, view_only); goto qry; + snprintf(buf, bufn, "ans=%s:%d", p, view_only); + goto qry; } rfbLog("process_remote_cmd: enable viewonly mode.\n"); view_only = 1; } else if (!strcmp(p, "noviewonly")) { if (query) { - snprintf(buf, bufn, "ans=%s:%d", p, !view_only); goto qry; + snprintf(buf, bufn, "ans=%s:%d", p, !view_only); + goto qry; } rfbLog("process_remote_cmd: disable viewonly mode.\n"); view_only = 0; @@ -6115,13 +6303,15 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else if (!strcmp(p, "deny") || !strcmp(p, "lock")) { if (query) { - snprintf(buf, bufn, "ans=%s:%d", p, deny_all); goto qry; + snprintf(buf, bufn, "ans=%s:%d", p, deny_all); + goto qry; } rfbLog("process_remote_cmd: denying new connections.\n"); deny_all = 1; } else if (!strcmp(p, "nodeny") || !strcmp(p, "unlock")) { if (query) { - snprintf(buf, bufn, "ans=%s:%d", p, !deny_all); goto qry; + snprintf(buf, bufn, "ans=%s:%d", p, !deny_all); + goto qry; } rfbLog("process_remote_cmd: allowing new connections.\n"); deny_all = 0; @@ -6251,7 +6441,8 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else if (strstr(p, "gone") == p) { COLON_CHECK("gone:") if (query) { - snprintf(buf, bufn, "ans=%s%s%s", p, co, NONUL(gone_cmd)); + snprintf(buf, bufn, "ans=%s%s%s", p, co, + NONUL(gone_cmd)); goto qry; } if (safe_remote_only) { @@ -6381,7 +6572,8 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else if (!strcmp(p, "xinerama")) { if (query) { - snprintf(buf, bufn, "ans=%s:%d", p, xinerama); goto qry; + snprintf(buf, bufn, "ans=%s:%d", p, xinerama); + goto qry; } rfbLog("process_remote_cmd: enable xinerama mode." "(if applicable).\n"); @@ -6389,7 +6581,8 @@ char *process_remote_cmd(char *cmd, int stringonly) { initialize_blackouts_and_xinerama(); } else if (!strcmp(p, "noxinerama")) { if (query) { - snprintf(buf, bufn, "ans=%s:%d", p, !xinerama); goto qry; + snprintf(buf, bufn, "ans=%s:%d", p, !xinerama); + goto qry; } rfbLog("process_remote_cmd: disable xinerama mode." "(if applicable).\n"); @@ -6515,7 +6708,8 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else if (!strcmp(p, "nomodtweak")) { if (query) { - snprintf(buf, bufn, "ans=%s:%d", p, !use_modifier_tweak); + snprintf(buf, bufn, "ans=%s:%d", p, + !use_modifier_tweak); goto qry; } rfbLog("process_remote_cmd: enabling -nomodtweak mode.\n"); @@ -6606,7 +6800,8 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else if (!strcmp(p, "noclear_mods")) { if (query) { - snprintf(buf, bufn, "ans=%s:%d", p, !(clear_mods == 1)); + snprintf(buf, bufn, "ans=%s:%d", p, + !(clear_mods == 1)); goto qry; } rfbLog("process_remote_cmd: disabling -clear_mods mode.\n"); @@ -6614,7 +6809,8 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else if (!strcmp(p, "clear_keys")) { if (query) { - snprintf(buf, bufn, "ans=%s:%d", p, clear_mods == 2); + snprintf(buf, bufn, "ans=%s:%d", p, + clear_mods == 2); goto qry; } rfbLog("process_remote_cmd: enabling -clear_keys mode.\n"); @@ -6623,7 +6819,8 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else if (!strcmp(p, "noclear_keys")) { if (query) { - snprintf(buf, bufn, "ans=%s:%d", p, !(clear_mods == 2)); + snprintf(buf, bufn, "ans=%s:%d", p, + !(clear_mods == 2)); goto qry; } rfbLog("process_remote_cmd: disabling -clear_keys mode.\n"); @@ -6694,6 +6891,29 @@ char *process_remote_cmd(char *cmd, int stringonly) { } no_autorepeat = 1; + } else if (!strcmp(p, "fb")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, !nofb); + goto qry; + } + if (nofb) { + rfbLog("process_remote_cmd: disabling nofb mode.\n"); + nofb = 0; + do_new_fb(1); + } + } else if (!strcmp(p, "nofb")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, nofb); + goto qry; + } + if (!nofb) { + rfbLog("process_remote_cmd: enabling nofb mode.\n"); + if (main_fb) { + push_black_screen(4); + } + nofb = 1; + } + } else if (!strcmp(p, "bell")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, sound_bell); @@ -6748,7 +6968,8 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else if (!strcmp(p, "cursorshape")) { if (query) { - snprintf(buf, bufn, "ans=%s:%d", p, cursor_shape_updates); + snprintf(buf, bufn, "ans=%s:%d", p, + cursor_shape_updates); goto qry; } rfbLog("process_remote_cmd: turning on cursorshape mode.\n"); @@ -6760,7 +6981,8 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else if (!strcmp(p, "nocursorshape")) { int i, max = 5; if (query) { - snprintf(buf, bufn, "ans=%s:%d", p, !cursor_shape_updates); + snprintf(buf, bufn, "ans=%s:%d", p, + !cursor_shape_updates); goto qry; } rfbLog("process_remote_cmd: turning off cursorshape mode.\n"); @@ -6776,14 +6998,16 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else if (!strcmp(p, "cursorpos")) { if (query) { - snprintf(buf, bufn, "ans=%s:%d", p, cursor_pos_updates); + snprintf(buf, bufn, "ans=%s:%d", p, + cursor_pos_updates); goto qry; } rfbLog("process_remote_cmd: turning on cursorpos mode.\n"); cursor_pos_updates = 1; } else if (!strcmp(p, "nocursorpos")) { if (query) { - snprintf(buf, bufn, "ans=%s:%d", p, !cursor_pos_updates); + snprintf(buf, bufn, "ans=%s:%d", p, + !cursor_pos_updates); goto qry; } rfbLog("process_remote_cmd: turning off cursorpos mode.\n"); @@ -6874,6 +7098,71 @@ char *process_remote_cmd(char *cmd, int stringonly) { use_xfixes = 0; initialize_xfixes(); + } else if (strstr(p, "alphacut") == p) { + int a; + COLON_CHECK("alphacut:") + if (query) { + snprintf(buf, bufn, "ans=%s%s%d", p, co, + alpha_threshold); + goto qry; + } + p += strlen("alphacut:"); + a = atoi(p); + if (a < 0) a = 0; + if (a > 256) a = 256; /* allow 256 for testing. */ + if (alpha_threshold != a) { + rfbLog("process_remote_cmd: setting alphacut " + "%d -> %d.\n", alpha_threshold, a); + if (a == 256) { + rfbLog("note: alphacut=256 leads to completely" + " transparent cursors.\n"); + } + alpha_threshold = a; + setup_cursors(); + first_cursor(); + } + } else if (strstr(p, "alphafrac") == p) { + double a; + COLON_CHECK("alphafrac:") + if (query) { + snprintf(buf, bufn, "ans=%s%s%f", p, co, + alpha_frac); + goto qry; + } + p += strlen("alphafrac:"); + a = atof(p); + if (a < 0.0) a = 0.0; + if (a > 1.0) a = 1.0; + if (alpha_frac != a) { + rfbLog("process_remote_cmd: setting alphafrac " + "%f -> %f.\n", alpha_frac, a); + alpha_frac = a; + setup_cursors(); + first_cursor(); + } + } else if (strstr(p, "alpharemove") == p) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, alpha_remove); + goto qry; + } + if (!alpha_remove) { + rfbLog("process_remote_cmd: enable alpharemove\n"); + alpha_remove = 1; + setup_cursors(); + first_cursor(); + } + } else if (strstr(p, "noalpharemove") == p) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, !alpha_remove); + goto qry; + } + if (alpha_remove) { + rfbLog("process_remote_cmd: disable alpharemove\n"); + alpha_remove = 0; + setup_cursors(); + first_cursor(); + } + } else if (strstr(p, "xwarp") == p || strstr(p, "xwarppointer") == p) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, use_xwarppointer); @@ -6881,7 +7170,8 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("process_remote_cmd: turning on xwarppointer mode.\n"); use_xwarppointer = 1; - } else if (strstr(p, "noxwarp") == p || strstr(p, "noxwarppointer") == p) { + } else if (strstr(p, "noxwarp") == p || + strstr(p, "noxwarppointer") == p) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !use_xwarppointer); goto qry; @@ -7021,15 +7311,36 @@ char *process_remote_cmd(char *cmd, int stringonly) { waitms, w); waitms = w; + } else if (strstr(p, "rfbwait") == p) { + int w, orig = rfbMaxClientWait; + COLON_CHECK("rfbwait:") + if (query) { + snprintf(buf, bufn, "ans=%s%s%d", p, co, + rfbMaxClientWait); + goto qry; + } + p += strlen("rfbwait:"); + w = atoi(p); + if (w < 0) w = 0; + rfbLog("process_remote_cmd: setting rfbMaxClientWait %d -> " + "%d ms.\n", orig, w); + rfbMaxClientWait = w; + if (screen) { + /* current unused by libvncserver: */ + screen->maxClientWait = w; + } + } else if (!strcmp(p, "nap")) { if (query) { - snprintf(buf, bufn, "ans=%s:%d", p, take_naps); goto qry; + snprintf(buf, bufn, "ans=%s:%d", p, take_naps); + goto qry; } rfbLog("process_remote_cmd: turning on nap mode.\n"); take_naps = 1; } else if (!strcmp(p, "nonap")) { if (query) { - snprintf(buf, bufn, "ans=%s:%d", p, !take_naps); goto qry; + snprintf(buf, bufn, "ans=%s:%d", p, !take_naps); + goto qry; } rfbLog("process_remote_cmd: turning off nap mode.\n"); take_naps = 0; @@ -7126,9 +7437,168 @@ char *process_remote_cmd(char *cmd, int stringonly) { screen->progressiveSliceHeight, f); screen->progressiveSliceHeight = f; + } else if (strstr(p, "rfbport") == p) { + int rp, orig = screen->port; + COLON_CHECK("rfbport:") + if (query) { + snprintf(buf, bufn, "ans=%s%s%d", p, co, screen->port); + goto qry; + } + p += strlen("rfbport:"); + rp = atoi(p); + reset_rfbport(orig, rp); + + } else if (!strcmp(p, "http")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, + (screen->httpListenSock > -1)); + goto qry; + } + if (screen->httpListenSock > -1) { + rfbLog("already listening for http connections.\n"); + } else { + rfbLog("turning on listening for http connections.\n"); + if (check_httpdir()) { + http_connections(1); + } + } + } else if (!strcmp(p, "nohttp")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, + !(screen->httpListenSock > -1)); + goto qry; + } + if (screen->httpListenSock < 0) { + rfbLog("already not listening for http connections.\n"); + } else { + rfbLog("turning off listening for http connections.\n"); + if (check_httpdir()) { + http_connections(0); + } + } + + } else if (strstr(p, "httpport") == p) { + int hp, orig = screen->httpPort; + COLON_CHECK("httpport:") + if (query) { + snprintf(buf, bufn, "ans=%s%s%d", p, co, + screen->httpPort); + goto qry; + } + p += strlen("httpport:"); + hp = atoi(p); + reset_httpport(orig, hp); + + } else if (strstr(p, "httpdir") == p) { + COLON_CHECK("httpdir:") + if (query) { + snprintf(buf, bufn, "ans=%s%s%s", p, co, + NONUL(http_dir)); + goto qry; + } + p += strlen("httpdir:"); + if (http_dir && !strcmp(http_dir, p)) { + rfbLog("no change in httpdir: %s\n", http_dir); + } else { + if (http_dir) { + free(http_dir); + } + http_dir = strdup(p); + if (*p == '\0') { + http_connections(0); + } else { + http_connections(1); + } + } + + } else if (!strcmp(p, "enablehttpproxy")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, + screen->httpEnableProxyConnect != 0); + goto qry; + } + rfbLog("turning on enablehttpproxy.\n"); + screen->httpEnableProxyConnect = 1; + } else if (!strcmp(p, "noenablehttpproxy")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, + screen->httpEnableProxyConnect == 0); + goto qry; + } + rfbLog("turning off enablehttpproxy.\n"); + screen->httpEnableProxyConnect = 0; + + } else if (!strcmp(p, "alwaysshared")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, + screen->alwaysShared != 0); + goto qry; + } + rfbLog("turning on alwaysshared.\n"); + screen->alwaysShared = 1; + } else if (!strcmp(p, "noalwaysshared")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, + screen->alwaysShared == 0); + goto qry; + } + rfbLog("turning off alwaysshared.\n"); + screen->alwaysShared = 0; + + } else if (!strcmp(p, "nevershared")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, + screen->neverShared != 0); + goto qry; + } + rfbLog("turning on nevershared.\n"); + screen->neverShared = 1; + } else if (!strcmp(p, "noalwaysshared")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, + screen->neverShared == 0); + goto qry; + } + rfbLog("turning off nevershared.\n"); + screen->neverShared = 0; + + } else if (!strcmp(p, "dontdisconnect")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, + screen->dontDisconnect != 0); + goto qry; + } + rfbLog("turning on dontdisconnect.\n"); + screen->dontDisconnect = 1; + } else if (!strcmp(p, "nodontdisconnect")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, + screen->dontDisconnect == 0); + goto qry; + } + rfbLog("turning off dontdisconnect.\n"); + screen->dontDisconnect = 0; + + } else if (strstr(p, "desktop") == p) { + COLON_CHECK("desktop:") + if (query) { + snprintf(buf, bufn, "ans=%s%s%s", p, co, + NONUL(rfb_desktop_name)); + goto qry; + } + p += strlen("desktop:"); + if (rfb_desktop_name) { + free(rfb_desktop_name); + } + rfb_desktop_name = strdup(p); + screen->desktopName = rfb_desktop_name; + rfbLog("process_remote_cmd: setting desktop name to %s\n", + rfb_desktop_name); + } else if (!strcmp(p, "noremote")) { if (query) { - snprintf(buf, bufn, "ans=%s:%d", p, !accept_remote_cmds); + snprintf(buf, bufn, "ans=%s:%d", p, + !accept_remote_cmds); goto qry; } rfbLog("process_remote_cmd: disabling remote commands.\n"); @@ -7152,9 +7622,6 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else if (!strcmp(p, "desktopname")) { snprintf(buf, bufn, "aro=%s:%s", p, NONUL(rfb_desktop_name)); - } else if (!strcmp(p, "desktop")) { - snprintf(buf, bufn, "aro=%s:%s", p, - NONUL(rfb_desktop_name)); } else if (!strcmp(p, "auth")) { snprintf(buf, bufn, "aro=%s:%s", p, NONUL(auth_file)); } else if (!strcmp(p, "rootshift")) { @@ -7178,7 +7645,8 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else if (!strcmp(p, "scaling_pad")) { snprintf(buf, bufn, "aro=%s:%d", p, scaling_pad); } else if (!strcmp(p, "scaling_interpolate")) { - snprintf(buf, bufn, "aro=%s:%d", p, scaling_interpolate); + snprintf(buf, bufn, "aro=%s:%d", p, + scaling_interpolate); } else if (!strcmp(p, "inetd")) { snprintf(buf, bufn, "aro=%s:%d", p, inetd); } else if (!strcmp(p, "safer")) { @@ -7201,8 +7669,6 @@ char *process_remote_cmd(char *cmd, int stringonly) { snprintf(buf, bufn, "aro=%s:%s", p, NONUL(lastmod)); } else if (!strcmp(p, "bg")) { snprintf(buf, bufn, "aro=%s:%d", p, opts_bg); - } else if (!strcmp(p, "nofb")) { - snprintf(buf, bufn, "aro=%s:%d", p, nofb); } else if (!strcmp(p, "sigpipe")) { snprintf(buf, bufn, "aro=%s:%s", p, NONUL(sigpipe)); } else if (!strcmp(p, "threads")) { @@ -7252,25 +7718,10 @@ char *process_remote_cmd(char *cmd, int stringonly) { snprintf(buf, bufn, "aro=%s:%d", p, dpy_x); } else if (!strcmp(p, "dpy_y")) { snprintf(buf, bufn, "aro=%s:%d", p, dpy_y); - } else if (!strcmp(p, "rfbport")) { - snprintf(buf, bufn, "aro=%s:%d", p, screen->port); - } else if (!strcmp(p, "rfbwait")) { - NOTAPPRO } else if (!strcmp(p, "rfbauth")) { NOTAPPRO } else if (!strcmp(p, "passwd")) { NOTAPPRO - } else if (!strcmp(p, "alwaysshared")) { - snprintf(buf, bufn, "aro=%s:%d", p, screen->alwaysShared); - } else if (!strcmp(p, "dontdisconnect")) { - snprintf(buf, bufn, "aro=%s:%d", p, - screen->dontDisconnect); - } else if (!strcmp(p, "httpdir")) { - snprintf(buf, bufn, "aro=%s:%s", p, - NONUL(screen->httpDir)); - } else if (!strcmp(p, "enablehttpproxy")) { - snprintf(buf, bufn, "aro=%s:%d", p, - screen->httpEnableProxyConnect); } else { NOTAPP } @@ -7541,6 +7992,7 @@ enum cursor_names { CURS_ROOT, CURS_WM, CURS_TERM, + CURS_PLUS, CURS_DYN1, CURS_DYN2, @@ -7567,7 +8019,16 @@ enum cursor_names { #define CURS_MAX 32 static cursor_info_t *cursors[CURS_MAX]; -static void setup_cursors(void) { +void first_cursor(void) { + if (! show_cursor) { + screen->cursor = NULL; + } else { + /* just set it to the arrow for now. */ + set_rfb_cursor(CURS_ARROW); + } +} + +void setup_cursors(void) { rfbCursorPtr rfb_curs; int i, n = 0; static int first = 1; @@ -7657,6 +8118,7 @@ static void setup_cursors(void) { cursors[CURS_ROOT] = &cur_root; n++; cursors[CURS_WM] = &cur_fleur; n++; cursors[CURS_TERM] = &cur_xterm; n++; + cursors[CURS_PLUS] = &cur_plus; n++; for (i=0; ipixels+i)); + a = a >> 24; /* alpha channel */ + if (a > 0) { + n_alpha++; + } + histo[a]++; + if (a < alpha_threshold) { + n_trans++; + } else { + n_opaque++; + } + i++; + } + } + if (n_opaque >= alpha_frac * n_alpha) { + thresh = alpha_threshold; + } else { + n_opaque = 0; + for (i=255; i>=0; i--) { + n_opaque += histo[i]; + thresh = i; + if (n_opaque >= alpha_frac * n_alpha) { + break; + } + } + } + i = 0; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { @@ -7991,7 +8493,7 @@ int get_xfixes_cursor(int init) { a = 0xff000000 & (*(xfc->pixels+i)); a = a >> 24; /* alpha channel */ - if (a == 0) { + if (a < thresh) { bitmap[i] = ' '; i++; continue; @@ -8006,6 +8508,15 @@ int get_xfixes_cursor(int init) { g = g >> 8; /* green */ b = b >> 0; /* blue */ + if (alpha_remove && a != 0) { + r = (255 * r) / a; + g = (255 * g) / a; + b = (255 * b) / a; + if (r > 255) r = 255; + if (g > 255) g = 255; + if (b > 255) b = 255; + } + if (indexed_color) { /* * Choose black or white for @@ -9016,8 +9527,7 @@ XImage *initialize_xdisplay_fb(void) { } if (! quiet) { fprintf(stderr, " initialize_xdisplay_fb()\n"); - fprintf(stderr, " Visual*: 0x%x\n", - (int) vinfo->visual); + fprintf(stderr, " Visual*: 0x%p\n", vinfo->visual); fprintf(stderr, " visualid: 0x%x\n", (int) vinfo->visualid); fprintf(stderr, " screen: %d\n", vinfo->screen); @@ -9138,7 +9648,7 @@ XImage *initialize_xdisplay_fb(void) { void parse_scale_string(char *str) { int m, n; - char *p; + char *p, *tstr; double f; scale_fac = 1.0; @@ -9153,8 +9663,9 @@ void parse_scale_string(char *str) { if (str == NULL || str[0] == '\0') { return; } + tstr = strdup(str); - if ( (p = strchr(str, ':')) != NULL) { + if ( (p = strchr(tstr, ':')) != NULL) { /* options */ if (strstr(p+1, "nb") != NULL) { scaling_noblend = 1; @@ -9170,10 +9681,10 @@ void parse_scale_string(char *str) { } *p = '\0'; } - if (strchr(str, '.') != NULL) { + if (strchr(tstr, '.') != NULL) { double test, diff, eps = 1.0e-7; - if (sscanf(str, "%lf", &f) != 1) { - rfbLog("bad -scale arg: %s\n", str); + if (sscanf(tstr, "%lf", &f) != 1) { + rfbLog("bad -scale arg: %s\n", tstr); clean_up_exit(1); } scale_fac = (double) f; @@ -9198,9 +9709,9 @@ void parse_scale_string(char *str) { clean_up_exit(1); } } else { - if (sscanf(str, "%d/%d", &m, &n) != 2) { - if (sscanf(str, "%d", &m) != 1) { - rfbLog("bad -scale arg: %s\n", str); + if (sscanf(tstr, "%d/%d", &m, &n) != 2) { + if (sscanf(tstr, "%d", &m) != 1) { + rfbLog("bad -scale arg: %s\n", tstr); clean_up_exit(1); } else { /* e.g. -scale 1 or -scale 2 */ @@ -9208,7 +9719,7 @@ void parse_scale_string(char *str) { } } if (n <= 0 || m <=0) { - rfbLog("bad -scale arg: %s\n", str); + rfbLog("bad -scale arg: %s\n", tstr); clean_up_exit(1); } scale_fac = ((double) m)/ n; @@ -9226,6 +9737,7 @@ void parse_scale_string(char *str) { } else { scaling = 1; } + free(tstr); } void setup_scaling(int *width_in, int *height_in) { @@ -9323,6 +9835,9 @@ void initialize_screen(int *argc, char **argv, XImage *fb) { if (create_screen) { screen = rfbGetScreen(argc, argv, width, height, bits_per_color, 1, (int) fb->bits_per_pixel/8); + if (screen && http_dir) { + http_connections(1); + } } else { /* set set frameBuffer member below. */ rfbLog("rfbNewFramebuffer(0x%x, 0x%x, %d, %d, %d, %d, %d)\n", @@ -9566,14 +10081,7 @@ void initialize_screen(int *argc, char **argv, XImage *fb) { depth = screen->serverFormat.depth; setup_cursors(); - if (! show_cursor) { - screen->cursor = NULL; - } else { - /* just set it to the arrow for now. */ - if (0 && !quiet) rfbLog("calling set_rfb_cursor...\n"); - set_rfb_cursor(CURS_ARROW); - if (0 && !quiet) rfbLog(" done.\n"); - } + first_cursor(); if (scaling) { mark_rect_as_modified(0, 0, dpy_x, dpy_y, 0); @@ -9890,7 +10398,7 @@ void blackout_tiles(void) { } void initialize_xinerama (void) { -#ifndef LIBVNCSERVER_HAVE_LIBXINERAMA +#if !LIBVNCSERVER_HAVE_LIBXINERAMA rfbLog("Xinerama: Library libXinerama is not available to determine\n"); rfbLog("Xinerama: the head geometries, consider using -blackout\n"); rfbLog("Xinerama: if the screen is non-rectangular.\n"); @@ -10242,7 +10750,7 @@ static int shm_create(XShmSegmentInfo *shm, XImage **ximg_ptr, int w, int h, *ximg_ptr = xim; -#ifdef LIBVNCSERVER_HAVE_XSHM +#if LIBVNCSERVER_HAVE_XSHM shm->shmid = shmget(IPC_PRIVATE, xim->bytes_per_line * xim->height, IPC_CREAT | 0777); @@ -10296,7 +10804,7 @@ static int shm_create(XShmSegmentInfo *shm, XImage **ximg_ptr, int w, int h, } void shm_delete(XShmSegmentInfo *shm) { -#ifdef LIBVNCSERVER_HAVE_XSHM +#if LIBVNCSERVER_HAVE_XSHM if (shm != NULL && shm->shmaddr != (char *) -1) { shmdt(shm->shmaddr); } @@ -10308,7 +10816,7 @@ void shm_delete(XShmSegmentInfo *shm) { void shm_clean(XShmSegmentInfo *shm, XImage *xim) { X_LOCK; -#ifdef LIBVNCSERVER_HAVE_XSHM +#if LIBVNCSERVER_HAVE_XSHM if (shm != NULL && shm->shmid != -1) { XShmDetach_wr(dpy, shm); } @@ -12237,15 +12745,20 @@ char gui_code[] = ""; #include "tkx11vnc.h" #endif -void run_gui(char *gui_xdisplay, int connect_to_x11vnc) { +void run_gui(char *gui_xdisplay, int connect_to_x11vnc, pid_t parent) { char *x11vnc_xdisplay = NULL; char extra_path[] = ":/usr/local/bin:/usr/bin/X11:/usr/sfw/bin" ":/usr/X11R6/bin:/usr/openwin/bin:/usr/dt/bin"; char cmd[100]; char *wish = NULL, *orig_path, *full_path, *tpath, *p; - int try_max = 9, sleep = 300; + int try_max = 4, sleep = 300; + pid_t mypid = getpid(); FILE *pipe; + if (*gui_code == '\0') { + rfbLog("gui not available in this program.\n"); + exit(0); + } if (getenv("DISPLAY") != NULL) { x11vnc_xdisplay = strdup(getenv("DISPLAY")); } @@ -12275,10 +12788,16 @@ void run_gui(char *gui_xdisplay, int connect_to_x11vnc) { if (rc == 0) { break; } + if (parent && mypid != parent && kill(parent, 0) != 0) { + fprintf(stderr, "gui: parent process %d has gone" + " away: bailing out.\n", parent); + rc = 1; + break; + } } + set_env("X11VNC_XDISPLAY", x11vnc_xdisplay); if (rc == 0) { fprintf(stderr, "gui: ping succeeded.\n"); - set_env("X11VNC_XDISPLAY", x11vnc_xdisplay); set_env("X11VNC_CONNECT", "1"); } else { fprintf(stderr, "gui: could not connect to: '%s', try" @@ -12345,10 +12864,6 @@ void do_gui(char *opts) { int connect_to_x11vnc = 0; Display *test_dpy; - if (*gui_code == '\0') { - rfbLog("gui not available in this program.\n"); - clean_up_exit(1); - } if (opts) { s = strdup(opts); } else { @@ -12417,9 +12932,10 @@ void do_gui(char *opts) { XCloseDisplay(test_dpy); if (start_x11vnc) { -#if defined(LIBVNCSERVER_HAVE_FORK) +#if LIBVNCSERVER_HAVE_FORK /* fork into the background now */ int p; + pid_t parent = getpid(); if ((p = fork()) > 0) { ; /* parent */ } else if (p == -1) { @@ -12427,7 +12943,7 @@ void do_gui(char *opts) { perror("fork"); clean_up_exit(1); } else { - run_gui(gui_xdisplay, connect_to_x11vnc); + run_gui(gui_xdisplay, connect_to_x11vnc, parent); exit(1); } #else @@ -12437,7 +12953,7 @@ void do_gui(char *opts) { #endif } if (!start_x11vnc) { - run_gui(gui_xdisplay, connect_to_x11vnc); + run_gui(gui_xdisplay, connect_to_x11vnc, 0); exit(1); } if (old_xauth) { @@ -13467,6 +13983,13 @@ static void print_help(void) { " default (see -noxfixes below). This can be disabled\n" " with -nocursor, and also some values of the \"mode\"\n" " option below.\n" +" \n" +" Note that under XFIXES cursors with transparency\n" +" (alpha channel) will not be exactly represented and\n" +" so Overlay may be preferred. See also the -alphacut\n" +" and -alphafrac options below as fudge factors to try\n" +" to improve the situation for cursors with transparency\n" +" for a given theme.\n" "\n" " The \"mode\" string can be used to fine-tune the\n" " displaying of cursor shapes. It can be used the\n" @@ -13500,6 +14023,29 @@ static void print_help(void) { "\n" "-noxfixes Do not use the XFIXES extension to draw the exact cursor\n" " shape even if it is available.\n" +"-alphacut n When using the XFIXES extension for the cursor shape,\n" +" cursors with transparency will not be displayed exactly\n" +" (but opaque ones will). This option sets n as a cutoff\n" +" for cursors that have transparency (\"alpha channel\"\n" +" with values ranging from 0 to 255) Any cursor pixel with\n" +" alpha value less than n becomes completely transparent.\n" +" Otherwise the pixel is completely opaque. Default %d\n" +" \n" +" Note: the options -alphacut, -alphafrac, and -alphafrac\n" +" may be removed if a more accurate internal method for\n" +" handling cursor transparency is implemented.\n" +"-alphafrac fraction With the threshold in -alphacut some cursors will become\n" +" almost completely transparent because their alpha values\n" +" are not high enough. For those cursors adjust the\n" +" alpha threshold until fraction of the non-zero alpha\n" +" channel pixels become opaque. Default %.2f\n" +"-alpharemove By default, XFIXES cursors pixels with transparency have\n" +" the alpha factor multiplied into the RGB color values\n" +" (i.e. that corresponding to blending the cursor with a\n" +" black background). Specify this option to remove the\n" +" alpha factor. (useful for light colored semi-transparent\n" +" cursors).\n" +"\n" "-nocursorshape Do not use the TightVNC CursorShapeUpdates extension\n" " even if clients support it. See -cursor above.\n" "-cursorpos Option -cursorpos enables sending the X cursor position\n" @@ -13766,18 +14312,25 @@ static void print_help(void) { " keymapping, use \"-key1-key2\" to delete.\n" " norepeat enable -norepeat mode.\n" " repeat disable -norepeat mode.\n" +" nofb enable -nofb mode.\n" +" fb disable -nofb mode.\n" " bell enable bell (if supported).\n" " nobell disable bell.\n" -" sel disable -nosel mode.\n" +" bell enable bell (if supported).\n" " nosel enable -nosel mode.\n" -" primary disable -noprimary mode.\n" +" sel disable -nosel mode.\n" " noprimary enable -noprimary mode.\n" +" primary disable -noprimary mode.\n" " cursor:mode enable -cursor \"mode\".\n" " show_cursor enable showing a cursor.\n" " noshow_cursor disable showing a cursor. (same as\n" " \"nocursor\")\n" " xfixes enable xfixes cursor shape mode.\n" " noxfixes disable xfixes cursor shape mode.\n" +" alphacut:n set -alphacut to n.\n" +" alphafrac:f set -alphafrac to f.\n" +" alpharemove enable -alpharemove mode.\n" +" noalpharemove disable -alpharemove mode.\n" " cursorshape disable -nocursorshape mode.\n" " nocursorshape enable -nocursorshape mode.\n" " cursorpos disable -nocursorpos mode.\n" @@ -13795,6 +14348,7 @@ static void print_help(void) { " nodebug_keyboard disable -debug_keyboard, same as \"nodk\"\n" " defer:n set -defer to n ms,same as deferupdate:n\n" " wait:n set -wait to n ms.\n" +" rfbwait:n set -rfbwait (rfbMaxClientWait) to n ms.\n" " nap enable -nap mode.\n" " nonap disable -nap mode.\n" " sb:n set -sb to n s, same as screen_blank:n\n" @@ -13804,8 +14358,23 @@ static void print_help(void) { " fuzz:n set -fuzz to n.\n" " progressive:n set libvncserver -progressive slice\n" " height parameter to n.\n" -" file:name run -remote commands from file \"name\",\n" -" one command per line,blank and # skipped\n" +" desktop:str set -desktop name to str for new clients.\n" +" rfbport:n set -rfbport to n.\n" +" http enable http client connections.\n" +" nohttp disable http client connections.\n" +" httpport:n set -httpport to n.\n" +" httpdir:dir set -httpdir to dir (and enable http).\n" +" enablehttpproxy enable -enablehttpproxy mode.\n" +" noenablehttpproxy disable -enablehttpproxy mode.\n" +" alwaysshared enable -alwaysshared mode.\n" +" noalwaysshared disable -alwaysshared mode.\n" +" (may interfere with other options)\n" +" nevershared enable -nevershared mode.\n" +" nonevershared disable -nevershared mode.\n" +" (may interfere with other options)\n" +" dontdisconnect enable -dontdisconnect mode.\n" +" nodontdisconnect disable -dontdisconnect mode.\n" +" (may interfere with other options)\n" " noremote disable the -remote command processing,\n" " it cannot be turned back on.\n" "\n" @@ -13851,33 +14420,37 @@ static void print_help(void) { " overlay_cursor overlay_yescursor nooverlay_nocursor\n" " nooverlay_cursor nooverlay_yescursor overlay_nocursor\n" " visual scale viewonly noviewonly shared noshared\n" -" forever noforever once deny lock nodeny unlock connect\n" -" allowonce allow localhost nolocalhost accept gone shm\n" -" noshm flipbyteorder noflipbyteorder onetile noonetile\n" -" blackout xinerama noxinerama xrandr noxrandr xrandr_mode\n" -" padgeom quiet q noquiet modtweak nomodtweak xkb noxkb\n" -" skip_keycodes add_keysyms noadd_keysyms clear_mods\n" -" noclear_mods clear_keys noclear_keys remap repeat\n" -" norepeat bell nobell sel nosel primary noprimary\n" -" cursorshape nocursorshape cursorpos nocursorpos cursor\n" -" show_cursor noshow_cursor nocursor xfixes noxfixes xwarp\n" -" xwarppointer noxwarp noxwarppointer buttonmap dragging\n" -" nodragging pointer_mode input_skip debug_pointer dp\n" -" nodebug_pointer nodp debug_keyboard dk nodebug_keyboard\n" -" nodk deferupdate defer wait nap nonap sb screen_blank\n" -" fs gaps grow fuzz progressive noremote\n" +" forever noforever once deny lock nodeny unlock\n" +" connect allowonce allow localhost nolocalhost accept\n" +" gone shm noshm flipbyteorder noflipbyteorder onetile\n" +" noonetile blackout xinerama noxinerama xrandr noxrandr\n" +" xrandr_mode padgeom quiet q noquiet modtweak nomodtweak\n" +" xkb noxkb skip_keycodes add_keysyms noadd_keysyms\n" +" clear_mods noclear_mods clear_keys noclear_keys\n" +" remap repeat norepeat fb nofb bell nobell sel\n" +" nosel primary noprimary cursorshape nocursorshape\n" +" cursorpos nocursorpos cursor show_cursor noshow_cursor\n" +" nocursor xfixes noxfixes alphacut alphafrac alpharemove\n" +" noalpharemove xwarp xwarppointer noxwarp noxwarppointer\n" +" buttonmap dragging nodragging pointer_mode input_skip\n" +" debug_pointer dp nodebug_pointer nodp debug_keyboard\n" +" dk nodebug_keyboard nodk deferupdate defer wait\n" +" rfbwait nap nonap sb screen_blank fs gaps grow fuzz\n" +" progressive rfbport http nohttp httpport httpdir\n" +" enablehttpproxy noenablehttpproxy alwaysshared\n" +" noalwaysshared nevershared noalwaysshared dontdisconnect\n" +" nodontdisconnect desktop noremote\n" "\n" -" aro= display vncdisplay desktopname desktop auth\n" -" rootshift scale_str scaled_x scaled_y scale_numer\n" -" scale_denom scale_fac scaling_noblend scaling_nomult4\n" -" scaling_pad scaling_interpolate inetd safer unsafe\n" -" passwdfile using_shm logfile o rc norc h help V version\n" -" lastmod bg nofb sigpipe threads clients client_count\n" -" pid ext_xtest ext_xkb ext_xshm ext_xinerama ext_overlay\n" -" ext_xfixes ext_xdamage ext_xrandr rootwin num_buttons\n" -" button_mask mouse_x mouse_y bpp depth indexed_color\n" -" dpy_x dpy_y rfbport rfbwait rfbauth passwd alwaysshared\n" -" dontdisconnect httpdir enablehttpproxy\n" +" aro= display vncdisplay desktopname auth rootshift\n" +" scale_str scaled_x scaled_y scale_numer scale_denom\n" +" scale_fac scaling_noblend scaling_nomult4 scaling_pad\n" +" scaling_interpolate inetd safer unsafe passwdfile\n" +" using_shm logfile o rc norc h help V version lastmod\n" +" bg sigpipe threads clients client_count pid ext_xtest\n" +" ext_xkb ext_xshm ext_xinerama ext_overlay ext_xfixes\n" +" ext_xdamage ext_xrandr rootwin num_buttons button_mask\n" +" mouse_x mouse_y bpp depth indexed_color dpy_x dpy_y\n" +" rfbauth passwd\n" "\n" "-sync By default -remote commands are run asynchronously, that\n" " is, the request is posted and the program immediately\n" @@ -13939,6 +14512,8 @@ static void print_help(void) { vnc_connect ? "-vncconnect":"-novncconnect", use_modifier_tweak ? "-modtweak":"-nomodtweak", no_autorepeat ? "-norepeat":"-repeat", + alpha_threshold, + alpha_frac, cursor_pos_updates ? "-cursorpos":"-nocursorpos", pointer_mode_max, pointer_mode, ui_skip, @@ -13965,7 +14540,7 @@ static void print_help(void) { char *this_host(void) { char host[MAXN]; -#ifdef LIBVNCSERVER_HAVE_GETHOSTNAME +#if LIBVNCSERVER_HAVE_GETHOSTNAME if (gethostname(host, MAXN) == 0) { return strdup(host); } @@ -14405,7 +14980,7 @@ int main(int argc, char* argv[]) { } else if (!strcmp(arg, "-q") || !strcmp(arg, "-quiet")) { quiet = 1; } else if (!strcmp(arg, "-bg") || !strcmp(arg, "-background")) { -#ifdef LIBVNCSERVER_HAVE_SETSID +#if LIBVNCSERVER_HAVE_SETSID bg = 1; opts_bg = bg; #else @@ -14462,6 +15037,14 @@ int main(int argc, char* argv[]) { show_cursor = 0; } else if (!strcmp(arg, "-noxfixes")) { use_xfixes = 0; + } else if (!strcmp(arg, "-alphacut")) { + CHECK_ARGC + alpha_threshold = atoi(argv[++i]); + } else if (!strcmp(arg, "-alphafrac")) { + CHECK_ARGC + alpha_frac = atof(argv[++i]); + } else if (!strcmp(arg, "-alpharemove")) { + alpha_remove = 1; } else if (!strcmp(arg, "-nocursorshape")) { cursor_shape_updates = 0; } else if (!strcmp(arg, "-cursorpos")) { @@ -14521,7 +15104,7 @@ int main(int argc, char* argv[]) { "be \"ignore\" or \"exit\"\n", argv[i]); exit(1); } -#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD +#if LIBVNCSERVER_HAVE_LIBPTHREAD } else if (!strcmp(arg, "-threads")) { use_threads = 1; } else if (!strcmp(arg, "-nothreads")) { @@ -14574,6 +15157,9 @@ int main(int argc, char* argv[]) { safe_remote_only = 1; } else if (!strcmp(arg, "-deny_all")) { deny_all = 1; + } else if (!strcmp(arg, "-httpdir")) { + CHECK_ARGC + http_dir = strdup(argv[++i]); } else { if (!strcmp(arg, "-desktop") && i < argc-1) { dt = 1; @@ -14738,6 +15324,18 @@ int main(int argc, char* argv[]) { if (waitms < 0) { waitms = 0; } + if (alpha_threshold < 0) { + alpha_threshold = 0; + } + if (alpha_threshold > 256) { + alpha_threshold = 256; + } + if (alpha_frac < 0.0) { + alpha_frac = 0.0; + } + if (alpha_frac > 1.0) { + alpha_frac = 1.0; + } if (inetd) { shared = 0; connect_once = 1; @@ -14750,8 +15348,14 @@ int main(int argc, char* argv[]) { /* increase rfbwait if threaded */ if (use_threads && ! got_rfbwait) { - argv_vnc[argc_vnc++] = strdup("-rfbwait"); - argv_vnc[argc_vnc++] = strdup("604800000"); /* one week... */ + if (0) { + /* -rfbwait = rfbScreen->maxClientWait is not used */ + argv_vnc[argc_vnc++] = strdup("-rfbwait"); + argv_vnc[argc_vnc++] = strdup("604800000"); + } else { + /* set the global in sockets.c instead: */ + rfbMaxClientWait = 604800000; + } } /* no framebuffer (Win2VNC) mode */ @@ -14901,7 +15505,7 @@ int main(int argc, char* argv[]) { if (xkbcompat) { use_xkb = 0; } -#ifdef LIBVNCSERVER_HAVE_XKEYBOARD +#if LIBVNCSERVER_HAVE_XKEYBOARD /* * Disable XKEYBOARD before calling XOpenDisplay() * this should be used if there is ambiguity in the keymapping. @@ -14959,7 +15563,7 @@ int main(int argc, char* argv[]) { rfb_desktop_name = strdup(argv_vnc[argc_vnc-1]); } -#ifdef LIBVNCSERVER_HAVE_LIBXFIXES +#if LIBVNCSERVER_HAVE_LIBXFIXES if (! XFixesQueryExtension(dpy, &xfixes_base_event_type, &er)) { if (! quiet) { rfbLog("disabling xfixes mode: display does not " @@ -14971,7 +15575,7 @@ int main(int argc, char* argv[]) { } #endif -#ifdef LIBVNCSERVER_HAVE_LIBXDAMAGE +#if LIBVNCSERVER_HAVE_LIBXDAMAGE if (! XDamageQueryExtension(dpy, &xdamage_base_event_type, &er)) { if (0 && ! quiet) { rfbLog("disabling xdamage mode: display does not " @@ -15110,7 +15714,7 @@ int main(int argc, char* argv[]) { rfbLog("the x11vnc and X server processes should be" " running on\n"); rfbLog("the same machine.)\n"); -#ifdef LIBVNCSERVER_HAVE_XSHM +#if LIBVNCSERVER_HAVE_XSHM rfbLog("Restart with -noshm to override this.\n"); } exit(1); @@ -15122,7 +15726,7 @@ int main(int argc, char* argv[]) { } } -#ifdef LIBVNCSERVER_HAVE_XKEYBOARD +#if LIBVNCSERVER_HAVE_XKEYBOARD /* check for XKEYBOARD */ if (use_xkb) { initialize_xkb(); @@ -15137,7 +15741,7 @@ int main(int argc, char* argv[]) { } #endif -#ifdef LIBVNCSERVER_HAVE_LIBXRANDR +#if LIBVNCSERVER_HAVE_LIBXRANDR if (! XRRQueryExtension(dpy, &xrandr_base_event_type, &er)) { if (xrandr && ! quiet) { rfbLog("disabling -xrandr mode: display does not" @@ -15233,7 +15837,7 @@ int main(int argc, char* argv[]) { fflush(stdout); } -#if defined(LIBVNCSERVER_HAVE_FORK) && defined(LIBVNCSERVER_HAVE_SETSID) +#if LIBVNCSERVER_HAVE_FORK && LIBVNCSERVER_HAVE_SETSID if (bg) { /* fork into the background now */ int p, n;