summaryrefslogtreecommitdiffstats
path: root/x11vnc/tkx11vnc.h
diff options
context:
space:
mode:
authorrunge <runge>2005-07-07 01:45:21 +0000
committerrunge <runge>2005-07-07 01:45:21 +0000
commit8fcf08613247c17aab767476fca6870bb45480a9 (patch)
tree27e5c932aeef9f47ee7e3a246da15b810f1401fb /x11vnc/tkx11vnc.h
parentc59929365c6b73d89fd0ccbdcb223c0ec44a4d40 (diff)
downloadlibtdevnc-8fcf08613247c17aab767476fca6870bb45480a9.tar.gz
libtdevnc-8fcf08613247c17aab767476fca6870bb45480a9.zip
x11vnc: -gui tray now embeds in systray; more improvements to gui.
Diffstat (limited to 'x11vnc/tkx11vnc.h')
-rw-r--r--x11vnc/tkx11vnc.h1737
1 files changed, 1413 insertions, 324 deletions
diff --git a/x11vnc/tkx11vnc.h b/x11vnc/tkx11vnc.h
index 2f52f9c..ddff298 100644
--- a/x11vnc/tkx11vnc.h
+++ b/x11vnc/tkx11vnc.h
@@ -108,32 +108,41 @@
"Screen\n"
" =DRA refresh\n"
" =RA reset\n"
-" =DRA blacken\n"
+" =RA blacken\n"
" fixscreen:\n"
" -- D\n"
-" id:\n"
-" sid:\n"
" =D scale:\n"
" scale_cursor:\n"
" --\n"
-" overlay\n"
-" overlay_nocursor\n"
-" --\n"
" =D solid\n"
" solid_color:\n"
-" visual:\n"
+" --\n"
+" =GAL OverlayVisuals::\n"
+" overlay\n"
+" overlay_nocursor\n"
+" =GAL LOFF\n"
+" =GAL 8-Bit-Color::\n"
" flashcmap\n"
" shiftcmap:\n"
" notruecolor\n"
+" =GAL LOFF\n"
+" =GAL SubWindow::\n"
+" id:\n"
+" sid:\n"
+" =GAL LOFF\n"
+" =GAL ResizeRotate::\n"
+" = xrandr\n"
+" =-C:resize,newfbsize,exit xrandr_mode:\n"
+" padgeom:\n"
+" =GAL LOFF\n"
" --\n"
" =P blackout:\n"
" xinerama\n"
" clip:\n"
-" rawfb:\n"
" --\n"
-" = xrandr\n"
-" =-C:resize,newfbsize,exit xrandr_mode:\n"
-" padgeom:\n"
+" visual:\n"
+" rawfb:\n"
+" pipeinput:\n"
"\n"
"Keyboard\n"
" =D norepeat\n"
@@ -141,12 +150,12 @@
" modtweak\n"
" xkb\n"
" --\n"
+" =FP remap:\n"
+" --\n"
" skip_keycodes:\n"
" sloppy_keys\n"
" skip_dups\n"
" --\n"
-" =FP remap:\n"
-" --\n"
" clear_mods\n"
" clear_keys\n"
"\n"
@@ -158,53 +167,43 @@
" =D nocursorshape\n"
" --\n"
" noxfixes\n"
+" =GAL AlphaBlending::\n"
" noalphablend\n"
" alphacut:\n"
" alphafrac:\n"
" alpharemove\n"
+" =GAL LOFF\n"
" --\n"
" buttonmap:\n"
" --\n"
" xwarppointer\n"
"\n"
"Misc\n"
+" =GD-C:full,icon,tray WindowView:\n"
" =GD simple-gui\n"
" -- D\n"
+" =GA all-settings\n"
+" =RA remote-cmd:\n"
+" --\n"
" =F rc:\n"
" norc\n"
-" nolookup\n"
-" --\n"
" nofb\n"
-" --\n"
" =D nobell\n"
+" nolookup\n"
+" =GAL Selection::\n"
" =D nosel\n"
" noprimary\n"
" seldir:\n"
+" =GAL LOFF\n"
" --\n"
" xtrap\n"
" xrecord\n"
-" =RA reset_record\n"
+" =RQA reset_record\n"
" --\n"
" bg\n"
" =-C:ignore,exit sigpipe:\n"
" =0 inetd\n"
" rfbwait:\n"
-" pipeinput:\n"
-" --\n"
-" =RA remote-cmd:\n"
-" =GA all-settings\n"
-" --\n"
-" =GAL Misc-Tuning::\n"
-" fs:\n"
-" gaps:\n"
-" grow:\n"
-" fuzz:\n"
-" wait_ui:\n"
-" nowait_bog\n"
-" readtimeout:\n"
-" snapfb\n"
-" threads\n"
-" wmdt:\n"
"\n"
"Debugging\n"
" debug_pointer\n"
@@ -214,65 +213,63 @@
" =GA tail-logfile\n"
" quiet\n"
" --\n"
+" =GAL Misc-Debug::\n"
" debug_xevents\n"
" debug_xdamage\n"
" =-C:0,1,2,3 debug_wireframe:\n"
" debug_scroll\n"
" debug_tiles\n"
+" debug_grabs\n"
" dbg\n"
-" --\n"
+" =GAL LOFF\n"
" =GA show-start-cmd\n"
" =DG debug_gui\n"
"\n"
"Permissions\n"
" =DRQA lock\n"
" =DRQA unlock\n"
-" =SQA deny_all\n"
" --\n"
" =DFP allow:\n"
" =D localhost\n"
" =RA allowonce:\n"
" listen:\n"
" -- D\n"
-" =RA noremote\n"
-" --\n"
-" =D viewonly\n"
" =D shared\n"
" =D forever\n"
" timeout:\n"
" --\n"
+" =D viewonly\n"
" input:\n"
" --\n"
-" =S alwaysshared\n"
-" =S nevershared\n"
-" =S dontdisconnect\n"
+" safer\n"
+" unsafe\n"
+" =RA noremote\n"
" --\n"
+" =GAL Passwords::\n"
+" passwd:\n"
" viewpasswd:\n"
" =F passwdfile:\n"
-" =0 storepasswd\n"
" =F rfbauth:\n"
-" passwd:\n"
-" --\n"
-" safer\n"
-" unsafe\n"
+" =0 storepasswd\n"
+" =GAL LOFF\n"
+" =GAL Misc-Perms::\n"
+" =S alwaysshared\n"
+" =S nevershared\n"
+" =S dontdisconnect\n"
+" =SQA deny_all\n"
+" =GAL LOFF\n"
"\n"
"Tuning\n"
" =D-C:0,1,2,3,4 pointer_mode:\n"
" input_skip:\n"
" =D nodragging\n"
" --\n"
-" noshm\n"
-" flipbyteorder\n"
-" onetile\n"
-" --\n"
-" xdamage\n"
-" xd_area:\n"
-" xd_mem:\n"
-" --\n"
+" =GAL WireFrame::\n"
" wireframe\n"
" wireframe_mode:\n"
" =-C:never,top,always wirecopyrect:\n"
-" --\n"
+" =GAL LOFF\n"
+" =GAL ScrollCopyRect::\n"
" =-C:never,keys,mouse,always scrollcopyrect:\n"
" scr_area:\n"
" scr_skip:\n"
@@ -281,6 +278,12 @@
" scr_term:\n"
" scr_keyrepeat:\n"
" scr_parms:\n"
+" =GAL LOFF\n"
+" =GAL XDAMAGE::\n"
+" xdamage\n"
+" xd_area:\n"
+" xd_mem:\n"
+" =GAL LOFF\n"
" -- D\n"
" speeds:\n"
" =D wait:\n"
@@ -288,7 +291,24 @@
" =D nap\n"
" screen_blank:\n"
" --\n"
+" =GAL SharedMemory::\n"
+" noshm\n"
+" flipbyteorder\n"
+" onetile\n"
+" =GAL LOFF\n"
+" =GAL Misc-Tuning::\n"
" progressive:\n"
+" fs:\n"
+" gaps:\n"
+" grow:\n"
+" fuzz:\n"
+" wait_ui:\n"
+" nowait_bog\n"
+" readtimeout:\n"
+" snapfb\n"
+" threads\n"
+" wmdt:\n"
+" =GAL LOFF\n"
"\"\n"
"}\n"
"\n"
@@ -420,26 +440,32 @@
"\"\n"
"\n"
" set helptext(Tray) \"\n"
-"The tray/icon mode (started with \\\"x11vnc -gui tray ...\\\") presents a\n"
-"small icon that indicates the status of a running x11vnc server.\n"
+"The tray/icon mode (started with \\\"x11vnc -gui tray ...\\\", etc.) presents\n"
+"a small icon that indicates the status of the running x11vnc server.\n"
"\n"
"Depending on your environment, this icon may be embedded in a system\n"
-"tray or applet dock, or simply be a standalone window.\n"
+"tray or applet dock, or simply be a standalone window. \\\"-gui tray\\\"\n"
+"will attempt to embed the icon in the system tray, while \\\"-gui icon\\\"\n"
+"is for a standalone window. Use \\\"-gui tray=setpass\\\" (or icon=setpass)\n"
+"to be prompted to set the session password at startup.\n"
"\n"
"When the icon has a light background, that means no VNC viewers are\n"
-"currently connected to the display.\n"
+"currently connected to the VNC display.\n"
"\n"
"When the icon has a dark background (i.e. reverse-video), that means at\n"
-"least one VNC viewer is connected to the display.\n"
+"least one VNC viewer is connected to the VNC display.\n"
"\n"
"Moving the mouse pointer over the icon will popup a \\\"status balloon\\\"\n"
-"indicating the VNC display name and the names and other info of any\n"
-"connected VNC viewers.\n"
+"indicating the VNC display name and the names and info of any connected VNC\n"
+"viewers. Press the middle mouse button if the balloon does not appear.\n"
"\n"
-"Clicking the right mouse button on the icon displays a menu of actions:\n"
+"Clicking the left or right mouse button on the icon displays a menu\n"
+"of actions:\n"
"\n"
-" Properties - Brings up the Properties dialog. The full tkx11vnc\n"
-" GUI may be accessed via the \\\"Advanced ...\\\" button.\n"
+" Properties - Brings up the Properties dialog to set some basic\n"
+" parameters. The full tkx11vnc GUI may be accessed\n"
+" via the \\\"Advanced ...\\\" button. Press \\\"Help ...\\\"\n"
+" in the Properties dialog for more info.\n"
" \n"
" Help - Displays this help text.\n"
" \n"
@@ -447,10 +473,17 @@
" of a computer that is running a VNC viewer in\n"
" \\\"listen\\\" mode (e.g. vncviewer -listen). For a\n"
" non-standard listening port use \\\"host:port\\\".\n"
+"\n"
" Pressing \\\"OK\\\" will initiate the reverse\n"
" connection. Use a blank hostname to skip it.\n"
" \n"
" Disconnect All - Disconnects all current VNC viewers.\n"
+"\n"
+" Window View - Switch between the \\\"full\\\" gui (also known as\n"
+" \\\"Advanced\\\"), \\\"icon\\\" mode (small icon window with\n"
+" popups), or \\\"tray\\\" mode (small icon embedded in the\n"
+" system tray). This is a shortcut for the action:\n"
+" \\\"Properties -> Advanced -> Misc -> WindowView\\\".\n"
" \n"
" Stop x11vnc - Directs the x11vnc server to disconnect all vncviewers\n"
" and then exit. The tray/icon GUI then exits as well.\n"
@@ -459,7 +492,8 @@
"If the x11vnc server stops for any reason, the tray/icon gui will exit.\n"
"\n"
"If you delete the tray/icon (e.g. X out button), that is the same\n"
-"as the \\\"Stop x11vnc\\\" action in the menu.\n"
+"as the \\\"Stop x11vnc\\\" action in the menu. (This will disconnect any\n"
+"VNC viewer you are currently using to access the display).\n"
"\"\n"
"\n"
" set helptext(Properties) \"\n"
@@ -467,34 +501,34 @@
"running x11vnc server. After modifying them press \\\"OK\\\" or \\\"Apply\\\"\n"
"to apply the changes, or press \\\"Cancel\\\" to skip applying them.\n"
"\n"
-"\\\"Accept Connections\\\" toggles whether VNC viewers are allowed\n"
-"to connect or not. It corresponds to the \\\"-R unlock\\\" and \\\"-R lock\\\"\n"
-"remote-control commands.\n"
-"\n"
-"\\\"Ask for Confirmation\\\" toggles whether a popup menu will be presented\n"
-"at the X display when a new VNC viewer attempts to connects. The person\n"
-"sitting at the X display can chose to accept or reject the connection\n"
-"or accept the connection in View-Only mode. It corresponds to the \n"
-"\\\"-R accept:popup\\\" and \\\"-R accept:\\\" remote-control commands.\n"
-"\n"
-"\\\"All Clients ViewOnly\\\" toggles whether the entire VNC desktop is\n"
-"view only. All clients will only be able to watch when this is set\n"
-"(regardless of how they logged in). It corresponds to the \\\"-R viewonly\\\"\n"
-"and \\\"-R noviewonly\\\" remote-control commands.\n"
-"\n"
-"\\\"Shared\\\" toggles whether multiple simultaneous connections are\n"
-"allowed or not. It corresponds to the \\\"-R shared\\\" and \\\"-R noshared\\\"\n"
-"remote-control commands.\n"
-"\n"
-"\\\"Password\\\" lets you set the session password viewers may use to gain full\n"
-"access to the display.\n"
-"\n"
-"\\\"ViewOnly Password\\\" lets you set the session password viewers may\n"
-"use to gain view only access to the display.\n"
-"\n"
-"NOTE: These passwords only last for the current x11vnc session (they are\n"
-"not remembered, see the -storepasswd, -passwdfile, and -rfbauth x11vnc\n"
-"options for using stored passwords).\n"
+" - \\\"Accept Connections\\\" toggles whether VNC viewers are allowed\n"
+" to connect or not. It corresponds to the \\\"-R unlock\\\" and \\\"-R lock\\\"\n"
+" remote-control commands.\n"
+" \n"
+" - \\\"Ask for Confirmation\\\" toggles whether a popup menu will be presented\n"
+" at the X display when a new VNC viewer attempts to connects. The person\n"
+" sitting at the X display can chose to accept or reject the connection\n"
+" or accept the connection in View-Only mode. It corresponds to the \n"
+" \\\"-R accept:popup\\\" and \\\"-R accept:\\\" remote-control commands.\n"
+" \n"
+" - \\\"All Clients ViewOnly\\\" toggles whether the entire VNC desktop is\n"
+" view only. All clients will only be able to watch when this is set\n"
+" (regardless of how they logged in). It corresponds to the\n"
+" \\\"-R viewonly\\\" and \\\"-R noviewonly\\\" remote-control commands.\n"
+" \n"
+" - \\\"Shared\\\" toggles whether multiple simultaneous connections are\n"
+" allowed or not. It corresponds to the \\\"-R shared\\\" and \\\"-R noshared\\\"\n"
+" remote-control commands.\n"
+"\n"
+" - \\\"Password\\\" lets you set the session password viewers may use to gain full\n"
+" access to the display.\n"
+" \n"
+" - \\\"ViewOnly Password\\\" lets you set the session password viewers may\n"
+" use to gain view only access to the display.\n"
+"\n"
+"NOTE: These \\\"session\\\" passwords only last for the current x11vnc\n"
+"session (they are not remembered, see the -storepasswd, -passwdfile,\n"
+"and -rfbauth x11vnc options for using stored passwords).\n"
"\n"
"If you set \\\"Password\\\" to the empty string that makes the \\\"View-Only\n"
"Password\\\" empty as well and removes the need for any password to log in.\n"
@@ -502,17 +536,269 @@
"If you set \\\"ViewOnly Password\\\" to the empty string that just removes\n"
"the ViewOnly log in aspect: \\\"Password\\\" is still required to log in.\n"
"\n"
-"The \\\"Help ...\\\" button shows this help text.\n"
-"\n"
-"The \\\"Advanced ...\\\" button replaces the Properties dialog with the full\n"
-"tkx11vnc GUI. Any dynamic settings can be modified in the full GUI.\n"
+" - The \\\"Help ...\\\" button shows this help text.\n"
+" \n"
+" - The \\\"Advanced ...\\\" button replaces the Properties dialog with the full\n"
+" tkx11vnc GUI. All dynamic settings can be modified in the full GUI.\n"
"\" \n"
"\n"
" set helptext(all) $helpall\n"
"\n"
" set helptext(Misc-Tuning:) \"\n"
-"These contain some miscellaneous tuning parameters that are not\n"
-"often used. Placed here to avoid overcrowding in the Tuning menu.\n"
+"x11vnc has what seems like hundreds of tuning parameters. In this\n"
+"sub-menu we place some lesser used ones. Mostly likely you'll want to\n"
+"leave them at their default values, but you can try them out quickly\n"
+"with the gui to see if they improve things.\n"
+"\"\n"
+"\n"
+" set helptext(Passwords:) \"\n"
+"The items in this sub-menu pertain to setting passwords. Note that x11vnc\n"
+"has two types of password files: RealVNC-style ones (you can create them\n"
+"with x11vnc -storepasswd or other VNC utility program) you use these\n"
+"via -rfbauth; and plain-text file passwords you use via -passwdfile.\n"
+"\n"
+"Normally passwords cannot be changed by remote-control (e.g. the gui),\n"
+"but for the case of the \\\"Icon\\\" and \\\"Tray\\\" modes this constraint has\n"
+"been relaxed.\n"
+"\n"
+"In neither the RealVNC-style nor the plain-text file cases should the\n"
+"password files be readable by users you do not want to access the VNC\n"
+"server. Contrary to popular belief, the RealVNC-style passwords are\n"
+"not encrypted, merely obscured.\n"
+"\n"
+"x11vnc has the even less secure -passwd and -viewpasswd supplied on\n"
+"the command line. Be careful with these since they could be read by\n"
+"users with something like the ps(1) command. On some operating systems\n"
+"x11vnc tries to quickly overwrite them on the command line but it doesn't\n"
+"work everywhere.\n"
+"\n"
+"Regarding ViewOnly passwords (where a VNC client using that password\n"
+"can only watch the screen, not interact with it), this is not available\n"
+"with -rfbauth, but only with -passwdfile, -passwd, and -viewpasswd.\n"
+"\"\n"
+"\n"
+" set helptext(Misc-Perms:) \"\n"
+"In this sub-menu we provide some lesser used permission options.\n"
+"Regarding -alwaysshared, -nevershared, and -dontdisconnect, you probably\n"
+"should never use them and just use x11vnc's -shared and -forever options\n"
+"instead (these give basically the same functionality and if you mixed\n"
+"them too much unexpected things may happen).\n"
+"\"\n"
+"\n"
+" set helptext(AlphaBlending:) \"\n"
+"In this sub-menu we provide some tweak parameters for cursors (little\n"
+"icon at the mouse pointer) that have transparency (i.e. an Alpha channel\n"
+"in addition to Red, Green, and Blue RGB channels). For these cursors,\n"
+"some of the graphics underneath the cursor is allowed to be blended in:\n"
+"e.g. a drop-shadow (a terrible effect IMNSHO).\n"
+"\n"
+"AlphaBlending for x11vnc is only available when the XFIXES X extension is\n"
+"present (since otherwise it cannot see the cursors at all and so applies\n"
+"heuristics to show some fake cursors). AlphaBlending is only a problem\n"
+"with x11vnc when the cursors are not opaque.\n"
+"\n"
+"Opaque cursors (e.g. bitmap or simply colored cursor) are rendered\n"
+"correctly by x11vnc. Only when there is transparency does x11vnc have\n"
+"to make some approximation to transform the cursor to be opaque (the\n"
+"VNC protocol does not provide for an alpha channel in cursors, only RGB).\n"
+"\n"
+"The items in this sub-menu let you tweak x11vnc's approximation scheme\n"
+"for cursors with transparency. Hopefully you won't have to use them.\n"
+"Certain cursor \\\"themes\\\" may require adjustment however.\n"
+"\"\n"
+" set helptext(OverlayVisuals:) \"\n"
+"In this sub-menu are some options that involve fixing color problems\n"
+"for \\\"Overlay\\\" or \\\"Multi-Depth\\\" visuals. This problem is rare\n"
+"since overlay and multi-depth visual video hardware is rare. \n"
+"Some Sun, SGI, and HP machines are known to have them.\n"
+"\n"
+"The short answer is if you have a multi-depth visual display (e.g. 8 and\n"
+"24 bits), and you see messed up colors in x11vnc try the \\\"-overlay\\\"\n"
+"option on Solaris or IRIX.\n"
+"\n"
+"A brief Background on pixels, color, and visuals:\n"
+"\n"
+" Pixels (picture elements) are kept in video memory as a certain number\n"
+" of bits-per-pixel (bpp). Most common are 8bpp, 16bpp, and 32bpp.\n"
+" Less common are 24bpp, 4bpp, and 1bpp (monochrome).\n"
+"\n"
+" How pixel values (i.e. values of the bits) are rendered into colors on\n"
+" the screen can be done via different \\\"Recipes\\\". These different\n"
+" recipes are referred to as \\\"visuals\\\". E.g. for 8bpp there is\n"
+" a PseudoColor visual that maintains a mapping (that can be changed\n"
+" dynamically) of the pixel values (256 possible ones) into RGB values.\n"
+" Other 8bpp visuals, e.g. StaticGrey and TrueColor have fixed, regular\n"
+" mappings and so provide less variation in kinds of colors.\n"
+"\n"
+" A visual's \\\"depth\\\" is how many of the pixels are used in the\n"
+" actual recipe. This may sound wasteful (i.t. not using some of the\n"
+" bits), but for 32bpp (4 billion colors) that is too much and nearly\n"
+" always only 24 for them are used. The most common Visual seems to\n"
+" be depth 24 TrueColor at 32bpp. This provides 16 million colors\n"
+" which is more than the number of pixels on most screens (1280x1024 =\n"
+" 1.3 million pixels). Another sometimes used visual that ignores some\n"
+" bits is depth 15 TrueColor at 16bpp.\n"
+"\n"
+"OK, now, finally, to the Overlay Visuals. Some hardware (or software\n"
+"emulations) allow different depth visuals to be used on the display\n"
+"at the same time. The pixels of windows using different depth visuals\n"
+"may overlap.\n"
+"\n"
+"The most common seems to be both 8 and 24 depth visuals on a 32bpp setup.\n"
+"24 of the pixels can be used for one visual and the remaining 8 for the\n"
+"other. This is sometimes referred to as \\\"8+24\\\" mode. Furthermore,\n"
+"a speedup is achieved because writing graphics data to, say, the 8bit\n"
+"visual does not destroy the image data in the 24bit visual. Evidently\n"
+"popup menus can be done very quickly this way: they use the 8bit visual\n"
+"and when the popup goes away the graphics data in the 24bit visual is\n"
+"immediately reexposed without having the application redrawing it.\n"
+"\n"
+"Also, some legacy applications can only use 8bpp visuals. But in these\n"
+"days of high color graphics and web browsers one would like the rest\n"
+"of the desktop to use depth 24 visuals. They often work on the multi\n"
+"depth visuals.\n"
+"\n"
+"How does this effect x11vnc? x11vnc nearly always polls the root window\n"
+"(container of all other windows). The root window will be one depth,\n"
+"e.g. 8 or 24. Any windows using the *other* depth will appear to have\n"
+"messed up colors (or just be black or some other solid color) when viewed\n"
+"via x11vnc.\n"
+"\n"
+"How to fix? Solaris and IRIX provide an API to extract the full snapshot\n"
+"of the display with all the colors correct. It comes to x11vnc as depth\n"
+"24 TrueColor. To enable this use the \\\"-overlay\\\" option. Performance\n"
+"may be slower, but if the colors are correct that is a big improvement.\n"
+"\"\n"
+"\n"
+" set helptext(8-Bit-Color:) \"\n"
+"Some older displays (e.g. with limited Video RAM) use 8 bits-per-pixel\n"
+"color. This allows for only 256 different colors on the screen at the\n"
+"same time. This sometimes leads to problems with viewing these 8bpp\n"
+"displays via x11vnc. This sub-menu has some options that correspond to\n"
+"workarounds for this case. If you can configure the machine to use 16bpp\n"
+"it may be worth it to avoid the color problems (e.g. color flashing\n"
+"as the 8bit colormap is switched).\n"
+"\"\n"
+" set helptext(SubWindow:) \"\n"
+"This sub-menu has a couple options regarding having x11vnc poll a \n"
+"single window, not the entire display. This way just the window\n"
+"is shared.\n"
+"\n"
+"Note if the application pops up multiple windows they are not tracked\n"
+"and shared. So this is not application sharing. The application has to\n"
+"be very simple (e.g. a simple terminal or the image window on a webcam)\n"
+"for this mode to be useable.\n"
+"\"\n"
+" set helptext(ResizeRotate:) \"\n"
+"This sub-menu has some options regarding screens that support the X\n"
+"Resize, Reflection, and Rotation Extension (RANDR), and one expects screen\n"
+"resizing, reflection, or rotation to take place during the x11vnc session.\n"
+"This is pretty rare, but x11vnc seems to handle it reasonably well using\n"
+"this X extension.\n"
+"\n"
+"This mode is on by default in -id mode to try to track the changing\n"
+"size of the SubWindow. It is not on by default for full-screen mode\n"
+"because of the extra overhead, etc.\n"
+"\"\n"
+"\n"
+" set helptext(WireFrame:) \"\n"
+"This sub-menu has some options for the x11vnc wireframing speedup scheme.\n"
+"\n"
+"For x11vnc, Wireframing means to watch for toplevel windows being Opaquely\n"
+"Moved or Resized. When x11vnc detects this, it stops polling the screen\n"
+"and simply shows a \\\"wireframe\\\" outline of the window as it is being\n"
+"moved or resized. This avoids \\\"screen polling thrashing\\\" when the\n"
+"screen is changing so rapidly during this period. For various reasons\n"
+"this is usually much faster then letting the window manager do its\n"
+"own wireframing (you are encouraged to do Opaque moves and resizes\n"
+"when using x11vnc!)\n"
+"\n"
+"Also, once a moved window is released in its new position, x11vnc uses\n"
+"the VNC CopyRect encoding to very efficiently update the VNC viewers\n"
+"(each just copies the image data locally).\n"
+"\n"
+"This sort of scheme was used much in the 1990's on local displays because\n"
+"video hardware was slow at the time. x11vnc tries to use this same trick\n"
+"as a speedup for its activities (the network is much slower than video\n"
+"hardware writes, and the video hardware reads that x11vnc uses to poll\n"
+"the screen are still slow today).\n"
+"\"\n"
+"\n"
+" set helptext(ScrollCopyRect:) \"\n"
+"This sub-menu has some options for the x11vnc Scroll detection and\n"
+"CopyRect speedup scheme.\n"
+"\n"
+"For this mode, x11vnc \\\"spies\\\" on communication be the X server and\n"
+"applications using the RECORD extension. It looks for various patterns\n"
+"to detect a scrolled window. This only works for some applications,\n"
+"fortunately some important ones.\n"
+"\n"
+"Once the scroll is detected it uses the VNC CopyRect encoding for a\n"
+"big speedup. Screen polling is also sped up for this scheme.\n"
+"\n"
+"There are many tweakable parameters for this mode and they are described\n"
+"in the sub-menu items.\n"
+"\"\n"
+"\n"
+" set helptext(XDAMAGE:) \"\n"
+"The DAMAGE X extension allows the X server to send signals to x11vnc\n"
+"telling it which regions of the screen have been changed. This improves\n"
+"x11vnc's performance markedly. The DAMAGE extension must be available\n"
+"on the display for this to work.\n"
+"\n"
+"Unfortunately DAMAGE cannot be trusted completely for the changed regions,\n"
+"because often the reported changed region is much larger than the actual\n"
+"changed regions. Nevertheless, x11vnc uses the DAMAGE information very\n"
+"effectively as hints to improve its performance.\n"
+"\n"
+"The items in the sub-menu allow tweaking x11vnc's DAMAGE algorithm.\n"
+"\"\n"
+"\n"
+" set helptext(SharedMemory:) \"\n"
+"This sub-menu provides some options regarding SYSV shared memory usage\n"
+"(shm) by x11vnc. Usually you want shm turned on because the x11vnc\n"
+"process is nearly always running on the same machine the X server process\n"
+"is running on. SharedMemory gives a performance speedup. However,\n"
+"if you need to modify this scenario these options allow you to.\n"
+"\"\n"
+"\n"
+" set helptext(Misc-Debug:) \"\n"
+"This sub-menu contains a lot of debugging parameters usually used\n"
+"for debugging x11vnc itself. This is unlike the -debug_pointer and\n"
+"-debug_keyboard options that are useful in learning information, quirks,\n"
+"etc. about your local display and environment.\n"
+"\"\n"
+"\n"
+" set helptext(Selection:) \"\n"
+"This sub-menu contains some options centering around the Selection\n"
+"(also referred to as the Clipboard, Cutbuffers, etc). x11vnc will try\n"
+"to exchange the selections between the VNC viewers and the X server.\n"
+"\"\n"
+"\n"
+" set helptext(WindowView) \"\n"
+"Set the Window View Mode for the gui. There are three modes:\n"
+"\n"
+" - full: Presents the full gui (Actions, Clients, etc, buttons,\n"
+" and the Text area and Set/Entry box).\n"
+"\n"
+" - icon: Presents a small icon instead of the full gui. Moving\n"
+" the mouse over it shows the VNC display name and any\n"
+" connected clients. Clicking on the icon pops up a menu\n"
+" of actions to perform. Among them is \\\"Properties\\\" that\n"
+" allows setting more parameters. Clicking on \\\"Advanced\\\"\n"
+" in \\\"Properties\\\" brings up the full gui.\n"
+"\n"
+" - tray: Attempt to embed the small icon in the system tray. If\n"
+" this fails it will resort to icon mode where the small icon\n"
+" is a standalone window.\n"
+"\n"
+"Note that in \\\"full\\\" mode if you delete the full gui window the gui\n"
+"terminates (but the x11vnc server keeps running). However under \\\"icon\\\"\n"
+"or \\\"tray\\\" mode if you bring up the full gui window via \\\"Properties ->\n"
+"Advanced\\\" and then delete it the gui does NOT terminate.\n"
+"\n"
+"Also note that by default in \\\"icon\\\" mode if you delete the icon\n"
+"window both the gui and the x11vnc server terminate.\n"
"\"\n"
"\n"
" set helptext(gui) \"\n"
@@ -520,23 +806,30 @@
"provides an interface to each of the many x11vnc command line options and\n"
"remote control commands. See \\\"Help -> all\\\" for much info about x11vnc.\n"
"\n"
+"For a simplier gui, run x11vnc in \\\"tray\\\" or \\\"icon\\\" mode such as\n"
+"\\\"-gui tray\\\", \\\"-gui icon\\\", or \\\"-gui tray=setpass\\\". In that\n"
+"mode the full gui is only available under \\\"Advanced ...\\\".\n"
+"\n"
+"Also, \\\"-gui ez\\\" will show fewer menu items (toggle via Misc -> simple_gui)\n"
+"\n"
"All menu items have a (?) button one can click on to get more information\n"
"about the option or command.\n"
"\n"
"There are two states tkx11vnc can be in:\n"
"\n"
" 1) Available to control a running x11vnc process.\n"
+"\n"
" 2) Getting ready to start a x11vnc process.\n"
"\n"
+"Most people will just use state 1).\n"
+"\n"
"In state 1) the Menu items available in the menus are those that\n"
"correspond to the x11vnc \\\"remote control\\\" commands. See the -remote\n"
"entry under \\\"Help -> all\\\" for a complete list. Also available is\n"
"the \\\"Actions -> stop\\\" item to shut down the running x11vnc server,\n"
-"thereby changing to state 2). One could also simply \\\"Actions -> detach\\\"\n"
-"leaving the x11vnc server running. \\\"Actions -> attach\\\" would\n"
-"reestablish the connection.\n"
+"thereby changing to state 2). There are other actions available too.\n"
"\n"
-"In state 2) the Menu items available in the menus (Actions, Clients,\n"
+"In state 2) the Menu items available in the menus (\\\"Actions\\\", \\\"Clients\\\",\n"
"etc.) are those that correspond to command line options used in starting\n"
"an x11vnc process, and the \\\"Actions -> start\\\" item executes\n"
"x11vnc thereby changing to state 1). To see what x11vnc startup command\n"
@@ -546,11 +839,13 @@
"There is much overlap between the menu items available in state 1)\n"
"and state 2), but it is worth keeping in mind it is not 100%.\n"
"For example, you cannot set passwords or password files in state 1).\n"
+"(update: simple password setting is now allowed in \\\"tray\\\" or \\\"icon\\\" mode).\n"
"\n"
"\n"
"Also note that there may be *two* separate X displays involved, not just\n"
"one: 1) the X display x11vnc will be polling (and making available to\n"
"VNC viewers), and 2) the X display this GUI is intended to display on.\n"
+"\n"
"For example, one might use ssh to access the remote machine where the\n"
"GUI would display on :11 and x11vnc would poll display :0. By default\n"
"the gui will display on the value in the DISPLAY env. variable followed\n"
@@ -562,34 +857,36 @@
"--- ----------\n"
"\n"
"1) At the top of the gui is a info text label where information will\n"
-"be posted, e.g. when traversing menu items text indicating how to get\n"
-"help on the item and its current value will be displayed.\n"
+" be posted, e.g. when traversing menu items text indicating how to get\n"
+" help on the item and its current value will be displayed.\n"
"\n"
-"2) Below the info label is the area where the menu buttons, Actions,\n"
-"Clients, etc., are presented. If a menu item has a checkbox,\n"
-"it corresponds to a boolean on/off variable. Otherwise it is\n"
-"either a string variable, or an action not associated with a\n"
-"variable (for the most part).\n"
+"2) Below the info label is the area where the menu buttons, \\\"Actions\\\",\n"
+" \\\"Clients\\\", etc., are presented. If a menu item has a checkbox,\n"
+" it corresponds to a boolean on/off variable. Otherwise it is\n"
+" either a string variable, or an action not associated with a\n"
+" variable (for the most part).\n"
"\n"
-"3) Below the menu button area is a text label indicating the current x11vnc\n"
-"X display being polled and the corresponding VNC display name. Both\n"
-"will be \\\"(*none*)\\\" when there is no connection established.\n"
+"3) Below the menu button area is a label indicating the current x11vnc\n"
+" X display being polled and the corresponding VNC display name. Both\n"
+" will be \\\"(*none*)\\\" when there is no connection established.\n"
"\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 click in the area and use PageUp/PageDown or the arrow keys.\n"
+"4) Below the x11 and vnc displays label is a text area there scrolling\n"
+" information about actions being taken and commands being run is displayed.\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"
-"parameter name and one types in the new value. Then one presses the\n"
-"\\\"OK\\\" button or presses \\\"Enter\\\" to set the value. Or you can press\n"
-"\\\"Cancel\\\" or \\\"Escape\\\" to avoid changing the variable. Some variables\n"
-"are boolean toggles (for example, \\\"Permissions -> viewonly\\\") or Radio\n"
-"button selections. Selecting these menu items will not activate the\n"
-"entry area but rather toggle the variable directly.\n"
+" requires supplying a string value, the label will be set to the\n"
+" parameter name and one types in the new value. Then one presses the\n"
+" \\\"OK\\\" button or presses \\\"Enter\\\" to set the value. Or you can press\n"
+" \\\"Cancel\\\" or \\\"Escape\\\" to avoid changing the variable.\n"
"\n"
+" Many variables are boolean toggles (for example, \\\"Permissions ->\n"
+" viewonly\\\") or Radio button selections. Selecting these menu items\n"
+" will NOT activate the entry area but rather toggle the variable\n"
+" immediately.\n"
"\n"
-"Cascades Bug: There is a bug not yet worked around for the cascade menus\n"
+"\n"
+"CASCADES BUG: There is a bug not yet worked around for the cascade menus\n"
"where the (?) help button gets in the way. To get the mouse over to\n"
"the cascade menu click and release mouse to activate the cascade, then\n"
"you can click on its items. Dragging with a mouse button held down will\n"
@@ -677,7 +974,7 @@
" wm withdraw $w\n"
" set x [expr [winfo screenwidth $w]/2 - [winfo reqwidth $w]/2];\n"
" set y [expr [winfo screenheight $w]/2 - [winfo reqheight $w]/2];\n"
-" wm geom $w +$x+$y\n"
+" wm geometry $w +$x+$y\n"
" wm deiconify $w\n"
" update\n"
"}\n"
@@ -702,8 +999,21 @@
"}\n"
"\n"
"proc set_name {name} {\n"
-" global full_win\n"
-" if [info exists full_win] {\n"
+" global full_win icon_mode\n"
+" global saved_set_name\n"
+"\n"
+" if {![info exists saved_set_name]} {\n"
+" set saved_set_name \"tkx11vnc\"\n"
+" }\n"
+" if {$name == \"RESTORE\"} {\n"
+" set name $saved_set_name\n"
+" } else {\n"
+" set saved_set_name $name\n"
+" }\n"
+" if {![info exists full_win]} {\n"
+" return\n"
+" }\n"
+" if {$icon_mode} {\n"
" set w $full_win\n"
" } else {\n"
" set w \".\"\n"
@@ -763,6 +1073,16 @@
"\n"
"proc active_when_connected {item} {\n"
" global helpremote helptext\n"
+" global icon_mode\n"
+"\n"
+" if {$icon_mode} {\n"
+" if {$item == \"passwd\"} {\n"
+" return 1\n"
+" }\n"
+" if {$item == \"viewpasswd\"} {\n"
+" return 1\n"
+" }\n"
+" }\n"
"\n"
" if {[opt_match G $item]} {\n"
" return 1\n"
@@ -875,7 +1195,10 @@
" append text \"\\n\\n\"\n"
" append text \"==== current $item value: ====\\n\";\n"
" append text \"\\n\"\n"
-" if {$menu_var($item) == \"\"} {\n"
+"\n"
+" if {$item == \"passwd\" || $item == \"viewpasswd\"} {\n"
+" ;\n"
+" } elseif {$menu_var($item) == \"\"} {\n"
" append text \"$unset_str\\n\"\n"
" } else {\n"
" append text \"$menu_var($item)\\n\"\n"
@@ -1113,6 +1436,9 @@
"\n"
" foreach case [array names menu_b] {\n"
" set menu_button $menu_b($case)\n"
+" if {![winfo exists $menu_button]} {\n"
+" continue\n"
+" }\n"
" $menu_button configure -state $state\n"
" }\n"
"}\n"
@@ -1474,7 +1800,7 @@
" global ca_bk ca_bm ca_bb ca_bk ca_di\n"
"\n"
" append_text \"\\nUse these checkboxes to set the input permissions \"\n"
-" append_text \"for this client\\n-or- whether to disconnect it instead. \"\n"
+" append_text \"for this client\\n-OR- whether to disconnect it instead. \"\n"
" append_text \"Then press \\\"OK\\\" or \\\"Cancel\\\".\\n\\n\"\n"
" set w \"$text_area.ca_f\"\n"
" catch {destroy $w}\n"
@@ -1524,7 +1850,7 @@
"# with entry = 0.\n"
"proc entry_dialog {item {entry 1}} {\n"
" global menu_var entry_str entry_set entry_dialog_item\n"
-" global unset_str connected_to_x11vnc\n"
+" global unset_str connected_to_x11vnc entry_box\n"
"\n"
" set entry_str \"Set $item\"\n"
" set entry_set 0\n"
@@ -1533,6 +1859,10 @@
" entry_enable\n"
" menus_disable\n"
"\n"
+" if {$item == \"passwd\" || $item == \"viewpasswd\"} {\n"
+" $entry_box configure -show \"*\"\n"
+" }\n"
+"\n"
" if {$entry} {\n"
" entry_insert \"\"\n"
" if {[info exists menu_var($item)] &&\n"
@@ -1590,6 +1920,9 @@
" append_text \"skipped setting $item\\n\"\n"
" }\n"
" }\n"
+"\n"
+" $entry_box configure -show \"\"\n"
+"\n"
" return $rc\n"
"}\n"
"\n"
@@ -1816,7 +2149,26 @@
"}\n"
"\n"
"proc append_text {str} {\n"
-" global text_area\n"
+" global text_area text_area_str\n"
+"\n"
+" if {![info exists text_area_str]} {\n"
+" set text_area_str \"\"\n"
+" }\n"
+" append text_area_str $str\n"
+"\n"
+" if {![info exists text_area]} {\n"
+" puts stderr $str\n"
+" return\n"
+" }\n"
+" if {$text_area == \"\"} {\n"
+" puts stderr $str\n"
+" return\n"
+" }\n"
+" if {![winfo exists $text_area]} {\n"
+" puts stderr $str\n"
+" return\n"
+" }\n"
+" \n"
" $text_area insert end $str\n"
" $text_area see end\n"
"}\n"
@@ -1928,6 +2280,7 @@
" if {[in_debug_mode]} {\n"
" append_text \"action: \\\"$item\\\"\\n\"\n"
" }\n"
+"#puts \"action: \\\"$item\\\"\\n\"\n"
"\n"
" if {$item == \"ping\"} {\n"
" if {$beginner_mode} {\n"
@@ -1966,6 +2319,9 @@
" } elseif {$item == \"Misc-Tuning:\"} {\n"
" menu_help \"$item\"\n"
" return\n"
+" } elseif {$item == \"WindowView\"} {\n"
+" change_view_state\n"
+" return\n"
" } elseif {$item == \"stop+quit\"} {\n"
" do_stop_quit\n"
" }\n"
@@ -2008,7 +2364,7 @@
" set debug [in_debug_mode]\n"
"\n"
" set string 0\n"
-" if {[is_action $item]} {\n"
+" if {[is_action $item] || $item == \"WindowView\"} {\n"
" # Menu item is action:\n"
" if {$debug} {\n"
" ptime [time {do_action $item}]\n"
@@ -2018,6 +2374,7 @@
" return\n"
" }\n"
"\n"
+"\n"
" if {[value_is_string $item]} {\n"
" # Menu item is a string:\n"
" if {$item_cascade($item) != \"\"} {\n"
@@ -2164,8 +2521,12 @@
" set_name \"tkx11vnc - $name\"\n"
"}\n"
"proc set_vnc_display {name} {\n"
-" global vnc_display\n"
+" global vnc_display icon_mode\n"
" set vnc_display \"VNC display: $name\"\n"
+"\n"
+" if {$icon_mode} {\n"
+" set_icon_label\n"
+" }\n"
"}\n"
"proc set_vnc_url {name} {\n"
" global vnc_url\n"
@@ -2182,6 +2543,22 @@
" set_vnc_url \"(*none*)\"\n"
"}\n"
"\n"
+"proc get_vnc_display_number {} {\n"
+" global vnc_display\n"
+" if ![info exists vnc_display] {\n"
+" return \"none\"\n"
+" }\n"
+" if {$vnc_display == \"\"} {\n"
+" return \"none\"\n"
+" }\n"
+" set str $vnc_display\n"
+" regsub {VNC display: *} $str \"\" str\n"
+" if [regexp {:([0-9][0-9]*)} $str m0 n] {\n"
+" return $n\n"
+" }\n"
+" return \"none\"\n"
+"}\n"
+"\n"
"proc fetch_displays {} {\n"
"\n"
" set qargs [list \"-Q\" \"display,vncdisplay\"]\n"
@@ -2356,14 +2733,34 @@
"\n"
"proc update_clients_menu {list} {\n"
" global item_cascade ffont\n"
+" global saved_clients_str\n"
+"\n"
+" if {![info exists saved_clients_str]} {\n"
+" set saved_clients_str \"\"\n"
+" }\n"
+" if {$list == \"INIT\"} {\n"
+" set list $saved_clients_str\n"
+" } else {\n"
+" set saved_clients_str $list\n"
+" }\n"
+"\n"
" set subm $item_cascade(current);\n"
" catch {destroy $subm}\n"
" menu $subm -tearoff 0 -font $ffont\n"
" $subm add command\n"
-" $subm add command -label \"refresh-list\" -command \"update_clients_and_repost\"\n"
+" $subm add command -label \"refresh-list\" \\\n"
+" -command \"update_clients_and_repost\"\n"
" $subm add separator\n"
" set count 0\n"
" foreach client [split $list \",\"] {\n"
+" if {![regexp {^[a-z0-9]*[a-z0-9]:} $client]} {\n"
+" append_text \"Skipping client line: \"\n"
+" append_text $client\n"
+" append_text \"\\n\"\n"
+" continue\n"
+" }\n"
+" regsub -all {[{}()~!$&*|;'\"`{}<>\\[\\]]} $client \"\" client\n"
+" #'\n"
" if {[regexp {^(.*):(.*):(.*):(.*):(.*):(.*):(.*)$} \\\n"
" $client m0 m1 m2 m3 m4 m5 m6 m7]} {\n"
" # id:ip:port:user:hostname:input:loginvo\n"
@@ -2381,11 +2778,12 @@
"}\n"
"\n"
"proc set_widgets {} {\n"
-" global connected_to_x11vnc item_case item_entry menu_m\n"
+" global connected_to_x11vnc item_case item_menu item_entry menu_m\n"
"\n"
" foreach item [array names item_case] {\n"
" set case $item_case($item)\n"
-" set menu $menu_m($case)\n"
+"# set menu $menu_m($case)\n"
+" set menu $item_menu($item)\n"
" set entry $item_entry($item)\n"
" if {$entry < 0} {\n"
" # skip case under beginner_mode \n"
@@ -2395,21 +2793,20 @@
" if {$type == \"separator\" || $type == \"tearoff\"} {\n"
" continue\n"
" }\n"
+" if {![winfo exists $menu]} {\n"
+" continue\n"
+" }\n"
" if {$connected_to_x11vnc} {\n"
" if {[active_when_connected $item]} {\n"
" $menu entryconfigure $entry -state normal\n"
-"#puts \"n-1 $case / $item / $entry\"\n"
" } else {\n"
" $menu entryconfigure $entry -state disabled\n"
-"#puts \"I-1 $case / $item / $entry\"\n"
" }\n"
" } else {\n"
" if {[active_when_starting $item]} {\n"
" $menu entryconfigure $entry -state normal\n"
-"#puts \"n-2 $case / $item / $entry\"\n"
" } else {\n"
" $menu entryconfigure $entry -state disabled\n"
-"#puts \"I-2 $case / $item / $entry\"\n"
" }\n"
" }\n"
" }\n"
@@ -2417,7 +2814,7 @@
"\n"
"proc toggle_simple_gui {} {\n"
" global beginner_mode simple_gui_created\n"
-" global connected_to_x11vnc\n"
+" global connected_to_x11vnc make_gui_count\n"
"\n"
" if {$beginner_mode} {\n"
" append_text \"\\nSwitching to simple-gui mode.\\n\"\n"
@@ -2425,26 +2822,81 @@
" append_text \"\\nSwitching to power-user gui mode.\\n\"\n"
" }\n"
"\n"
+" if {$make_gui_count == 1} {\n"
+" incr make_gui_count\n"
+" }\n"
" set simple_gui_created 1\n"
" make_menu_items\n"
" set_widgets\n"
" set_internal_help\n"
-" if {$connected_to_x11vnc} {\n"
-" query_all\n"
-" }\n"
+"# if {$connected_to_x11vnc} {\n"
+"# query_all\n"
+"# }\n"
" append_text \"\\n\"\n"
"}\n"
"\n"
+"proc little_qs {m} {\n"
+" global bfont ffont beginner_mode\n"
+" global helpremote helptext helplabel\n"
+" global tk_version\n"
+"\n"
+" if {$tk_version < 8.0} {\n"
+" return\n"
+" }\n"
+"\n"
+" set n [$m index end]\n"
+"\n"
+" for {set i 0} {$i <= $n} {incr i} {\n"
+" set type [$m type $i]\n"
+"#puts \"$m - $i - $type\"\n"
+" if {$type == \"separator\"} {\n"
+" $m add separator\n"
+" } elseif {$type == \"tearoff\"} {\n"
+" continue;\n"
+" } else {\n"
+" set label [$m entrycget $i -label]\n"
+" set str \"\"\n"
+" if {[info exists helpremote($label)]} {\n"
+" set str \"(?)\"\n"
+" } elseif {[info exists helptext($label)]} {\n"
+" set str \"(?)\"\n"
+" }\n"
+" $m add command -label $str \\\n"
+" -font $ffont \\\n"
+" -command \"menu_help $label\";\n"
+"\n"
+" if {$str == \"\"} {\n"
+" $m entryconfigure end -state disabled\n"
+" }\n"
+" set arg \"$m,$i\"\n"
+"#puts \"helplabel: $arg -> $label\"\n"
+" set helplabel($arg) $label\n"
+" set j [$m index end]\n"
+" set arg \"$m,$j\"\n"
+" set helplabel($arg) $label\n"
+" }\n"
+" if {$i == 0} {\n"
+" $m entryconfigure end -columnbreak 1\n"
+" }\n"
+" }\n"
+"\n"
+" menu_bindings $m\n"
+"}\n"
+"\n"
"proc make_menu_items {} {\n"
" global template \n"
" global menu_b menu_m menu_count\n"
-" global item_opts item_bool item_case item_entry menu_var unset_str\n"
+" global item_opts item_bool item_case item_menu item_entry menu_var unset_str\n"
" global item_cascade\n"
" global bfont ffont beginner_mode simple_gui_created\n"
" global helptext helpremote helplabel\n"
"\n"
-" # Extract the menu items:\n"
" set case \"\";\n"
+" set L_casc \"\"\n"
+" set L_casc_count 0\n"
+" set L_menus [list]\n"
+"\n"
+" # Extract the menu items:\n"
" foreach line [split $template \"\\n\"] {\n"
" if {[regexp {^Row:} $line]} {\n"
" continue\n"
@@ -2454,10 +2906,9 @@
"\n"
" if {$simple_gui_created} {\n"
" set i0 0\n"
-" if {$case == \"Misc\"} {\n"
-" # kludge for simple_gui\n"
-" set i0 1\n"
-" }\n"
+" #if {$case == \"Misc\"} { # kludge for simple_gui\n"
+" # set i0 1\n"
+" #}\n"
" catch {$menu_m($case) delete $i0 end}\n"
" }\n"
" set menu_count($case) 0\n"
@@ -2485,6 +2936,11 @@
" }\n"
" regsub {:$} $item {} item\n"
"\n"
+" if {$item == \"LOFF\"} {\n"
+" set L_casc \"\"\n"
+" continue\n"
+" }\n"
+"\n"
" if {$item == \"-- D\"} {\n"
" set beginner_sep 1\n"
" set item \"--\"\n"
@@ -2496,17 +2952,27 @@
" set item_case($item) $case\n"
" set item_bool($item) $bool\n"
" set item_cascade($item) \"\"\n"
-" set item_entry($item) $menu_count($case)\n"
+"\n"
+" if {$L_casc == \"\"} {\n"
+" set item_entry($item) $menu_count($case)\n"
+" set m $menu_m($case)\n"
+" } else {\n"
+" # hack for cascades for crowded menus. See =GAL opts.\n"
+" set item_entry($item) $L_casc_count\n"
+" set m $L_casc\n"
+" }\n"
"\n"
" set mvar 0 \n"
-" set m $menu_m($case)\n"
"\n"
" if {$beginner_mode && ! $beginner_sep && ![opt_match D $item]} {\n"
" set item_entry($item) \"-1\"\n"
" continue;\n"
" }\n"
"\n"
-" if {0} { puts \"ITEM: $item\\t- $opts\\t- $case\\t- $bool\\t- $menu_count($case)\" }\n"
+" set item_menu($item) $m\n"
+"\n"
+" if {0} { puts \"ITEM: $item\\t- $opts\\t- $case\\t- \\\n"
+" $bool\\t- $menu_count($case)\" }\n"
"\n"
" # Create the menu items, its variables, etc., etc.\n"
"\n"
@@ -2525,12 +2991,25 @@
" -font $ffont \\\n"
" -command \"menu_help $item\"\n"
"\n"
+" } elseif {[opt_match L $item]} {\n"
+" # Special sub-menu cascade (=GAL ends with LOFF)\n"
+" set subm $m.casc_L$menu_count($case)\n"
+" catch {destroy $subm}\n"
+" menu $subm -tearoff 0 -font $ffont\n"
+" set item_cascade($item) $subm\n"
+" $m add cascade -label \"$item\" \\\n"
+" -font $ffont \\\n"
+" -menu $subm\n"
+" set L_casc $subm\n"
+" set L_casc_count -1\n"
+" lappend L_menus $L_casc\n"
+"\n"
" } elseif {$item == \"current\"} {\n"
" # Current clients cascade\n"
" set subm $m.current_cascade\n"
" catch {destroy $subm}\n"
" set item_cascade($item) $subm\n"
-" update_clients_menu \"\"\n"
+" update_clients_menu \"INIT\"\n"
" $m add cascade -label \"$item\" \\\n"
" -font $ffont \\\n"
" -menu $subm\n"
@@ -2540,7 +3019,9 @@
" $m add command -label \"$item\" \\\n"
" -font $ffont \\\n"
" -command \"do_var $item\"\n"
-" set menu_var($item) \"\"; # for convenience\n"
+" if {![info exists menu_var($item)]} {\n"
+" set menu_var($item) \"\"; # for convenience\n"
+" }\n"
"\n"
" } elseif {! $item_bool($item)} {\n"
" # String\n"
@@ -2569,25 +3050,34 @@
" set mvar 1\n"
"\n"
" } elseif {$item == \"simple-gui\"} {\n"
-" if {! $simple_gui_created} {\n"
-" $m add checkbutton -label \"$item\" \\\n"
-" -command \"toggle_simple_gui\" \\\n"
-" -font $ffont \\\n"
-" -variable beginner_mode\n"
-" }\n"
+" $m add checkbutton -label \"$item\" \\\n"
+" -command \"toggle_simple_gui\" \\\n"
+" -font $ffont \\\n"
+" -variable beginner_mode\n"
" } else {\n"
" # Boolean\n"
" $m add checkbutton -label \"$item\" \\\n"
" -command \"do_var $item\" \\\n"
" -font $ffont \\\n"
" -variable menu_var($item)\n"
-" set menu_var($item) 0\n"
+" if {![info exists menu_var($item)]} {\n"
+" set menu_var($item) 0\n"
+" }\n"
" }\n"
"\n"
-" incr menu_count($case)\n"
+" if {$L_casc_count == -1} {\n"
+" incr menu_count($case)\n"
+" incr L_casc_count\n"
+" } elseif {$L_casc != \"\"} {\n"
+" incr L_casc_count\n"
+" } else {\n"
+" incr menu_count($case)\n"
+" }\n"
"\n"
" if {$mvar} {\n"
-" set menu_var($item) $unset_str\n"
+" if {![info exists menu_var($item)]} {\n"
+" set menu_var($item) $unset_str\n"
+" }\n"
" }\n"
" }\n"
"\n"
@@ -2596,52 +3086,28 @@
" if {$case == \"Help\"} {\n"
" continue;\n"
" }\n"
-" set m $menu_m($case);\n"
-" set n [$m index end]\n"
-"\n"
-" for {set i 0} {$i <= $n} {incr i} {\n"
-" set type [$m type $i]\n"
-" if {$type == \"separator\"} {\n"
-" $m add separator\n"
-" } elseif {$type == \"tearoff\"} {\n"
-" continue;\n"
-" } else {\n"
-" set label [$m entrycget $i -label]\n"
-" set str \"\"\n"
-" if {[info exists helpremote($label)]} {\n"
-" set str \"(?)\"\n"
-" } elseif {[info exists helptext($label)]} {\n"
-" set str \"(?)\"\n"
-" }\n"
-" $m add command -label $str \\\n"
-" -font $ffont \\\n"
-" -command \"menu_help $label\";\n"
-"\n"
-" if {$str == \"\"} {\n"
-" $m entryconfigure end -state disabled\n"
-" }\n"
-" set arg \"$m,$i\"\n"
-" set helplabel($arg) $label\n"
-" set j [$m index end]\n"
-" set arg \"$m,$j\"\n"
-" set helplabel($arg) $label\n"
-" }\n"
-" if {$i == 0} {\n"
-" $m entryconfigure end -columnbreak 1\n"
-" }\n"
-" }\n"
+" little_qs $menu_m($case);\n"
+" }\n"
+" foreach m $L_menus {\n"
+" little_qs $m\n"
" }\n"
"}\n"
"\n"
"proc menu_posted {} {\n"
-" global last_query_all_time query_all_freq\n"
-" global connected_to_x11vnc\n"
+" global last_query_all_time query_all_freq icon_mode\n"
+" global connected_to_x11vnc client_tail\n"
+"\n"
" set now [clock seconds]\n"
"\n"
+" if {$icon_mode && $client_tail != \"\"} {\n"
+" set delay [expr 2 * $query_all_freq]\n"
+" } else {\n"
+" set delay $query_all_freq\n"
+" }\n"
"\n"
" if {$connected_to_x11vnc} {\n"
" set quiet 0\n"
-" set refresh [expr \"$last_query_all_time + $query_all_freq\"]\n"
+" set refresh [expr \"$last_query_all_time + $delay\"]\n"
"\n"
" # puts \"menu_posted $now $last_query_all_time\"\n"
" # puts \"menu_posted $refresh\"\n"
@@ -2656,6 +3122,14 @@
" }\n"
"}\n"
"\n"
+"proc props_widgets {state} {\n"
+" global props_buttons\n"
+" foreach w $props_buttons {\n"
+" $w configure -state $state \n"
+" }\n"
+" update\n"
+"}\n"
+"\n"
"proc props_apply {} {\n"
" global props_accept props_confirm props_viewonly props_shared\n"
" global props_passwd props_viewpasswd\n"
@@ -2663,6 +3137,8 @@
" global prop0_passwd prop0_viewpasswd\n"
" global menu_var\n"
"\n"
+" props_widgets disabled\n"
+"\n"
" if {$props_accept != $prop0_accept} {\n"
" if {$props_accept} {\n"
" push_new_value \"unlock\" \"unlock\" 1 0\n"
@@ -2732,13 +3208,13 @@
" set prop0_viewpasswd $props_viewpasswd\n"
" after 500\n"
" }\n"
+" props_widgets normal\n"
"}\n"
"\n"
"proc props_advanced {} {\n"
-" global tray_mode icon_win props_win full_win\n"
+" global icon_mode icon_win props_win full_win\n"
" global props_advanced_first\n"
"\n"
-"\n"
" if ![info exists props_advanced_first] {\n"
" center_win $full_win\n"
" set props_advanced_first 1\n"
@@ -2755,13 +3231,14 @@
" }\n"
"}\n"
"\n"
-"proc do_props {} {\n"
+"proc do_props {{msg \"\"}} {\n"
" global props_accept props_confirm props_viewonly props_shared\n"
" global props_passwd props_viewpasswd\n"
" global prop0_accept prop0_confirm prop0_viewonly prop0_shared\n"
" global prop0_passwd prop0_viewpasswd\n"
" global menu_var unset_str\n"
" global have_labelframes ffont bfont\n"
+" global props_buttons icon_noadvanced\n"
"\n"
" if ![info exists props_accept] {\n"
" set props_accept 1\n"
@@ -2818,10 +3295,15 @@
" }\n"
" set prop0_viewpasswd $props_viewpasswd\n"
"\n"
+" if [info exists props_buttons] {\n"
+" catch {unset props_buttons}\n"
+" }\n"
+" set props_buttons [list]\n"
+"\n"
" set w .props\n"
" catch {destroy $w}\n"
" toplevel $w\n"
-" wm title $w \"Properties\"\n"
+" wm title $w \"x11vnc Properties\"\n"
" set b1 \"$w.buttons1\"\n"
" frame $b1\n"
" button $b1.ok -text OK -command \"props_apply; destroy $w\" -font $bfont\n"
@@ -2829,14 +3311,21 @@
" button $b1.apply -text Apply -command \"props_apply\" -font $bfont\n"
"\n"
" pack $b1.apply $b1.cancel $b1.ok -side right -expand 1\n"
+" lappend props_buttons $b1.apply $b1.cancel $b1.ok\n"
"\n"
" set b2 \"$w.buttons2\"\n"
" frame $b2\n"
"\n"
" button $b2.advanced -text \"Advanced ...\" \\\n"
" -command \"destroy $w; props_advanced\" -font $bfont\n"
+" if {! $icon_noadvanced} {\n"
+" lappend props_buttons $b2.advanced\n"
+" pack $b2.advanced -side right -expand 1\n"
+" }\n"
+"\n"
" button $b2.help -text \"Help ...\" -command \"menu_help Properties\" -font $bfont\n"
-" pack $b2.advanced $b2.help -side right -expand 1\n"
+" lappend props_buttons $b2.help\n"
+" pack $b2.help -side right -expand 1\n"
"\n"
" set vp \"$w.viewpw\"\n"
" if {$have_labelframes} {\n"
@@ -2850,6 +3339,8 @@
" entry $vp.e -show \"*\" -textvariable props_viewpasswd -font $bfont\n"
" pack $vp.e -fill x -expand 1 -padx 1m -pady 1m -side top\n"
"\n"
+" lappend props_buttons $vp.e\n"
+"\n"
" set pw \"$w.passwd\"\n"
" if {$have_labelframes} {\n"
" labelframe $pw -text \"Password\" -font $bfont\n"
@@ -2862,6 +3353,8 @@
" entry $pw.e -show \"*\" -textvariable props_passwd -font $bfont\n"
" pack $pw.e -fill x -expand 1 -padx 1m -pady 1m -side top\n"
"\n"
+" lappend props_buttons $pw.e\n"
+"\n"
" set sh \"$w.shared\"\n"
" frame $sh\n"
" checkbutton $sh.button -text \"Shared\" \\\n"
@@ -2886,14 +3379,27 @@
" -variable props_accept -anchor w -font $bfont\n"
" pack $ac.button -fill x -expand 1 -padx 1m -pady 1m\n"
"\n"
-" pack $b1 -side bottom -fill x -pady 1m -padx 2m\n"
-" pack $b2 -side bottom -fill x -pady 1m -padx 2m\n"
-" pack $vp -side bottom -fill x -pady 1m -padx 2m\n"
-" pack $pw -side bottom -fill x -pady 1m -padx 2m\n"
-" pack $sh -side bottom -fill x -pady 0m -padx 2m\n"
-" pack $vo -side bottom -fill x -pady 0m -padx 2m\n"
-" pack $cf -side bottom -fill x -pady 0m -padx 2m\n"
-" pack $ac -side bottom -fill x -pady 0m -padx 2m\n"
+" set px \"6m\"\n"
+" pack $b1 -side bottom -fill x -pady 1m -padx $px\n"
+" pack $b2 -side bottom -fill x -pady 1m -padx $px\n"
+" pack $vp -side bottom -fill x -pady 1m -padx $px\n"
+" pack $pw -side bottom -fill x -pady 1m -padx $px\n"
+" pack $sh -side bottom -fill x -pady 0m -padx $px\n"
+" pack $vo -side bottom -fill x -pady 0m -padx $px\n"
+" pack $cf -side bottom -fill x -pady 0m -padx $px\n"
+" pack $ac -side bottom -fill x -pady 0m -padx $px\n"
+"\n"
+" if {$msg != \"\"} {\n"
+" set tw [textwidth $msg]\n"
+" set th [textheight $msg]\n"
+" set th [expr $th - 1]\n"
+" set ms \"$w.msg\"\n"
+" text $ms -font $ffont -relief ridge -width $tw -height $th\n"
+" $ms insert 1.0 $msg\n"
+" pack $ms -side bottom -fill x -pady 1m -padx $px\n"
+" }\n"
+"\n"
+" lappend props_buttons $ac.button $cf.button $vo.button $sh.button\n"
"\n"
" wm resizable $w 1 0\n"
" center_win $w\n"
@@ -2922,6 +3428,8 @@
" \n"
" tkwait window $w\n"
"\n"
+" regsub -all {[{}()~!$&*|;'\"`{}<>\\[\\]]} $newclient \"\" newclient\n"
+" #'\n"
" if {$newclient != \"\"} {\n"
" push_new_value \"connect\" \"connect\" \"$newclient\" 1\n"
" }\n"
@@ -2932,6 +3440,9 @@
"}\n"
"\n"
"proc pmenu {m x y} {\n"
+" if {![winfo exists $m]} {\n"
+" return\n"
+" }\n"
" set x [expr $x-10]\n"
" set y [expr $y-10]\n"
" $m post $x $y\n"
@@ -2981,31 +3492,22 @@
"\n"
"proc read_client_info {} {\n"
" global x11vnc_client_file client_tail client_str\n"
-" global unlinked_x11vnc_client_file\n"
+" global client_tail_read\n"
+" set db 0\n"
+"\n"
" if {$client_tail != \"\"} {\n"
" after 100\n"
" set str \"\"\n"
" set count [gets $client_tail str]\n"
+" if {$db} {puts stderr \"read_client_info: $str\"}\n"
"\n"
-" # we can unlink the file early since both processes\n"
-" # have it open.\n"
-" if ![info exists unlinked_x11vnc_client_file] {\n"
-" set unlinked_x11vnc_client_file 0\n"
-" } elseif {$unlinked_x11vnc_client_file == \"\"} {\n"
-" set unlinked_x11vnc_client_file 0\n"
-" }\n"
-" if {! $unlinked_x11vnc_client_file} {\n"
-" after 500\n"
-" catch {file delete $x11vnc_client_file}\n"
-" set unlinked_x11vnc_client_file 1\n"
-" }\n"
-"\n"
-" if {$count == -1} {\n"
+" if {$count == -1 || [eof $client_tail]} {\n"
" close $client_tail\n"
" catch {file delete $x11vnc_client_file}\n"
" clean_icon_exit\n"
" }\n"
" if {$count > 0 && ![regexp {^[ ]*$} $str]} {\n"
+" set client_tail_read 1\n"
" if {$str == \"quit\"} {\n"
" catch {file delete $x11vnc_client_file}\n"
" clean_icon_exit\n"
@@ -3022,14 +3524,16 @@
"}\n"
"\n"
"proc show_client_balloon {} {\n"
-" global tray_mode icon_win props_win full_win\n"
+" global icon_mode icon_win props_win full_win\n"
" global client_balloon ffont\n"
"\n"
+" set noinfo \"tkx11vnc: no client information\"\n"
+" set noinfo \"$noinfo\\navailable from x11vnc ...\"\n"
" if ![info exists client_balloon] {\n"
-" set client_balloon \"tkx11vnc ...\"\n"
+" set client_balloon $noinfo\n"
" }\n"
" if {$client_balloon == \"\"} {\n"
-" set client_balloon \"tkx11vnc ...\"\n"
+" set client_balloon $noinfo\n"
" }\n"
"\n"
" set x [expr [winfo rootx $icon_win] + ([winfo width $icon_win]/2)]\n"
@@ -3072,67 +3576,288 @@
"}\n"
"\n"
"proc icon_win_cfg {clients} {\n"
-" global icon_win\n"
+" global icon_win client_tail client_tail_read\n"
" if {$clients > 0} {\n"
" $icon_win configure -bg black -fg white\n"
" } else {\n"
" $icon_win configure -bg white -fg black\n"
" }\n"
+" if {$client_tail == \"\" || !$client_tail_read} {\n"
+" $icon_win configure -fg red\n"
+" }\n"
+"}\n"
+"\n"
+"proc server_accept {sock addr port} {\n"
+" global socket_cookie server socket_got_callback\n"
+" global client_tail\n"
+" set db 0\n"
+"\n"
+" if {$db} {puts stderr \"sock=$sock addr=$addr port=$port\"}\n"
+"\n"
+" update; update idletasks\n"
+" after 50\n"
+" update; update idletasks\n"
+" set count [gets $sock str]\n"
+"\n"
+" if {$count >= 0} {\n"
+" set str [string trim $str]\n"
+" if {$db} {puts stderr \"server_accept: \\\"$str\\\"\"}\n"
+" if {$str == \"COOKIE:$socket_cookie\"} {\n"
+" set client_tail $sock\n"
+" if {$db} {puts stderr \"cookie matched. $client_tail\"}\n"
+" } else {\n"
+" if {$db} {puts stderr \"cookie NO matched.\"}\n"
+" }\n"
+" }\n"
+" catch {close $server}\n"
+" set socket_got_callback 1\n"
+" if {$db} {puts stderr \"socket_got_callback $socket_got_callback\"}\n"
+"}\n"
+"\n"
+"proc try_client_info_sock {} {\n"
+" global socket_cookie server socket_got_callback\n"
+" global x11vnc_started hostname\n"
+" set start 13037\n"
+" set tries 100\n"
+" set socket_got_callback 0\n"
+"\n"
+" if {$x11vnc_started} {\n"
+" set myaddr \"127.0.0.1\"\n"
+" } else {\n"
+" set myaddr $hostname\n"
+" }\n"
+" set socket_cookie [clock clicks]\n"
+" \n"
+" for {set i 0} {$i <= $tries} {incr i} {\n"
+" set port [expr $start + $i]\n"
+" set server [socket -server server_accept -myaddr $myaddr $port]\n"
+" if {$server == \"\"} {\n"
+" continue\n"
+" }\n"
+" if {[eof $server]} {\n"
+" continue\n"
+" }\n"
+" set err \"\"\n"
+" catch {set err [fconfigure $server -error]}\n"
+" #puts \"err: $server: $err\"\n"
+" if {$err == \"\"} {\n"
+" break\n"
+" }\n"
+" }\n"
+" if {$server == \"\"} {\n"
+" append_text \"try_client_info_sock: server socket failed.\\n\"\n"
+" return\n"
+" }\n"
+" run_remote_cmd [list \"-nosync\" \"-R\" \"noop\"]\n"
+" after 500\n"
+" run_remote_cmd [list \"-nosync\" \"-R\" \\\n"
+" \"client_info_sock:$myaddr:$port:$socket_cookie\"]\n"
+" after 500\n"
+"\n"
+" set aftid \"\"\n"
+" if {$socket_got_callback == 0} {\n"
+" set aftid [after 10000 {set socket_got_callback 2}]\n"
+" tkwait variable socket_got_callback\n"
+" }\n"
+"\n"
+" if {$aftid != \"\"} {\n"
+" catch {after cancel $aftid}\n"
+" }\n"
+"\n"
+" if {$socket_got_callback != 1} {\n"
+" puts stderr \"try_client_info_sock failed: no callback\\n\"\n"
+" catch {close $server}\n"
+" } else {\n"
+" setup_client_tail\n"
+" }\n"
+"}\n"
+"\n"
+"proc set_icon_label {} {\n"
+" global icon_win\n"
+"\n"
+" set lab [get_icon_label]\n"
+" \n"
+" if {[info exists icon_win]} {\n"
+" $icon_win configure -text $lab\n"
+" }\n"
+"}\n"
+"\n"
+"proc get_icon_label {{set 0}} {\n"
+" global icon_minimal \n"
+"\n"
+" set lab0 \"x11\\nvnc\"\n"
+" \n"
+" if {$icon_minimal} {\n"
+" set lab [get_vnc_display_number]\n"
+" if {$lab != \"none\"} {\n"
+" set lab \" :$lab\"\n"
+" }\n"
+" } else {\n"
+" set lab $lab0\n"
+" }\n"
+" return $lab\n"
+"}\n"
+"\n"
+"proc lmenu {menu} {\n"
+" global window_view_posted\n"
+" after 100\n"
+" if {!$window_view_posted} {\n"
+" after 100\n"
+" if {!$window_view_posted} {\n"
+" $menu unpost\n"
+" return\n"
+" }\n"
+" }\n"
+" # kludge for WindowView\n"
+" focus $menu\n"
+"}\n"
+"\n"
+"proc old_balloon {} {\n"
+" global client_str saved_client_str\n"
+" set str \"\"\n"
+" if {[info exists client_str]} {\n"
+" if {$client_str != \"\"} {\n"
+" set str $client_str\n"
+" }\n"
+" }\n"
+" if {$str == \"\"} {\n"
+" if {[info exists saved_client_str]} {\n"
+" set str $saved_client_str\n"
+" }\n"
+" }\n"
+" if {$str != \"\"} {\n"
+" set_client_balloon $str\n"
+" }\n"
"}\n"
"\n"
"proc make_icon {} {\n"
-" global tray_mode tray_embed_id icon_win props_win full_win\n"
-" global x11vnc_client_file client_tail client_str\n"
+" global icon_mode icon_embed_id icon_win props_win full_win\n"
+" global tray_embed tray_running env\n"
+" global x11vnc_client_file client_tail client_str saved_clients_str\n"
" global client_balloon_id\n"
-" global bfont ffont\n"
+" global bfont sfont ffont\n"
+" global icon_minimal gui_start_mode\n"
+" global window_view_posted menu_var x11vnc_gui_geom\n"
+" set min_x 24\n"
+" set min_y 24\n"
" \n"
-"# if {$tray_embed_id != \"\"} {\n"
-"# wm withdraw .\n"
-"# set top \".icon\"\n"
-"# toplevel $top -use $tray_embed_id\n"
-"# }\n"
+" set font $bfont\n"
+" if {$tray_embed} {\n"
+" set font $sfont\n"
+" }\n"
+" if {[info exists env(X11VNC_ICON_FONT)]} {\n"
+" set font $env(X11VNC_ICON_FONT)\n"
+" }\n"
+" if {[regexp {([0-9][0-9]*)x([0-9][0-9]*)} $x11vnc_gui_geom m mx my]} {\n"
+" if {$mx < $min_x} {\n"
+" set min_x $mx\n"
+" }\n"
+" if {$my < $min_y} {\n"
+" set min_y $my\n"
+" }\n"
+" }\n"
+" wm minsize . $min_x $min_y\n"
"\n"
-" set l .label\n"
+" if {$tray_embed && $tray_running} {\n"
+" wm withdraw .\n"
+" }\n"
+"\n"
+" set l .icon\n"
" set icon_win $l\n"
-" label $l -text \"x11\\nvnc\" -borderwidth 5 -font $bfont\n"
+" catch destroy {$icon_win}\n"
+" if {$icon_minimal} {\n"
+" set bw 1\n"
+" } else {\n"
+" set bw 5\n"
+" }\n"
+" set lab [get_icon_label]\n"
+" label $l -text $lab -borderwidth $bw -font $font\n"
" icon_win_cfg 0\n"
"\n"
-" pack $l\n"
+" set window_view_posted 0\n"
+" pack $l -fill both -expand 1\n"
" set menu \"$l.menu\"\n"
-" menu $menu -tearoff 0\n"
-" $menu add command -font $bfont -label \"Properties\" -command do_props\n"
-" $menu add command -font $bfont -label \"Help\" -command \"menu_help Tray\"\n"
+" menu $menu -tearoff 0 -postcommand {set window_view_posted 0}\n"
+" $menu add command -font $font -label \"Properties\" -command do_props\n"
+" $menu add command -font $font -label \"Help\" -command \"menu_help Tray\"\n"
" $menu add separator\n"
-" $menu add command -font $bfont -label \"New Client\" -command do_new_client\n"
-" $menu add command -font $bfont -label \"Disconnect All\" -command do_disconnect_all\n"
+" $menu add command -font $font -label \"New Client\" -command do_new_client\n"
+" $menu add command -font $font -label \"Disconnect All\" -command do_disconnect_all\n"
" $menu add separator\n"
-" $menu add command -font $bfont -label \"Stop x11vnc\" -command clean_icon_exit\n"
"\n"
-" bind . <Button-1> \"pmenu $menu %X %Y\"\n"
-" bind . <Button-3> \"pmenu $menu %X %Y\"\n"
-" bind $menu <Leave> \"after 200; $menu unpost\"\n"
-"\n"
-" if {$x11vnc_client_file != \"\" } {\n"
-" if ![file exists $x11vnc_client_file] {\n"
-" set fh [open $x11vnc_client_file \"w\"]\n"
-" puts $fh \"skip\"\n"
-" close $fh\n"
-" }\n"
-" if [file exists $x11vnc_client_file] {\n"
-" set client_tail [open \"|tail -f $x11vnc_client_file\" \"r\"]\n"
-" }\n"
+" set wv \"$menu.casc1\"\n"
+" catch {destroy $wv}\n"
+" menu $wv -tearoff 0 -font $ffont \\\n"
+" -postcommand {set window_view_posted 1}\n"
+" foreach val {full icon tray} {\n"
+" $wv add radiobutton -label \"$val\" \\\n"
+" -value \"$val\" -font $ffont \\\n"
+" -command \"do_var WindowView\" \\\n"
+" -variable menu_var(WindowView)\n"
" }\n"
+" $menu add cascade -font $font -label \"Window View\" -menu $wv\n"
"\n"
+" $menu add command -font $font -label \"Stop x11vnc\" -command clean_icon_exit\n"
+"\n"
+" bind $icon_win <ButtonPress-1> \"pmenu $menu %X %Y\"\n"
+" bind $icon_win <ButtonPress-3> \"pmenu $menu %X %Y\"\n"
" bind $icon_win <Enter> {set client_balloon_id [after 500 show_client_balloon]}\n"
" bind $icon_win <Button> {kill_client_balloon}\n"
" bind $icon_win <Leave> {kill_client_balloon}\n"
+" bind $icon_win <ButtonPress-2> {kill_client_balloon; show_client_balloon}\n"
+" bind $menu <Leave> \"lmenu $menu\"\n"
+" bind $menu <KeyPress-Escape> \"$menu unpost\"\n"
+"\n"
+" if {!$tray_embed || !$tray_running} {\n"
+" global x11vnc_gui_geom\n"
+" if {$x11vnc_gui_geom != \"\"} {\n"
+" set doit 1\n"
+" if {[regexp {x} $x11vnc_gui_geom]} {\n"
+" if {$gui_start_mode == \"full\"} {\n"
+" set doit 0\n"
+" }\n"
+" } \n"
+" if {$doit} {\n"
+" wm geometry . $x11vnc_gui_geom\n"
+" }\n"
+" }\n"
+" }\n"
+" wm deiconify .\n"
+"\n"
+" if {$client_tail == \"\" } {\n"
+" stop_watch on\n"
+" try_client_info_sock\n"
+" if {$client_tail == \"\" } {\n"
+" after 500\n"
+" try_client_info_sock\n"
+" }\n"
+" stop_watch off\n"
+" }\n"
+" if {$client_tail == \"\" } {\n"
+" set m \"\\n\"\n"
+" set m \"${m}tkx11vnc:\\n\"\n"
+" set m \"${m}\\n\"\n"
+" set m \"${m} Warning -- running in icon/tray mode but the\\n\"\n"
+" set m \"${m} connected client info channel from x11vnc is\\n\"\n"
+" set m \"${m} not working. The viewer client list and icon\\n\"\n"
+" set m \"${m} color indicator will not be accurate.\\n\"\n"
+" set m \"${m}\\n\"\n"
+" set m \"${m} You may need to restart \\\"x11vnc -gui tray ...\\\"\\n\"\n"
+" set m \"${m} for this to work properly.\\n\"\n"
+" set m \"${m}\\n\"\n"
+" textwin \"Warning\" \"Warning\" $m\n"
+" update\n"
+" }\n"
+"\n"
+" old_balloon\n"
"}\n"
"\n"
-"proc clean_icon_exit {} {\n"
-" global client_tail\n"
+"proc clean_client_tail {} {\n"
+" global client_tail client_tail_read\n"
" if [info exists client_tail] {\n"
" if {$client_tail != \"\"} {\n"
-" set p [pid $client_tail]\n"
+" set p \"\"\n"
+" catch {set p [pid $client_tail]}\n"
" if {$p != \"\"} {\n"
" catch {exec kill -TERM $p >/dev/null 2>/dev/null}\n"
" }\n"
@@ -3140,6 +3865,11 @@
" set client_tail \"\"\n"
" }\n"
" }\n"
+" set client_tail_read 0\n"
+"}\n"
+"\n"
+"proc clean_icon_exit {} {\n"
+" clean_client_tail\n"
" push_new_value \"stop\" \"stop\" 1 0\n"
" set_connected no\n"
" update\n"
@@ -3147,31 +3877,122 @@
" exit\n"
"}\n"
"\n"
-"proc make_widgets {} {\n"
-" global template \n"
+"proc make_gui {mode} {\n"
+" global icon_mode tray_embed full_win icon_win\n"
+" global top_widget_names x11vnc_gui_geom\n"
+" global gui_current_state make_gui_count\n"
+" global x11vnc_connect connected_to_x11vnc\n"
+" global x11_display\n"
+" global gui_start_mode\n"
+"\n"
+" incr make_gui_count\n"
+"\n"
+" if {$gui_start_mode == \"\"} {\n"
+" set gui_start_mode $mode\n"
+" }\n"
+"\n"
+" wm withdraw .\n"
+"\n"
+" set full_geom \"\"\n"
+" if {[winfo exists .full]} {\n"
+" catch {set full_geom [wm geometry .full]}\n"
+" }\n"
+"\n"
+" set fw .full\n"
+" set full_win $fw\n"
+" catch {pack forget $full_win}\n"
+" catch {pack forget $icon_win}\n"
+" catch {destroy $full_win}\n"
+" catch {destroy $icon_win}\n"
+"\n"
+" wm minsize . 1 1\n"
+"\n"
+" if {$mode == \"full\"} {\n"
+" frame $fw\n"
+" set icon_mode 0\n"
+"\n"
+" wm protocol . WM_DELETE_WINDOW \"destroy .; exit\"\n"
+" make_widgets $fw\n"
+"\n"
+" set w \".\"\n"
+" wm geometry $w \"\"\n"
+" if {$x11vnc_gui_geom != \"\"} {\n"
+" set doit 1\n"
+" if {[regexp {x} $x11vnc_gui_geom]} {\n"
+" if {$gui_start_mode != $mode} {\n"
+" set doit 0\n"
+" }\n"
+" }\n"
+" if {$doit} {\n"
+" wm geometry $w $x11vnc_gui_geom\n"
+" }\n"
+" }\n"
+" pack $fw -fill both -expand 1\n"
+"\n"
+" } elseif {$mode == \"icon\" || $mode == \"tray\"} {\n"
+"\n"
+" toplevel $fw\n"
+" wm withdraw $fw\n"
+"\n"
+" wm protocol $fw WM_DELETE_WINDOW \"wm withdraw .full\"\n"
+" wm protocol . WM_DELETE_WINDOW \"clean_icon_exit\"\n"
+" \n"
+" if {$mode == \"icon\"} {\n"
+" set tray_embed 0\n"
+" } elseif {$mode == \"tray\"} {\n"
+" set tray_embed 1\n"
+" }\n"
+" set icon_mode 1\n"
+" make_widgets $fw\n"
+" set w $fw\n"
+" make_icon\n"
+" wm geometry $fw \"\"\n"
+" wm geometry . \"\"\n"
+" } else {\n"
+" return\n"
+" }\n"
+" set_view_variable $mode\n"
+" set gui_current_state $mode\n"
+"\n"
+"\n"
+" wm deiconify .\n"
+" update idletasks\n"
+" wm minsize $w [winfo width $w] [winfo height $w]\n"
+" if {$mode == \"full\" && $make_gui_count > 1} {\n"
+" center_win .\n"
+" }\n"
+"\n"
+" if {$make_gui_count == 1} {\n"
+" if {$x11vnc_connect} {\n"
+" try_connect_and_query_all\n"
+" }\n"
+" } else {\n"
+" set_name \"RESTORE\"\n"
+" }\n"
+" set_widgets\n"
+"\n"
+" if {$mode == \"icon\" || $mode == \"tray\"} {\n"
+" setup_client_tail\n"
+" if {$mode == \"tray\"} {\n"
+" setup_tray_embed\n"
+" }\n"
+" }\n"
+"}\n"
+"\n"
+"proc make_widgets {top} {\n"
+" global template make_gui_count\n"
" global menu_b menu_m menu_count\n"
-" global item_opts item_bool item_case item_entry menu_var unset_str\n"
+" global item_opts item_bool item_case item_menu item_entry menu_var unset_str\n"
" global item_cascade\n"
" global info_label info_str x11_display vnc_display\n"
-" global text_area\n"
+" global text_area text_area_str\n"
" global entry_box entry_str entry_set entry_label entry_ok entry_browse\n"
" global entry_help entry_skip\n"
" global bfont ffont beginner_mode\n"
" global helptext helpremote helplabel\n"
-" global tray_mode icon_win props_win full_win\n"
-"\n"
-" if {$tray_mode} {\n"
-" set top \".advanced\"\n"
-" toplevel $top\n"
-" wm withdraw $top\n"
-" set full_win $top\n"
-" wm protocol $top WM_DELETE_WINDOW \"wm withdraw $top\"\n"
-" wm protocol . WM_DELETE_WINDOW \"clean_icon_exit\"\n"
-" make_icon\n"
-" } else {\n"
-" set top \"\"\n"
-" set full_win \".\"\n"
-" }\n"
+" global icon_mode icon_win props_win full_win\n"
+" global top_widget_names\n"
+"\n"
"\n"
" # Make the top label\n"
" set label_width 80\n"
@@ -3180,6 +4001,8 @@
" -anchor w -width $label_width -font $ffont\n"
" pack $info_label -side top -fill x -expand 0\n"
"\n"
+" set top_widget_names(info) $info_label\n"
+"\n"
" # Extract the Rows:\n"
" set row 0;\n"
" set colmax 0;\n"
@@ -3241,22 +4064,29 @@
" }\n"
" }\n"
" pack $f -side top -fill x\n"
+" set top_widget_names(menuframe) $f\n"
"\n"
" make_menu_items\n"
"\n"
" # Make the x11 and vnc display label bar:\n"
" set df \"$top.displayframe\"\n"
" frame $df -bd 1 -relief groove\n"
+" set top_widget_names(displayframe) $df\n"
"\n"
" set df_x11 \"$df.xdisplay\"\n"
-" no_x11_display\n"
"\n"
+" if {$make_gui_count == 1} {\n"
+" no_x11_display\n"
+" }\n"
" set lw [expr {$label_width / 2}]\n"
" label $df_x11 -textvariable x11_display -width $lw -anchor w \\\n"
" -font $ffont\n"
"\n"
" set df_vnc \"$df.vdisplay\"\n"
-" no_vnc_display\n"
+"\n"
+" if {$make_gui_count == 1} {\n"
+" no_vnc_display\n"
+" }\n"
" label $df_vnc -textvariable vnc_display -width $lw -anchor w \\\n"
" -font $ffont\n"
"\n"
@@ -3267,14 +4097,20 @@
" set text_area \"$top.text\"\n"
" text $text_area -height 12 -relief ridge -font $ffont\n"
" pack $text_area -side top -fill both -expand 1\n"
+" set top_widget_names(text) $text_area\n"
"\n"
"\n"
-" set str \"Click Help -> gui for overview.\"\n"
-" append_text \"\\n$str\\n\\n\"\n"
+" if {$text_area_str == \"\"} {\n"
+" set str \"Click Help -> gui for overview.\"\n"
+" append_text \"\\n$str\\n\\n\"\n"
+" } else {\n"
+" append_text $text_area_str\n"
+" }\n"
"\n"
" # Make entry box stuff\n"
" set ef \"$top.entryframe\"\n"
" frame $ef -bd 1 -relief groove\n"
+" set top_widget_names(entryframe) $ef\n"
"\n"
" # Entry Label\n"
" set ef_label \"$ef.label\"\n"
@@ -3328,24 +4164,24 @@
" set entry_label $ef_label\n"
" entry_disable\n"
"\n"
-" if {$top == \"\"} {\n"
-" set w \".\"\n"
-" } else {\n"
-" set w $top\n"
-" }\n"
-" update idletasks\n"
-" wm minsize $w [winfo width $w] [winfo height $w]\n"
"}\n"
"\n"
-"proc menu_bindings {} {\n"
-" bind Menu <<MenuSelect>> {\n"
+"proc menu_bindings {m} {\n"
+" set db 0\n"
+" if {$db} {puts \"menu_bindings $m\"}\n"
+"\n"
+" bind $m <<MenuSelect>> {\n"
"#syntax hilite bug \\\n"
"MenuSelect>>\n"
" set n [%W index active]\n"
+" set db 0\n"
+" if {$db} {puts stderr \"menu_bindings %W $n\"}\n"
" set label \" \"\n"
" if {$n != \"none\"} {\n"
" set str %W,$n\n"
" set which \"\"\n"
+"\n"
+" if {$db} {puts \"menu_bindings $str\"}\n"
" if {[info exists helplabel($str)]} {\n"
" set vname [format %%-16s $helplabel($str)]\n"
" set label \"Click (?) for help on: $vname\"\n"
@@ -3353,6 +4189,8 @@
" }\n"
" if {$which == \"\"} {\n"
" ;\n"
+" } elseif {$which == \"passwd\" || $which == \"viewpasswd\"} {\n"
+" ;\n"
" } elseif {[is_action $which]} {\n"
" if {[info exists menu_var($which)] \n"
" && $menu_var($which) != \"\"} {\n"
@@ -3403,14 +4241,30 @@
"proc stop_watch {onoff} {\n"
" global orig_cursor text_area entry_box\n"
"\n"
-" set widgets [list . $text_area $entry_box] \n"
+" set widgets [list .]\n"
+" if [info exists text_area] {\n"
+" if {$text_area != \"\"} {\n"
+" lappend widgets $text_area\n"
+" }\n"
+" }\n"
+" if [info exists entry_box] {\n"
+" if {$entry_box != \"\"} {\n"
+" lappend widgets $entry_box\n"
+" }\n"
+" }\n"
"\n"
" if {$onoff == \"on\"} {\n"
" foreach item $widgets {\n"
+" if {![winfo exists $item]} {\n"
+" continue\n"
+" }\n"
" $item config -cursor {watch}\n"
" }\n"
" } else {\n"
" foreach item $widgets {\n"
+" if {![winfo exists $item]} {\n"
+" continue\n"
+" }\n"
" $item config -cursor {}\n"
" }\n"
" }\n"
@@ -3621,6 +4475,7 @@
" }\n"
" lappend cmd \"2>\"\n"
" lappend cmd \"/dev/null\"\n"
+"# lappend cmd \"/tmp/nono\"\n"
"\n"
" if {0} {\n"
" set str [join $cmd]\n"
@@ -3632,9 +4487,12 @@
"\n"
" set output \"\"\n"
" menus_disable\n"
+"\n"
" stop_watch on\n"
" catch {set output [eval exec $cmd]}\n"
" stop_watch off\n"
+"#puts stderr [exec cat /tmp/nono]\n"
+"\n"
" menus_enable\n"
" if {$debug} {\n"
" if {[string length $output] > 100} {\n"
@@ -3699,13 +4557,150 @@
" }\n"
"}\n"
"\n"
+"proc set_view_variable {val} {\n"
+" global menu_var\n"
+" set menu_var(WindowView) $val\n"
+"}\n"
+"proc get_view_variable {} {\n"
+" global menu_var\n"
+" if {![info exists menu_var(WindowView)]} {\n"
+" set menu_var(WindowView) \"none\"\n"
+" }\n"
+" return $menu_var(WindowView)\n"
+"}\n"
+"\n"
+"proc change_view_state {} {\n"
+" global menu_var gui_current_state\n"
+"\n"
+" set new [get_view_variable]\n"
+"\n"
+" set old $gui_current_state\n"
+" #puts \"$old -> $new\"\n"
+"\n"
+" if {$old == $new} {\n"
+" return\n"
+" }\n"
+"\n"
+" if {$old == \"full\" || $old == \"icon\" || $old == \"tray\"} {\n"
+" ;\n"
+" } else {\n"
+" set old \"none\"\n"
+" }\n"
+"\n"
+" if {$new == \"full\" || $new == \"icon\" || $new == \"tray\"} {\n"
+" if {$old == \"tray\"} {\n"
+" # sigh XReparentWindow would be too easy...\n"
+" # undo_tray_embed\n"
+" restart_everything $new\n"
+" destroy .\n"
+" exit\n"
+" }\n"
+" make_gui $new\n"
+" } else {\n"
+" set_view_variable $old\n"
+" }\n"
+"}\n"
+"\n"
+"proc setup_client_tail {} {\n"
+" global client_tail\n"
+" if {$client_tail != \"\"} {\n"
+" fileevent $client_tail readable read_client_info\n"
+" }\n"
+"}\n"
+"\n"
+"proc setup_tray_embed {} {\n"
+" global icon_win\n"
+" update\n"
+" set w [winfo width .]\n"
+" set h [winfo height .]\n"
+" if {$w < 24} {\n"
+" set w 24\n"
+" }\n"
+" if {$h < 24} {\n"
+" set h 24\n"
+" }\n"
+" wm minsize . $w $h\n"
+" set wid [winfo id .] \n"
+" push_new_value \"remote-cmd\" \"remote-cmd\" \"trayembed:$wid\" 0\n"
+"}\n"
+"\n"
+"proc restart_everything {gui_mode} {\n"
+" global env gui_argv0 x11vnc_prog full_win\n"
+" if {$gui_mode == \"full\"} {\n"
+" set env(X11VNC_ICON_MODE) 0\n"
+" } elseif {$gui_mode == \"icon\"} {\n"
+" set env(X11VNC_ICON_MODE) 1\n"
+" } elseif {$gui_mode == \"tray\"} {\n"
+" if {![regexp -nocase {TRAY} $env(X11VNC_ICON_MODE)]} {\n"
+" set env(X11VNC_ICON_MODE) \"TRAY\"\n"
+" }\n"
+" }\n"
+" puts stderr \"\"\n"
+" puts stderr \"tkx11vnc: restarting gui to leave tray mode.\"\n"
+" puts stderr \" new gui will be running in the background.\"\n"
+" puts stderr \" use kill(1) rather than Ctrl-C to kill it.\"\n"
+" puts stderr \"\"\n"
+" if {[info exists env(X11VNC_RESTART_DEPTH)]} {\n"
+" set n $env(X11VNC_RESTART_DEPTH)\n"
+" incr n\n"
+" set env(X11VNC_RESTART_DEPTH) $n\n"
+" } else {\n"
+" set env(X11VNC_RESTART_DEPTH) 0\n"
+" }\n"
+" set env(X11VNC_ICON_SETPASS) \"\"\n"
+"\n"
+" if {![info exists env(X11VNC_WISHCMD)]} {\n"
+" puts stderr \"failure in restart_everything.\"\n"
+" exit 1;\n"
+" }\n"
+"\n"
+" set code [exec $x11vnc_prog -printgui]\n"
+" if {[string length $code] < 20000} {\n"
+" puts stderr \"failure in restart_everything.\"\n"
+" exit 1;\n"
+" }\n"
+" set tmp \"/tmp/x11vnc[pid]\"\n"
+" file delete -force $tmp\n"
+" if {[file exists $tmp]} {\n"
+" puts stderr \"failure in restart_everything.\"\n"
+" exit 1;\n"
+" }\n"
+" set fh [open $tmp \"a\"]\n"
+" if {![file owned $tmp]} {\n"
+" puts stderr \"failure in restart_everything.\"\n"
+" exit 1;\n"
+" }\n"
+" file attributes $tmp -permissions \"0400\"\n"
+" puts $fh $code\n"
+" close $fh\n"
+"\n"
+" #puts stderr [exec ls -l $tmp]\n"
+"\n"
+" wm withdraw .\n"
+" catch {wm withdraw $full_win}\n"
+" update\n"
+"\n"
+" exec $env(X11VNC_WISHCMD) $tmp &\n"
+" after 2000\n"
+" file delete -force $tmp\n"
+" \n"
+" destroy .\n"
+" exit\n"
+"}\n"
+"\n"
+"proc undo_tray_embed {} {\n"
+" global icon_win\n"
+" set wid [winfo id .] \n"
+" push_new_value \"remote-cmd\" \"remote-cmd\" \"trayunembed:$wid\" 0\n"
+"}\n"
+"\n"
"############################################################################\n"
"# main:\n"
"\n"
"global env x11vnc_prog x11vnc_cmdline x11vnc_xdisplay x11vnc_connect;\n"
-"global x11vnc_client_file\n"
+"global x11vnc_client_file x11vnc_gui_geom x11vnc_started vnc_url\n"
"global x11vnc_auth_file x11vnc_connect_file beginner_mode simple_gui_created\n"
-"global helpall helptext helpremote helplabel hostname;\n"
+"global helpall helptext helpremote helplabel hostname osname\n"
"global all_settings reply_xdisplay always_update\n"
"global max_text_height max_text_width\n"
"global menu_var unset_str menus_disabled\n"
@@ -3713,15 +4708,21 @@
"global connected_to_x11vnc\n"
"global delay_sleep extra_sleep extra_sleep_split\n"
"global cache_all_query_vars\n"
-"global last_query_all_time query_all_freq\n"
-"global tray_mode tray_embed_id client_tail\n"
+"global last_query_all_time query_all_freq client_tail client_tail_read\n"
+"global icon_mode tray_embed tray_running icon_setpasswd icon_embed_id\n"
+"global icon_noadvanced icon_minimal\n"
+"global make_gui_count text_area_str\n"
+"global gui_argv0 gui_start_mode\n"
"\n"
"set unset_str \"(unset)\"\n"
+"set vnc_url $unset_str\n"
"set connected_to_x11vnc 0\n"
"set menus_disabled 0\n"
"set max_text_height 40\n"
"set max_text_width 90\n"
"set bfont \"-adobe-helvetica-bold-r-*-*-*-120-*-*-*-*-*-*\"\n"
+"set sfont \"-adobe-helvetica-bold-r-*-*-*-100-*-*-*-*-*-*\"\n"
+"set snfont \"-adobe-helvetica-medium-r-*-*-*-100-*-*-*-*-*-*\"\n"
"set ffont \"fixed\"\n"
"set help_indent 24;\n"
"set reply_xdisplay \"\"\n"
@@ -3731,12 +4732,23 @@
"set query_all_freq 120\n"
"set last_query_all_time [clock seconds]\n"
"set client_tail \"\"\n"
+"set client_tail_read 0\n"
+"set make_gui_count 0\n"
+"set text_area_str \"\"\n"
+"set gui_argv0 $argv0\n"
+"set gui_start_mode \"\"\n"
"\n"
"# these are no longer used under x11vnc -sync:\n"
"set delay_sleep 350\n"
"set extra_sleep 1000\n"
"set extra_sleep_split 4\n"
"\n"
+"if {$tk_version < 8.0} {\n"
+" puts stderr \"\"\n"
+" puts stderr \"*** tkx11vnc: tk version is old $tk_version, please use 8.0 or higher.\"\n"
+" puts stderr \"*** will try to continue with reduced functionality...\"\n"
+" puts stderr \"\"\n"
+"}\n"
"if {[regexp {^[34]} $tk_version] || $tk_version == \"8.0\"} {\n"
" set old_labels 1\n"
"} else {\n"
@@ -3765,7 +4777,34 @@
" exit 0\n"
"}\n"
"\n"
+"\n"
+"set_view_variable \"full\"\n"
+"\n"
+"#puts [exec env | grep X11VNC]\n"
+"\n"
"# Read environment for clues:\n"
+"\n"
+"set x11vnc_client_file \"\";\n"
+"if {[info exists env(X11VNC_CLIENT_FILE)]} {\n"
+" set x11vnc_client_file $env(X11VNC_CLIENT_FILE);\n"
+" set file $x11vnc_client_file\n"
+"\n"
+" set client_tail \"\"\n"
+" if {[file exists $file] && [file isfile $file]} {\n"
+" if {[file readable $file] && [file owned $file]} {\n"
+" set client_tail [open \"|tail -f $x11vnc_client_file\" \"r\"]\n"
+" }\n"
+" }\n"
+" if {$client_tail != \"\"} {\n"
+" gets $client_tail tmp\n"
+" if [eof $client_tail] {\n"
+" clean_client_tail\n"
+" set client_tail \"\"\n"
+" }\n"
+" }\n"
+" catch {file delete -force $x11vnc_client_file}\n"
+"}\n"
+"\n"
"if {[info exists env(X11VNC_PROG)]} {\n"
" set x11vnc_prog $env(X11VNC_PROG);\n"
"} else {\n"
@@ -3784,16 +4823,21 @@
" set x11vnc_connect 0;\n"
"}\n"
"\n"
+"if {[info exists env(X11VNC_GUI_GEOM)]} {\n"
+" set x11vnc_gui_geom $env(X11VNC_GUI_GEOM);\n"
+"} else {\n"
+" set x11vnc_gui_geom \"\"\n"
+"}\n"
+"\n"
"if {[info exists env(X11VNC_CONNECT_FILE)]} {\n"
" set x11vnc_connect_file $env(X11VNC_CONNECT_FILE);\n"
"} else {\n"
" set x11vnc_connect_file \"\";\n"
"}\n"
"\n"
-"if {[info exists env(X11VNC_CLIENT_FILE)]} {\n"
-" set x11vnc_client_file $env(X11VNC_CLIENT_FILE);\n"
-"} else {\n"
-" set x11vnc_client_file \"\";\n"
+"set x11vnc_started 0\n"
+"if {[info exists env(X11VNC_STARTED)]} {\n"
+" set x11vnc_started 1\n"
"}\n"
"\n"
"if {[info exists env(X11VNC_XDISPLAY)]} {\n"
@@ -3801,6 +4845,7 @@
" set x11vnc_connect 1\n"
"\n"
"} elseif {$argv != \"\" && [regexp {:[0-9]} $argv]} {\n"
+" set env(X11VNC_XDISPLAY) \"$argv\"\n"
" set x11vnc_xdisplay \"$argv\"\n"
" set x11vnc_connect 1\n"
"\n"
@@ -3823,21 +4868,55 @@
" set beginner_mode 0\n"
"}\n"
"\n"
-"set tray_mode 0\n"
-"if {[info exists env(X11VNC_TRAY_MODE)]} {\n"
-" set tray_mode 1\n"
+"set icon_mode 0\n"
+"set tray_embed 0\n"
+"set tray_running 0\n"
+"if {![info exists env(X11VNC_ICON_MODE)]} {\n"
+" set icon_mode 0\n"
+"} elseif {$env(X11VNC_ICON_MODE) == \"\" || $env(X11VNC_ICON_MODE) == \"0\"} {\n"
+" set icon_mode 0\n"
"} else {\n"
-" set tray_mode 0\n"
+" set icon_mode 1\n"
+" set_view_variable \"icon\"\n"
+" if [regexp -nocase {TRAY} $env(X11VNC_ICON_MODE)] {\n"
+" set tray_embed 1\n"
+" }\n"
+" if [regexp -nocase {RUNNING} $env(X11VNC_ICON_MODE)] {\n"
+" set tray_running 1\n"
+" }\n"
+"}\n"
+"set icon_setpasswd 0\n"
+"if {[info exists env(X11VNC_ICON_SETPASS)]} {\n"
+" if {$env(X11VNC_ICON_SETPASS) != \"\"} {\n"
+" set icon_setpasswd 1\n"
+" }\n"
"}\n"
-"set tray_mode 1\n"
"\n"
-"if {[info exists env(X11VNC_TRAY_EMBED_ID)]} {\n"
-" set tray_embed_id $env(X11VNC_TRAY_EMBED_ID)\n"
+"set icon_noadvanced 0\n"
+"if {[info exists env(X11VNC_ICON_NOADVANCED)]} {\n"
+" set icon_noadvanced 1\n"
+"}\n"
+"\n"
+"set icon_minimal 0\n"
+"if {[info exists env(X11VNC_ICON_MINIMAL)]} {\n"
+" set icon_minimal 1\n"
+"}\n"
+"\n"
+"if {[info exists env(X11VNC_ICON_EMBED_ID)]} {\n"
+" set icon_embed_id $env(X11VNC_ICON_EMBED_ID)\n"
"} else {\n"
-" set tray_embed_id \"\"\n"
+" set icon_embed_id \"\"\n"
"}\n"
"\n"
+"\n"
"set hostname [exec uname -n]\n"
+"set osname [exec uname]\n"
+"\n"
+"if {[regexp -nocase {IRIX} $osname]} {\n"
+" # IRIX \"fixed\" font is huge and doublespaced... \n"
+" set ffont $snfont\n"
+"}\n"
+"\n"
"#puts [exec env]\n"
"#puts \"x11vnc_xdisplay: $x11vnc_xdisplay\"\n"
"\n"
@@ -3860,18 +4939,28 @@
"set_template\n"
"\n"
"set_name \"tkx11vnc\"\n"
-"make_widgets;\n"
"\n"
-"menu_bindings;\n"
"key_bindings;\n"
"\n"
-"if {$x11vnc_connect} {\n"
-" try_connect_and_query_all\n"
-"}\n"
-"set_widgets\n"
-"\n"
-"if {$tray_mode && $client_tail != \"\"} {\n"
-" fileevent $client_tail readable read_client_info\n"
+"if {$icon_mode} {\n"
+" if {$tray_embed} {\n"
+" make_gui \"tray\"\n"
+" } else {\n"
+" make_gui \"icon\"\n"
+" }\n"
+" old_balloon\n"
+" if {$icon_setpasswd} {\n"
+" set m \"You must specify a Session\\n\" \n"
+" set m \"${m}Password before VNC clients can\\n\" \n"
+" set m \"${m}connect. Enter one in the Password\\n\" \n"
+" set m \"${m}field and then Press \\\"OK\\\". This\\n\" \n"
+" set m \"${m}password is not stored, it is only\\n\" \n"
+" set m \"${m}used for this x11vnc session.\\n\" \n"
+" do_props $m\n"
+" push_new_value \"unlock\" \"unlock\" 1 0\n"
+" }\n"
+"} else {\n"
+" make_gui \"full\"\n"
"}\n"
"\n"
"# main loop.\n"