summaryrefslogtreecommitdiffstats
path: root/x11vnc/tkx11vnc.h
diff options
context:
space:
mode:
Diffstat (limited to 'x11vnc/tkx11vnc.h')
-rw-r--r--x11vnc/tkx11vnc.h718
1 files changed, 683 insertions, 35 deletions
diff --git a/x11vnc/tkx11vnc.h b/x11vnc/tkx11vnc.h
index 239b6be..2f52f9c 100644
--- a/x11vnc/tkx11vnc.h
+++ b/x11vnc/tkx11vnc.h
@@ -398,7 +398,7 @@
"checkboxes and pressing \\\"OK\\\". This is like the \\\"-input\\\" option\n"
"but on a per-client basis.\n"
"\n"
-"To not change any aspects of the VNC client press \\\"Skip\\\".\n"
+"To not change any aspects of the VNC client press \\\"Cancel\\\".\n"
"\"\n"
"\n"
" set helptext(solid_color) \"\n"
@@ -419,6 +419,95 @@
"and one for power users.\n"
"\"\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"
+"\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"
+"\n"
+"When the icon has a light background, that means no VNC viewers are\n"
+"currently connected to the 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"
+"\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"
+"\n"
+"Clicking the right mouse button on the icon displays a menu of actions:\n"
+"\n"
+" Properties - Brings up the Properties dialog. The full tkx11vnc\n"
+" GUI may be accessed via the \\\"Advanced ...\\\" button.\n"
+" \n"
+" Help - Displays this help text.\n"
+" \n"
+" New Client - Presents an entry box where you type in the name\n"
+" 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"
+" 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"
+" Stop x11vnc - Directs the x11vnc server to disconnect all vncviewers\n"
+" and then exit. The tray/icon GUI then exits as well.\n"
+"\n"
+"\n"
+"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"
+"\"\n"
+"\n"
+" set helptext(Properties) \"\n"
+"The Properties dialog allows you to set some basic parameters of a\n"
+"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"
+"\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"
+"\n"
+"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"
+"\" \n"
+"\n"
" set helptext(all) $helpall\n"
"\n"
" set helptext(Misc-Tuning:) \"\n"
@@ -494,7 +583,7 @@
"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"
-"\\\"Skip\\\" or \\\"Escape\\\" to avoid changing the variable. Some variables\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"
@@ -567,7 +656,7 @@
"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"
-"\\\"Skip\\\" or \\\"Escape\\\" to avoid changing the variable. Some variables\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"
@@ -613,8 +702,14 @@
"}\n"
"\n"
"proc set_name {name} {\n"
-" wm title . \"$name\"\n"
-" wm iconname . \"$name\"\n"
+" global full_win\n"
+" if [info exists full_win] {\n"
+" set w $full_win\n"
+" } else {\n"
+" set w \".\"\n"
+" }\n"
+" wm title $w \"$name\"\n"
+" wm iconname $w \"$name\"\n"
"}\n"
"\n"
"proc make_toplevel {w {title \"\"}} {\n"
@@ -732,7 +827,8 @@
" set text \"Help on $item:\\n\\n\"\n"
"\n"
" if {[is_gui_internal $item]} {\n"
-" if {$item != \"gui\" && $item != \"all\" && $item != \"Misc-Tuning:\"} {\n"
+" if {$item != \"gui\" && $item != \"all\" && $item != \"Misc-Tuning:\" \\\n"
+" && $item != \"Properties\" && $item != \"Tray\"} {\n"
" append text \" + Is a gui internal Action (cannot be set).\\n\";\n"
" }\n"
" } elseif {[is_action $item]} {\n"
@@ -1173,7 +1269,11 @@
" set query_output \"\"\n"
"\n"
" if {!$debug} {\n"
-" append_text \"x11vnc $rargs ...\"\n"
+" if [regexp {passwd} $rargs] {\n"
+" append_text \"x11vnc ...\"\n"
+" } else {\n"
+" append_text \"x11vnc $rargs ...\"\n"
+" }\n"
" }\n"
"\n"
" if {$getout} {\n"
@@ -1264,7 +1364,7 @@
"\n"
" append_text \"\\nUse these checkboxes to set the input permissions, \"\n"
" append_text \"or type in the \\\"KMB...\\\"\\n\"\n"
-" append_text \"-input string manually. Then press \\\"OK\\\" or \\\"Skip\\\".\\n\"\n"
+" append_text \"-input string manually. Then press \\\"OK\\\" or \\\"Cancel\\\".\\n\"\n"
" append_text \"(note: an empty setting means use the default behavior, \"\n"
" append_text \"see viewonly)\\n\\n\"\n"
" set w \"$text_area.wk_f\"\n"
@@ -1375,7 +1475,7 @@
"\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 \"Then press \\\"OK\\\" or \\\"Skip\\\".\\n\\n\"\n"
+" append_text \"Then press \\\"OK\\\" or \\\"Cancel\\\".\\n\\n\"\n"
" set w \"$text_area.ca_f\"\n"
" catch {destroy $w}\n"
" frame $w -bd 1 -relief ridge -cursor {top_left_arrow}\n"
@@ -1420,7 +1520,7 @@
" }\n"
"}\n"
"\n"
-"# For updating a string variable. Also used for simple OK/Skip dialogs\n"
+"# For updating a string variable. Also used for simple OK/Cancel dialogs\n"
"# with entry = 0.\n"
"proc entry_dialog {item {entry 1}} {\n"
" global menu_var entry_str entry_set entry_dialog_item\n"
@@ -1587,6 +1687,9 @@
" || $item == \"client\" || $item == \"client_input\"} {\n"
" append_text \"\\t($msg)\\n\"\n"
" return 1\n"
+" } elseif {$item == \"passwd\" || $item == \"viewpasswd\"} {\n"
+" append_text \"\\t($msg)\\n\"\n"
+" return 1\n"
" } else {\n"
" append_text \"\\t*FAILED* $msg\\n\"\n"
" return 0\n"
@@ -1810,6 +1913,14 @@
" set_connected no\n"
"}\n"
"\n"
+"proc do_stop_quit {} {\n"
+" push_new_value \"stop\" \"stop\" 1 0\n"
+" set_connected no\n"
+" update\n"
+" after 250\n"
+" destroy .\n"
+"}\n"
+"\n"
"# Menu item is an action:\n"
"proc do_action {item} {\n"
" global menu_var connected_to_x11vnc beginner_mode\n"
@@ -1856,11 +1967,7 @@
" menu_help \"$item\"\n"
" return\n"
" } elseif {$item == \"stop+quit\"} {\n"
-" push_new_value \"stop\" \"stop\" 1 0\n"
-" set_connected no\n"
-" update\n"
-" after 500\n"
-" destroy .\n"
+" do_stop_quit\n"
" }\n"
"\n"
" if {[value_is_string $item]} {\n"
@@ -1967,6 +2074,12 @@
"}\n"
"\n"
"proc is_gui_internal {item} {\n"
+" if {$item == \"Properties\"} {\n"
+" return 1\n"
+" }\n"
+" if {$item == \"Tray\"} {\n"
+" return 1\n"
+" }\n"
" return [opt_match G $item]\n"
"}\n"
"\n"
@@ -2200,7 +2313,7 @@
" append_text \"Invalid client info string: $client\\n\"\n"
" return\n"
" }\n"
-" append msg \"*** To *DISCONNECT* this client press \\\"OK\\\", otherwise press \\\"Skip\\\"\\n\"\n"
+" append msg \"*** To *DISCONNECT* this client press \\\"OK\\\", otherwise press \\\"Cancel\\\"\\n\"\n"
" bell\n"
" if {[warning_dialog $msg \"current\"]} {\n"
" push_new_value \"disconnect\" \"disconnect\" $cid 1\n"
@@ -2261,7 +2374,7 @@
" regsub {:.*$} $client \"\" clabel\n"
" }\n"
" $subm add command -label \"$clabel\" \\\n"
-" -command \"client_dialog $client\"\n"
+" -command \"client_dialog \\{$client\\}\"\n"
" incr count\n"
" }\n"
" $subm entryconfigure 0 -label \"num-clients: $count\"\n"
@@ -2543,6 +2656,497 @@
" }\n"
"}\n"
"\n"
+"proc props_apply {} {\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\n"
+"\n"
+" if {$props_accept != $prop0_accept} {\n"
+" if {$props_accept} {\n"
+" push_new_value \"unlock\" \"unlock\" 1 0\n"
+" } else {\n"
+" push_new_value \"lock\" \"lock\" 1 0\n"
+" }\n"
+" set prop0_accept $props_accept\n"
+" after 500\n"
+" }\n"
+"\n"
+" if {$props_confirm != $prop0_confirm} {\n"
+" if {$props_confirm} {\n"
+" push_new_value \"accept\" \"accept\" \"popup\" 1\n"
+" } else {\n"
+" push_new_value \"accept\" \"accept\" \"\" 1\n"
+" }\n"
+" if {$menu_var(accept) == \"popup\"} {\n"
+" set props_confirm 1\n"
+" } elseif {$menu_var(accept) == \"\"} {\n"
+" set props_confirm 0\n"
+" }\n"
+" set prop0_confirm $props_confirm\n"
+" after 500\n"
+" }\n"
+"\n"
+" if {$props_viewonly != $prop0_viewonly} {\n"
+" if {$props_viewonly} {\n"
+" push_new_value \"viewonly\" \"viewonly\" 1 1\n"
+" } else {\n"
+" push_new_value \"viewonly\" \"noviewonly\" 1 1\n"
+" }\n"
+" if {$menu_var(viewonly)} {\n"
+" set props_viewonly 1\n"
+" } else {\n"
+" set props_viewonly 0\n"
+" }\n"
+" set prop0_viewonly $props_viewonly\n"
+" after 500\n"
+" }\n"
+"\n"
+" if {$props_shared != $prop0_shared} {\n"
+" if {$props_shared} {\n"
+" push_new_value \"shared\" \"shared\" 1 1\n"
+" } else {\n"
+" push_new_value \"shared\" \"noshared\" 1 1\n"
+" }\n"
+" if {$menu_var(shared)} {\n"
+" set props_shared 1\n"
+" } else {\n"
+" set props_shared 0\n"
+" }\n"
+" set prop0_shared $props_shared\n"
+" after 500\n"
+" }\n"
+"\n"
+" if {$props_passwd != $prop0_passwd} {\n"
+" push_new_value \"passwd\" \"passwd\" \"$props_passwd\" 0\n"
+" set prop0_passwd $props_passwd\n"
+" if {$props_passwd == \"\"} {\n"
+" set props_viewpasswd \"\"\n"
+" }\n"
+" after 500\n"
+" }\n"
+"\n"
+" if {$props_viewpasswd != $prop0_viewpasswd} {\n"
+" push_new_value \"viewpasswd\" \"viewpasswd\" \"$props_viewpasswd\" 0\n"
+" set prop0_viewpasswd $props_viewpasswd\n"
+" after 500\n"
+" }\n"
+"}\n"
+"\n"
+"proc props_advanced {} {\n"
+" global tray_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"
+" set first 1\n"
+" } else {\n"
+" set first 0\n"
+" }\n"
+" wm deiconify $full_win\n"
+" update\n"
+"\n"
+" if {$first} {\n"
+" set w $full_win\n"
+" wm minsize $w [winfo width $w] [winfo height $w]\n"
+" }\n"
+"}\n"
+"\n"
+"proc do_props {} {\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"
+"\n"
+" if ![info exists props_accept] {\n"
+" set props_accept 1\n"
+" }\n"
+" set prop0_accept $props_accept\n"
+"\n"
+" if [info exists menu_var(accept)] {\n"
+" if {$menu_var(accept) == $unset_str || $menu_var(accept) == \"\"} {\n"
+" set props_confirm 0\n"
+" } else {\n"
+" set props_confirm 1\n"
+" }\n"
+" } else {\n"
+" set menu_var(accept) \"\"\n"
+" set props_confirm 0\n"
+" }\n"
+" set prop0_confirm $props_confirm\n"
+"\n"
+" if [info exists menu_var(viewonly)] {\n"
+" if {$menu_var(viewonly) == $unset_str || $menu_var(viewonly) == \"\"} {\n"
+" set props_viewonly 0\n"
+" } elseif ($menu_var(viewonly)) {\n"
+" set props_viewonly 1\n"
+" } else {\n"
+" set props_viewonly 0\n"
+" }\n"
+" } else {\n"
+" set menu_var(viewonly) 0\n"
+" set props_viewonly 0\n"
+" }\n"
+" set prop0_viewonly $props_viewonly\n"
+"\n"
+" if [info exists menu_var(shared)] {\n"
+" if {$menu_var(shared) == $unset_str || $menu_var(shared) == \"\"} {\n"
+" set props_shared 0\n"
+" } elseif ($menu_var(shared)) {\n"
+" set props_shared 1\n"
+" } else {\n"
+" set props_shared 0\n"
+" }\n"
+" } else {\n"
+" set menu_var(shared) 0\n"
+" set props_shared 0\n"
+" }\n"
+" set prop0_shared $props_shared\n"
+"\n"
+" if ![info exists props_passwd] {\n"
+" set props_passwd \"\"\n"
+" }\n"
+" set prop0_passwd $props_passwd\n"
+"\n"
+" if ![info exists props_viewpasswd] {\n"
+" set props_viewpasswd \"\"\n"
+" }\n"
+" set prop0_viewpasswd $props_viewpasswd\n"
+"\n"
+" set w .props\n"
+" catch {destroy $w}\n"
+" toplevel $w\n"
+" wm title $w \"Properties\"\n"
+" set b1 \"$w.buttons1\"\n"
+" frame $b1\n"
+" button $b1.ok -text OK -command \"props_apply; destroy $w\" -font $bfont\n"
+" button $b1.cancel -text Cancel -command \"destroy $w\" -font $bfont\n"
+" button $b1.apply -text Apply -command \"props_apply\" -font $bfont\n"
+"\n"
+" pack $b1.apply $b1.cancel $b1.ok -side right -expand 1\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"
+" button $b2.help -text \"Help ...\" -command \"menu_help Properties\" -font $bfont\n"
+" pack $b2.advanced $b2.help -side right -expand 1\n"
+"\n"
+" set vp \"$w.viewpw\"\n"
+" if {$have_labelframes} {\n"
+" labelframe $vp -text \"ViewOnly Password\" -font $bfont\n"
+" } else {\n"
+" frame $vp\n"
+" set l $vp.l\n"
+" label $l -text \"ViewOnly Password:\" -justify left -anchor w -font $bfont\n"
+" pack $vp.l -fill x -expand 1 -padx 1m -pady 0m -side top\n"
+" }\n"
+" 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"
+" set pw \"$w.passwd\"\n"
+" if {$have_labelframes} {\n"
+" labelframe $pw -text \"Password\" -font $bfont\n"
+" } else {\n"
+" frame $pw\n"
+" set l $pw.l\n"
+" label $l -text \"Password:\" -justify left -anchor w -font $bfont\n"
+" pack $pw.l -fill x -expand 1 -padx 1m -pady 0m -side top\n"
+" }\n"
+" 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"
+" set sh \"$w.shared\"\n"
+" frame $sh\n"
+" checkbutton $sh.button -text \"Shared\" \\\n"
+" -variable props_shared -anchor w -font $bfont\n"
+" pack $sh.button -fill x -expand 1 -padx 1m -pady 1m\n"
+"\n"
+" set vo \"$w.viewonly\"\n"
+" frame $vo\n"
+" checkbutton $vo.button -text \"All Clients ViewOnly\" \\\n"
+" -variable props_viewonly -anchor w -font $bfont\n"
+" pack $vo.button -fill x -expand 1 -padx 1m -pady 1m\n"
+"\n"
+" set cf \"$w.confirm\"\n"
+" frame $cf\n"
+" checkbutton $cf.button -text \"Ask for Confirmation\" \\\n"
+" -variable props_confirm -anchor w -font $bfont\n"
+" pack $cf.button -fill x -expand 1 -padx 1m -pady 1m\n"
+"\n"
+" set ac \"$w.accept\"\n"
+" frame $ac\n"
+" checkbutton $ac.button -text \"Accept Connections\" \\\n"
+" -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"
+"\n"
+" wm resizable $w 1 0\n"
+" center_win $w\n"
+" update\n"
+" wm minsize $w [winfo width $w] [winfo height $w]\n"
+"\n"
+" tkwait window $w\n"
+"}\n"
+"\n"
+"proc do_new_client {} {\n"
+" global newclient ffont bfont\n"
+"\n"
+" set w .newclient\n"
+" catch {destroy $w}\n"
+" toplevel $w\n"
+" label $w.l -text \"Hostname: \" -font $bfont\n"
+" set newclient \"\"\n"
+" entry $w.e -width 16 -textvariable newclient -font $bfont \n"
+" button $w.b -text OK -command \"destroy $w\" -font $bfont\n"
+" bind $w.e <Return> \"update; after 100; destroy $w\"\n"
+"\n"
+" pack $w.l $w.e $w.b -side left -pady 1m -padx 1m\n"
+" focus $w.e\n"
+" center_win $w\n"
+" update \n"
+" \n"
+" tkwait window $w\n"
+"\n"
+" if {$newclient != \"\"} {\n"
+" push_new_value \"connect\" \"connect\" \"$newclient\" 1\n"
+" }\n"
+"}\n"
+"\n"
+"proc do_disconnect_all {} {\n"
+" push_new_value \"disconnect\" \"disconnect\" \"all\" 1\n"
+"}\n"
+"\n"
+"proc pmenu {m x y} {\n"
+" set x [expr $x-10]\n"
+" set y [expr $y-10]\n"
+" $m post $x $y\n"
+"}\n"
+"\n"
+"proc set_client_balloon {str} {\n"
+" global client_balloon vnc_display\n"
+" \n"
+" set client_balloon \"$vnc_display\"\n"
+" set count 0\n"
+" foreach client [split $str \",\"] {\n"
+" if {[regexp {^(.*):(.*):(.*):(.*):(.*):(.*):(.*)$} \\\n"
+" $client m0 m1 m2 m3 m4 m5 m6 m7]} {\n"
+" # id:ip:port:user:hostname:input:loginvo\n"
+" set id $m1\n"
+" set ip $m2\n"
+" set port $m3\n"
+" set user $m4\n"
+" if {[string length $user] >= 24} {\n"
+" # weird identd hash...\n"
+" set user [string range $user 0 8]\n"
+" set user \"${user}...\"\n"
+" }\n"
+" set host $m5\n"
+" set input $m6\n"
+" set vo $m7\n"
+" if [regexp {^[ ]*$} $host] {\n"
+" set host $ip\n"
+" }\n"
+" set client_balloon \"${client_balloon}\\n$user\\@$host\"\n"
+" if {$vo == \"1\"} {\n"
+" set client_balloon \"${client_balloon} - view\"\n"
+" } else {\n"
+" set client_balloon \"${client_balloon} - full\"\n"
+" }\n"
+" } else {\n"
+" set i [expr $count+1]\n"
+" set client_balloon \"${client_balloon}\\nunknown-host$i\"\n"
+" }\n"
+" incr count\n"
+" }\n"
+" if {$count == 0} {\n"
+" set client_balloon \"${client_balloon}\\nNo connections.\"\n"
+" }\n"
+" icon_win_cfg $count\n"
+"}\n"
+"\n"
+"proc read_client_info {} {\n"
+" global x11vnc_client_file client_tail client_str\n"
+" global unlinked_x11vnc_client_file\n"
+" if {$client_tail != \"\"} {\n"
+" after 100\n"
+" set str \"\"\n"
+" set count [gets $client_tail 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"
+" close $client_tail\n"
+" catch {file delete $x11vnc_client_file}\n"
+" clean_icon_exit\n"
+" }\n"
+" if {$count > 0 && ![regexp {^[ ]*$} $str]} {\n"
+" if {$str == \"quit\"} {\n"
+" catch {file delete $x11vnc_client_file}\n"
+" clean_icon_exit\n"
+" } elseif {$str != \"skip\"} {\n"
+" if {$str == \"none\"} {\n"
+" set str \"\"\n"
+" }\n"
+" update_clients_menu $str\n"
+" set client_str $str\n"
+" set_client_balloon $str\n"
+" }\n"
+" }\n"
+" }\n"
+"}\n"
+"\n"
+"proc show_client_balloon {} {\n"
+" global tray_mode icon_win props_win full_win\n"
+" global client_balloon ffont\n"
+"\n"
+" if ![info exists client_balloon] {\n"
+" set client_balloon \"tkx11vnc ...\"\n"
+" }\n"
+" if {$client_balloon == \"\"} {\n"
+" set client_balloon \"tkx11vnc ...\"\n"
+" }\n"
+"\n"
+" set x [expr [winfo rootx $icon_win] + ([winfo width $icon_win]/2)]\n"
+" set y [expr [winfo rooty $icon_win] + [winfo height $icon_win] + 4]\n"
+"\n"
+" set w .client_balloon\n"
+" catch {destroy $w}\n"
+" toplevel $w -bg black -screen [winfo screen $icon_win]\n"
+" wm overrideredirect $w 1\n"
+" label $w.l -text \"$client_balloon\" -relief flat -bg \"#ffffaa\" -fg black \\\n"
+" -padx 2 -pady 0 -anchor w -justify left -font $ffont\n"
+" pack $w.l -side left -padx 1 -pady 1\n"
+"\n"
+" set w2 [winfo reqwidth $w.l]\n"
+" set h2 [winfo reqheight $w.l]\n"
+"\n"
+" set W [winfo screenwidth $w]\n"
+" set H [winfo screenheight $w]\n"
+"\n"
+" if {[expr $x+$w2] > $W} {\n"
+" set w3 [winfo width $icon_win]\n"
+" set x [expr \"$W - $w2 - $w3 - 4\"] \n"
+" }\n"
+" if {[expr $y+$h2] > $H} {\n"
+" set h3 [winfo height $icon_win]\n"
+" set y [expr \"$H - $h2 - $h3 - 4\"] \n"
+" }\n"
+"\n"
+" wm geometry $w +${x}+${y}\n"
+"}\n"
+"\n"
+"proc kill_client_balloon {} {\n"
+" global client_balloon_id client_balloon_win\n"
+" if [info exists client_balloon_id] {\n"
+" catch {after cancel $client_balloon_id}\n"
+" }\n"
+" if [winfo exists .client_balloon] {\n"
+" destroy .client_balloon\n"
+" }\n"
+"}\n"
+"\n"
+"proc icon_win_cfg {clients} {\n"
+" global icon_win\n"
+" if {$clients > 0} {\n"
+" $icon_win configure -bg black -fg white\n"
+" } else {\n"
+" $icon_win configure -bg white -fg black\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 client_balloon_id\n"
+" global bfont ffont\n"
+" \n"
+"# if {$tray_embed_id != \"\"} {\n"
+"# wm withdraw .\n"
+"# set top \".icon\"\n"
+"# toplevel $top -use $tray_embed_id\n"
+"# }\n"
+"\n"
+" set l .label\n"
+" set icon_win $l\n"
+" label $l -text \"x11\\nvnc\" -borderwidth 5 -font $bfont\n"
+" icon_win_cfg 0\n"
+"\n"
+" pack $l\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 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 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"
+" }\n"
+"\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"
+"}\n"
+"\n"
+"proc clean_icon_exit {} {\n"
+" global client_tail\n"
+" if [info exists client_tail] {\n"
+" if {$client_tail != \"\"} {\n"
+" set p [pid $client_tail]\n"
+" if {$p != \"\"} {\n"
+" catch {exec kill -TERM $p >/dev/null 2>/dev/null}\n"
+" }\n"
+" catch {close $client_tail}\n"
+" set client_tail \"\"\n"
+" }\n"
+" }\n"
+" push_new_value \"stop\" \"stop\" 1 0\n"
+" set_connected no\n"
+" update\n"
+" destroy .\n"
+" exit\n"
+"}\n"
+"\n"
"proc make_widgets {} {\n"
" global template \n"
" global menu_b menu_m menu_count\n"
@@ -2554,10 +3158,24 @@
" 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"
"\n"
" # Make the top label\n"
" set label_width 80\n"
-" set info_label .info\n"
+" set info_label \"$top.info\"\n"
" label $info_label -textvariable info_str -bd 2 -relief groove \\\n"
" -anchor w -width $label_width -font $ffont\n"
" pack $info_label -side top -fill x -expand 0\n"
@@ -2594,7 +3212,7 @@
" }\n"
"\n"
" # Make frames for the rows and make the menu buttons.\n"
-" set f \".menuframe\"\n"
+" set f \"$top.menuframe\"\n"
" frame $f\n"
" for {set c 0} {$c < $colmax} {incr c} {\n"
" set colf \"$f.menuframe$c\"\n"
@@ -2627,7 +3245,7 @@
" make_menu_items\n"
"\n"
" # Make the x11 and vnc display label bar:\n"
-" set df .displayframe\n"
+" set df \"$top.displayframe\"\n"
" frame $df -bd 1 -relief groove\n"
"\n"
" set df_x11 \"$df.xdisplay\"\n"
@@ -2646,16 +3264,16 @@
" pack $df -side top -fill x\n"
"\n"
" # text area\n"
-" text .text -height 12 -relief ridge -font $ffont\n"
-" set text_area .text\n"
-" pack .text -side top -fill both -expand 1\n"
+" 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"
"\n"
"\n"
" set str \"Click Help -> gui for overview.\"\n"
" append_text \"\\n$str\\n\\n\"\n"
"\n"
" # Make entry box stuff\n"
-" set ef .entryframe\n"
+" set ef \"$top.entryframe\"\n"
" frame $ef -bd 1 -relief groove\n"
"\n"
" # Entry Label\n"
@@ -2679,7 +3297,7 @@
"\n"
" # Entry Skip button\n"
" set ef_skip \"$ef.skip\"\n"
-" button $ef_skip -text Skip -pady $bpy -padx $bpx -command {set entry_set 0} \\\n"
+" button $ef_skip -text Cancel -pady $bpy -padx $bpx -command {set entry_set 0} \\\n"
" -highlightthickness $hlt \\\n"
" -font $bfont\n"
"\n"
@@ -2710,13 +3328,13 @@
" set entry_label $ef_label\n"
" entry_disable\n"
"\n"
-" update\n"
-" wm minsize . [winfo width .] [winfo height .]\n"
-"\n"
-" #set w [winfo width .info]\n"
-" #puts \"w1: $w\"\n"
-" #set w [winfo reqwidth .info]\n"
-" #puts \"w2: $w\"\n"
+" 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"
@@ -2803,7 +3421,7 @@
" set msg \"\\n\\n\"\n"
" append msg \"*** WARNING: setting \\\"noremote\\\" will disable ALL remote control commands (i.e.\\n\"\n"
" append msg \"*** WARNING: *this* gui will be locked out). Do you really want to do this?\\n\"\n"
-" append msg \"*** WARNING: If so, press \\\"OK\\\", otherwise press \\\"Skip\\\"\\n\"\n"
+" append msg \"*** WARNING: If so, press \\\"OK\\\", otherwise press \\\"Cancel\\\"\\n\"\n"
" append msg \"\\n\"\n"
" bell\n"
" return [warning_dialog $msg \"noremote\"]\n"
@@ -2814,7 +3432,7 @@
" set msg [get_start_x11vnc_txt]\n"
" append msg \"\\n\"\n"
" append msg \"*** To run the above command on machine \\\"$hostname\\\" to\\n\"\n"
-" append msg \"*** start x11vnc press \\\"OK\\\" otherwise press \\\"Skip\\\".\\n\"\n"
+" append msg \"*** start x11vnc press \\\"OK\\\" otherwise press \\\"Cancel\\\".\\n\"\n"
" return [warning_dialog $msg \"start\"]\n"
"}\n"
"\n"
@@ -3085,16 +3703,18 @@
"# main:\n"
"\n"
"global env x11vnc_prog x11vnc_cmdline x11vnc_xdisplay x11vnc_connect;\n"
+"global x11vnc_client_file\n"
"global x11vnc_auth_file x11vnc_connect_file beginner_mode simple_gui_created\n"
"global helpall helptext helpremote helplabel hostname;\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"
-"global bfont ffont old_labels\n"
+"global bfont ffont old_labels have_labelframes\n"
"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"
"\n"
"set unset_str \"(unset)\"\n"
"set connected_to_x11vnc 0\n"
@@ -3110,6 +3730,7 @@
"set cache_all_query_vars \"\"\n"
"set query_all_freq 120\n"
"set last_query_all_time [clock seconds]\n"
+"set client_tail \"\"\n"
"\n"
"# these are no longer used under x11vnc -sync:\n"
"set delay_sleep 350\n"
@@ -3121,6 +3742,10 @@
"} else {\n"
" set old_labels 0\n"
"}\n"
+"set have_labelframes 1\n"
+"if {$tk_version < 8.4} {\n"
+" set have_labelframes 0\n"
+"}\n"
"\n"
"if {\"$argv\" == \"-spit\"} {\n"
" set fh [open $argv0 r]\n"
@@ -3165,6 +3790,12 @@
" 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"
+"}\n"
+"\n"
"if {[info exists env(X11VNC_XDISPLAY)]} {\n"
" set x11vnc_xdisplay $env(X11VNC_XDISPLAY);\n"
" set x11vnc_connect 1\n"
@@ -3192,6 +3823,19 @@
" 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"
+"} else {\n"
+" set tray_mode 0\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"
+"} else {\n"
+" set tray_embed_id \"\"\n"
+"}\n"
"\n"
"set hostname [exec uname -n]\n"
"#puts [exec env]\n"
@@ -3226,5 +3870,9 @@
"}\n"
"set_widgets\n"
"\n"
+"if {$tray_mode && $client_tail != \"\"} {\n"
+" fileevent $client_tail readable read_client_info\n"
+"}\n"
+"\n"
"# main loop.\n"
;