Commit ec45cd95 authored by runge's avatar runge

x11vnc: tweaks for release, fix queue buildup under -viewonly.

parent 640eb162
2005-07-09 Karl Runge <runge@karlrunge.com>
2005-07-12 Karl Runge <runge@karlrunge.com>
* x11vnc: tweaks for release, fix queue buildup under -viewonly
2005-07-10 Karl Runge <runge@karlrunge.com>
* x11vnc: -grab_buster for breaking XGrabServer deadlock, fix
scrolls and copyrect for -clip and -id cases.
......
2005-07-10 Karl Runge <runge@karlrunge.com>
* gui: remove nevershared etc., parse cmd line, bug fixes.
* x11vnc: fix pointer queue buildup under -viewonly.
2005-07-10 Karl Runge <runge@karlrunge.com>
* more improvements to gui, default values, save-settings..
* x11vnc scary password warnings. Release settings. -QD option.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -252,9 +252,9 @@ Permissions
=0 storepasswd
=GAL LOFF
=GAL Misc-Perms::
=S alwaysshared
=S nevershared
=S dontdisconnect
=0S alwaysshared
=0S nevershared
=0S dontdisconnect
=SQA deny_all
=GAL LOFF
......@@ -335,7 +335,8 @@ The \"Actions -> stop\" action sends a signal to the running x11vnc
server indicating it should shutdown all connections and exit.
The GUI stays running in case you want to start a new x11vnc or attach
to another one. Use \"Actions -> Quit\" if you want to have the gui exit.
to another one. Use \"Actions -> Quit\" if you then want to have the
gui exit. Use \"Actions -> stop+quit\" to have both exit at once.
"
set helptext(show-start-cmd) "
......@@ -345,8 +346,10 @@ settings. This can be done even in the attached state. Intended for
debugging the gui. The help item for \"Actions -> start\" gives the
same info.
If you want to load in a saved profile \"rc file\" use Misc -> rc
and select the file.
If you want to load in a saved profile \"rc file\" use \"Misc -> rc\"
and select the file. \"Actions -> load-settings\" does a similar thing
with an rc-file, but reading the file and setting the gui variables to
its values.
"
set helptext(debug_gui) "
......@@ -393,7 +396,9 @@ default. Basically sets everything to 0 or the string (unset).
This action is only available in \"startup\" mode, not when connected
to a running x11vnc server (in that case the variable settings reflect
the state of the running x11vnc).
the state of the running x11vnc). To detach from a running x11vnc
server use \"Actions -> detach\"; to completely stop the x11vnc server
use \"Actions -> stop\".
"
set helptext(defaults-all) "
......@@ -402,7 +407,9 @@ everything to the default queries \"x11vnc -QD var\" retrieved at startup.
This action is only available in \"startup\" mode, not when connected
to a running x11vnc server (in that case the variable settings reflect
the state of the running x11vnc).
the state of the running x11vnc). To detach from a running x11vnc
server use \"Actions -> detach\"; to completely stop the x11vnc server
use \"Actions -> stop\".
"
set helptext(load-settings) "
......@@ -416,7 +423,9 @@ using the gui before starting x11vnc.
This action is only available in \"startup\" mode, not when connected
to a running x11vnc server (in that case the variable settings reflect
the state of the running x11vnc).
the state of the running x11vnc). To detach from a running x11vnc
server use \"Actions -> detach\"; to completely stop the x11vnc server
use \"Actions -> stop\".
"
set helptext(save-settings) "
......@@ -652,6 +661,7 @@ with -rfbauth, but only with -passwdfile, -passwd, and -viewpasswd.
set helptext(Misc-Perms:) "
In this sub-menu we provide some lesser used permission options.
Regarding -alwaysshared, -nevershared, and -dontdisconnect, you probably
should never use them and just use x11vnc's -shared and -forever options
instead (these give basically the same functionality and if you mixed
......@@ -974,8 +984,9 @@ Key Bindings:
Anywhere: Control-a invokes \"Actions -> attach\"
Anywhere: Control-p invokes \"Actions -> ping\"
Anywhere: Control-u and Control-r invoke \"Actions -> update-all\"
"
set under_wally "
Misc:
Since x11vnc has so many settings and to avoid further confusion,
......@@ -2168,6 +2179,8 @@ proc get_default_vars {} {
set val ""
} elseif {$item == "auth"} {
set val ""
} elseif {$item == "gui"} {
continue
}
# some hacks we do here for now..
if {$item == "cursor" && $val == ""} {
......@@ -2176,8 +2189,8 @@ proc get_default_vars {} {
set val "always"
} elseif {$item == "wirecopyrect" && $val == ""} {
set val "always"
} elseif {$item == "overlay_nocursor" && $val == 0} {
set val 1
# } elseif {$item == "overlay_nocursor" && $val == 0} {
# set val 1
}
set default_var($item) $val
......@@ -2186,6 +2199,94 @@ proc get_default_vars {} {
}
}
proc tilde_expand {file} {
global env
if {[file exists $file]} {
return $file
}
set user ""
if {[info exists env(USER)]} {
set user $env(USER)
}
if {$user == "" && [info exists env(LOGNAME)]} {
set user $env(LOGNAME)
}
set home ""
if {[info exists env(HOME)]} {
set home $env(HOME)
} elseif {$user != ""} {
set home "/home/$user"
}
if {[regexp {^~} $file]} {
if {[regexp {^~/} $file]} {
if {$home != ""} {
regsub {^~} $file $home file
}
} else {
regsub {^~} $file "/home/" file
}
}
return $file
}
proc insert_cmdline_vars {} {
global env cmd_var menu_var default_var x11vnc_cmdline
if {![info exists x11vnc_cmdline]} {
return
}
if {$x11vnc_cmdline == ""} {
return
}
set cmd_var(novar) 1
set str [string trim $x11vnc_cmdline]
while {[regexp -- {^-} $str]} {
if {[regexp -- {^--*([^ \t][^ \t]*)(.*)$} $str m var rest]} {
set rest [string trim $rest]
set var [string trim $var]
if {[regexp {^\{\{([^\}]*)\}\}(.*)} $rest m val rest]} {
set str [string trim $rest]
set cmd_var($var) $val
} else {
set str $rest
set cmd_var($var) "boolean"
}
} else {
break
}
}
if {[info exists cmd_var(rc)]} {
load_settings $cmd_var(rc)
} elseif {[info exists cmd_var(norc)]} {
;
} else {
set filex [tilde_expand "~/.x11vncrc"]
if {[file exists $filex]} {
load_settings $filex
}
}
foreach var [array names cmd_var] {
if {$var == "novar"} {
continue
}
if {[regexp {^[ \t]*$} $var]} {
continue
}
if {[info exists menu_var($var)]} {
if {$cmd_var($var) == "boolean"} {
set menu_var($var) 1
} else {
set menu_var($var) $cmd_var($var)
}
}
}
}
proc copy_default_vars {} {
global menu_var default_var
foreach item [array names default_var] {
......@@ -2239,22 +2340,25 @@ proc update_menu_vars {{query ""}} {
}
}
proc load_settings {} {
global menu_var default_var
proc load_settings {{file ""}} {
global menu_var default_var env
if {$file == ""} {
if {![info exists menu_var(load-settings)]} {
return
}
set file $menu_var(load-settings)
}
if {$file == ""} {
return
}
set fh ""
catch {set fh [open $file "r"]}
set filex [tilde_expand $file]
catch {set fh [open $filex "r"]}
if {$fh == ""} {
append_text "load_settings: *** failed to open $file ***\n"
append_text "load_settings: *** failed to open $filex ***\n"
return
}
copy_default_vars
......@@ -2281,6 +2385,9 @@ proc load_settings {} {
}
close $fh
set count 0
set parms ""
foreach line [split $str "\n"] {
set line [string trim $line]
regsub {^--*} $line "" line
......@@ -2291,15 +2398,30 @@ proc load_settings {} {
if {[regexp {^[ \t]*$} $item]} {
continue
}
if {$item == "gui"} {
continue
}
if {[info exists menu_var($item)]} {
if {[value_is_bool $item]} {
set menu_var($item) 1
incr count
append parms " -$item\n"
} elseif {[value_is_string $item]} {
if {$value != ""} {
set menu_var($item) $value
set nitem [get_nitem $item]
append parms " -$nitem $value\n"
incr count
}
}
}
}
append_text "loaded $count parameter settings from $filex"
if {$count > 0} {
append_text ":\n"
append_text $parms
} else {
append_text ".\n"
}
}
......@@ -2361,6 +2483,7 @@ proc save_settings {} {
if {$file == ""} {
return
}
set file [tilde_expand $file]
append_text "\nSaving current settings to $file ...\n"
if {[file exists $file]} {
set backup "${file}~"
......@@ -2525,7 +2648,8 @@ proc show_all_settings {} {
proc show_logfile {} {
global menu_var unset_str
set logfile $menu_var(logfile)
set logfile [tilde_expand $menu_var(logfile)]
if {$logfile == "" || $logfile == $unset_str} {
set txt "\nNo logfile was specified at x11vnc startup.\n\n"
......@@ -3843,6 +3967,8 @@ proc do_new_client {} {
button $w.b -text OK -command "destroy $w" -font $bfont
bind $w.e <Return> "update; after 100; destroy $w"
wm title $w "New Client"
pack $w.l $w.e $w.b -side left -pady 1m -padx 1m
focus $w.e
center_win $w
......@@ -4338,6 +4464,8 @@ proc make_gui {mode} {
wm minsize . 1 1
set gui_current_state ""
if {$mode == "full"} {
frame $fw
set icon_mode 0
......@@ -4397,6 +4525,8 @@ proc make_gui {mode} {
copy_default_vars
if {$x11vnc_connect} {
try_connect_and_query_all
} else {
insert_cmdline_vars
}
} else {
set_name "RESTORE"
......@@ -4731,13 +4861,12 @@ proc get_settings_rcfile {} {
}
if {$item == "debug_gui"} {
continue
}
if {$item == "WindowView"} {
} elseif {$item == "WindowView"} {
continue
}
if {$item == "rc" || $item == "norc"} {
} elseif {$item == "rc" || $item == "norc"} {
continue
}
set def ""
if {[info exists default_var($item)]} {
set def $default_var($item)
......@@ -4768,16 +4897,7 @@ proc get_settings_rcfile {} {
set ntab 3
if {$item == "gui" || [value_is_string $item]} {
set nitem $item
if {$nitem == "screen_blank"} {
set nitem "sb"
} elseif {$nitem == "xrandr_mode"} {
set nitem "xrandr"
} elseif {$nitem == "wireframe_mode"} {
set nitem "wireframe"
} elseif {$nitem == "solid_color"} {
set nitem "solid"
}
set nitem [get_nitem $item]
if {$mv == "" && $def != ""} {
set qst $hmm
......@@ -4871,8 +4991,22 @@ proc show_start_cmd {} {
append_text "$msg\n"
}
proc get_nitem {item} {
set nitem $item
if {$nitem == "screen_blank"} {
set nitem "sb"
} elseif {$nitem == "xrandr_mode"} {
set nitem "xrandr"
} elseif {$nitem == "wireframe_mode"} {
set nitem "wireframe"
} elseif {$nitem == "solid_color"} {
set nitem "solid"
}
return $nitem
}
proc get_start_x11vnc_cmd {{show_rc 0}} {
global menu_var default_var unset_str x11vnc_prog
global cmd_var menu_var default_var unset_str x11vnc_prog
set xterm_cmd "xterm -iconic -geometry 80x35 -title x11vnc-console -e"
......@@ -4880,24 +5014,26 @@ proc get_start_x11vnc_cmd {{show_rc 0}} {
lappend cmd $x11vnc_prog
lappend cmd "-gui"
lappend cmd "none"
set rc_txt ""
set saw_id 0
foreach item [lsort [array names menu_var]] {
if {$item == "gui"} {
;
continue
} elseif {![active_when_starting $item]} {
continue
} elseif {[is_action $item]} {
continue
}
if {$item == "debug_gui"} {
} elseif {$item == "debug_gui"} {
continue
}
if {$item == "WindowView"} {
} elseif {$item == "WindowView"} {
continue
}
if {$item == "id" || $item == "sid"} {
set val $menu_var($item);
if {$val == "0x0" || $val == "root"} {
......@@ -4909,17 +5045,13 @@ proc get_start_x11vnc_cmd {{show_rc 0}} {
}
if {$item == "id"} {
set saw_id 1
}
if {$item == "httpport" && $menu_var($item) == "0"} {
} elseif {$item == "httpport" && $menu_var($item) == "0"} {
continue
}
if {$item == "progressive" && $menu_var($item) == "0"} {
} elseif {$item == "progressive" && $menu_var($item) == "0"} {
continue
}
if {$item == "dontdisconnect" && $menu_var($item) == "-1"} {
} elseif {$item == "dontdisconnect" && $menu_var($item) == "-1"} {
continue
}
if {$item == "alwaysshared" && $menu_var($item) == "-1"} {
} elseif {$item == "alwaysshared" && $menu_var($item) == "-1"} {
continue
}
......@@ -4939,20 +5071,13 @@ proc get_start_x11vnc_cmd {{show_rc 0}} {
}
}
} elseif {[value_is_string $item]} {
if {[info exists menu_var($item)]} {
if {$menu_var($item) != ""
&& $menu_var($item) != $unset_str} {
set add 1
set nitem $item
if {$nitem == "screen_blank"} {
set nitem "sb"
} elseif {$nitem == "xrandr_mode"} {
set nitem "xrandr"
} elseif {$nitem == "wireframe_mode"} {
set nitem "wireframe"
} elseif {$nitem == "solid_color"} {
set nitem "solid"
if {![info exists menu_var($item)]} {
continue
}
if {$menu_var($item) != "" && $menu_var($item) != $unset_str} {
set add 1
set nitem [get_nitem $item]
if {[info exists default_var($item)]} {
if {$menu_var($item) == $default_var($item)} {
set add 0;
......@@ -4960,15 +5085,31 @@ proc get_start_x11vnc_cmd {{show_rc 0}} {
}
if {$add} {
lappend cmd "-$nitem"
lappend cmd $menu_var($item)
set mt $menu_var($item)
set mv $menu_var($item)
if {[regexp {^~} $mv]} {
if {$item == "auth" ||
$item == "rc" ||
$item == "accept" ||
$item == "connect" ||
$item == "allow" ||
$item == "passwdfile" ||
$item == "o" ||
$item == "logfile" ||
$item == "remap" ||
$item == "httpdir"} {
set mv [tilde_expand $mv]
}
}
lappend cmd $mv
set mt $mv
regsub -all {#} $mt {\#} mt
append rc_txt "-$nitem $mt\n"
}
}
}
}
}
lappend cmd "2>"
lappend cmd "/dev/null"
lappend cmd "&"
......@@ -5073,7 +5214,7 @@ proc run_remote_cmd {opts} {
lappend cmd "/dev/null"
# lappend cmd "/tmp/nono"
if {0} {
if {0 || $debug} {
set str [join $cmd]
puts "running: $str"
foreach word $cmd {
......@@ -5170,6 +5311,9 @@ proc change_view_state {} {
set new [get_view_variable]
if {![info exists gui_current_state]} {
set gui_current_state ""
}
set old $gui_current_state
#puts "$old -> $new"
......
......@@ -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 {$file == \"\"} {\n"
" if {![info exists menu_var(load-settings)]} {\n"
" return\n"
" }\n"
" set file $menu_var(load-settings)\n"
" }\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,15 +2404,30 @@
" 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"
......@@ -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,20 +5077,13 @@
" }\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"
......@@ -4966,15 +5091,31 @@
" }\n"
" if {$add} {\n"
" lappend cmd \"-$nitem\"\n"
" lappend cmd $menu_var($item)\n"
" set mt $menu_var($item)\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"
" \n"
" lappend cmd $mv\n"
" set mt $mv\n"
" regsub -all {#} $mt {\\#} mt\n"
" append rc_txt \"-$nitem $mt\\n\"\n"
" }\n"
" }\n"
" }\n"
" }\n"
" }\n"
" lappend cmd \"2>\"\n"
" lappend cmd \"/dev/null\"\n"
" lappend cmd \"&\"\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"
......
......@@ -2,7 +2,7 @@
.TH X11VNC "1" "July 2005" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
version: 0.7.2, lastmod: 2005-07-10
version: 0.7.2, lastmod: 2005-07-12
.SH SYNOPSIS
.B x11vnc
[OPTION]...
......@@ -1804,6 +1804,10 @@ given by hexnumber. Use =noadvanced to disable the
full gui. (To supply more than one, use "+" sign).
E.g. \fB-gui\fR tray=setpass and \fB-gui\fR icon=0x3600028
.IP
Other modes: "full", the default and need not be
specified. "\fB-gui\fR \fInone\fR", do not show a gui, useful
to override a ~/.x11vncrc setting, etc.
.IP
5) When "geom=+X+Y" is specified, that geometry
is passed to the gui toplevel. This is the icon in
icon/tray mode, or the full gui otherwise. You can
......
......@@ -387,7 +387,7 @@ double xdamage_scheduled_mark = 0.0;
sraRegionPtr xdamage_scheduled_mark_region = NULL;
/* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.7.2 lastmod: 2005-07-10";
char lastmod[] = "0.7.2 lastmod: 2005-07-12";
int hack_val = 0;
/* X display info */
......@@ -531,7 +531,9 @@ int cursor_x, cursor_y; /* x and y from the viewer(s) */
int button_change_x, button_change_y;
int got_user_input = 0;
int got_pointer_input = 0;
int got_pointer_calls = 0;
int got_keyboard_input = 0;
int got_keyboard_calls = 0;
int urgent_update = 0;
int last_keyboard_keycode = 0;
rfbBool last_rfb_down = FALSE;
......@@ -800,7 +802,9 @@ enum {
char *rc_rcfile = NULL; /* -rc */
int rc_rcfile_default = 0;
int rc_norc = 0;
int got_norc = 0;
int opts_bg = 0;
#ifndef VNCSHARED
......@@ -9586,6 +9590,7 @@ void keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) {
static double max_keyrepeat_last_time = 0.0;
dtime0(&tnow);
got_keyboard_calls++;
if (debug_keyboard) {
char *str;
......@@ -10520,6 +10525,10 @@ void pointer(int mask, int x, int y, rfbClientPtr client) {
int sent = 0, buffer_it = 0;
double now;
if (mask >= 0) {
got_pointer_calls++;
}
if (debug_pointer && mask >= 0) {
static int show_motion = -1;
static double last_pointer = 0.0;
......@@ -12573,13 +12582,13 @@ int send_remote_cmd(char *cmd, int query, int wait) {
}
if (in != NULL) {
fprintf(stderr, "sending remote command: \"%s\"\nvia connect"
" file: %s\n", cmd, client_connect_file);
fprintf(stderr, ">>> sending remote command: \"%s\"\n via"
" connect file: %s\n", cmd, client_connect_file);
fprintf(in, "%s\n", cmd);
fclose(in);
} else {
fprintf(stderr, "sending remote command: \"%s\" via VNC_CONNECT"
" X property.\n", cmd);
fprintf(stderr, ">>> sending remote command: \"%s\" via"
" VNC_CONNECT X property.\n", cmd);
set_vnc_connect_prop(cmd);
XFlush(dpy);
}
......@@ -16090,9 +16099,13 @@ char *process_remote_cmd(char *cmd, int stringonly) {
} else if (!strcmp(p, "flag")) {
snprintf(buf, bufn, "aro=%s:%s", p, NONUL(flagfile));
} else if (!strcmp(p, "rc")) {
snprintf(buf, bufn, "aro=%s:%s", p, NONUL(rc_rcfile));
char *s = rc_rcfile;
if (rc_rcfile_default) {
s = NULL;
}
snprintf(buf, bufn, "aro=%s:%s", p, NONUL(s));
} else if (!strcmp(p, "norc")) {
snprintf(buf, bufn, "aro=%s:%d", p, rc_norc);
snprintf(buf, bufn, "aro=%s:%d", p, got_norc);
} else if (!strcmp(p, "h") || !strcmp(p, "help") ||
!strcmp(p, "V") || !strcmp(p, "version") ||
!strcmp(p, "lastmod")) {
......@@ -18230,6 +18243,8 @@ void restore_cursor_shape_updates(rfbScreenInfoPtr s) {
void disable_cursor_shape_updates(rfbScreenInfoPtr s) {
rfbClientIteratorPtr iter;
rfbClientPtr cl;
static int changed = 0;
int count = 0;
if (! s || ! s->clientHead) {
return;
......@@ -18242,9 +18257,17 @@ void disable_cursor_shape_updates(rfbScreenInfoPtr s) {
if (cl->enableCursorShapeUpdates) {
cd->had_cursor_shape_updates = 1;
count++;
if (debug_pointer) {
rfbLog("%s disable HCSU\n", cl->host);
}
}
if (cl->enableCursorPosUpdates) {
cd->had_cursor_pos_updates = 1;
count++;
if (debug_pointer) {
rfbLog("%s disable HCPU\n", cl->host);
}
}
cl->enableCursorShapeUpdates = FALSE;
......@@ -18252,6 +18275,10 @@ void disable_cursor_shape_updates(rfbScreenInfoPtr s) {
cl->cursorWasChanged = FALSE;
}
rfbReleaseClientIterator(iter);
if (count) {
changed = 1;
}
}
int cursor_shape_updates_clients(rfbScreenInfoPtr s) {
......@@ -23977,7 +24004,7 @@ void run_gui(char *gui_xdisplay, int connect_to_x11vnc, int simple_gui,
FILE *pipe, *tmpf;
if (*gui_code == '\0') {
rfbLog("gui not compiled into this program.\n");
rfbLog("gui: gui not compiled into this program.\n");
exit(0);
}
if (getenv("DISPLAY") != NULL) {
......@@ -23990,7 +24017,7 @@ void run_gui(char *gui_xdisplay, int connect_to_x11vnc, int simple_gui,
}
if (connect_to_x11vnc) {
int rc, i;
rfbLogEnable(0);
rfbLogEnable(1);
if (! client_connect_file) {
if (getenv("XAUTHORITY") != NULL) {
old_xauth = strdup(getenv("XAUTHORITY"));
......@@ -24008,7 +24035,7 @@ void run_gui(char *gui_xdisplay, int connect_to_x11vnc, int simple_gui,
dpy = XOpenDisplay(x11vnc_xdisplay);
}
if (! dpy) {
fprintf(stderr, "gui: could not open x11vnc "
rfbLog("gui: could not open x11vnc "
"display: %s\n", NONUL(x11vnc_xdisplay));
exit(1);
}
......@@ -24018,16 +24045,18 @@ void run_gui(char *gui_xdisplay, int connect_to_x11vnc, int simple_gui,
}
usleep(2200*1000);
fprintf(stderr, "\n");
rfbLog("gui: trying to contact a x11vnc server at X display "
"%s ...\n", NONUL(x11vnc_xdisplay));
for (i=0; i<try_max; i++) {
usleep(sleep*1000);
fprintf(stderr, "gui: pinging %s try=%d ...\n",
rfbLog("gui: pinging %s try=%d ...\n",
NONUL(x11vnc_xdisplay), i+1);
rc = send_remote_cmd("qry=ping", 1, 1);
if (rc == 0) {
break;
}
if (parent && mypid != parent && kill(parent, 0) != 0) {
fprintf(stderr, "gui: parent process %d has gone"
rfbLog("gui: parent process %d has gone"
" away: bailing out.\n", parent);
rc = 1;
break;
......@@ -24038,10 +24067,10 @@ void run_gui(char *gui_xdisplay, int connect_to_x11vnc, int simple_gui,
set_env("X11VNC_AUTH_FILE", getenv("XAUTHORITY"));
}
if (rc == 0) {
fprintf(stderr, "gui: ping succeeded.\n");
rfbLog("gui: ping succeeded.\n");
set_env("X11VNC_CONNECT", "1");
} else {
fprintf(stderr, "gui: could not connect to: '%s', try"
rfbLog("gui: could not connect to: '%s', try"
" again manually.\n", x11vnc_xdisplay);
}
if (client_connect_file) {
......@@ -24063,6 +24092,7 @@ void run_gui(char *gui_xdisplay, int connect_to_x11vnc, int simple_gui,
}
free(old_xauth);
}
rfbLogEnable(0);
}
orig_path = getenv("PATH");
......@@ -24211,7 +24241,7 @@ void do_gui(char *opts, int sleep) {
int got_gui_xdisplay = 0;
int start_x11vnc = 1;
int connect_to_x11vnc = 0;
int simple_gui = 0;
int simple_gui = 0, none_gui = 0;
Display *test_dpy;
if (opts) {
......@@ -24245,6 +24275,8 @@ void do_gui(char *opts, int sleep) {
} else if (!strcmp(p, "wait")) {
start_x11vnc = 0;
connect_to_x11vnc = 0;
} else if (!strcmp(p, "none")) {
none_gui = 1;
} else if (!strcmp(p, "conn") || !strcmp(p, "connect")) {
start_x11vnc = 0;
connect_to_x11vnc = 1;
......@@ -24255,6 +24287,8 @@ void do_gui(char *opts, int sleep) {
if ((q = strchr(p, '=')) != NULL) {
icon_mode_font = strdup(q+1);
}
} else if (!strcmp(p, "full")) {
;
} else if (strstr(p, "tray") == p || strstr(p, "icon") == p) {
char *q;
icon_mode = 1;
......@@ -24279,6 +24313,13 @@ void do_gui(char *opts, int sleep) {
p = strtok(NULL, ",");
}
free(s);
if (none_gui) {
if (!start_x11vnc) {
exit(0);
}
return;
}
if (start_x11vnc) {
connect_to_x11vnc = 1;
}
......@@ -26425,6 +26466,32 @@ int scrollability(Window win, int set) {
return set;
}
void eat_viewonly_input(int max_eat, int keep) {
int i, gp, gk;
for (i=0; i<max_eat; i++) {
int cont = 0;
gp = got_pointer_calls;
gk = got_keyboard_calls;
rfbCFD(0);
if (got_pointer_calls > gp) {
if (debug_pointer) {
rfbLog("eat_viewonly_input: pointer: %d\n", i);
}
cont++;
}
if (got_keyboard_calls > gk) {
if (debug_keyboard) {
rfbLog("eat_viewonly_input: keyboard: %d\n", i);
}
cont++;
}
if (i >= keep - 1 && ! cont) {
break;
}
}
}
int eat_pointer(int max_ptr_eat, int keep) {
int i, count = 0, gp = got_pointer_input;
......@@ -29585,7 +29652,9 @@ static void watch_loop(void) {
got_user_input = 0;
got_pointer_input = 0;
got_pointer_calls = 0;
got_keyboard_input = 0;
got_keyboard_calls = 0;
urgent_update = 0;
if (! use_threads) {
......@@ -29614,6 +29683,12 @@ if (debug_scroll) fprintf(stderr, "watch_loop: LOOP-BACK: %d\n", ret);
continue;
}
}
/* watch for viewonly input piling up: */
if ((got_pointer_calls > got_pointer_input)
|| (got_keyboard_calls > got_keyboard_input)) {
eat_viewonly_input(10, 3);
}
} else {
if (0 && use_xrecord) {
/* XXX not working */
......@@ -31174,6 +31249,10 @@ static void print_help(int mode) {
" full gui. (To supply more than one, use \"+\" sign).\n"
" E.g. -gui tray=setpass and -gui icon=0x3600028\n"
"\n"
" Other modes: \"full\", the default and need not be\n"
" specified. \"-gui none\", do not show a gui, useful\n"
" to override a ~/.x11vncrc setting, etc.\n"
"\n"
" 5) When \"geom=+X+Y\" is specified, that geometry\n"
" is passed to the gui toplevel. This is the icon in\n"
" icon/tray mode, or the full gui otherwise. You can\n"
......@@ -31868,6 +31947,7 @@ static void check_rcfile(int argc, char **argv) {
}
if (!strcmp(argv[i], "-norc")) {
norc = 1;
got_norc = 1;
}
if (!strcmp(argv[i], "-QD")) {
norc = 1;
......@@ -31909,6 +31989,7 @@ static void check_rcfile(int argc, char **argv) {
norc = 1;
} else {
rc_rcfile = strdup(rcfile);
rc_rcfile_default = 1;
}
}
}
......@@ -31975,7 +32056,7 @@ static void check_rcfile(int argc, char **argv) {
c = *q;
q++;
}
if (q != p) {
if (q != p && !cont) {
if (*q == '\0') {
q--;
}
......@@ -32252,7 +32333,7 @@ void nopassword_warning_msg(int gotloc) {
fprintf(stderr, "%s", str1);
fflush(stderr);
usleep(2500 * 1000);
usleep(2000 * 1000);
fprintf(stderr, "%s", str2);
if (gotloc) {
fprintf(stderr, "%s", str3);
......@@ -32940,6 +33021,10 @@ int main(int argc, char* argv[]) {
if (!got_passwd && !got_rfbauth && !got_passwdfile && !nopw) {
running_without_passwd = 1;
}
if (launch_gui && (query_cmd || remote_cmd)) {
launch_gui = 0;
gui_str = NULL;
}
if (launch_gui) {
int sleep = 0;
if (running_without_passwd && !quiet) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment