summaryrefslogtreecommitdiffstats
path: root/x11vnc/tkx11vnc.h
diff options
context:
space:
mode:
authorrunge <runge>2005-07-13 01:23:57 +0000
committerrunge <runge>2005-07-13 01:23:57 +0000
commitec45cd952ba011036a0e5cc3b4c3cf10386cd12d (patch)
tree61300efac6d0712e0e37a22e805938f1e1a4b8e5 /x11vnc/tkx11vnc.h
parent640eb162396cfc1fc308973eca331b2694b51849 (diff)
downloadlibtdevnc-ec45cd952ba011036a0e5cc3b4c3cf10386cd12d.tar.gz
libtdevnc-ec45cd952ba011036a0e5cc3b4c3cf10386cd12d.zip
x11vnc: tweaks for release, fix queue buildup under -viewonly.
Diffstat (limited to 'x11vnc/tkx11vnc.h')
-rw-r--r--x11vnc/tkx11vnc.h288
1 files changed, 216 insertions, 72 deletions
diff --git a/x11vnc/tkx11vnc.h b/x11vnc/tkx11vnc.h
index 721d936..97d3ae5 100644
--- a/x11vnc/tkx11vnc.h
+++ b/x11vnc/tkx11vnc.h
@@ -258,9 +258,9 @@
" =0 storepasswd\n"
" =GAL LOFF\n"
" =GAL Misc-Perms::\n"
-" =S alwaysshared\n"
-" =S nevershared\n"
-" =S dontdisconnect\n"
+" =0S alwaysshared\n"
+" =0S nevershared\n"
+" =0S dontdisconnect\n"
" =SQA deny_all\n"
" =GAL LOFF\n"
"\n"
@@ -341,7 +341,8 @@
"server indicating it should shutdown all connections and exit.\n"
"\n"
"The GUI stays running in case you want to start a new x11vnc or attach\n"
-"to another one. Use \\\"Actions -> Quit\\\" if you want to have the gui exit.\n"
+"to another one. Use \\\"Actions -> Quit\\\" if you then want to have the\n"
+"gui exit. Use \\\"Actions -> stop+quit\\\" to have both exit at once.\n"
"\"\n"
"\n"
" set helptext(show-start-cmd) \"\n"
@@ -351,8 +352,10 @@
"debugging the gui. The help item for \\\"Actions -> start\\\" gives the\n"
"same info.\n"
"\n"
-"If you want to load in a saved profile \\\"rc file\\\" use Misc -> rc\n"
-"and select the file.\n"
+"If you want to load in a saved profile \\\"rc file\\\" use \\\"Misc -> rc\\\"\n"
+"and select the file. \\\"Actions -> load-settings\\\" does a similar thing\n"
+"with an rc-file, but reading the file and setting the gui variables to\n"
+"its values.\n"
"\"\n"
"\n"
" set helptext(debug_gui) \"\n"
@@ -399,7 +402,9 @@
"\n"
"This action is only available in \\\"startup\\\" mode, not when connected\n"
"to a running x11vnc server (in that case the variable settings reflect\n"
-"the state of the running x11vnc).\n"
+"the state of the running x11vnc). To detach from a running x11vnc\n"
+"server use \\\"Actions -> detach\\\"; to completely stop the x11vnc server\n"
+"use \\\"Actions -> stop\\\".\n"
"\"\n"
"\n"
" set helptext(defaults-all) \"\n"
@@ -408,7 +413,9 @@
"\n"
"This action is only available in \\\"startup\\\" mode, not when connected\n"
"to a running x11vnc server (in that case the variable settings reflect\n"
-"the state of the running x11vnc).\n"
+"the state of the running x11vnc). To detach from a running x11vnc\n"
+"server use \\\"Actions -> detach\\\"; to completely stop the x11vnc server\n"
+"use \\\"Actions -> stop\\\".\n"
"\"\n"
"\n"
" set helptext(load-settings) \"\n"
@@ -422,7 +429,9 @@
"\n"
"This action is only available in \\\"startup\\\" mode, not when connected\n"
"to a running x11vnc server (in that case the variable settings reflect\n"
-"the state of the running x11vnc).\n"
+"the state of the running x11vnc). To detach from a running x11vnc\n"
+"server use \\\"Actions -> detach\\\"; to completely stop the x11vnc server\n"
+"use \\\"Actions -> stop\\\".\n"
"\"\n"
"\n"
" set helptext(save-settings) \"\n"
@@ -658,6 +667,7 @@
"\n"
" set helptext(Misc-Perms:) \"\n"
"In this sub-menu we provide some lesser used permission options.\n"
+"\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"
@@ -980,8 +990,9 @@
" Anywhere: Control-a invokes \\\"Actions -> attach\\\"\n"
" Anywhere: Control-p invokes \\\"Actions -> ping\\\"\n"
" Anywhere: Control-u and Control-r invoke \\\"Actions -> update-all\\\"\n"
+"\"\n"
"\n"
-"\n"
+"set under_wally \"\n"
"Misc:\n"
"\n"
"Since x11vnc has so many settings and to avoid further confusion,\n"
@@ -2174,6 +2185,8 @@
" set val \"\"\n"
" } elseif {$item == \"auth\"} {\n"
" set val \"\"\n"
+" } elseif {$item == \"gui\"} {\n"
+" continue\n"
" } \n"
" # some hacks we do here for now..\n"
" if {$item == \"cursor\" && $val == \"\"} {\n"
@@ -2182,8 +2195,8 @@
" set val \"always\"\n"
" } elseif {$item == \"wirecopyrect\" && $val == \"\"} {\n"
" set val \"always\"\n"
-" } elseif {$item == \"overlay_nocursor\" && $val == 0} {\n"
-" set val 1\n"
+"# } elseif {$item == \"overlay_nocursor\" && $val == 0} {\n"
+"# set val 1\n"
" }\n"
"\n"
" set default_var($item) $val\n"
@@ -2192,6 +2205,94 @@
" }\n"
"}\n"
"\n"
+"proc tilde_expand {file} {\n"
+" global env\n"
+" if {[file exists $file]} {\n"
+" return $file\n"
+" }\n"
+"\n"
+" set user \"\"\n"
+" if {[info exists env(USER)]} {\n"
+" set user $env(USER)\n"
+" }\n"
+" if {$user == \"\" && [info exists env(LOGNAME)]} {\n"
+" set user $env(LOGNAME)\n"
+" }\n"
+"\n"
+" set home \"\"\n"
+" if {[info exists env(HOME)]} {\n"
+" set home $env(HOME)\n"
+" } elseif {$user != \"\"} {\n"
+" set home \"/home/$user\"\n"
+" }\n"
+"\n"
+" if {[regexp {^~} $file]} {\n"
+" if {[regexp {^~/} $file]} {\n"
+" if {$home != \"\"} {\n"
+" regsub {^~} $file $home file\n"
+" }\n"
+" } else {\n"
+" regsub {^~} $file \"/home/\" file\n"
+" }\n"
+" }\n"
+" return $file\n"
+"}\n"
+"\n"
+"proc insert_cmdline_vars {} {\n"
+" global env cmd_var menu_var default_var x11vnc_cmdline\n"
+" if {![info exists x11vnc_cmdline]} {\n"
+" return\n"
+" }\n"
+" if {$x11vnc_cmdline == \"\"} {\n"
+" return\n"
+" }\n"
+" set cmd_var(novar) 1 \n"
+" set str [string trim $x11vnc_cmdline]\n"
+"\n"
+" while {[regexp -- {^-} $str]} {\n"
+" if {[regexp -- {^--*([^ \\t][^ \\t]*)(.*)$} $str m var rest]} {\n"
+" set rest [string trim $rest]\n"
+" set var [string trim $var]\n"
+" if {[regexp {^\\{\\{([^\\}]*)\\}\\}(.*)} $rest m val rest]} {\n"
+" set str [string trim $rest]\n"
+" set cmd_var($var) $val\n"
+" } else {\n"
+" set str $rest\n"
+" set cmd_var($var) \"boolean\"\n"
+" }\n"
+" } else {\n"
+" break\n"
+" }\n"
+" }\n"
+"\n"
+" if {[info exists cmd_var(rc)]} {\n"
+" load_settings $cmd_var(rc)\n"
+" } elseif {[info exists cmd_var(norc)]} {\n"
+" ;\n"
+" } else {\n"
+" set filex [tilde_expand \"~/.x11vncrc\"]\n"
+" if {[file exists $filex]} {\n"
+" load_settings $filex\n"
+" }\n"
+" }\n"
+"\n"
+" foreach var [array names cmd_var] {\n"
+" if {$var == \"novar\"} {\n"
+" continue\n"
+" }\n"
+" if {[regexp {^[ \\t]*$} $var]} {\n"
+" continue\n"
+" }\n"
+" if {[info exists menu_var($var)]} {\n"
+" if {$cmd_var($var) == \"boolean\"} {\n"
+" set menu_var($var) 1\n"
+" } else {\n"
+" set menu_var($var) $cmd_var($var)\n"
+" }\n"
+" }\n"
+" }\n"
+"}\n"
+"\n"
"proc copy_default_vars {} {\n"
" global menu_var default_var\n"
" foreach item [array names default_var] {\n"
@@ -2245,22 +2346,25 @@
" }\n"
"}\n"
"\n"
-"proc load_settings {} {\n"
-" global menu_var default_var\n"
+"proc load_settings {{file \"\"}} {\n"
+" global menu_var default_var env\n"
"\n"
-" if {![info exists menu_var(load-settings)]} {\n"
-" return\n"
+" if {$file == \"\"} {\n"
+" if {![info exists menu_var(load-settings)]} {\n"
+" return\n"
+" }\n"
+" set file $menu_var(load-settings)\n"
" }\n"
-" set file $menu_var(load-settings)\n"
" if {$file == \"\"} {\n"
" return\n"
" }\n"
"\n"
" set fh \"\"\n"
-" catch {set fh [open $file \"r\"]}\n"
+" set filex [tilde_expand $file]\n"
+" catch {set fh [open $filex \"r\"]}\n"
"\n"
" if {$fh == \"\"} {\n"
-" append_text \"load_settings: *** failed to open $file ***\\n\"\n"
+" append_text \"load_settings: *** failed to open $filex ***\\n\"\n"
" return\n"
" }\n"
" copy_default_vars\n"
@@ -2287,6 +2391,9 @@
" }\n"
" close $fh\n"
"\n"
+" set count 0\n"
+" set parms \"\"\n"
+"\n"
" foreach line [split $str \"\\n\"] {\n"
" set line [string trim $line]\n"
" regsub {^--*} $line \"\" line\n"
@@ -2297,16 +2404,31 @@
" if {[regexp {^[ \\t]*$} $item]} {\n"
" continue\n"
" }\n"
+" if {$item == \"gui\"} {\n"
+" continue\n"
+" }\n"
" if {[info exists menu_var($item)]} {\n"
" if {[value_is_bool $item]} {\n"
" set menu_var($item) 1\n"
+" incr count\n"
+" append parms \" -$item\\n\"\n"
" } elseif {[value_is_string $item]} {\n"
" if {$value != \"\"} {\n"
" set menu_var($item) $value\n"
+" set nitem [get_nitem $item]\n"
+" append parms \" -$nitem $value\\n\"\n"
+" incr count\n"
" }\n"
" }\n"
" }\n"
" }\n"
+" append_text \"loaded $count parameter settings from $filex\"\n"
+" if {$count > 0} {\n"
+" append_text \":\\n\"\n"
+" append_text $parms\n"
+" } else {\n"
+" append_text \".\\n\"\n"
+" }\n"
"}\n"
"\n"
"proc save_settings {} {\n"
@@ -2367,6 +2489,7 @@
" if {$file == \"\"} {\n"
" return\n"
" }\n"
+" set file [tilde_expand $file]\n"
" append_text \"\\nSaving current settings to $file ...\\n\" \n"
" if {[file exists $file]} {\n"
" set backup \"${file}~\"\n"
@@ -2531,7 +2654,8 @@
"\n"
"proc show_logfile {} {\n"
" global menu_var unset_str\n"
-" set logfile $menu_var(logfile)\n"
+"\n"
+" set logfile [tilde_expand $menu_var(logfile)]\n"
" \n"
" if {$logfile == \"\" || $logfile == $unset_str} {\n"
" set txt \"\\nNo logfile was specified at x11vnc startup.\\n\\n\" \n"
@@ -3849,6 +3973,8 @@
" button $w.b -text OK -command \"destroy $w\" -font $bfont\n"
" bind $w.e <Return> \"update; after 100; destroy $w\"\n"
"\n"
+" wm title $w \"New Client\"\n"
+"\n"
" pack $w.l $w.e $w.b -side left -pady 1m -padx 1m\n"
" focus $w.e\n"
" center_win $w\n"
@@ -4344,6 +4470,8 @@
"\n"
" wm minsize . 1 1\n"
"\n"
+" set gui_current_state \"\"\n"
+"\n"
" if {$mode == \"full\"} {\n"
" frame $fw\n"
" set icon_mode 0\n"
@@ -4403,6 +4531,8 @@
" copy_default_vars\n"
" if {$x11vnc_connect} {\n"
" try_connect_and_query_all\n"
+" } else {\n"
+" insert_cmdline_vars\n"
" }\n"
" } else {\n"
" set_name \"RESTORE\"\n"
@@ -4737,13 +4867,12 @@
" }\n"
" if {$item == \"debug_gui\"} {\n"
" continue\n"
-" }\n"
-" if {$item == \"WindowView\"} {\n"
+" } elseif {$item == \"WindowView\"} {\n"
" continue\n"
-" }\n"
-" if {$item == \"rc\" || $item == \"norc\"} {\n"
+" } elseif {$item == \"rc\" || $item == \"norc\"} {\n"
" continue\n"
" }\n"
+"\n"
" set def \"\"\n"
" if {[info exists default_var($item)]} {\n"
" set def $default_var($item)\n"
@@ -4774,16 +4903,7 @@
" set ntab 3\n"
"\n"
" if {$item == \"gui\" || [value_is_string $item]} {\n"
-" set nitem $item\n"
-" if {$nitem == \"screen_blank\"} {\n"
-" set nitem \"sb\"\n"
-" } elseif {$nitem == \"xrandr_mode\"} {\n"
-" set nitem \"xrandr\"\n"
-" } elseif {$nitem == \"wireframe_mode\"} {\n"
-" set nitem \"wireframe\"\n"
-" } elseif {$nitem == \"solid_color\"} {\n"
-" set nitem \"solid\"\n"
-" }\n"
+" set nitem [get_nitem $item]\n"
"\n"
" if {$mv == \"\" && $def != \"\"} {\n"
" set qst $hmm\n"
@@ -4877,8 +4997,22 @@
" append_text \"$msg\\n\"\n"
"}\n"
"\n"
+"proc get_nitem {item} {\n"
+" set nitem $item\n"
+" if {$nitem == \"screen_blank\"} {\n"
+" set nitem \"sb\"\n"
+" } elseif {$nitem == \"xrandr_mode\"} {\n"
+" set nitem \"xrandr\"\n"
+" } elseif {$nitem == \"wireframe_mode\"} {\n"
+" set nitem \"wireframe\"\n"
+" } elseif {$nitem == \"solid_color\"} {\n"
+" set nitem \"solid\"\n"
+" }\n"
+" return $nitem\n"
+"}\n"
+"\n"
"proc get_start_x11vnc_cmd {{show_rc 0}} {\n"
-" global menu_var default_var unset_str x11vnc_prog\n"
+" global cmd_var menu_var default_var unset_str x11vnc_prog\n"
"\n"
" set xterm_cmd \"xterm -iconic -geometry 80x35 -title x11vnc-console -e\"\n"
"\n"
@@ -4886,24 +5020,26 @@
"\n"
" lappend cmd $x11vnc_prog\n"
"\n"
+" lappend cmd \"-gui\"\n"
+" lappend cmd \"none\"\n"
+"\n"
" set rc_txt \"\"\n"
"\n"
" set saw_id 0\n"
"\n"
" foreach item [lsort [array names menu_var]] {\n"
" if {$item == \"gui\"} {\n"
-" ;\n"
+" continue\n"
" } elseif {![active_when_starting $item]} {\n"
" continue\n"
" } elseif {[is_action $item]} {\n"
" continue\n"
-" }\n"
-" if {$item == \"debug_gui\"} {\n"
+" } elseif {$item == \"debug_gui\"} {\n"
" continue\n"
-" }\n"
-" if {$item == \"WindowView\"} {\n"
+" } elseif {$item == \"WindowView\"} {\n"
" continue\n"
" }\n"
+"\n"
" if {$item == \"id\" || $item == \"sid\"} {\n"
" set val $menu_var($item);\n"
" if {$val == \"0x0\" || $val == \"root\"} {\n"
@@ -4915,17 +5051,13 @@
" }\n"
" if {$item == \"id\"} {\n"
" set saw_id 1\n"
-" }\n"
-" if {$item == \"httpport\" && $menu_var($item) == \"0\"} {\n"
+" } elseif {$item == \"httpport\" && $menu_var($item) == \"0\"} {\n"
" continue\n"
-" }\n"
-" if {$item == \"progressive\" && $menu_var($item) == \"0\"} {\n"
+" } elseif {$item == \"progressive\" && $menu_var($item) == \"0\"} {\n"
" continue\n"
-" }\n"
-" if {$item == \"dontdisconnect\" && $menu_var($item) == \"-1\"} {\n"
+" } elseif {$item == \"dontdisconnect\" && $menu_var($item) == \"-1\"} {\n"
" continue\n"
-" }\n"
-" if {$item == \"alwaysshared\" && $menu_var($item) == \"-1\"} {\n"
+" } elseif {$item == \"alwaysshared\" && $menu_var($item) == \"-1\"} {\n"
" continue\n"
" }\n"
"\n"
@@ -4945,32 +5077,41 @@
" }\n"
" }\n"
" } elseif {[value_is_string $item]} {\n"
-" if {[info exists menu_var($item)]} {\n"
-" if {$menu_var($item) != \"\"\n"
-" && $menu_var($item) != $unset_str} {\n"
-" set add 1\n"
-" set nitem $item\n"
-" if {$nitem == \"screen_blank\"} {\n"
-" set nitem \"sb\"\n"
-" } elseif {$nitem == \"xrandr_mode\"} {\n"
-" set nitem \"xrandr\"\n"
-" } elseif {$nitem == \"wireframe_mode\"} {\n"
-" set nitem \"wireframe\"\n"
-" } elseif {$nitem == \"solid_color\"} {\n"
-" set nitem \"solid\"\n"
+" if {![info exists menu_var($item)]} {\n"
+" continue\n"
+" }\n"
+" if {$menu_var($item) != \"\" && $menu_var($item) != $unset_str} {\n"
+" set add 1\n"
+" set nitem [get_nitem $item]\n"
+"\n"
+" if {[info exists default_var($item)]} {\n"
+" if {$menu_var($item) == $default_var($item)} {\n"
+" set add 0;\n"
" }\n"
-" if {[info exists default_var($item)]} {\n"
-" if {$menu_var($item) == $default_var($item)} {\n"
-" set add 0;\n"
+" }\n"
+" if {$add} {\n"
+" lappend cmd \"-$nitem\"\n"
+" set mv $menu_var($item)\n"
+"\n"
+" if {[regexp {^~} $mv]} {\n"
+" if {$item == \"auth\" ||\n"
+" $item == \"rc\" ||\n"
+" $item == \"accept\" || \n"
+" $item == \"connect\" || \n"
+" $item == \"allow\" || \n"
+" $item == \"passwdfile\" || \n"
+" $item == \"o\" || \n"
+" $item == \"logfile\" || \n"
+" $item == \"remap\" || \n"
+" $item == \"httpdir\"} { \n"
+" set mv [tilde_expand $mv]\n"
" }\n"
" }\n"
-" if {$add} {\n"
-" lappend cmd \"-$nitem\"\n"
-" lappend cmd $menu_var($item)\n"
-" set mt $menu_var($item)\n"
-" regsub -all {#} $mt {\\#} mt\n"
-" append rc_txt \"-$nitem $mt\\n\"\n"
-" }\n"
+" \n"
+" lappend cmd $mv\n"
+" set mt $mv\n"
+" regsub -all {#} $mt {\\#} mt\n"
+" append rc_txt \"-$nitem $mt\\n\"\n"
" }\n"
" }\n"
" }\n"
@@ -5079,7 +5220,7 @@
" lappend cmd \"/dev/null\"\n"
"# lappend cmd \"/tmp/nono\"\n"
"\n"
-" if {0} {\n"
+" if {0 || $debug} {\n"
" set str [join $cmd]\n"
" puts \"running: $str\"\n"
" foreach word $cmd {\n"
@@ -5176,6 +5317,9 @@
"\n"
" set new [get_view_variable]\n"
"\n"
+" if {![info exists gui_current_state]} {\n"
+" set gui_current_state \"\"\n"
+" }\n"
" set old $gui_current_state\n"
" #puts \"$old -> $new\"\n"
"\n"