From 2bc615f6e07edf1dd7a868d13a46f848374e2063 Mon Sep 17 00:00:00 2001 From: runge Date: Sat, 5 Feb 2005 17:06:20 +0000 Subject: [PATCH] x11vnc -solid color, -opts; tightvnc unix viewer alpha patch --- ChangeLog | 5 + tightvnc-1.3dev5-vncviewer-alpha-cursor.patch | 143 +++ x11vnc/ChangeLog | 4 + x11vnc/README | 820 ++++++++++-------- x11vnc/tkx11vnc | 13 +- x11vnc/tkx11vnc.h | 13 +- x11vnc/x11vnc.1 | 62 +- x11vnc/x11vnc.c | 500 ++++++++++- 8 files changed, 1155 insertions(+), 405 deletions(-) create mode 100644 tightvnc-1.3dev5-vncviewer-alpha-cursor.patch diff --git a/ChangeLog b/ChangeLog index 18de084..5974569 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-02-05 Karl Runge + * x11vnc: -solid color, -opts/-? + * tightvnc-1.3dev5-vncviewer-alpha-cursor.patch: create, name + says it all. + 2005-01-23 Karl Runge * x11vnc: -timeout, -noalphablend. make -R norepeat work. * sync with new draw cursor mechanism. diff --git a/tightvnc-1.3dev5-vncviewer-alpha-cursor.patch b/tightvnc-1.3dev5-vncviewer-alpha-cursor.patch new file mode 100644 index 0000000..c9b31e7 --- /dev/null +++ b/tightvnc-1.3dev5-vncviewer-alpha-cursor.patch @@ -0,0 +1,143 @@ +--- vnc_unixsrc.orig/vncviewer/cursor.c 2003-01-15 04:46:52.000000000 -0500 ++++ vnc_unixsrc/vncviewer/cursor.c 2005-02-05 12:28:10.000000000 -0500 +@@ -472,6 +472,140 @@ + int offset, bytesPerPixel; + char *pos; + ++#define alphahack ++#ifdef alphahack ++ /* hack to have cursor transparency at 32bpp */ ++ static int alphablend = -1; ++ ++ if (alphablend < 0) { ++ /* you have to set NO_ALPHABLEND=1 in your environment to disable */ ++ if (getenv("NO_ALPHABLEND")) { ++ alphablend = 0; ++ } else { ++ alphablend = 1; ++ } ++ } ++ ++ bytesPerPixel = myFormat.bitsPerPixel / 8; ++ ++ if (alphablend && bytesPerPixel == 4) { ++ unsigned long pixel, put, *upos, *upix; ++ int got_alpha = 0, rsX, rsY, rsW, rsH; ++ static XImage *image = NULL; ++ static int iwidth = 128; ++ ++ if (! image) { ++ /* watch out for tiny fb (rare) */ ++ if (iwidth > si.framebufferWidth) { ++ iwidth = si.framebufferWidth; ++ } ++ if (iwidth > si.framebufferHeight) { ++ iwidth = si.framebufferHeight; ++ } ++ ++ /* initialize an XImage with a chunk of desktopWin */ ++ image = XGetImage(dpy, desktopWin, 0, 0, iwidth, iwidth, ++ AllPlanes, ZPixmap); ++ } ++ ++ /* first check if there is any non-zero alpha channel data at all: */ ++ for (y = 0; y < rcHeight; y++) { ++ for (x = 0; x < rcWidth; x++) { ++ int alpha; ++ ++ offset = y * rcWidth + x; ++ pos = (char *)&rcSource[offset * bytesPerPixel]; ++ ++ upos = (unsigned long *) pos; ++ alpha = (*upos & 0xff000000) >> 24; ++ if (alpha) { ++ got_alpha = 1; ++ break; ++ } ++ } ++ if (got_alpha) { ++ break; ++ } ++ } ++ ++ if (!got_alpha) { ++ /* no alpha channel data, fallback to the old way */ ++ goto oldway; ++ } ++ ++ /* load the saved fb patch in to image (faster way?) */ ++ XGetSubImage(dpy, rcSavedArea, 0, 0, rcWidth, rcHeight, ++ AllPlanes, ZPixmap, image, 0, 0); ++ upix = (unsigned long *)image->data; ++ ++ /* if the richcursor is clipped, the fb patch will be smaller */ ++ rsW = rcWidth; ++ rsX = 0; /* used to denote a shift from the left side */ ++ x = rcCursorX - rcHotX; ++ if (x < 0) { ++ rsW += x; ++ rsX = -x; ++ } else if (x + rsW > si.framebufferWidth) { ++ rsW = si.framebufferWidth - x; ++ } ++ rsH = rcHeight; ++ rsY = 0; /* used to denote a shift from the top side */ ++ y = rcCursorY - rcHotY; ++ if (y < 0) { ++ rsH += y; ++ rsY = -y; ++ } else if (y + rsH > si.framebufferHeight) { ++ rsH = si.framebufferHeight - y; ++ } ++ ++ /* ++ * now loop over the cursor data, blend in the fb values, ++ * and then overwrite the fb (CopyDataToScreen()) ++ */ ++ for (y = 0; y < rcHeight; y++) { ++ y0 = rcCursorY - rcHotY + y; ++ if (y0 < 0 || y0 >= si.framebufferHeight) { ++ continue; /* clipped */ ++ } ++ for (x = 0; x < rcWidth; x++) { ++ int alpha, color_curs, color_fb, i; ++ ++ x0 = rcCursorX - rcHotX + x; ++ if (x0 < 0 || x0 >= si.framebufferWidth) { ++ continue; /* clipped */ ++ } ++ ++ offset = y * rcWidth + x; ++ pos = (char *)&rcSource[offset * bytesPerPixel]; ++ ++ /* extract secret alpha byte from rich cursor: */ ++ upos = (unsigned long *) pos; ++ alpha = (*upos & 0xff000000) >> 24; /* XXX MSB? */ ++ ++ /* extract the pixel from the fb: */ ++ pixel = *(upix + (y-rsY)*iwidth + (x-rsX)); ++ ++ put = 0; ++ /* for simplicity, blend all 4 bytes */ ++ for (i = 0; i < 4; i++) { ++ int sh = i*8; ++ color_curs = ((0xff << sh) & *upos) >> sh; ++ color_fb = ((0xff << sh) & pixel) >> sh; ++ ++ /* XXX assumes pre-multipled color_curs */ ++ color_fb = color_curs ++ + ((0xff - alpha) * color_fb)/0xff; ++ put |= color_fb << sh; ++ } ++ /* place in the fb: */ ++ CopyDataToScreen((char *)&put, x0, y0, 1, 1); ++ } ++ } ++ return; ++ } ++oldway: ++#endif ++ + bytesPerPixel = myFormat.bitsPerPixel / 8; + + /* FIXME: Speed optimization is possible. */ diff --git a/x11vnc/ChangeLog b/x11vnc/ChangeLog index d6174cc..799ca9e 100644 --- a/x11vnc/ChangeLog +++ b/x11vnc/ChangeLog @@ -1,3 +1,7 @@ +2005-02-05 Karl Runge + * -solid solid color background when clients are connected. + * -opts/-? to show option names only. + 2005-01-23 Karl Runge * sync with new draw cursor mechanism, keep old way in OLD_TREE. * add -timeout option, change -alphablend to be default diff --git a/x11vnc/README b/x11vnc/README index 6ba11b4..3126bec 100644 --- a/x11vnc/README +++ b/x11vnc/README @@ -1,5 +1,5 @@ -x11vnc README file Date: Sun Jan 23 23:48:41 EST 2005 +x11vnc README file Date: Sat Feb 5 12:56:36 EST 2005 The following information is taken from these URLs: @@ -50,10 +50,10 @@ x11vnc: a VNC server for real X displays (to [1]FAQ) (to [2]downloads) interact with the whole virtual X11 desktop. The VNC protocol is in most cases better suited for remote connections - with low bandwidth and high latency than is the X11 protocol. Also, - with no state maintained the viewing-end can crash, be rebooted, or - relocated and the applications and desktop continue running. Not so - with X11. + with low bandwidth and high latency than is the X11 protocol (the + exception is cached pixmap data on the viewing-end). Also, with no + state maintained the viewing-end can crash, be rebooted, or relocated + and the applications and desktop continue running. Not so with X11. So the standard Xvnc program is very useful, I use it for things like: * desktop conferencing with other users (e.g. codereviews). @@ -77,16 +77,14 @@ x11vnc: a VNC server for real X displays (to [1]FAQ) (to [2]downloads) wish to view is "far-away.east:0" and the workstation you are presently working at is "sitting-here.west". - Step 0. Download x11vnc ([9]see below) and have it available to run - (e.g. via $PATH) on far-away.east. Similarly, have a VNC viewer (e.g. - vncviewer) ready to run on sitting-here.west. We recommend - [10]TightVNC Viewers. + Step 0. Download x11vnc ([9]see below) and have it available to run on + far-away.east. Similarly, have a VNC viewer (e.g. vncviewer) ready to + run on sitting-here.west. We recommend [10]TightVNC Viewers. Step 1. By some means log in to far-away.east and get a command shell running there. You can use ssh, rlogin, telnet, or any other method to do this. x11vnc needs to be run on the same machine the X server - process is running on (because MIT-SHM shared memory is used to poll - the X11 framebuffer). + process is running on (otherwise things would be extremely slow). Step 2. In that far-away.east shell (with command prompt "far-away>" in this example) run x11vnc directed at the far-away.east X session @@ -133,6 +131,11 @@ x11vnc: a VNC server for real X displays (to [1]FAQ) (to [2]downloads) shutdown automatically (or you can use the -forever [14]option to have it wait for additional viewer connections). + Shortcut: Of course if you left x11vnc running in a terminal window or + as a [15]service on far-away.east:0, you'd only have to do Step 3 as + you moved around. Be sure to use a VNC [16]password or [17]other + measures if you do that. + Desktop Sharing: The above more or less assumed nobody was sitting at the workstation display "far-away.east:0". This is often the case: a user wants to access her workstation remotely. Another usage pattern @@ -146,9 +149,9 @@ x11vnc: a VNC server for real X displays (to [1]FAQ) (to [2]downloads) For these cases it should be obvious how it is done. The above steps will work, but more easily the user sitting at far-away.east:0 simply starts up x11vnc from a terminal window, after which the guests would - start their VNC viewers. For this usage mode the -accept popup option - discussed in the [15]FAQ below may be of use to allow the user at - far-away.east:0 to accept or reject incoming connections. + start their VNC viewers. For this usage mode the "-connect + host1,host2" option may be of use automatically connect to vncviewers + in "-listen" mode on the list of hosts. _________________________________________________________________ Tunnelling x11vnc via ssh: @@ -173,8 +176,8 @@ x11vnc: a VNC server for real X displays (to [1]FAQ) (to [2]downloads) Some VNC viewers will do the ssh tunnelling for you automatically, the TightVNC vncviewer does this when the "-via far-away.east" option is supplied to it (this requires x11vnc to be already running on - far-away.east or having it started by [16]inetd(1)). See the 3rd - script example [17]below for more info. + far-away.east or having it started by [18]inetd(1)). See the 3rd + script example [19]below for more info. If the machine you SSH into is not the same machine with the X display you wish to view (e.g. your company provides incoming SSH access to a @@ -184,9 +187,9 @@ x11vnc: a VNC server for real X displays (to [1]FAQ) (to [2]downloads) up x11vnc on it. _________________________________________________________________ - Scripts to automate tunneling: As discussed below, there may be some - problems with port 5900 being available. If that happens, the above - port and display numbers may change a bit (e.g. -> 5901 and :1). + Scripts to automate ssh tunneling: As discussed below, there may be + some problems with port 5900 being available. If that happens, the + above port and display numbers may change a bit (e.g. -> 5901 and :1). However, if you "know" port 5900 will be free on the local and remote machines, you can easily automate the above two steps by using the x11vnc option -bg (forks into background after connection to the @@ -257,7 +260,7 @@ export VNC_VIA_CMD vncviewer -via $host localhost:0 # must be TightVNC vncviewer. Of course if you already have the x11vnc running waiting for - connections (or have it started out of [18]inetd(1)), you can simply + connections (or have it started out of [20]inetd(1)), you can simply use the TightVNC "vncviewer -via gateway host:port" in its default mode to provide secure ssh tunnelling. @@ -265,44 +268,43 @@ vncviewer -via $host localhost:0 # must be TightVNC vncviewer. VNC password file: Also note in the first example script that the option "-rfbauth .vnc/passwd" provides additional protection by requiring a VNC password for every VNC viewer that connects. The - vncpasswd or storepasswd programs, or the x11vnc [19]-storepasswd + vncpasswd or storepasswd programs, or the x11vnc [21]-storepasswd option can be used to create the password file. x11vnc also has the - slightly less secure [20]-passwdfile and "-passwd XXXXX" options. + slightly less secure [22]-passwdfile and "-passwd XXXXX" options. Important: It is up to you to tell x11vnc to use password protection, it will not do it for you automatically. The same goes for encrypting the channel between the viewer and x11vnc: it is up to you to use ssh, stunnel, VPN, etc. Also look into the -allow and -localhost - [21]options and building x11vnc with [22]tcp_wrappers support to limit + [23]options and building x11vnc with [24]tcp_wrappers support to limit host access. _________________________________________________________________ Downloading x11vnc: - x11vnc is a contributed program to the [23]LibVNCServer project at + x11vnc is a contributed program to the [25]LibVNCServer project at 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 Dec 2004, the [24]x11vnc-0.7.tar.gz source package is - released (recommended download) . The [25]x11vnc 0.7 release notes. + link. As of Dec 2004, the [26]x11vnc-0.7.tar.gz source package is + released (recommended download) . The [27]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 [26]x11vnc.c file to replace the one in the above + build the x11vnc program. Also, you can get a copy of my latest, + bleeding edge [28]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 [27]tkx11vnc.h file. If you have an + update the tcl/tk gui with the [29]tkx11vnc.h file. If you have an older libvncserver source tree, you may need to switch on the OLD_TREE variable near the top of the x11vnc.c file. - See the [28]FAQ below for information about where you might obtain a + See the [30]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: - * [29]http://www.tightvnc.com/download.html - * [30]http://www.realvnc.com/download-free.html - * [31]http://sourceforge.net/projects/cotvnc/ + * [31]http://www.tightvnc.com/download.html + * [32]http://www.realvnc.com/download-free.html + * [33]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 @@ -312,8 +314,8 @@ 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: - * [32]rx11vnc wrapper script - * [33]rx11vnc.pl wrapper script to tunnel traffic thru ssh + * [34]rx11vnc wrapper script + * [35]rx11vnc.pl wrapper script to tunnel traffic thru ssh _________________________________________________________________ Building x11vnc: @@ -355,9 +357,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 [34]ftp://ftp.uu.net/graphics/jpeg/ and zlib at - [35]http://www.gzip.org/zlib/. See also - [36]http://www.sunfreeware.com/ for Solaris binary packages of these + at [36]ftp://ftp.uu.net/graphics/jpeg/ and zlib at + [37]http://www.gzip.org/zlib/. See also + [38]http://www.sunfreeware.com/ for Solaris binary packages of these libraries. Here is a build script that indicates one way to pass the library @@ -411,18 +413,7 @@ ls -l ./x11vnc/x11vnc you do not have any ENV or BASH_ENV in your environment doing things like that. - There is a build problem on Solaris 7 11/99 (update 4) where the - header file X11/extensions/XKBstr.h that X11/XKBlib.h uses was not - shipped. The x11vnc configure succeeds and sets - LIBVNCSERVER_HAVE_XKEYBOARD in rfb/rfbconfig.h but then the build of - x11vnc fails in the make. A workaround is to remove all lines - referring to LIBVNCSERVER_HAVE_XKEYBOARD in rfb/rfbconfig.h after - configure has been run. Alternatively, one could put #undef - LIBVNCSERVER_HAVE_XKEYBOARD after the rfb/rfb.h include in the - 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 [37]this + If you need to build on Solaris 2.5.1 or earlier, see [39]this workaround FAQ. Building on HP-UX: For jpeg and zlib you will need to do the same @@ -452,8 +443,11 @@ ls -l ./x11vnc/x11vnc protocol.) I suggest using xsetroot, dtstyle or similar utility to set a solid background while using x11vnc. You can turn the pretty background image back on when you are using the display directly. + Update: As of Feb/2005 in the libvncserver CVS, x11vnc has the -solid + [color] option that works on recent GNOME and KDE and also on classic + X (background image is on the root window). - I also find the [38]tightvnc encoding gives the best response for my + I also find the [40]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. @@ -469,10 +463,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 [39]command line options. Useful options are -nap to use fewer + via its [41]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 [40]-storepasswd option can be + storepasswd programs, or the x11vnc [42]-storepasswd option can be used to create the password file). Algorithm: How does x11vnc do it? Rather brute-forcedly: it @@ -496,14 +490,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 [41]even more interesting effect if + decorations. There will be an [43]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) - [42]SunRay session (Please remember to use -nap and maybe -wait 200 to + [44]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 @@ -579,7 +573,7 @@ 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 [43]contact me if you have any questions, + Please feel free to [45]contact me if you have any questions, problems, or comments about x11vnc, etc. _________________________________________________________________ @@ -588,44 +582,42 @@ ls -l ./x11vnc/x11vnc [Building and Starting] - [44]Q-1: I can't get x11vnc to start up. It says "XOpenDisplay failed + [46]Q-1: I can't get x11vnc to start up. It says "XOpenDisplay failed (null)" or "Xlib: connection to ":0.0" refused by server" and then exits. What do I need to do? - [45]Q-2: I can't get x11vnc and/or libvncserver to compile. + [47]Q-2: I can't get x11vnc and/or libvncserver to compile. - [46]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 + [48]Q-3: Help, I need to run x11vnc on Solaris 2.5.1 and it doesn't + compile! - [47]Q-4: Where can I get a precompiled x11vnc binary for my Operating + [49]Q-4: Where can I get a precompiled x11vnc binary for my Operating System? - [48]Q-5: Where can I get a VNC Viewer binary (or source code) for the + [50]Q-5: Where can I get a VNC Viewer binary (or source code) for the Operating System I will be viewing from? - [49]Q-6: How can I see all of x11vnc's command line options and + [51]Q-6: How can I see all of x11vnc's command line options and documentation on how to use them? - [50]Q-7: I don't like typing arcane command line options every time I + [52]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? - [51]Q-8: Can I make x11vnc more quiet and also go into the background + [53]Q-8: Can I make x11vnc more quiet and also go into the background after starting up? - [52]Q-9: Sometimes when a VNC viewer dies abruptly, x11vnc also dies + [54]Q-9: 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. [Win2VNC Related] - [53]Q-10: I have two separate machine displays in front of me, one + [55]Q-10: 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? - [54]Q-11: I am running Win2VNC on my windows machine and trying to + [56]Q-11: 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: @@ -633,200 +625,200 @@ ls -l ./x11vnc/x11vnc [Color Issues] - [55]Q-12: The X display I run x11vnc on is only 8 bits per pixel (bpp) + [57]Q-12: 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. - [56]Q-13: Color problems: Why are the colors for some windows messed + [58]Q-13: 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. - [57]Q-14: How do I figure out the window id to supply to the -id + [59]Q-14: How do I figure out the window id to supply to the -id windowid option? - [58]Q-15: Why don't menus or other transient windows come up when I am + [60]Q-15: Why don't menus or other transient windows come up when I am using the -id windowid option to view a single application window? - [59]Q-16: My X display is depth 24 at 24bpp (instead of the normal + [61]Q-16: My X display is depth 24 at 24bpp (instead of the normal depth 24 at 32bpp). I'm having lots of color and visual problems with x11vnc and vncviewer. [Xterminals] - [60]Q-17: Can I use x11vnc to view and interact with an Xterminal + [62]Q-17: 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? - [61]Q-18: How do I get my X permissions (MIT-MAGIC-COOKIE) correct for + [63]Q-18: How do I get my X permissions (MIT-MAGIC-COOKIE) correct for a Unix/Linux machine acting as an Xterminal? [Remote Control] - [62]Q-19: How do I stop x11vnc once it is running in the background? + [64]Q-19: How do I stop x11vnc once it is running in the background? - [63]Q-20: Can I change settings in x11vnc without having to restart + [65]Q-20: Can I change settings in x11vnc without having to restart it? Is there a way to remote control it? [Security and Permissions] - [64]Q-21: Why does x11vnc exit as soon as the VNC viewer disconnects? + [66]Q-21: 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? - [65]Q-22: Can I limit which machines incoming VNC clients can connect + [67]Q-22: Can I limit which machines incoming VNC clients can connect from? - [66]Q-23: How do I build x11vnc/libvncserver with libwrap + [68]Q-23: How do I build x11vnc/libvncserver with libwrap (tcp_wrappers) support? - [67]Q-24: Can I prompt the user at the local X display whether the + [69]Q-24: 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? - [68]Q-25: How do I create a VNC password for use with x11vnc? + [70]Q-25: How do I create a VNC password for use with x11vnc? - [69]Q-26: How can I tunnel my connection to x11vnc via an encrypted + [71]Q-26: How can I tunnel my connection to x11vnc via an encrypted SSH channel between two Unix machines? - [70]Q-27: How can I tunnel my connection to x11vnc via an encrypted + [72]Q-27: How can I tunnel my connection to x11vnc via an encrypted SSH channel from Windows using an SSH client like Putty? - [71]Q-28: Does x11vnc support Unix usernames and passwords? Can I + [73]Q-28: Does x11vnc support Unix usernames and passwords? Can I further limit the set of Unix usernames who can connect to the VNC desktop? - [72]Q-29: Can I have two passwords for VNC viewers, one for full + [74]Q-29: Can I have two passwords for VNC viewers, one for full access and the other for view-only access to the display? - [73]Q-30: I use a screen-lock when I leave my workstation (e.g. + [75]Q-30: 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? - [74]Q-31: Can I have x11vnc automatically lock the screen when I + [76]Q-31: Can I have x11vnc automatically lock the screen when I disconnect the VNC viewer? [Display Managers and Services] - [75]Q-32: How can I run x11vnc as a "service" that is always + [77]Q-32: How can I run x11vnc as a "service" that is always available? - [76]Q-33: How can I use x11vnc to connect to an X login screen like + [78]Q-33: 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). - [77]Q-34: Can I run x11vnc out of inetd(1)? How about xinetd(1)? + [79]Q-34: Can I run x11vnc out of inetd(1)? How about xinetd(1)? - [78]Q-35: How do I make x11vnc work with the Java VNC viewer applet in + [80]Q-35: How do I make x11vnc work with the Java VNC viewer applet in a web browser? - [79]Q-36: Are reverse connections (i.e. the VNC server connecting to + [81]Q-36: Are reverse connections (i.e. the VNC server connecting to the VNC viewer) using "vncviewer -listen" and vncconnect(1) supported? [Resource Usage and Performance] - [80]Q-37: I have lots of memory, but why does x11vnc fail with + [82]Q-37: 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)? - [81]Q-38: How can I make x11vnc use less system resources? + [83]Q-38: How can I make x11vnc use less system resources? - [82]Q-39: How can I make x11vnc use MORE system resources? + [84]Q-39: How can I make x11vnc use MORE system resources? - [83]Q-40: I use x11vnc over a slow link with high latency (e.g. dialup + [85]Q-40: I use x11vnc over a slow link with high latency (e.g. dialup modem), is there anything I can do to speed things up? - [84]Q-41: When I drag windows around with the mouse or scroll up and + [86]Q-41: 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? [Mouse Cursor Shapes] - [85]Q-42: Why isn't the mouse cursor shape (the little icon shape + [87]Q-42: Why isn't the mouse cursor shape (the little icon shape where the mouse pointer is) correct as I move from window to window? - [86]Q-43: When using XFIXES cursorshape mode, some of the cursors look + [88]Q-43: When using XFIXES cursorshape mode, some of the cursors look really bad with extra black borders around the cursor and other cruft. How can I improve their appearance? - [87]Q-44: In XFIXES mode, are there any hacks to handle cursor + [89]Q-44: In XFIXES mode, are there any hacks to handle cursor transparency ("alpha channel") exactly? [Mouse Pointer] - [88]Q-45: Why does the mouse arrow just stay in one corner in my + [90]Q-45: Why does the mouse arrow just stay in one corner in my vncviewer, whereas my cursor (that does move) is just a dot? - [89]Q-46: Can I take advantage of the TightVNC extension to the VNC + [91]Q-46: 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)? - [90]Q-47: Is it possible to swap the mouse buttons (e.g. left-handed + [92]Q-47: 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? [Keyboard Issues] - [91]Q-48: How can I get my AltGr and Shift modifiers to work between + [93]Q-48: How can I get my AltGr and Shift modifiers to work between keyboards for different languages? - [92]Q-49: When I try to type a "<" (i.e. less than) instead I get ">" + [94]Q-49: When I try to type a "<" (i.e. less than) instead I get ">" (i.e. greater than)! Strangely, typing ">" works OK!! - [93]Q-50: I'm using an "international" keyboard (e.g. German "de", or + [95]Q-50: 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? - [94]Q-51: When typing I sometimes get double, triple, or more of my + [96]Q-51: 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? - [95]Q-52: The x11vnc -norepeat mode is in effect, but I still get + [97]Q-52: The x11vnc -norepeat mode is in effect, but I still get repeated keystrokes!! - [96]Q-53: The machine where I run x11vnc has an AltGr key, but the + [98]Q-53: 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? - [97]Q-54: I have a Sun machine I run x11vnc on. Its Sun keyboard has + [99]Q-54: 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) - [98]Q-55: Can I map a keystroke to a mouse button click on the remote + [100]Q-55: Can I map a keystroke to a mouse button click on the remote machine? [Screen Related Issues and Features] - [99]Q-56: The remote display is larger (in number of pixels) than the + [101]Q-56: 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? - [100]Q-57: Does x11vnc support server-side framebuffer scaling? (E.g. + [102]Q-57: Does x11vnc support server-side framebuffer scaling? (E.g. to make the desktop smaller). - [101]Q-58: Does x11vnc work with Xinerama? (i.e. multiple monitors + [103]Q-58: Does x11vnc work with Xinerama? (i.e. multiple monitors joined together to form one big, single screen). - [102]Q-59: Can I use x11vnc on a multi-headed display that is not + [104]Q-59: Can I use x11vnc on a multi-headed display that is not Xinerama (i.e. separate screens :0.0, :0.1, ... for each monitor)? - [103]Q-60: Does x11vnc support the XRANDR (X Resize, Rotate and + [105]Q-60: Does x11vnc support the XRANDR (X Resize, Rotate and Reflection) extension? Whenever I rotate or resize the screen x11vnc just seems to crash. - [104]Q-61: Why is the view in my VNC viewer completely black? Or why + [106]Q-61: Why is the view in my VNC viewer completely black? Or why is everything flashing around randomly? - [105]Q-62: I use Linux Virtual Consoles (VC's) to implement 'Fast User + [107]Q-62: 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 @@ -834,7 +826,7 @@ ls -l ./x11vnc/x11vnc otherwise all messed up unless the X session x11vnc is attached to is in the active VC? - [106]Q-63: I am using x11vnc where my local machine has "popup/hidden + [108]Q-63: 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 @@ -842,10 +834,10 @@ ls -l ./x11vnc/x11vnc [Misc: Clipboard, Beeps, etc.] - [107]Q-64: Does the Clipboard/Selection get transferred between the + [109]Q-64: Does the Clipboard/Selection get transferred between the vncviewer and the X display? - [108]Q-65: Why don't I hear the "Beeps" in my X session (e.g. when + [110]Q-65: Why don't I hear the "Beeps" in my X session (e.g. when typing tput bel in an xterm)? _________________________________________________________________ @@ -937,16 +929,20 @@ ls -l ./x11vnc/x11vnc zlib-devel 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 + compile! We apologize that x11vnc does not build cleanly on older versions of - Solaris, Linux, etc.: very few users are on these old releases. Here - is a workaround for Solaris 2.5.1 (and perhaps earlier): + Solaris, Linux, etc.: very few users are on these old releases. + + We have heard that since Dec/2004 a Solaris 2.6 built x11vnc will run + on Solaris Solaris 2.5 and 2.5.1 (since a workaround for XConvertCase + is provided). + + In any event, here is a workaround for Solaris 2.5.1 (and perhaps + earlier and perhaps non-Solaris): First use the environment settings (CPPFLAGS, LDFLAGS, etc.) in the - above [109]Solaris build script to run the configure command. That + above [111]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 @@ -962,8 +958,12 @@ int gethostname(char *name, int namelen); long random(); int srandom(unsigned int seed); #undef LIBVNCSERVER_HAVE_LIBPTHREAD +#ifndef SHUT_RDWR #define SHUT_RDWR 2 +#endif +#ifndef in_addr_t typedef unsigned int in_addr_t; +#endif #ifndef snprintf #define snprintf(a, n, args...) sprintf((a), ## args) #endif @@ -976,6 +976,9 @@ typedef unsigned int in_addr_t; Similar sorts of kludges can be done on other older OS (Solaris, Linux, ...) releases. + Here are some notes for similar steps that need to be done to build on + [112]SunOS 4.x + Please let us know if you had to use the above workaround (and whether it worked or not). If there is enough demand we will try to push clean compilations back to earlier Solaris, Linux, etc, releases. @@ -983,18 +986,19 @@ typedef unsigned int in_addr_t; Q-4: Where can I get a precompiled x11vnc binary for my Operating System? - Hopefully the [110]build steps above and [111]FAQ provide enough info + Hopefully the [113]build steps above and [114]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) [112]http://packages.debian.org/x11vnc + Debian: (.deb) [115]http://packages.debian.org/x11vnc - Slackware: (.tgz) [113]http://www.linuxpackages.net/ Redhat/Fedora: - (.rpm) [114]http://dag.wieers.com/packages/x11vnc/ wwexptools: (.tgz) - [115]http://www.bell-labs.com/project/wwexptools/packages.html The + Slackware: (.tgz) [116]http://www.linuxpackages.net/ Redhat/Fedora: + (.rpm) [117]http://dag.wieers.com/packages/x11vnc/ Solaris: (pkg) + [118]http://www.sunfreeware.com/ wwexptools: (.tgz) + [119]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 @@ -1006,13 +1010,14 @@ 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 [116]build notes above for where to download libz and libjpeg, and - then build everything with gcc. + the [120]build notes above for where to download libz and libjpeg, and + then build everything with gcc. For Solaris, the + http://www.sunfreeware.com/ packages are built with libz and libjpeg. If the above binaries don't work and building x11vnc on your OS fails (and all else fails!) you can try one of my motley collection of - [117]test binaries. Some may be old, some may have extra debugging - output, etc. One may work on your OS, but please understand they are + [121]test binaries. Some may be old, some may have extra debugging + output, etc. They may work on your OS, but please understand they are test/experimental binaries not intended for general usage like the above precompiled ones from 3rd parties. @@ -1033,14 +1038,16 @@ typedef unsigned int in_addr_t; To obtain VNC viewers for the viewing side (Windows, Mac OS, or Unix) try here: - * [118]http://www.tightvnc.com/download.html - * [119]http://www.realvnc.com/download-free.html - * [120]http://sourceforge.net/projects/cotvnc/ + * [122]http://www.tightvnc.com/download.html + * [123]http://www.realvnc.com/download-free.html + * [124]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 [121]here as well. + Run: x11vnc -opts to list just the option names or run: x11vnc + -help for long descriptions about each option. The output is listed + [125]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? Or a GUI? @@ -1095,7 +1102,7 @@ display :0 As of Apr/2004 the above fix only works for BSD signal systems (Linux, FreeBSD, ...) For SYSV systems there is a workaround in my - [122]x11vnc.c file. It also has an option -sigpipe exit to have x11vnc + [126]x11vnc.c file. It also has an option -sigpipe exit to have x11vnc clean up and exit upon receiving SIGPIPE. [Win2VNC Related] @@ -1110,16 +1117,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 [123]x2vnc, however you would + This will also work X11 to X11 using [127]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: - * [124]Original Win2VNC - * [125]Enhanced Win2VNC and [126]sourceforge link - * [127]x2vnc - * [128]x2x also [129]here - * [130]zvnc (MorphOS) + * [128]Original Win2VNC + * [129]Enhanced Win2VNC and [130]sourceforge link + * [131]x2vnc + * [132]x2x also [133]here + * [134]zvnc (MorphOS) All of them (except x2x) will work with x11vnc. @@ -1174,7 +1181,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 [131]previous question regarding 8 bpp + You may want to review the [135]previous question regarding 8 bpp PseudoColor. On some hardware (Sun/SPARC, Sgi), the -overlay option discussed a @@ -1251,7 +1258,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 - [132]problems. + [136]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 @@ -1357,7 +1364,7 @@ central-server> xauth nextract - xterm123:0 | ssh xterm123 xauth nmerge - xauth(1) manpage for more details. If the display name needs to be changed between the two hosts, see - [133]this note on the xauth add ... command. + [137]this note on the xauth add ... command. A less secure option is to run something like "xhost +127.0.0.1" to allow cookie-free local access for x11vnc. @@ -1366,7 +1373,7 @@ central-server> xauth nextract - xterm123:0 | ssh xterm123 xauth nmerge - accounts, NFS, etc. you'll need to contact your system administrator to set something up. - Not recommended, but as a last resort, you could have x11vnc [134]poll + Not recommended, but as a last resort, you could have x11vnc [138]poll the Xterminal over the network. Note: use of Display Manager (gdm, kdm, ...) auth cookie files (i.e. @@ -1434,10 +1441,10 @@ central-server> xauth nextract - xterm123:0 | ssh xterm123 xauth nmerge - -shared option to have x11vnc allow multiple clients to connect simultaneously. - Recommended additional safety measures include using ssh ([135]see + Recommended additional safety measures include using ssh ([139]see above), stunnel, or a VPN to authenticate and encrypt the viewer - connections or to at least use the -rfbauth passwd-file [136]option to - use VNC password protection (or [137]-passwdfile) It is up to you to + connections or to at least use the -rfbauth passwd-file [140]option to + use VNC password protection (or [141]-passwdfile) It is up to you to apply these security measures, they will not be done for you automatically. @@ -1473,7 +1480,7 @@ central-server> xauth nextract - xterm123:0 | ssh xterm123 xauth nmerge - is "vnc", e.g.: vnc: 192.168.100.3 .example.com - Note that if you run x11vnc out of [138]inetd you do not need to build + Note that if you run x11vnc out of [142]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. @@ -1517,7 +1524,7 @@ central-server> xauth nextract - xterm123:0 | ssh xterm123 xauth nmerge - 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 [139]ftp://ftp.x.org/ + is available at [143]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 @@ -1556,7 +1563,7 @@ elif [ $rc = 4 ]; then fi exit 1 - Stefan Radman has written a nice dtksh script [140]dtVncPopup for use + Stefan Radman has written a nice dtksh script [144]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. @@ -1582,9 +1589,11 @@ exit 1 directory. And as of Jun/2004 in the libvncserver CVS x11vnc supports the -storepasswd "pass" "file" option, which is the the same functionality of storepasswd. Be sure to quote the "pass" if it - contains shell meta characters, spaces, etc. + contains shell meta characters, spaces, etc. Example: + x11vnc -storepasswd 'sword*fish' $HOME/myvncpasswd - You then use the password via the x11vnc option: -rfbauth filename + You then use the password via the x11vnc option: -rfbauth + $HOME/myvncpasswd Compared to vncpasswd(1) the latter two methods are a somewhat unsafe because the password is specified on the command line and so someone @@ -1592,14 +1601,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 [141]-passwdfile and -passwd/-viewpasswd plain + x11vnc also has the [145]-passwdfile and -passwd/-viewpasswd plain text (i.e. not obscured like the -rfbauth VNC passwords) password options. Q-26: 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 [142]how to tunnel VNC via + See the description earlier on this page on [146]how to tunnel VNC via SSH from Unix to Unix. A number of ways are described along with some issues you may encounter. @@ -1609,7 +1618,7 @@ exit 1 Q-27: How can I tunnel my connection to x11vnc via an encrypted SSH channel from Windows using an SSH client like Putty? - [143]Above we described how to tunnel VNC via SSH from Unix to Unix, + [147]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 @@ -1642,7 +1651,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 [144]above another option is to first start the VNC + As discussed [148]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 @@ -1663,7 +1672,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 - [145]elsewhere on this page. Of course a malicious user could allow + [149]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 @@ -1739,7 +1748,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 [146]blockdpy.c The idea behind it is simple (but + source for it is [150]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 @@ -1765,12 +1774,12 @@ exit 1 # reject it Yes, a user mentions he uses the -gone option under CDE to run a screen lock program: - x11vnc -display :0.0 -forever -gone 'dtaction LockDisplay' + x11vnc -display :0 -forever -gone 'dtaction LockDisplay' Other possibilities are: - x11vnc -display :0.0 -forever -gone 'xscreensaver-command -lock' - x11vnc -display :0.0 -forever -gone 'kdesktop_lock' - x11vnc -display :0.0 -forever -gone 'xlock &' + x11vnc -display :0 -forever -gone 'xscreensaver-command -lock' + x11vnc -display :0 -forever -gone 'kdesktop_lock' + x11vnc -display :0 -forever -gone 'xlock &' [Display Managers and Services] @@ -1786,11 +1795,11 @@ exit 1 # reject it permissions. Here are some ideas: - * Use the description under "Continuously" in the [147]FAQ on x11vnc + * Use the description under "Continuously" in the [151]FAQ on x11vnc and Display Managers - * Use the description in the [148]FAQ on x11vnc and inetd(1) + * Use the description in the [152]FAQ on x11vnc and inetd(1) * Start x11vnc from $HOME/.xsession (or $HOME/.xinitrc) - * Although less reliable, see the [149]x11vnc_loop rc.local hack + * Although less reliable, see the [153]x11vnc_loop rc.local hack below. The display manager scheme will not be specific to which user has the @@ -1892,18 +1901,18 @@ x11vnc -logfile $HOME/.x11vnc.log -rfbauth $HOME/.vnc/passwd -forever -bg Then restart: /usr/sbin/gdm-restart (or reboot). The KillInitClients=false setting is important: without it x11vnc will be - killed immediately after the user logs in. Here are [150]full details + killed immediately after the user logs in. Here are [154]full details on how to configure gdm 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. [151]x11vnc_loop It will need some local + file like rc.local. [155]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. If the machine is a traditional Xterminal you may want to read - [152]this FAQ. + [156]this FAQ. Q-34: Can I run x11vnc out of inetd(1)? How about xinetd(1)? @@ -2046,7 +2055,7 @@ xprop -root -f VNC_CONNECT 8s -set VNC_CONNECT "$1" 19/03/2004 10:10:58 error creating tile-row shm for len=4 19/03/2004 10:10:58 reverting to single_copytile mode - Here is a shell script [153]shm_clear to list and prompt for removal + Here is a shell script [157]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, @@ -2084,7 +2093,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 [154]earlier question + sockets it should be acceptable (see an [158]earlier question discussing -noshm). Q-38: How can I make x11vnc use less system resources? @@ -2119,7 +2128,8 @@ ied) (reduces amount of data needed to be sent) * Use a smaller desktop size (e.g. 1024x768 instead of 1280x1024) * Make sure the desktop background is a solid color (the background - is resent every time it is re-exposed) + is resent every time it is re-exposed). Consider using the -solid + [color] option. * Configure your window manager or desktop "theme" to not use fancy images, shading, and gradients for the window decorations, etc. Disable Opaque moves, resizes, and animations. @@ -2132,7 +2142,7 @@ ied) worth it, but could be of use in some situations. VNC viewer parameters: - * Use a [155]TightVNC enabled viewer! + * Use a [159]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 @@ -2293,7 +2303,7 @@ ied) hide the alpha data), but it also currently requires the client and server to be of the same endianness (otherwise the hidden alpha data gets reset to zero by the translation function). As an example, for - the TightVNC 1.3dev5 Unix vncviewer [156]this patch enables the + the TightVNC 1.3dev5 Unix vncviewer [160]this patch enables the TightVNC viewer to do the blending locally. You have to set the environment variable ALPHABLEND=1 before starting your modified viewer. The patch code should give an example on how to change the @@ -2305,7 +2315,7 @@ ied) Q-45: 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 [157]tightvnc extension + This default takes advantage of a [161]tightvnc extension (CursorShapeUpdates) that allows specifying a cursor image shape for the local VNC viewer. You may disable it with the -nocursor option to x11vnc if your viewer does not have this extension. @@ -2390,12 +2400,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 [158]this FAQ + and ">" it. This key does not exist on the keyboard (see [162]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 [159]FAQ about the -xkb option for a more powerful method + Also see the [163]FAQ about the -xkb option for a more powerful method of modifier tweaking for use on X servers with the XKEYBOARD extension. @@ -2456,7 +2466,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 [160]FAQ about the -xkb option as a possible workaround + See also the [164]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. @@ -2596,7 +2606,7 @@ ied) keystrokes!! Are you using x11vnc to log in to an X session? (as described - [161]this FAQ) If so, x11vnc is starting before your session, and then + [165]this FAQ) If so, x11vnc is starting before your session, and then your session startup could be resetting the autorepeat to be on. Or it could be something inside your desktop that decides to turn it back on. x11vnc in -norepeat mode will not battle with things turning @@ -2681,7 +2691,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 [162]this + local display. Especially for hand-held devices. See also [166]this FAQ on x11vnc scaling. Q-57: Does x11vnc support server-side framebuffer scaling? (E.g. to @@ -2779,7 +2789,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 [163]FAQ to increase the limit. It + /etc/system as mentioned in another [167]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. @@ -2892,155 +2902,159 @@ References 12. http://www.karlrunge.com/x11vnc/index.html#viewer-download 13. http://www.sun.com/software/solaris/freeware/ 14. http://www.karlrunge.com/x11vnc/x11vnc_opts.html - 15. http://www.karlrunge.com/x11vnc/index.html#accept - 16. http://www.karlrunge.com/x11vnc/index.html#inetd - 17. http://www.karlrunge.com/x11vnc/index.html#tightvnc_via + 15. http://www.karlrunge.com/x11vnc/index.html#service + 16. http://www.karlrunge.com/x11vnc/index.html#passwd + 17. http://www.karlrunge.com/x11vnc/index.html#vnc_password_file 18. http://www.karlrunge.com/x11vnc/index.html#inetd - 19. http://www.karlrunge.com/x11vnc/index.html#passwd - 20. http://www.karlrunge.com/x11vnc/index.html#passwdfile - 21. http://www.karlrunge.com/x11vnc/index.html#allow_opt - 22. http://www.karlrunge.com/x11vnc/index.html#tcp_wrappers - 23. http://sourceforge.net/projects/libvncserver/ - 24. http://sourceforge.net/project/showfiles.php?group_id=32584&package_id=119006&release_id=292078 - 25. http://sourceforge.net/project/shownotes.php?group_id=32584&release_id=292078 - 26. http://www.karlrunge.com/x11vnc/x11vnc.c - 27. http://www.karlrunge.com/x11vnc/tkx11vnc.h - 28. http://www.karlrunge.com/x11vnc/index.html#binaries - 29. http://www.tightvnc.com/download.html - 30. http://www.realvnc.com/download-free.html - 31. http://sourceforge.net/projects/cotvnc/ - 32. http://www.karlrunge.com/x11vnc/rx11vnc - 33. http://www.karlrunge.com/x11vnc/rx11vnc.pl - 34. ftp://ftp.uu.net/graphics/jpeg/ - 35. http://www.gzip.org/zlib/ - 36. http://www.sunfreeware.com/ - 37. http://www.karlrunge.com/x11vnc/index.html#solaris251build - 38. http://www.tightvnc.com/ - 39. http://www.karlrunge.com/x11vnc/x11vnc_opts.html - 40. http://www.karlrunge.com/x11vnc/index.html#passwd - 41. http://www.karlrunge.com/x11vnc/recurse_x11vnc.jpg - 42. http://wwws.sun.com/sunray/index.html - 43. mailto:xvml@karlrunge.com - 44. http://www.karlrunge.com/x11vnc/index.html#FAQ-1 - 45. http://www.karlrunge.com/x11vnc/index.html#FAQ-2 - 46. http://www.karlrunge.com/x11vnc/index.html#FAQ-3 - 47. http://www.karlrunge.com/x11vnc/index.html#FAQ-4 - 48. http://www.karlrunge.com/x11vnc/index.html#FAQ-5 - 49. http://www.karlrunge.com/x11vnc/index.html#FAQ-6 - 50. http://www.karlrunge.com/x11vnc/index.html#FAQ-7 - 51. http://www.karlrunge.com/x11vnc/index.html#FAQ-8 - 52. http://www.karlrunge.com/x11vnc/index.html#FAQ-9 - 53. http://www.karlrunge.com/x11vnc/index.html#FAQ-10 - 54. http://www.karlrunge.com/x11vnc/index.html#FAQ-11 - 55. http://www.karlrunge.com/x11vnc/index.html#FAQ-12 - 56. http://www.karlrunge.com/x11vnc/index.html#FAQ-13 - 57. http://www.karlrunge.com/x11vnc/index.html#FAQ-14 - 58. http://www.karlrunge.com/x11vnc/index.html#FAQ-15 - 59. http://www.karlrunge.com/x11vnc/index.html#FAQ-16 - 60. http://www.karlrunge.com/x11vnc/index.html#FAQ-17 - 61. http://www.karlrunge.com/x11vnc/index.html#FAQ-18 - 62. http://www.karlrunge.com/x11vnc/index.html#FAQ-19 - 63. http://www.karlrunge.com/x11vnc/index.html#FAQ-20 - 64. http://www.karlrunge.com/x11vnc/index.html#FAQ-21 - 65. http://www.karlrunge.com/x11vnc/index.html#FAQ-22 - 66. http://www.karlrunge.com/x11vnc/index.html#FAQ-23 - 67. http://www.karlrunge.com/x11vnc/index.html#FAQ-24 - 68. http://www.karlrunge.com/x11vnc/index.html#FAQ-25 - 69. http://www.karlrunge.com/x11vnc/index.html#FAQ-26 - 70. http://www.karlrunge.com/x11vnc/index.html#FAQ-27 - 71. http://www.karlrunge.com/x11vnc/index.html#FAQ-28 - 72. http://www.karlrunge.com/x11vnc/index.html#FAQ-29 - 73. http://www.karlrunge.com/x11vnc/index.html#FAQ-30 - 74. http://www.karlrunge.com/x11vnc/index.html#FAQ-31 - 75. http://www.karlrunge.com/x11vnc/index.html#FAQ-32 - 76. http://www.karlrunge.com/x11vnc/index.html#FAQ-33 - 77. http://www.karlrunge.com/x11vnc/index.html#FAQ-34 - 78. http://www.karlrunge.com/x11vnc/index.html#FAQ-35 - 79. http://www.karlrunge.com/x11vnc/index.html#FAQ-36 - 80. http://www.karlrunge.com/x11vnc/index.html#FAQ-37 - 81. http://www.karlrunge.com/x11vnc/index.html#FAQ-38 - 82. http://www.karlrunge.com/x11vnc/index.html#FAQ-39 - 83. http://www.karlrunge.com/x11vnc/index.html#FAQ-40 - 84. http://www.karlrunge.com/x11vnc/index.html#FAQ-41 - 85. http://www.karlrunge.com/x11vnc/index.html#FAQ-42 - 86. http://www.karlrunge.com/x11vnc/index.html#FAQ-43 - 87. http://www.karlrunge.com/x11vnc/index.html#FAQ-44 - 88. http://www.karlrunge.com/x11vnc/index.html#FAQ-45 - 89. http://www.karlrunge.com/x11vnc/index.html#FAQ-46 - 90. http://www.karlrunge.com/x11vnc/index.html#FAQ-47 - 91. http://www.karlrunge.com/x11vnc/index.html#FAQ-48 - 92. http://www.karlrunge.com/x11vnc/index.html#FAQ-49 - 93. http://www.karlrunge.com/x11vnc/index.html#FAQ-50 - 94. http://www.karlrunge.com/x11vnc/index.html#FAQ-51 - 95. http://www.karlrunge.com/x11vnc/index.html#FAQ-52 - 96. http://www.karlrunge.com/x11vnc/index.html#FAQ-53 - 97. http://www.karlrunge.com/x11vnc/index.html#FAQ-54 - 98. http://www.karlrunge.com/x11vnc/index.html#FAQ-55 - 99. http://www.karlrunge.com/x11vnc/index.html#FAQ-56 - 100. http://www.karlrunge.com/x11vnc/index.html#FAQ-57 - 101. http://www.karlrunge.com/x11vnc/index.html#FAQ-58 - 102. http://www.karlrunge.com/x11vnc/index.html#FAQ-59 - 103. http://www.karlrunge.com/x11vnc/index.html#FAQ-60 - 104. http://www.karlrunge.com/x11vnc/index.html#FAQ-61 - 105. http://www.karlrunge.com/x11vnc/index.html#FAQ-62 - 106. http://www.karlrunge.com/x11vnc/index.html#FAQ-63 - 107. http://www.karlrunge.com/x11vnc/index.html#FAQ-64 - 108. http://www.karlrunge.com/x11vnc/index.html#FAQ-65 - 109. http://www.karlrunge.com/x11vnc/index.html#solarisbuilding - 110. http://www.karlrunge.com/x11vnc/index.html#building - 111. http://www.karlrunge.com/x11vnc/index.html#buildfaq - 112. http://packages.debian.org/x11vnc - 113. http://www.linuxpackages.net/search_view.php?by=name&name=x11vnc - 114. http://dag.wieers.com/packages/x11vnc/ - 115. http://www.bell-labs.com/project/wwexptools/packages.html - 116. http://www.karlrunge.com/x11vnc/index.html#solarisbuilding - 117. http://www.karlrunge.com/x11vnc/bins - 118. http://www.tightvnc.com/download.html - 119. http://www.realvnc.com/download-free.html - 120. http://sourceforge.net/projects/cotvnc/ - 121. http://www.karlrunge.com/x11vnc/x11vnc_opts.html - 122. http://www.karlrunge.com/x11vnc/x11vnc.c - 123. http://fredrik.hubbe.net/x2vnc.html - 124. http://www.hubbe.net/~hubbe/win2vnc.html - 125. http://www.deboer.gmxhome.de/ - 126. http://sourceforge.net/projects/win2vnc/ + 19. http://www.karlrunge.com/x11vnc/index.html#tightvnc_via + 20. http://www.karlrunge.com/x11vnc/index.html#inetd + 21. http://www.karlrunge.com/x11vnc/index.html#passwd + 22. http://www.karlrunge.com/x11vnc/index.html#passwdfile + 23. http://www.karlrunge.com/x11vnc/index.html#allow_opt + 24. http://www.karlrunge.com/x11vnc/index.html#tcp_wrappers + 25. http://sourceforge.net/projects/libvncserver/ + 26. http://sourceforge.net/project/showfiles.php?group_id=32584&package_id=119006&release_id=292078 + 27. http://sourceforge.net/project/shownotes.php?group_id=32584&release_id=292078 + 28. http://www.karlrunge.com/x11vnc/x11vnc.c + 29. http://www.karlrunge.com/x11vnc/tkx11vnc.h + 30. http://www.karlrunge.com/x11vnc/index.html#binaries + 31. http://www.tightvnc.com/download.html + 32. http://www.realvnc.com/download-free.html + 33. http://sourceforge.net/projects/cotvnc/ + 34. http://www.karlrunge.com/x11vnc/rx11vnc + 35. http://www.karlrunge.com/x11vnc/rx11vnc.pl + 36. ftp://ftp.uu.net/graphics/jpeg/ + 37. http://www.gzip.org/zlib/ + 38. http://www.sunfreeware.com/ + 39. http://www.karlrunge.com/x11vnc/index.html#solaris251build + 40. http://www.tightvnc.com/ + 41. http://www.karlrunge.com/x11vnc/x11vnc_opts.html + 42. http://www.karlrunge.com/x11vnc/index.html#passwd + 43. http://www.karlrunge.com/x11vnc/recurse_x11vnc.jpg + 44. http://wwws.sun.com/sunray/index.html + 45. mailto:xvml@karlrunge.com + 46. http://www.karlrunge.com/x11vnc/index.html#FAQ-1 + 47. http://www.karlrunge.com/x11vnc/index.html#FAQ-2 + 48. http://www.karlrunge.com/x11vnc/index.html#FAQ-3 + 49. http://www.karlrunge.com/x11vnc/index.html#FAQ-4 + 50. http://www.karlrunge.com/x11vnc/index.html#FAQ-5 + 51. http://www.karlrunge.com/x11vnc/index.html#FAQ-6 + 52. http://www.karlrunge.com/x11vnc/index.html#FAQ-7 + 53. http://www.karlrunge.com/x11vnc/index.html#FAQ-8 + 54. http://www.karlrunge.com/x11vnc/index.html#FAQ-9 + 55. http://www.karlrunge.com/x11vnc/index.html#FAQ-10 + 56. http://www.karlrunge.com/x11vnc/index.html#FAQ-11 + 57. http://www.karlrunge.com/x11vnc/index.html#FAQ-12 + 58. http://www.karlrunge.com/x11vnc/index.html#FAQ-13 + 59. http://www.karlrunge.com/x11vnc/index.html#FAQ-14 + 60. http://www.karlrunge.com/x11vnc/index.html#FAQ-15 + 61. http://www.karlrunge.com/x11vnc/index.html#FAQ-16 + 62. http://www.karlrunge.com/x11vnc/index.html#FAQ-17 + 63. http://www.karlrunge.com/x11vnc/index.html#FAQ-18 + 64. http://www.karlrunge.com/x11vnc/index.html#FAQ-19 + 65. http://www.karlrunge.com/x11vnc/index.html#FAQ-20 + 66. http://www.karlrunge.com/x11vnc/index.html#FAQ-21 + 67. http://www.karlrunge.com/x11vnc/index.html#FAQ-22 + 68. http://www.karlrunge.com/x11vnc/index.html#FAQ-23 + 69. http://www.karlrunge.com/x11vnc/index.html#FAQ-24 + 70. http://www.karlrunge.com/x11vnc/index.html#FAQ-25 + 71. http://www.karlrunge.com/x11vnc/index.html#FAQ-26 + 72. http://www.karlrunge.com/x11vnc/index.html#FAQ-27 + 73. http://www.karlrunge.com/x11vnc/index.html#FAQ-28 + 74. http://www.karlrunge.com/x11vnc/index.html#FAQ-29 + 75. http://www.karlrunge.com/x11vnc/index.html#FAQ-30 + 76. http://www.karlrunge.com/x11vnc/index.html#FAQ-31 + 77. http://www.karlrunge.com/x11vnc/index.html#FAQ-32 + 78. http://www.karlrunge.com/x11vnc/index.html#FAQ-33 + 79. http://www.karlrunge.com/x11vnc/index.html#FAQ-34 + 80. http://www.karlrunge.com/x11vnc/index.html#FAQ-35 + 81. http://www.karlrunge.com/x11vnc/index.html#FAQ-36 + 82. http://www.karlrunge.com/x11vnc/index.html#FAQ-37 + 83. http://www.karlrunge.com/x11vnc/index.html#FAQ-38 + 84. http://www.karlrunge.com/x11vnc/index.html#FAQ-39 + 85. http://www.karlrunge.com/x11vnc/index.html#FAQ-40 + 86. http://www.karlrunge.com/x11vnc/index.html#FAQ-41 + 87. http://www.karlrunge.com/x11vnc/index.html#FAQ-42 + 88. http://www.karlrunge.com/x11vnc/index.html#FAQ-43 + 89. http://www.karlrunge.com/x11vnc/index.html#FAQ-44 + 90. http://www.karlrunge.com/x11vnc/index.html#FAQ-45 + 91. http://www.karlrunge.com/x11vnc/index.html#FAQ-46 + 92. http://www.karlrunge.com/x11vnc/index.html#FAQ-47 + 93. http://www.karlrunge.com/x11vnc/index.html#FAQ-48 + 94. http://www.karlrunge.com/x11vnc/index.html#FAQ-49 + 95. http://www.karlrunge.com/x11vnc/index.html#FAQ-50 + 96. http://www.karlrunge.com/x11vnc/index.html#FAQ-51 + 97. http://www.karlrunge.com/x11vnc/index.html#FAQ-52 + 98. http://www.karlrunge.com/x11vnc/index.html#FAQ-53 + 99. http://www.karlrunge.com/x11vnc/index.html#FAQ-54 + 100. http://www.karlrunge.com/x11vnc/index.html#FAQ-55 + 101. http://www.karlrunge.com/x11vnc/index.html#FAQ-56 + 102. http://www.karlrunge.com/x11vnc/index.html#FAQ-57 + 103. http://www.karlrunge.com/x11vnc/index.html#FAQ-58 + 104. http://www.karlrunge.com/x11vnc/index.html#FAQ-59 + 105. http://www.karlrunge.com/x11vnc/index.html#FAQ-60 + 106. http://www.karlrunge.com/x11vnc/index.html#FAQ-61 + 107. http://www.karlrunge.com/x11vnc/index.html#FAQ-62 + 108. http://www.karlrunge.com/x11vnc/index.html#FAQ-63 + 109. http://www.karlrunge.com/x11vnc/index.html#FAQ-64 + 110. http://www.karlrunge.com/x11vnc/index.html#FAQ-65 + 111. http://www.karlrunge.com/x11vnc/index.html#solarisbuilding + 112. http://www.karlrunge.com/x11vnc/x11vnc_sunos4.html + 113. http://www.karlrunge.com/x11vnc/index.html#building + 114. http://www.karlrunge.com/x11vnc/index.html#buildfaq + 115. http://packages.debian.org/x11vnc + 116. http://www.linuxpackages.net/search_view.php?by=name&name=x11vnc + 117. http://dag.wieers.com/packages/x11vnc/ + 118. http://www.sunfreeware.com/ + 119. http://www.bell-labs.com/project/wwexptools/packages.html + 120. http://www.karlrunge.com/x11vnc/index.html#solarisbuilding + 121. http://www.karlrunge.com/x11vnc/bins + 122. http://www.tightvnc.com/download.html + 123. http://www.realvnc.com/download-free.html + 124. http://sourceforge.net/projects/cotvnc/ + 125. http://www.karlrunge.com/x11vnc/x11vnc_opts.html + 126. http://www.karlrunge.com/x11vnc/x11vnc.c 127. http://fredrik.hubbe.net/x2vnc.html - 128. http://freshmeat.net/projects/x2x/ - 129. http://ftp.digital.com/pub/Digital/SRC/x2x/ - 130. http://zapek.com/software/zvnc/ - 131. http://www.karlrunge.com/x11vnc/index.html#8bpp - 132. http://www.karlrunge.com/x11vnc/index.html#overlays - 133. http://www.karlrunge.com/x11vnc/index.html#xauth_pain - 134. http://www.karlrunge.com/x11vnc/index.html#noshm - 135. http://www.karlrunge.com/x11vnc/index.html#tunnelling - 136. http://www.karlrunge.com/x11vnc/index.html#passwd - 137. http://www.karlrunge.com/x11vnc/index.html#passwdfile - 138. http://www.karlrunge.com/x11vnc/index.html#inetd - 139. ftp://ftp.x.org/ - 140. http://www.karlrunge.com/x11vnc/dtVncPopup + 128. http://www.hubbe.net/~hubbe/win2vnc.html + 129. http://www.deboer.gmxhome.de/ + 130. http://sourceforge.net/projects/win2vnc/ + 131. http://fredrik.hubbe.net/x2vnc.html + 132. http://freshmeat.net/projects/x2x/ + 133. http://ftp.digital.com/pub/Digital/SRC/x2x/ + 134. http://zapek.com/software/zvnc/ + 135. http://www.karlrunge.com/x11vnc/index.html#8bpp + 136. http://www.karlrunge.com/x11vnc/index.html#overlays + 137. http://www.karlrunge.com/x11vnc/index.html#xauth_pain + 138. http://www.karlrunge.com/x11vnc/index.html#noshm + 139. http://www.karlrunge.com/x11vnc/index.html#tunnelling + 140. http://www.karlrunge.com/x11vnc/index.html#passwd 141. http://www.karlrunge.com/x11vnc/index.html#passwdfile - 142. http://www.karlrunge.com/x11vnc/index.html#tunnelling - 143. http://www.karlrunge.com/x11vnc/index.html#tunnelling - 144. http://www.karlrunge.com/x11vnc/index.html#tunnelling - 145. http://www.karlrunge.com/x11vnc/index.html#tunnelling - 146. http://www.karlrunge.com/x11vnc/blockdpy.c - 147. http://www.karlrunge.com/x11vnc/index.html#display_manager - 148. http://www.karlrunge.com/x11vnc/index.html#inetd - 149. http://www.karlrunge.com/x11vnc/index.html#x11vnc_loop - 150. http://www.jirka.org/gdm-documentation/x241.html - 151. http://www.karlrunge.com/x11vnc/x11vnc_loop - 152. http://www.karlrunge.com/x11vnc/index.html#xterminal_xauth - 153. http://www.karlrunge.com/x11vnc/shm_clear - 154. http://www.karlrunge.com/x11vnc/index.html#noshm - 155. http://www.tightvnc.com/ - 156. http://www.karlrunge.com/x11vnc/tight-vncviewer-alphahack.patch - 157. http://www.tightvnc.com/ - 158. http://www.karlrunge.com/x11vnc/index.html#greaterless - 159. http://www.karlrunge.com/x11vnc/index.html#xkbmodtweak - 160. http://www.karlrunge.com/x11vnc/index.html#xkbmodtweak - 161. http://www.karlrunge.com/x11vnc/index.html#display_manager - 162. http://www.karlrunge.com/x11vnc/index.html#scaling - 163. http://www.karlrunge.com/x11vnc/index.html#solshm + 142. http://www.karlrunge.com/x11vnc/index.html#inetd + 143. ftp://ftp.x.org/ + 144. http://www.karlrunge.com/x11vnc/dtVncPopup + 145. http://www.karlrunge.com/x11vnc/index.html#passwdfile + 146. http://www.karlrunge.com/x11vnc/index.html#tunnelling + 147. http://www.karlrunge.com/x11vnc/index.html#tunnelling + 148. http://www.karlrunge.com/x11vnc/index.html#tunnelling + 149. http://www.karlrunge.com/x11vnc/index.html#tunnelling + 150. http://www.karlrunge.com/x11vnc/blockdpy.c + 151. http://www.karlrunge.com/x11vnc/index.html#display_manager + 152. http://www.karlrunge.com/x11vnc/index.html#inetd + 153. http://www.karlrunge.com/x11vnc/index.html#x11vnc_loop + 154. http://www.jirka.org/gdm-documentation/x241.html + 155. http://www.karlrunge.com/x11vnc/x11vnc_loop + 156. http://www.karlrunge.com/x11vnc/index.html#xterminal_xauth + 157. http://www.karlrunge.com/x11vnc/shm_clear + 158. http://www.karlrunge.com/x11vnc/index.html#noshm + 159. http://www.tightvnc.com/ + 160. http://www.karlrunge.com/x11vnc/tight-vncviewer-alphahack.patch + 161. http://www.tightvnc.com/ + 162. http://www.karlrunge.com/x11vnc/index.html#greaterless + 163. http://www.karlrunge.com/x11vnc/index.html#xkbmodtweak + 164. http://www.karlrunge.com/x11vnc/index.html#xkbmodtweak + 165. http://www.karlrunge.com/x11vnc/index.html#display_manager + 166. http://www.karlrunge.com/x11vnc/index.html#scaling + 167. http://www.karlrunge.com/x11vnc/index.html#solshm ======================================================================= @@ -3051,10 +3065,85 @@ http://www.karlrunge.com/x11vnc/x11vnc_opts.html: x11vnc: a VNC server for real X displays Here are all of x11vnc command line options: +% x11vnc -opts (see below for -help long descriptions) + +x11vnc: allow VNC connections to real X11 displays. 0.7.1pre lastmod: 2005-02-0 +5 + +x11vnc options: + -display disp -auth file + -id windowid -sid windowid + -flashcmap -notruecolor + -visual n -overlay + -overlay_nocursor -scale fraction + -viewonly -shared + -once -forever + -timeout n -inetd + -connect string -vncconnect + -novncconnect -allow host1[,host2..] + -localhost -viewpasswd string + -passwdfile filename -storepasswd pass file + -accept string -gone string + -noshm -flipbyteorder + -onetile -solid [color] + -blackout string -xinerama + -xrandr [mode] -padgeom WxH + -o logfile -rc filename + -norc -h, -help + -?, -opts -V, -version + -q -bg + -modtweak -nomodtweak + -xkb -skip_keycodes string + -add_keysyms -clear_mods + -clear_keys -remap string + -norepeat -repeat + -nofb -nobell + -nosel -noprimary + -cursor [mode] -nocursor + -noxfixes -alphacut n + -alphafrac fraction -alpharemove + -noalphablend -nocursorshape + -cursorpos -nocursorpos + -xwarppointer -buttonmap string + -nodragging -pointer_mode n + -input_skip n -speeds rd,bw,lat + -debug_pointer -debug_keyboard + -defer time -wait time + -nap -sb time + -sigpipe string -threads + -nothreads -fs f + -gaps n -grow n + -fuzz n -snapfb + -gui [gui-opts] -remote command + -query variable -sync + -noremote -unsafe + -safer -deny_all + + +libvncserver options: +-rfbport port TCP port for RFB protocol +-rfbwait time max time in ms to wait for RFB client +-rfbauth passwd-file use authentication on RFB protocol + (use 'storepasswd' to create a password file) +-passwd plain-password use authentication + (use plain-password as password, USE AT YOUR RISK) +-deferupdate time time in ms to defer updates (default 40) +-desktop name VNC desktop name (default "LibVNCServer") +-alwaysshared always treat new clients as shared +-nevershared never treat new clients as shared +-dontdisconnect don't disconnect existing clients when a new non-shared + connection comes in (refuse new connection instead) +-httpdir dir-path enable http server using dir-path home +-httpport portnum use portnum for http connection +-enablehttpproxy enable http proxy support +-progressive height enable progressive updating for slow links + + + % x11vnc -help -x11vnc: allow VNC connections to real X11 displays. 0.7.1pre lastmod: 2005-01-2 -3 +x11vnc: allow VNC connections to real X11 displays. 0.7.1pre lastmod: 2005-02-0 +5 Typical usage is: @@ -3300,6 +3389,19 @@ Options: just use 1 shm tile for polling. Limits shm segments used to 3. +-solid [color] To improve performance, when VNC clients are connected + try to change the desktop background to a solid color. + The [color] is optional: the default color is "cyan4". + For a different one specify the X color (rgb.txt name, + e.g. "darkblue" or numerical "#RRGGBB"). Currently + this option only works on GNOME, KDE, and classic X + (i.e. with the background image on the root window). + The "gconftool-2" and "dcop" external commands are + run for GNOME and KDE respectively. Other desktops + won't work, e.g. XFCE (send us the corresponding + commands if you find them). If x11vnc guesses your + desktop incorrectly, you can force it by prefixing + color with "gnome:", "kde:", or "root:". -blackout string Black out rectangles on the screen. "string" is a comma separated list of WxH+X+Y type geometries for each rectangle. @@ -3352,6 +3454,7 @@ Options: -rc filename Use "filename" instead of $HOME/.x11vncrc for rc file. -norc Do not process any .x11vncrc file for options. -h, -help Print this help text. +-?, -opts Only list the x11vnc options. -V, -version Print program version (last modification date). -q Be quiet by printing less informational output to @@ -3606,11 +3709,11 @@ Options: available in -threads mode which has its own pointer event handling mechanism. - To try out the different pointer modes to see - which one gives the best response for your usage, - it is convenient to use the remote control function, - e.g. "x11vnc -R pointer_mode:4" or the tcl/tk gui - (Tuning -> pointer_mode -> n). + To try out the different pointer modes to see which + one gives the best response for your usage, it is + convenient to use the remote control function, for + example "x11vnc -R pm:4" or the tcl/tk gui (Tuning -> + pointer_mode -> n). -input_skip n For the pointer handling when non-threaded: try to read n user input events before scanning display. n < 0 @@ -3821,6 +3924,9 @@ Options: onetile enable -onetile mode. (you may need to set shm for this to do something) noonetile disable -onetile mode. + solid enable -solid mode + nosolid disable -solid mode. + solid_color:color set -solid color (and apply it). blackout:str set -blackout "str" (empty to disable). See -blackout for the form of "str" (basically: WxH+X+Y,...) @@ -3859,7 +3965,6 @@ Options: fb disable -nofb mode. bell enable bell (if supported). nobell disable bell. - bell enable bell (if supported). nosel enable -nosel mode. sel disable -nosel mode. noprimary enable -noprimary mode. @@ -3968,17 +4073,18 @@ Options: nowaitmapped 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 timeout 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 + overlay_nocursor visual scale viewonly noviewonly + shared noshared forever noforever once timeout deny + lock nodeny unlock connect allowonce allow localhost + nolocalhost accept gone shm noshm flipbyteorder + noflipbyteorder onetile noonetile solid_color solid + nosolid 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 alphablend noalphablend xwarp xwarppointer noxwarp noxwarppointer buttonmap diff --git a/x11vnc/tkx11vnc b/x11vnc/tkx11vnc index 2fd16d7..3e8f491 100755 --- a/x11vnc/tkx11vnc +++ b/x11vnc/tkx11vnc @@ -120,6 +120,9 @@ Screen =DP blackout: =D xinerama -- + solid + solid_color: + -- = xrandr =-C:resize,newfbsize,exit xrandr_mode: padgeom: @@ -127,9 +130,9 @@ Screen Keyboard norepeat add_keysyms + skip_keycodes: modtweak xkb - skip_keycodes: -- =FP remap: -- @@ -320,6 +323,10 @@ Shows a menu of currently connected VNC clients on the x11vnc server. Allows you to find more information about them or disconnect them. You will be prompted to confirm any disconnections. +" + + set helptext(solid_color) " +Set the -solid color value. " set helptext(xrandr_mode) " @@ -390,7 +397,7 @@ will be \"(*none*)\" when there is no connection established. 4) Below the x11 and vnc displays text label is a text area there scrolling information about actions being taken and commands being run is displayed. -To scroll use PageUp/PageDown or the arrow keys. +To scroll click in the area and use PageUp/PageDown or the arrow keys. 5) At the bottom is an entry area. When one selects a menu item that requires supplying a string value, the label will be set to the @@ -2319,6 +2326,8 @@ proc get_start_x11vnc_cmd {{show_rc 0}} { set nitem "sb" } elseif {$nitem == "xrandr_mode"} { set nitem "xrandr" + } elseif {$nitem == "solid_color"} { + set nitem "solid" } lappend cmd "-$nitem" lappend cmd $menu_var($item) diff --git a/x11vnc/tkx11vnc.h b/x11vnc/tkx11vnc.h index 8bca5a6..32ccbc2 100644 --- a/x11vnc/tkx11vnc.h +++ b/x11vnc/tkx11vnc.h @@ -126,6 +126,9 @@ " =DP blackout:\n" " =D xinerama\n" " --\n" +" solid\n" +" solid_color:\n" +" --\n" " = xrandr\n" " =-C:resize,newfbsize,exit xrandr_mode:\n" " padgeom:\n" @@ -133,9 +136,9 @@ "Keyboard\n" " norepeat\n" " add_keysyms\n" +" skip_keycodes:\n" " modtweak\n" " xkb\n" -" skip_keycodes:\n" " --\n" " =FP remap:\n" " --\n" @@ -328,6 +331,10 @@ "You will be prompted to confirm any disconnections.\n" "\"\n" "\n" +" set helptext(solid_color) \"\n" +"Set the -solid color value.\n" +"\"\n" +"\n" " set helptext(xrandr_mode) \"\n" "Set the -xrandr mode value.\n" "\"\n" @@ -396,7 +403,7 @@ "\n" "4) Below the x11 and vnc displays text label is a text area there scrolling\n" "information about actions being taken and commands being run is displayed.\n" -"To scroll use PageUp/PageDown or the arrow keys.\n" +"To scroll click in the area and use PageUp/PageDown or the arrow keys.\n" "\n" "5) At the bottom is an entry area. When one selects a menu item that\n" "requires supplying a string value, the label will be set to the\n" @@ -2325,6 +2332,8 @@ " set nitem \"sb\"\n" " } elseif {$nitem == \"xrandr_mode\"} {\n" " set nitem \"xrandr\"\n" +" } elseif {$nitem == \"solid_color\"} {\n" +" set nitem \"solid\"\n" " }\n" " lappend cmd \"-$nitem\"\n" " lappend cmd $menu_var($item)\n" diff --git a/x11vnc/x11vnc.1 b/x11vnc/x11vnc.1 index f6e2ce9..a95106a 100644 --- a/x11vnc/x11vnc.1 +++ b/x11vnc/x11vnc.1 @@ -1,8 +1,8 @@ .\" This file was automatically generated from x11vnc -help output. -.TH X11VNC "1" "January 2005" "x11vnc " "User Commands" +.TH X11VNC "1" "February 2005" "x11vnc " "User Commands" .SH NAME x11vnc - allow VNC connections to real X11 displays - version: 0.7.1pre, lastmod: 2005-01-23 + version: 0.7.1pre, lastmod: 2005-02-05 .SH SYNOPSIS .B x11vnc [OPTION]... @@ -351,6 +351,22 @@ Do not use the new copy_tiles() framebuffer mechanism, just use 1 shm tile for polling. Limits shm segments used to 3. .PP +\fB-solid\fR \fI[color]\fR +.IP +To improve performance, when VNC clients are connected +try to change the desktop background to a solid color. +The [color] is optional: the default color is "cyan4". +For a different one specify the X color (rgb.txt name, +e.g. "darkblue" or numerical "#RRGGBB"). Currently +this option only works on GNOME, KDE, and classic X +(i.e. with the background image on the root window). +The "gconftool-2" and "dcop" external commands are +run for GNOME and KDE respectively. Other desktops +won't work, e.g. XFCE (send us the corresponding +commands if you find them). If x11vnc guesses your +desktop incorrectly, you can force it by prefixing +color with "gnome:", "kde:", or "root:". +.PP \fB-blackout\fR \fIstring\fR .IP Black out rectangles on the screen. \fIstring\fR is a @@ -426,6 +442,7 @@ Do not process any .x11vncrc file for options. \fB-h,\fR \fB-help\fR .IP Print this help text. +-?, \fB-opts\fR Only list the x11vnc options. .PP \fB-V,\fR \fB-version\fR .IP @@ -764,11 +781,11 @@ pointer events). Also note that these modes are not available in \fB-threads\fR mode which has its own pointer event handling mechanism. .IP -To try out the different pointer modes to see -which one gives the best response for your usage, -it is convenient to use the remote control function, -e.g. "x11vnc \fB-R\fR pointer_mode:4" or the tcl/tk gui -(Tuning -> pointer_mode -> n). +To try out the different pointer modes to see which +one gives the best response for your usage, it is +convenient to use the remote control function, for +example "x11vnc \fB-R\fR pm:4" or the tcl/tk gui (Tuning -> +pointer_mode -> n). .PP \fB-input_skip\fR \fIn\fR .IP @@ -1065,6 +1082,12 @@ onetile enable \fB-onetile\fR mode. (you may need to .IP noonetile disable \fB-onetile\fR mode. .IP +solid enable \fB-solid\fR mode +.IP +nosolid disable \fB-solid\fR mode. +.IP +solid_color:color set \fB-solid\fR color (and apply it). +.IP blackout:str set \fB-blackout\fR "str" (empty to disable). See \fB-blackout\fR for the form of "str" (basically: WxH+X+Y,...) @@ -1130,8 +1153,6 @@ bell enable bell (if supported). .IP nobell disable bell. .IP -bell enable bell (if supported). -.IP nosel enable \fB-nosel\fR mode. .IP sel disable \fB-nosel\fR mode. @@ -1315,17 +1336,18 @@ refresh reset close disconnect id sid waitmapped nowaitmapped 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 timeout 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 +overlay_nocursor visual scale viewonly noviewonly +shared noshared forever noforever once timeout deny +lock nodeny unlock connect allowonce allow localhost +nolocalhost accept gone shm noshm flipbyteorder +noflipbyteorder onetile noonetile solid_color solid +nosolid 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 alphablend noalphablend xwarp xwarppointer noxwarp noxwarppointer buttonmap diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c index a5d34a8..fbf896a 100644 --- a/x11vnc/x11vnc.c +++ b/x11vnc/x11vnc.c @@ -273,7 +273,7 @@ static int xdamage_base_event_type; #endif /* date +'lastmod: %Y-%m-%d' */ -char lastmod[] = "0.7.1pre lastmod: 2005-01-23"; +char lastmod[] = "0.7.1pre lastmod: 2005-02-05"; /* X display info */ @@ -402,6 +402,7 @@ void close_clients(char *); void autorepeat(int restore); char *bitprint(unsigned int, int); void blackout_tiles(void); +void solid_bg(int); void check_connect_inputs(void); void check_padded_fb(void); void clean_up_exit(int); @@ -526,6 +527,9 @@ char *logfile = NULL; int logfile_append = 0; char *passwdfile = NULL; char *blackout_str = NULL; +int use_solid_bg = 0; +char *solid_str = NULL; +char *solid_default = "cyan4"; char *speeds_str = NULL; int measure_speeds = 1; @@ -1340,6 +1344,9 @@ void clean_up_exit (int ret) { if (no_autorepeat) { autorepeat(1); } + if (use_solid_bg) { + solid_bg(1); + } X_LOCK; XTestDiscard_wr(dpy); XCloseDisplay(dpy); @@ -1390,6 +1397,9 @@ static void interrupted (int sig) { if (no_autorepeat) { autorepeat(1); } + if (use_solid_bg) { + solid_bg(1); + } if (sig) { exit(2); @@ -1803,6 +1813,9 @@ static void client_gone(rfbClientPtr client) { if (no_autorepeat && client_count == 0) { autorepeat(1); } + if (use_solid_bg && client_count == 0) { + solid_bg(1); + } if (gone_cmd && *gone_cmd != '\0') { rfbLog("client_gone: using cmd for: %s\n", client->host); run_user_command(gone_cmd, client, "gone"); @@ -2830,6 +2843,9 @@ enum rfbNewClientAction new_client(rfbClientPtr client) { /* first client, turn off X server autorepeat */ autorepeat(0); } + if (use_solid_bg && client_count == 1) { + solid_bg(0); + } if (pad_geometry) { install_padded_fb(pad_geometry); @@ -6740,6 +6756,62 @@ char *process_remote_cmd(char *cmd, int stringonly) { } single_copytile = 0; + } else if (strstr(p, "solid_color") == p) { + char *new; + int doit = 1; + COLON_CHECK("solid_color:") + if (query) { + snprintf(buf, bufn, "ans=%s%s%s", p, co, + NONUL(solid_str)); + goto qry; + } + p += strlen("solid_color:"); + if (*p != '\0') { + new = strdup(p); + } else { + new = strdup(solid_default); + } + rfbLog("process_remote_cmd: solid %s -> %s\n", + NONUL(solid_str), new); + + if (solid_str) { + if (!strcmp(solid_str, new)) { + doit = 0; + } + free(solid_str); + } + solid_str = new; + use_solid_bg = 1; + + if (doit && client_count) { + solid_bg(0); + } + } else if (!strcmp(p, "solid")) { + int orig = use_solid_bg; + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, use_solid_bg); + goto qry; + } + rfbLog("process_remote_cmd: enable -solid mode\n"); + if (! solid_str) { + solid_str = strdup(solid_default); + } + use_solid_bg = 1; + if (client_count && !orig) { + solid_bg(0); + } + } else if (!strcmp(p, "nosolid")) { + int orig = use_solid_bg; + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, !use_solid_bg); + goto qry; + } + rfbLog("process_remote_cmd: disable -solid mode\n"); + use_solid_bg = 0; + if (client_count && orig) { + solid_bg(1); + } + } else if (strstr(p, "blackout") == p) { char *before, *old; COLON_CHECK("blackout:") @@ -10581,6 +10653,325 @@ void initialize_screen(int *argc, char **argv, XImage *fb) { } } +/* -- solid.c -- */ + +int do_cmd(char *cmd) { + int rc; + if (!cmd || *cmd == '\0') { + return 0; + } + rfbLog("running command:\n %s\n", cmd); + rc = system(cmd); + if (rc >= 256) { + rc = rc/256; + } + return rc; +} + +char *cmd_output(char *cmd) { + FILE *p; + static char output[50000]; + char line[1024]; + int rc; + + rfbLog("running pipe:\n %s\n", cmd); + p = popen(cmd, "r"); + + output[0] = '\0'; + + while (fgets(line, 1024, p) != NULL) { + if (strlen(output) + strlen(line) + 1 < 50000) { + strcat(output, line); + } + } + rc = pclose(p); + return(output); +} + +void solid_root(char *color) { + Window expose; + static XImage *image = NULL; + Pixmap pixmap; + XGCValues gcv; + GC gc; + XSetWindowAttributes swa; + Visual visual; + unsigned long mask, pixel; + XColor cdef; + Colormap cmap; + + if (subwin || window != rootwin) { + rfbLog("cannot set subwin to solid color, must be root\n"); + return; + } + + /* create the "clear" window just for generating exposures */ + swa.override_redirect = True; + swa.backing_store = NotUseful; + swa.save_under = False; + swa.background_pixmap = None; + visual.visualid = CopyFromParent; + mask = (CWOverrideRedirect|CWBackingStore|CWSaveUnder|CWBackPixmap); + expose = XCreateWindow(dpy, window, 0, 0, dpy_x, dpy_y, 0, depth, + InputOutput, &visual, mask, &swa); + + if (! color) { + /* restore the root window from the XImage snapshot */ + pixmap = XCreatePixmap(dpy, window, dpy_x, dpy_y, depth); + + if (! image) { + /* whoops */ + XDestroyWindow(dpy, expose); + rfbLog("no root snapshot available.\n"); + return; + } + + + /* draw the image to a pixmap: */ + gcv.function = GXcopy; + gcv.plane_mask = AllPlanes; + gc = XCreateGC(dpy, window, GCFunction|GCPlaneMask, &gcv); + + XPutImage(dpy, pixmap, gc, image, 0, 0, 0, 0, dpy_x, dpy_y); + + gcv.foreground = gcv.background = BlackPixel(dpy, scr); + gc = XCreateGC(dpy, window, GCForeground|GCBackground, &gcv); + + rfbLog("restoring root snapshot...\n"); + /* set the pixmap as the bg: */ + XSetWindowBackgroundPixmap(dpy, window, pixmap); + XFreePixmap(dpy, pixmap); + XClearWindow(dpy, window); + XFlush(dpy); + + /* generate exposures */ + XMapWindow(dpy, expose); + XSync(dpy, False); + XDestroyWindow(dpy, expose); + return; + } + + if (! image) { + /* need to retrieve a snapshot of the root background: */ + Window iwin; + XSetWindowAttributes iswa; + + /* create image window: */ + iswa.override_redirect = True; + iswa.backing_store = NotUseful; + iswa.save_under = False; + iswa.background_pixmap = None; + iswa.background_pixmap = ParentRelative; + + iwin = XCreateWindow(dpy, window, 0, 0, dpy_x, dpy_y, 0, depth, + InputOutput, &visual, mask, &iswa); + + rfbLog("snapshotting background...\n"); + + XMapWindow(dpy, iwin); + XSync(dpy, False); + image = XGetImage(dpy, iwin, 0, 0, dpy_x, dpy_y, AllPlanes, + ZPixmap); + XSync(dpy, False); + XDestroyWindow(dpy, iwin); + } + + /* use black for low colors or failure */ + pixel = BlackPixel(dpy, scr); + if (depth > 8 || strcmp(color, solid_default)) { + cmap = DefaultColormap (dpy, scr); + if (XParseColor(dpy, cmap, color, &cdef) && + XAllocColor(dpy, cmap, &cdef)) { + pixel = cdef.pixel; + } else { + rfbLog("error parsing/allocing color: %s\n", color); + } + } + + rfbLog("setting solid background...\n"); + XSetWindowBackground(dpy, window, pixel); + XMapWindow(dpy, expose); + XSync(dpy, False); + XDestroyWindow(dpy, expose); +} + +void solid_gnome(char *color) { + char get_color[] = "gconftool-2 --get " + "/desktop/gnome/background/primary_color"; + char set_color[] = "gconftool-2 --set " + "/desktop/gnome/background/primary_color --type string '%s'"; + char get_option[] = "gconftool-2 --get " + "/desktop/gnome/background/picture_options"; + char set_option[] = "gconftool-2 --set " + "/desktop/gnome/background/picture_options --type string '%s'"; + static char *orig_color = NULL; + static char *orig_option = NULL; + char *cmd; + + if (! color) { + if (! orig_color) { + orig_color = strdup("#FFFFFF"); + } + if (! orig_option) { + orig_option = strdup("stretched"); + } + if (strstr(orig_color, "'") != NULL) { + rfbLog("bad color: %s\n", orig_color); + return; + } + if (strstr(orig_option, "'") != NULL) { + rfbLog("bad option: %s\n", orig_option); + return; + } + cmd = (char *)malloc(strlen(set_option) - 2 + + strlen(orig_option) + 1); + sprintf(cmd, set_option, orig_option); + do_cmd(cmd); + free(cmd); + cmd = (char *)malloc(strlen(set_color) - 2 + + strlen(orig_color) + 1); + sprintf(cmd, set_color, orig_color); + do_cmd(cmd); + free(cmd); + return; + } + + if (! orig_color) { + char *q; + orig_color = strdup(cmd_output(get_color)); + if (*orig_color == '\0') { + orig_color = strdup("#FFFFFF"); + } + if ((q = strchr(orig_color, '\n')) != NULL) { + *q = '\0'; + } + } + if (! orig_option) { + char *q; + orig_option = strdup(cmd_output(get_option)); + if (*orig_option == '\0') { + orig_option = strdup("stretched"); + } + if ((q = strchr(orig_option, '\n')) != NULL) { + *q = '\0'; + } + } + if (strstr(color, "'") != NULL) { + rfbLog("bad color: %s\n", color); + return; + } + cmd = (char *)malloc(strlen(set_color) - 2 + strlen(color) + 1); + sprintf(cmd, set_color, color); + do_cmd(cmd); + free(cmd); + cmd = (char *)malloc(strlen(set_option) - 2 + strlen("none") + 1); + sprintf(cmd, set_option, "none"); + do_cmd(cmd); + free(cmd); +} + +void solid_kde(char *color) { + char set_color[] = "dcop kdesktop KBackgroundIface setColor '%s' 1"; + char bg_off[] = "dcop kdesktop KBackgroundIface setBackgroundEnabled 0"; + char bg_on[] = "dcop kdesktop KBackgroundIface setBackgroundEnabled 1"; + char *cmd; + + if (! color) { + do_cmd(bg_on); + return; + } + + if (strstr(color, "'") != NULL) { + rfbLog("bad color: %s\n", color); + return; + } + + cmd = (char *)malloc(strlen(set_color) - 2 + strlen(color) + 1); + sprintf(cmd, set_color, color); + do_cmd(cmd); + do_cmd(bg_off); + free(cmd); +} + +char *guess_desktop() { + Atom prop; + prop = XInternAtom(dpy, "_QT_DESKTOP_PROPERTIES", True); + if (prop != None) { + return "kde"; + } + prop = XInternAtom(dpy, "NAUTILUS_DESKTOP_WINDOW_ID", True); + if (prop != None) { + return "gnome"; + } + return "root"; +} + +void solid_bg(int restore) { + static int desktop = -1; + static int solid_on = 0; + static char *prev_str; + char *dtname, *color; + + if (restore) { + if (! solid_on) { + return; + } + if (desktop == 0) { + solid_root(NULL); + } else if (desktop == 1) { + solid_gnome(NULL); + } else if (desktop == 2) { + solid_kde(NULL); + } + solid_on = 0; + return; + } + if (! solid_str) { + return; + } + if (solid_on && !strcmp(prev_str, solid_str)) { + return; + } + if (strstr(solid_str, "guess:") == solid_str + || !strchr(solid_str, ':')) { + dtname = guess_desktop(); + rfbLog("guessed desktop: %s\n", dtname); + } else { + if (strstr(solid_str, "gnome:") == solid_str) { + dtname = "gnome"; + } else if (strstr(solid_str, "kde:") == solid_str) { + dtname = "kde"; + } else { + dtname = "root"; + } + } + + color = strchr(solid_str, ':'); + if (! color) { + color = solid_str; + } else { + color++; + if (*color == '\0') { + color = solid_default; + } + } + if (!strcmp(dtname, "gnome")) { + desktop = 1; + solid_gnome(color); + } else if (!strcmp(dtname, "kde")) { + desktop = 2; + solid_kde(color); + } else { + desktop = 0; + solid_root(color); + } + if (prev_str) { + free(prev_str); + } + prev_str = strdup(solid_str); + solid_on = 1; +} + /* -- xinerama.c -- */ /* * routines related to xinerama and blacking out rectangles @@ -14457,7 +14848,7 @@ static void watch_loop(void) { /* * text printed out under -help option */ -static void print_help(void) { +static void print_help(int mode) { char help[] = "\n" "x11vnc: allow VNC connections to real X11 displays. %s\n" @@ -14706,6 +15097,19 @@ static void print_help(void) { " just use 1 shm tile for polling. Limits shm segments\n" " used to 3.\n" "\n" +"-solid [color] To improve performance, when VNC clients are connected\n" +" try to change the desktop background to a solid color.\n" +" The [color] is optional: the default color is \"cyan4\".\n" +" For a different one specify the X color (rgb.txt name,\n" +" e.g. \"darkblue\" or numerical \"#RRGGBB\"). Currently\n" +" this option only works on GNOME, KDE, and classic X\n" +" (i.e. with the background image on the root window).\n" +" The \"gconftool-2\" and \"dcop\" external commands are\n" +" run for GNOME and KDE respectively. Other desktops\n" +" won't work, e.g. XFCE (send us the corresponding\n" +" commands if you find them). If x11vnc guesses your\n" +" desktop incorrectly, you can force it by prefixing\n" +" color with \"gnome:\", \"kde:\", or \"root:\".\n" "-blackout string Black out rectangles on the screen. \"string\" is a\n" " comma separated list of WxH+X+Y type geometries for\n" " each rectangle.\n" @@ -14758,6 +15162,7 @@ static void print_help(void) { "-rc filename Use \"filename\" instead of $HOME/.x11vncrc for rc file.\n" "-norc Do not process any .x11vncrc file for options.\n" "-h, -help Print this help text.\n" +"-?, -opts Only list the x11vnc options.\n" "-V, -version Print program version (last modification date).\n" "\n" "-q Be quiet by printing less informational output to\n" @@ -15024,11 +15429,11 @@ static void print_help(void) { " available in -threads mode which has its own pointer\n" " event handling mechanism.\n" "\n" -" To try out the different pointer modes to see\n" -" which one gives the best response for your usage,\n" -" it is convenient to use the remote control function,\n" -" e.g. \"x11vnc -R pointer_mode:4\" or the tcl/tk gui\n" -" (Tuning -> pointer_mode -> n).\n" +" To try out the different pointer modes to see which\n" +" one gives the best response for your usage, it is\n" +" convenient to use the remote control function, for\n" +" example \"x11vnc -R pm:4\" or the tcl/tk gui (Tuning ->\n" +" pointer_mode -> n).\n" "\n" "-input_skip n For the pointer handling when non-threaded: try to\n" " read n user input events before scanning display. n < 0\n" @@ -15239,6 +15644,9 @@ static void print_help(void) { " onetile enable -onetile mode. (you may need to\n" " set shm for this to do something)\n" " noonetile disable -onetile mode.\n" +" solid enable -solid mode\n" +" nosolid disable -solid mode.\n" +" solid_color:color set -solid color (and apply it).\n" " blackout:str set -blackout \"str\" (empty to disable).\n" " See -blackout for the form of \"str\"\n" " (basically: WxH+X+Y,...)\n" @@ -15277,7 +15685,6 @@ static void print_help(void) { " fb disable -nofb mode.\n" " bell enable bell (if supported).\n" " nobell disable bell.\n" -" bell enable bell (if supported).\n" " nosel enable -nosel mode.\n" " sel disable -nosel mode.\n" " noprimary enable -noprimary mode.\n" @@ -15385,17 +15792,18 @@ static void print_help(void) { " nowaitmapped flashcmap noflashcmap truecolor notruecolor\n" " overlay nooverlay overlay_cursor overlay_yescursor\n" " nooverlay_nocursor nooverlay_cursor nooverlay_yescursor\n" -" overlay_nocursor visual scale viewonly noviewonly shared\n" -" noshared forever noforever once timeout deny lock nodeny\n" -" unlock connect allowonce allow localhost nolocalhost\n" -" accept gone shm noshm flipbyteorder noflipbyteorder\n" -" onetile noonetile blackout xinerama noxinerama xrandr\n" -" noxrandr xrandr_mode padgeom quiet q noquiet modtweak\n" -" nomodtweak xkb noxkb skip_keycodes add_keysyms\n" -" noadd_keysyms clear_mods noclear_mods clear_keys\n" -" noclear_keys remap repeat norepeat fb nofb bell nobell\n" -" sel nosel primary noprimary cursorshape nocursorshape\n" -" cursorpos nocursorpos cursor show_cursor noshow_cursor\n" +" overlay_nocursor visual scale viewonly noviewonly\n" +" shared noshared forever noforever once timeout deny\n" +" lock nodeny unlock connect allowonce allow localhost\n" +" nolocalhost accept gone shm noshm flipbyteorder\n" +" noflipbyteorder onetile noonetile solid_color solid\n" +" nosolid 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 nosel\n" +" primary noprimary cursorshape nocursorshape cursorpos\n" +" nocursorpos cursor show_cursor noshow_cursor\n" " nocursor xfixes noxfixes alphacut alphafrac\n" " alpharemove noalpharemove alphablend noalphablend\n" " xwarp xwarppointer noxwarp noxwarppointer buttonmap\n" @@ -15473,6 +15881,31 @@ static void print_help(void) { ; /* have both our help and rfbUsage to stdout for more(1), etc. */ dup2(1, 2); + + if (mode == 1) { + char *p; + int l = 0; + fprintf(stderr, "x11vnc: allow VNC connections to real " + "X11 displays. %s\n\nx11vnc options:\n", lastmod); + p = strtok(help, "\n"); + while (p) { + int w = 23; + char tmp[100]; + if (p[0] == '-') { + strncpy(tmp, p, w); + fprintf(stderr, " %s", tmp); + l++; + if (l % 2 == 0) { + fprintf(stderr, "\n"); + } + } + p = strtok(NULL, "\n"); + } + fprintf(stderr, "\n\nlibvncserver options:\n"); + rfbUsage(); + fprintf(stderr, "\n"); + exit(1); + } fprintf(stderr, help, lastmod, view_only ? "on":"off", shared ? "on":"off", @@ -15503,6 +15936,9 @@ static void print_help(void) { void set_vnc_desktop_name(void) { int sz = 256; sprintf(vnc_desktop_name, "unknown"); + if (inetd) { + sprintf(vnc_desktop_name, "inetd-no-further-clients"); + } if (screen->port) { char *host = this_host(); int lport = screen->port; @@ -15827,6 +16263,8 @@ int main(int argc, char* argv[]) { argv_vnc[0] = strdup(argv[0]); program_name = strdup(argv[0]); + solid_default = strdup(solid_default); /* for freeing with -R */ + len = 0; for (i=1; i < argc; i++) { len += strlen(argv[i]) + 4 + 1; @@ -15970,6 +16408,18 @@ int main(int argc, char* argv[]) { flip_byte_order = 1; } else if (!strcmp(arg, "-onetile")) { single_copytile = 1; + } else if (!strcmp(arg, "-solid")) { + use_solid_bg = 1; + if (i < argc-1) { + char *s = argv[i+1]; + if (s[0] != '-') { + solid_str = strdup(s); + i++; + } + } + if (! solid_str) { + solid_str = strdup(solid_default); + } } else if (!strcmp(arg, "-blackout")) { CHECK_ARGC blackout_str = strdup(argv[++i]); @@ -16000,9 +16450,10 @@ int main(int argc, char* argv[]) { i++; /* done above */ } else if (!strcmp(arg, "-norc")) { ; /* done above */ - } else if (!strcmp(arg, "-h") || !strcmp(arg, "-help") - || !strcmp(arg, "-?")) { - print_help(); + } else if (!strcmp(arg, "-h") || !strcmp(arg, "-help")) { + print_help(0); + } else if (!strcmp(arg, "-?") || !strcmp(arg, "-opts")) { + print_help(1); } else if (!strcmp(arg, "-V") || !strcmp(arg, "-version")) { fprintf(stderr, "x11vnc: %s\n", lastmod); exit(0); @@ -16270,7 +16721,6 @@ int main(int argc, char* argv[]) { } - /* * If -passwd was used, clear it out of argv. This does not * work on all UNIX, have to use execvp() in general... @@ -16480,6 +16930,8 @@ int main(int argc, char* argv[]) { fprintf(stderr, " using_shm: %d\n", using_shm); fprintf(stderr, " flipbytes: %d\n", flip_byte_order); fprintf(stderr, " onetile: %d\n", single_copytile); + fprintf(stderr, " solid: %s\n", solid_str + ? solid_str : "null"); fprintf(stderr, " blackout: %s\n", blackout_str ? blackout_str : "null"); fprintf(stderr, " xinerama: %d\n", xinerama); @@ -16491,7 +16943,7 @@ int main(int argc, char* argv[]) { fprintf(stderr, " logfile: %s\n", logfile ? logfile : "null"); fprintf(stderr, " logappend: %d\n", logfile_append); - fprintf(stderr, " rc_file: \%s\n", rc_rcfile ? rc_rcfile + fprintf(stderr, " rc_file: %s\n", rc_rcfile ? rc_rcfile : "null"); fprintf(stderr, " norc: %d\n", rc_norc); fprintf(stderr, " bg: %d\n", bg);