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

pull/1/head
runge 19 years ago
parent 640eb16239
commit ec45cd952b

@ -1,4 +1,7 @@
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 * x11vnc: -grab_buster for breaking XGrabServer deadlock, fix
scrolls and copyrect for -clip and -id cases. scrolls and copyrect for -clip and -id cases.

@ -1,3 +1,7 @@
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> 2005-07-10 Karl Runge <runge@karlrunge.com>
* more improvements to gui, default values, save-settings.. * more improvements to gui, default values, save-settings..
* x11vnc scary password warnings. Release settings. -QD option. * x11vnc scary password warnings. Release settings. -QD option.

File diff suppressed because it is too large Load Diff

@ -252,9 +252,9 @@ Permissions
=0 storepasswd =0 storepasswd
=GAL LOFF =GAL LOFF
=GAL Misc-Perms:: =GAL Misc-Perms::
=S alwaysshared =0S alwaysshared
=S nevershared =0S nevershared
=S dontdisconnect =0S dontdisconnect
=SQA deny_all =SQA deny_all
=GAL LOFF =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. server indicating it should shutdown all connections and exit.
The GUI stays running in case you want to start a new x11vnc or attach 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) " 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 debugging the gui. The help item for \"Actions -> start\" gives the
same info. same info.
If you want to load in a saved profile \"rc file\" use Misc -> rc If you want to load in a saved profile \"rc file\" use \"Misc -> rc\"
and select the file. 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) " 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 This action is only available in \"startup\" mode, not when connected
to a running x11vnc server (in that case the variable settings reflect 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) " 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 This action is only available in \"startup\" mode, not when connected
to a running x11vnc server (in that case the variable settings reflect 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) " 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 This action is only available in \"startup\" mode, not when connected
to a running x11vnc server (in that case the variable settings reflect 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) " set helptext(save-settings) "
@ -652,6 +661,7 @@ with -rfbauth, but only with -passwdfile, -passwd, and -viewpasswd.
set helptext(Misc-Perms:) " set helptext(Misc-Perms:) "
In this sub-menu we provide some lesser used permission options. In this sub-menu we provide some lesser used permission options.
Regarding -alwaysshared, -nevershared, and -dontdisconnect, you probably Regarding -alwaysshared, -nevershared, and -dontdisconnect, you probably
should never use them and just use x11vnc's -shared and -forever options should never use them and just use x11vnc's -shared and -forever options
instead (these give basically the same functionality and if you mixed 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-a invokes \"Actions -> attach\"
Anywhere: Control-p invokes \"Actions -> ping\" Anywhere: Control-p invokes \"Actions -> ping\"
Anywhere: Control-u and Control-r invoke \"Actions -> update-all\" Anywhere: Control-u and Control-r invoke \"Actions -> update-all\"
"
set under_wally "
Misc: Misc:
Since x11vnc has so many settings and to avoid further confusion, Since x11vnc has so many settings and to avoid further confusion,
@ -2168,6 +2179,8 @@ proc get_default_vars {} {
set val "" set val ""
} elseif {$item == "auth"} { } elseif {$item == "auth"} {
set val "" set val ""
} elseif {$item == "gui"} {
continue
} }
# some hacks we do here for now.. # some hacks we do here for now..
if {$item == "cursor" && $val == ""} { if {$item == "cursor" && $val == ""} {
@ -2176,8 +2189,8 @@ proc get_default_vars {} {
set val "always" set val "always"
} elseif {$item == "wirecopyrect" && $val == ""} { } elseif {$item == "wirecopyrect" && $val == ""} {
set val "always" set val "always"
} elseif {$item == "overlay_nocursor" && $val == 0} { # } elseif {$item == "overlay_nocursor" && $val == 0} {
set val 1 # set val 1
} }
set default_var($item) $val 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 {} { proc copy_default_vars {} {
global menu_var default_var global menu_var default_var
foreach item [array names default_var] { foreach item [array names default_var] {
@ -2239,22 +2340,25 @@ proc update_menu_vars {{query ""}} {
} }
} }
proc load_settings {} { proc load_settings {{file ""}} {
global menu_var default_var global menu_var default_var env
if {![info exists menu_var(load-settings)]} { if {$file == ""} {
return if {![info exists menu_var(load-settings)]} {
return
}
set file $menu_var(load-settings)
} }
set file $menu_var(load-settings)
if {$file == ""} { if {$file == ""} {
return return
} }
set fh "" set fh ""
catch {set fh [open $file "r"]} set filex [tilde_expand $file]
catch {set fh [open $filex "r"]}
if {$fh == ""} { if {$fh == ""} {
append_text "load_settings: *** failed to open $file ***\n" append_text "load_settings: *** failed to open $filex ***\n"
return return
} }
copy_default_vars copy_default_vars
@ -2281,6 +2385,9 @@ proc load_settings {} {
} }
close $fh close $fh
set count 0
set parms ""
foreach line [split $str "\n"] { foreach line [split $str "\n"] {
set line [string trim $line] set line [string trim $line]
regsub {^--*} $line "" line regsub {^--*} $line "" line
@ -2291,16 +2398,31 @@ proc load_settings {} {
if {[regexp {^[ \t]*$} $item]} { if {[regexp {^[ \t]*$} $item]} {
continue continue
} }
if {$item == "gui"} {
continue
}
if {[info exists menu_var($item)]} { if {[info exists menu_var($item)]} {
if {[value_is_bool $item]} { if {[value_is_bool $item]} {
set menu_var($item) 1 set menu_var($item) 1
incr count
append parms " -$item\n"
} elseif {[value_is_string $item]} { } elseif {[value_is_string $item]} {
if {$value != ""} { if {$value != ""} {
set menu_var($item) $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"
}
} }
proc save_settings {} { proc save_settings {} {
@ -2361,6 +2483,7 @@ proc save_settings {} {
if {$file == ""} { if {$file == ""} {
return return
} }
set file [tilde_expand $file]
append_text "\nSaving current settings to $file ...\n" append_text "\nSaving current settings to $file ...\n"
if {[file exists $file]} { if {[file exists $file]} {
set backup "${file}~" set backup "${file}~"
@ -2525,7 +2648,8 @@ proc show_all_settings {} {
proc show_logfile {} { proc show_logfile {} {
global menu_var unset_str global menu_var unset_str
set logfile $menu_var(logfile)
set logfile [tilde_expand $menu_var(logfile)]
if {$logfile == "" || $logfile == $unset_str} { if {$logfile == "" || $logfile == $unset_str} {
set txt "\nNo logfile was specified at x11vnc startup.\n\n" 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 button $w.b -text OK -command "destroy $w" -font $bfont
bind $w.e <Return> "update; after 100; destroy $w" 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 pack $w.l $w.e $w.b -side left -pady 1m -padx 1m
focus $w.e focus $w.e
center_win $w center_win $w
@ -4338,6 +4464,8 @@ proc make_gui {mode} {
wm minsize . 1 1 wm minsize . 1 1
set gui_current_state ""
if {$mode == "full"} { if {$mode == "full"} {
frame $fw frame $fw
set icon_mode 0 set icon_mode 0
@ -4397,6 +4525,8 @@ proc make_gui {mode} {
copy_default_vars copy_default_vars
if {$x11vnc_connect} { if {$x11vnc_connect} {
try_connect_and_query_all try_connect_and_query_all
} else {
insert_cmdline_vars
} }
} else { } else {
set_name "RESTORE" set_name "RESTORE"
@ -4731,13 +4861,12 @@ proc get_settings_rcfile {} {
} }
if {$item == "debug_gui"} { if {$item == "debug_gui"} {
continue continue
} } elseif {$item == "WindowView"} {
if {$item == "WindowView"} {
continue continue
} } elseif {$item == "rc" || $item == "norc"} {
if {$item == "rc" || $item == "norc"} {
continue continue
} }
set def "" set def ""
if {[info exists default_var($item)]} { if {[info exists default_var($item)]} {
set def $default_var($item) set def $default_var($item)
@ -4768,16 +4897,7 @@ proc get_settings_rcfile {} {
set ntab 3 set ntab 3
if {$item == "gui" || [value_is_string $item]} { if {$item == "gui" || [value_is_string $item]} {
set nitem $item set nitem [get_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 {$mv == "" && $def != ""} { if {$mv == "" && $def != ""} {
set qst $hmm set qst $hmm
@ -4871,8 +4991,22 @@ proc show_start_cmd {} {
append_text "$msg\n" 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}} { 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" 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 $x11vnc_prog
lappend cmd "-gui"
lappend cmd "none"
set rc_txt "" set rc_txt ""
set saw_id 0 set saw_id 0
foreach item [lsort [array names menu_var]] { foreach item [lsort [array names menu_var]] {
if {$item == "gui"} { if {$item == "gui"} {
; continue
} elseif {![active_when_starting $item]} { } elseif {![active_when_starting $item]} {
continue continue
} elseif {[is_action $item]} { } elseif {[is_action $item]} {
continue continue
} } elseif {$item == "debug_gui"} {
if {$item == "debug_gui"} {
continue continue
} } elseif {$item == "WindowView"} {
if {$item == "WindowView"} {
continue continue
} }
if {$item == "id" || $item == "sid"} { if {$item == "id" || $item == "sid"} {
set val $menu_var($item); set val $menu_var($item);
if {$val == "0x0" || $val == "root"} { if {$val == "0x0" || $val == "root"} {
@ -4909,17 +5045,13 @@ proc get_start_x11vnc_cmd {{show_rc 0}} {
} }
if {$item == "id"} { if {$item == "id"} {
set saw_id 1 set saw_id 1
} } elseif {$item == "httpport" && $menu_var($item) == "0"} {
if {$item == "httpport" && $menu_var($item) == "0"} {
continue continue
} } elseif {$item == "progressive" && $menu_var($item) == "0"} {
if {$item == "progressive" && $menu_var($item) == "0"} {
continue continue
} } elseif {$item == "dontdisconnect" && $menu_var($item) == "-1"} {
if {$item == "dontdisconnect" && $menu_var($item) == "-1"} {
continue continue
} } elseif {$item == "alwaysshared" && $menu_var($item) == "-1"} {
if {$item == "alwaysshared" && $menu_var($item) == "-1"} {
continue continue
} }
@ -4939,32 +5071,41 @@ proc get_start_x11vnc_cmd {{show_rc 0}} {
} }
} }
} elseif {[value_is_string $item]} { } elseif {[value_is_string $item]} {
if {[info exists menu_var($item)]} { if {![info exists menu_var($item)]} {
if {$menu_var($item) != "" continue
&& $menu_var($item) != $unset_str} { }
set add 1 if {$menu_var($item) != "" && $menu_var($item) != $unset_str} {
set nitem $item set add 1
if {$nitem == "screen_blank"} { set nitem [get_nitem $item]
set nitem "sb"
} elseif {$nitem == "xrandr_mode"} { if {[info exists default_var($item)]} {
set nitem "xrandr" if {$menu_var($item) == $default_var($item)} {
} elseif {$nitem == "wireframe_mode"} { set add 0;
set nitem "wireframe"
} elseif {$nitem == "solid_color"} {
set nitem "solid"
} }
if {[info exists default_var($item)]} { }
if {$menu_var($item) == $default_var($item)} { if {$add} {
set add 0; lappend cmd "-$nitem"
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]
} }
} }
if {$add} {
lappend cmd "-$nitem" lappend cmd $mv
lappend cmd $menu_var($item) set mt $mv
set mt $menu_var($item) regsub -all {#} $mt {\#} mt
regsub -all {#} $mt {\#} mt append rc_txt "-$nitem $mt\n"
append rc_txt "-$nitem $mt\n"
}
} }
} }
} }
@ -5073,7 +5214,7 @@ proc run_remote_cmd {opts} {
lappend cmd "/dev/null" lappend cmd "/dev/null"
# lappend cmd "/tmp/nono" # lappend cmd "/tmp/nono"
if {0} { if {0 || $debug} {
set str [join $cmd] set str [join $cmd]
puts "running: $str" puts "running: $str"
foreach word $cmd { foreach word $cmd {
@ -5170,6 +5311,9 @@ proc change_view_state {} {
set new [get_view_variable] set new [get_view_variable]
if {![info exists gui_current_state]} {
set gui_current_state ""
}
set old $gui_current_state set old $gui_current_state
#puts "$old -> $new" #puts "$old -> $new"

@ -258,9 +258,9 @@
" =0 storepasswd\n" " =0 storepasswd\n"
" =GAL LOFF\n" " =GAL LOFF\n"
" =GAL Misc-Perms::\n" " =GAL Misc-Perms::\n"
" =S alwaysshared\n" " =0S alwaysshared\n"
" =S nevershared\n" " =0S nevershared\n"
" =S dontdisconnect\n" " =0S dontdisconnect\n"
" =SQA deny_all\n" " =SQA deny_all\n"
" =GAL LOFF\n" " =GAL LOFF\n"
"\n" "\n"
@ -341,7 +341,8 @@
"server indicating it should shutdown all connections and exit.\n" "server indicating it should shutdown all connections and exit.\n"
"\n" "\n"
"The GUI stays running in case you want to start a new x11vnc or attach\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"
"\n" "\n"
" set helptext(show-start-cmd) \"\n" " set helptext(show-start-cmd) \"\n"
@ -351,8 +352,10 @@
"debugging the gui. The help item for \\\"Actions -> start\\\" gives the\n" "debugging the gui. The help item for \\\"Actions -> start\\\" gives the\n"
"same info.\n" "same info.\n"
"\n" "\n"
"If you want to load in a saved profile \\\"rc file\\\" use Misc -> rc\n" "If you want to load in a saved profile \\\"rc file\\\" use \\\"Misc -> rc\\\"\n"
"and select the file.\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"
"\n" "\n"
" set helptext(debug_gui) \"\n" " set helptext(debug_gui) \"\n"
@ -399,7 +402,9 @@
"\n" "\n"
"This action is only available in \\\"startup\\\" mode, not when connected\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" "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"
"\n" "\n"
" set helptext(defaults-all) \"\n" " set helptext(defaults-all) \"\n"
@ -408,7 +413,9 @@
"\n" "\n"
"This action is only available in \\\"startup\\\" mode, not when connected\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" "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"
"\n" "\n"
" set helptext(load-settings) \"\n" " set helptext(load-settings) \"\n"
@ -422,7 +429,9 @@
"\n" "\n"
"This action is only available in \\\"startup\\\" mode, not when connected\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" "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"
"\n" "\n"
" set helptext(save-settings) \"\n" " set helptext(save-settings) \"\n"
@ -658,6 +667,7 @@
"\n" "\n"
" set helptext(Misc-Perms:) \"\n" " set helptext(Misc-Perms:) \"\n"
"In this sub-menu we provide some lesser used permission options.\n" "In this sub-menu we provide some lesser used permission options.\n"
"\n"
"Regarding -alwaysshared, -nevershared, and -dontdisconnect, you probably\n" "Regarding -alwaysshared, -nevershared, and -dontdisconnect, you probably\n"
"should never use them and just use x11vnc's -shared and -forever options\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" "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-a invokes \\\"Actions -> attach\\\"\n"
" Anywhere: Control-p invokes \\\"Actions -> ping\\\"\n" " Anywhere: Control-p invokes \\\"Actions -> ping\\\"\n"
" Anywhere: Control-u and Control-r invoke \\\"Actions -> update-all\\\"\n" " Anywhere: Control-u and Control-r invoke \\\"Actions -> update-all\\\"\n"
"\"\n"
"\n" "\n"
"\n" "set under_wally \"\n"
"Misc:\n" "Misc:\n"
"\n" "\n"
"Since x11vnc has so many settings and to avoid further confusion,\n" "Since x11vnc has so many settings and to avoid further confusion,\n"
@ -2174,6 +2185,8 @@
" set val \"\"\n" " set val \"\"\n"
" } elseif {$item == \"auth\"} {\n" " } elseif {$item == \"auth\"} {\n"
" set val \"\"\n" " set val \"\"\n"
" } elseif {$item == \"gui\"} {\n"
" continue\n"
" } \n" " } \n"
" # some hacks we do here for now..\n" " # some hacks we do here for now..\n"
" if {$item == \"cursor\" && $val == \"\"} {\n" " if {$item == \"cursor\" && $val == \"\"} {\n"
@ -2182,8 +2195,8 @@
" set val \"always\"\n" " set val \"always\"\n"
" } elseif {$item == \"wirecopyrect\" && $val == \"\"} {\n" " } elseif {$item == \"wirecopyrect\" && $val == \"\"} {\n"
" set val \"always\"\n" " set val \"always\"\n"
" } elseif {$item == \"overlay_nocursor\" && $val == 0} {\n" "# } elseif {$item == \"overlay_nocursor\" && $val == 0} {\n"
" set val 1\n" "# set val 1\n"
" }\n" " }\n"
"\n" "\n"
" set default_var($item) $val\n" " set default_var($item) $val\n"
@ -2192,6 +2205,94 @@
" }\n" " }\n"
"}\n" "}\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" "proc copy_default_vars {} {\n"
" global menu_var default_var\n" " global menu_var default_var\n"
" foreach item [array names default_var] {\n" " foreach item [array names default_var] {\n"
@ -2245,22 +2346,25 @@
" }\n" " }\n"
"}\n" "}\n"
"\n" "\n"
"proc load_settings {} {\n" "proc load_settings {{file \"\"}} {\n"
" global menu_var default_var\n" " global menu_var default_var env\n"
"\n" "\n"
" if {![info exists menu_var(load-settings)]} {\n" " if {$file == \"\"} {\n"
" return\n" " if {![info exists menu_var(load-settings)]} {\n"
" return\n"
" }\n"
" set file $menu_var(load-settings)\n"
" }\n" " }\n"
" set file $menu_var(load-settings)\n"
" if {$file == \"\"} {\n" " if {$file == \"\"} {\n"
" return\n" " return\n"
" }\n" " }\n"
"\n" "\n"
" set fh \"\"\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" "\n"
" if {$fh == \"\"} {\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" " return\n"
" }\n" " }\n"
" copy_default_vars\n" " copy_default_vars\n"
@ -2287,6 +2391,9 @@
" }\n" " }\n"
" close $fh\n" " close $fh\n"
"\n" "\n"
" set count 0\n"
" set parms \"\"\n"
"\n"
" foreach line [split $str \"\\n\"] {\n" " foreach line [split $str \"\\n\"] {\n"
" set line [string trim $line]\n" " set line [string trim $line]\n"
" regsub {^--*} $line \"\" line\n" " regsub {^--*} $line \"\" line\n"
@ -2297,16 +2404,31 @@
" if {[regexp {^[ \\t]*$} $item]} {\n" " if {[regexp {^[ \\t]*$} $item]} {\n"
" continue\n" " continue\n"
" }\n" " }\n"
" if {$item == \"gui\"} {\n"
" continue\n"
" }\n"
" if {[info exists menu_var($item)]} {\n" " if {[info exists menu_var($item)]} {\n"
" if {[value_is_bool $item]} {\n" " if {[value_is_bool $item]} {\n"
" set menu_var($item) 1\n" " set menu_var($item) 1\n"
" incr count\n"
" append parms \" -$item\\n\"\n"
" } elseif {[value_is_string $item]} {\n" " } elseif {[value_is_string $item]} {\n"
" if {$value != \"\"} {\n" " if {$value != \"\"} {\n"
" set menu_var($item) $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"
" }\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"
"\n" "\n"
"proc save_settings {} {\n" "proc save_settings {} {\n"
@ -2367,6 +2489,7 @@
" if {$file == \"\"} {\n" " if {$file == \"\"} {\n"
" return\n" " return\n"
" }\n" " }\n"
" set file [tilde_expand $file]\n"
" append_text \"\\nSaving current settings to $file ...\\n\" \n" " append_text \"\\nSaving current settings to $file ...\\n\" \n"
" if {[file exists $file]} {\n" " if {[file exists $file]} {\n"
" set backup \"${file}~\"\n" " set backup \"${file}~\"\n"
@ -2531,7 +2654,8 @@
"\n" "\n"
"proc show_logfile {} {\n" "proc show_logfile {} {\n"
" global menu_var unset_str\n" " global menu_var unset_str\n"
" set logfile $menu_var(logfile)\n" "\n"
" set logfile [tilde_expand $menu_var(logfile)]\n"
" \n" " \n"
" if {$logfile == \"\" || $logfile == $unset_str} {\n" " if {$logfile == \"\" || $logfile == $unset_str} {\n"
" set txt \"\\nNo logfile was specified at x11vnc startup.\\n\\n\" \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" " button $w.b -text OK -command \"destroy $w\" -font $bfont\n"
" bind $w.e <Return> \"update; after 100; destroy $w\"\n" " bind $w.e <Return> \"update; after 100; destroy $w\"\n"
"\n" "\n"
" wm title $w \"New Client\"\n"
"\n"
" pack $w.l $w.e $w.b -side left -pady 1m -padx 1m\n" " pack $w.l $w.e $w.b -side left -pady 1m -padx 1m\n"
" focus $w.e\n" " focus $w.e\n"
" center_win $w\n" " center_win $w\n"
@ -4344,6 +4470,8 @@
"\n" "\n"
" wm minsize . 1 1\n" " wm minsize . 1 1\n"
"\n" "\n"
" set gui_current_state \"\"\n"
"\n"
" if {$mode == \"full\"} {\n" " if {$mode == \"full\"} {\n"
" frame $fw\n" " frame $fw\n"
" set icon_mode 0\n" " set icon_mode 0\n"
@ -4403,6 +4531,8 @@
" copy_default_vars\n" " copy_default_vars\n"
" if {$x11vnc_connect} {\n" " if {$x11vnc_connect} {\n"
" try_connect_and_query_all\n" " try_connect_and_query_all\n"
" } else {\n"
" insert_cmdline_vars\n"
" }\n" " }\n"
" } else {\n" " } else {\n"
" set_name \"RESTORE\"\n" " set_name \"RESTORE\"\n"
@ -4737,13 +4867,12 @@
" }\n" " }\n"
" if {$item == \"debug_gui\"} {\n" " if {$item == \"debug_gui\"} {\n"
" continue\n" " continue\n"
" }\n" " } elseif {$item == \"WindowView\"} {\n"
" if {$item == \"WindowView\"} {\n"
" continue\n" " continue\n"
" }\n" " } elseif {$item == \"rc\" || $item == \"norc\"} {\n"
" if {$item == \"rc\" || $item == \"norc\"} {\n"
" continue\n" " continue\n"
" }\n" " }\n"
"\n"
" set def \"\"\n" " set def \"\"\n"
" if {[info exists default_var($item)]} {\n" " if {[info exists default_var($item)]} {\n"
" set def $default_var($item)\n" " set def $default_var($item)\n"
@ -4774,16 +4903,7 @@
" set ntab 3\n" " set ntab 3\n"
"\n" "\n"
" if {$item == \"gui\" || [value_is_string $item]} {\n" " if {$item == \"gui\" || [value_is_string $item]} {\n"
" set nitem $item\n" " set nitem [get_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"
"\n" "\n"
" if {$mv == \"\" && $def != \"\"} {\n" " if {$mv == \"\" && $def != \"\"} {\n"
" set qst $hmm\n" " set qst $hmm\n"
@ -4877,8 +4997,22 @@
" append_text \"$msg\\n\"\n" " append_text \"$msg\\n\"\n"
"}\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" "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" "\n"
" set xterm_cmd \"xterm -iconic -geometry 80x35 -title x11vnc-console -e\"\n" " set xterm_cmd \"xterm -iconic -geometry 80x35 -title x11vnc-console -e\"\n"
"\n" "\n"
@ -4886,24 +5020,26 @@
"\n" "\n"
" lappend cmd $x11vnc_prog\n" " lappend cmd $x11vnc_prog\n"
"\n" "\n"
" lappend cmd \"-gui\"\n"
" lappend cmd \"none\"\n"
"\n"
" set rc_txt \"\"\n" " set rc_txt \"\"\n"
"\n" "\n"
" set saw_id 0\n" " set saw_id 0\n"
"\n" "\n"
" foreach item [lsort [array names menu_var]] {\n" " foreach item [lsort [array names menu_var]] {\n"
" if {$item == \"gui\"} {\n" " if {$item == \"gui\"} {\n"
" ;\n" " continue\n"
" } elseif {![active_when_starting $item]} {\n" " } elseif {![active_when_starting $item]} {\n"
" continue\n" " continue\n"
" } elseif {[is_action $item]} {\n" " } elseif {[is_action $item]} {\n"
" continue\n" " continue\n"
" }\n" " } elseif {$item == \"debug_gui\"} {\n"
" if {$item == \"debug_gui\"} {\n"
" continue\n" " continue\n"
" }\n" " } elseif {$item == \"WindowView\"} {\n"
" if {$item == \"WindowView\"} {\n"
" continue\n" " continue\n"
" }\n" " }\n"
"\n"
" if {$item == \"id\" || $item == \"sid\"} {\n" " if {$item == \"id\" || $item == \"sid\"} {\n"
" set val $menu_var($item);\n" " set val $menu_var($item);\n"
" if {$val == \"0x0\" || $val == \"root\"} {\n" " if {$val == \"0x0\" || $val == \"root\"} {\n"
@ -4915,17 +5051,13 @@
" }\n" " }\n"
" if {$item == \"id\"} {\n" " if {$item == \"id\"} {\n"
" set saw_id 1\n" " set saw_id 1\n"
" }\n" " } elseif {$item == \"httpport\" && $menu_var($item) == \"0\"} {\n"
" if {$item == \"httpport\" && $menu_var($item) == \"0\"} {\n"
" continue\n" " continue\n"
" }\n" " } elseif {$item == \"progressive\" && $menu_var($item) == \"0\"} {\n"
" if {$item == \"progressive\" && $menu_var($item) == \"0\"} {\n"
" continue\n" " continue\n"
" }\n" " } elseif {$item == \"dontdisconnect\" && $menu_var($item) == \"-1\"} {\n"
" if {$item == \"dontdisconnect\" && $menu_var($item) == \"-1\"} {\n"
" continue\n" " continue\n"
" }\n" " } elseif {$item == \"alwaysshared\" && $menu_var($item) == \"-1\"} {\n"
" if {$item == \"alwaysshared\" && $menu_var($item) == \"-1\"} {\n"
" continue\n" " continue\n"
" }\n" " }\n"
"\n" "\n"
@ -4945,32 +5077,41 @@
" }\n" " }\n"
" }\n" " }\n"
" } elseif {[value_is_string $item]} {\n" " } elseif {[value_is_string $item]} {\n"
" if {[info exists menu_var($item)]} {\n" " if {![info exists menu_var($item)]} {\n"
" if {$menu_var($item) != \"\"\n" " continue\n"
" && $menu_var($item) != $unset_str} {\n" " }\n"
" set add 1\n" " if {$menu_var($item) != \"\" && $menu_var($item) != $unset_str} {\n"
" set nitem $item\n" " set add 1\n"
" if {$nitem == \"screen_blank\"} {\n" " set nitem [get_nitem $item]\n"
" set nitem \"sb\"\n" "\n"
" } elseif {$nitem == \"xrandr_mode\"} {\n" " if {[info exists default_var($item)]} {\n"
" set nitem \"xrandr\"\n" " if {$menu_var($item) == $default_var($item)} {\n"
" } elseif {$nitem == \"wireframe_mode\"} {\n" " set add 0;\n"
" set nitem \"wireframe\"\n"
" } elseif {$nitem == \"solid_color\"} {\n"
" set nitem \"solid\"\n"
" }\n" " }\n"
" if {[info exists default_var($item)]} {\n" " }\n"
" if {$menu_var($item) == $default_var($item)} {\n" " if {$add} {\n"
" set add 0;\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"
" }\n" " }\n"
" if {$add} {\n" " \n"
" lappend cmd \"-$nitem\"\n" " lappend cmd $mv\n"
" lappend cmd $menu_var($item)\n" " set mt $mv\n"
" set mt $menu_var($item)\n" " regsub -all {#} $mt {\\#} mt\n"
" regsub -all {#} $mt {\\#} mt\n" " append rc_txt \"-$nitem $mt\\n\"\n"
" append rc_txt \"-$nitem $mt\\n\"\n"
" }\n"
" }\n" " }\n"
" }\n" " }\n"
" }\n" " }\n"
@ -5079,7 +5220,7 @@
" lappend cmd \"/dev/null\"\n" " lappend cmd \"/dev/null\"\n"
"# lappend cmd \"/tmp/nono\"\n" "# lappend cmd \"/tmp/nono\"\n"
"\n" "\n"
" if {0} {\n" " if {0 || $debug} {\n"
" set str [join $cmd]\n" " set str [join $cmd]\n"
" puts \"running: $str\"\n" " puts \"running: $str\"\n"
" foreach word $cmd {\n" " foreach word $cmd {\n"
@ -5176,6 +5317,9 @@
"\n" "\n"
" set new [get_view_variable]\n" " set new [get_view_variable]\n"
"\n" "\n"
" if {![info exists gui_current_state]} {\n"
" set gui_current_state \"\"\n"
" }\n"
" set old $gui_current_state\n" " set old $gui_current_state\n"
" #puts \"$old -> $new\"\n" " #puts \"$old -> $new\"\n"
"\n" "\n"

@ -2,7 +2,7 @@
.TH X11VNC "1" "July 2005" "x11vnc " "User Commands" .TH X11VNC "1" "July 2005" "x11vnc " "User Commands"
.SH NAME .SH NAME
x11vnc - allow VNC connections to real X11 displays 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 .SH SYNOPSIS
.B x11vnc .B x11vnc
[OPTION]... [OPTION]...
@ -1804,6 +1804,10 @@ given by hexnumber. Use =noadvanced to disable the
full gui. (To supply more than one, use "+" sign). full gui. (To supply more than one, use "+" sign).
E.g. \fB-gui\fR tray=setpass and \fB-gui\fR icon=0x3600028 E.g. \fB-gui\fR tray=setpass and \fB-gui\fR icon=0x3600028
.IP .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 5) When "geom=+X+Y" is specified, that geometry
is passed to the gui toplevel. This is the icon in is passed to the gui toplevel. This is the icon in
icon/tray mode, or the full gui otherwise. You can 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; sraRegionPtr xdamage_scheduled_mark_region = NULL;
/* date +'lastmod: %Y-%m-%d' */ /* 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; int hack_val = 0;
/* X display info */ /* 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 button_change_x, button_change_y;
int got_user_input = 0; int got_user_input = 0;
int got_pointer_input = 0; int got_pointer_input = 0;
int got_pointer_calls = 0;
int got_keyboard_input = 0; int got_keyboard_input = 0;
int got_keyboard_calls = 0;
int urgent_update = 0; int urgent_update = 0;
int last_keyboard_keycode = 0; int last_keyboard_keycode = 0;
rfbBool last_rfb_down = FALSE; rfbBool last_rfb_down = FALSE;
@ -800,7 +802,9 @@ enum {
char *rc_rcfile = NULL; /* -rc */ char *rc_rcfile = NULL; /* -rc */
int rc_rcfile_default = 0;
int rc_norc = 0; int rc_norc = 0;
int got_norc = 0;
int opts_bg = 0; int opts_bg = 0;
#ifndef VNCSHARED #ifndef VNCSHARED
@ -9586,6 +9590,7 @@ void keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) {
static double max_keyrepeat_last_time = 0.0; static double max_keyrepeat_last_time = 0.0;
dtime0(&tnow); dtime0(&tnow);
got_keyboard_calls++;
if (debug_keyboard) { if (debug_keyboard) {
char *str; char *str;
@ -10520,6 +10525,10 @@ void pointer(int mask, int x, int y, rfbClientPtr client) {
int sent = 0, buffer_it = 0; int sent = 0, buffer_it = 0;
double now; double now;
if (mask >= 0) {
got_pointer_calls++;
}
if (debug_pointer && mask >= 0) { if (debug_pointer && mask >= 0) {
static int show_motion = -1; static int show_motion = -1;
static double last_pointer = 0.0; static double last_pointer = 0.0;
@ -12573,13 +12582,13 @@ int send_remote_cmd(char *cmd, int query, int wait) {
} }
if (in != NULL) { if (in != NULL) {
fprintf(stderr, "sending remote command: \"%s\"\nvia connect" fprintf(stderr, ">>> sending remote command: \"%s\"\n via"
" file: %s\n", cmd, client_connect_file); " connect file: %s\n", cmd, client_connect_file);
fprintf(in, "%s\n", cmd); fprintf(in, "%s\n", cmd);
fclose(in); fclose(in);
} else { } else {
fprintf(stderr, "sending remote command: \"%s\" via VNC_CONNECT" fprintf(stderr, ">>> sending remote command: \"%s\" via"
" X property.\n", cmd); " VNC_CONNECT X property.\n", cmd);
set_vnc_connect_prop(cmd); set_vnc_connect_prop(cmd);
XFlush(dpy); XFlush(dpy);
} }
@ -16090,9 +16099,13 @@ char *process_remote_cmd(char *cmd, int stringonly) {
} else if (!strcmp(p, "flag")) { } else if (!strcmp(p, "flag")) {
snprintf(buf, bufn, "aro=%s:%s", p, NONUL(flagfile)); snprintf(buf, bufn, "aro=%s:%s", p, NONUL(flagfile));
} else if (!strcmp(p, "rc")) { } 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")) { } 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") || } else if (!strcmp(p, "h") || !strcmp(p, "help") ||
!strcmp(p, "V") || !strcmp(p, "version") || !strcmp(p, "V") || !strcmp(p, "version") ||
!strcmp(p, "lastmod")) { !strcmp(p, "lastmod")) {
@ -18230,6 +18243,8 @@ void restore_cursor_shape_updates(rfbScreenInfoPtr s) {
void disable_cursor_shape_updates(rfbScreenInfoPtr s) { void disable_cursor_shape_updates(rfbScreenInfoPtr s) {
rfbClientIteratorPtr iter; rfbClientIteratorPtr iter;
rfbClientPtr cl; rfbClientPtr cl;
static int changed = 0;
int count = 0;
if (! s || ! s->clientHead) { if (! s || ! s->clientHead) {
return; return;
@ -18242,9 +18257,17 @@ void disable_cursor_shape_updates(rfbScreenInfoPtr s) {
if (cl->enableCursorShapeUpdates) { if (cl->enableCursorShapeUpdates) {
cd->had_cursor_shape_updates = 1; cd->had_cursor_shape_updates = 1;
count++;
if (debug_pointer) {
rfbLog("%s disable HCSU\n", cl->host);
}
} }
if (cl->enableCursorPosUpdates) { if (cl->enableCursorPosUpdates) {
cd->had_cursor_pos_updates = 1; cd->had_cursor_pos_updates = 1;
count++;
if (debug_pointer) {
rfbLog("%s disable HCPU\n", cl->host);
}
} }
cl->enableCursorShapeUpdates = FALSE; cl->enableCursorShapeUpdates = FALSE;
@ -18252,6 +18275,10 @@ void disable_cursor_shape_updates(rfbScreenInfoPtr s) {
cl->cursorWasChanged = FALSE; cl->cursorWasChanged = FALSE;
} }
rfbReleaseClientIterator(iter); rfbReleaseClientIterator(iter);
if (count) {
changed = 1;
}
} }
int cursor_shape_updates_clients(rfbScreenInfoPtr s) { 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; FILE *pipe, *tmpf;
if (*gui_code == '\0') { if (*gui_code == '\0') {
rfbLog("gui not compiled into this program.\n"); rfbLog("gui: gui not compiled into this program.\n");
exit(0); exit(0);
} }
if (getenv("DISPLAY") != NULL) { 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) { if (connect_to_x11vnc) {
int rc, i; int rc, i;
rfbLogEnable(0); rfbLogEnable(1);
if (! client_connect_file) { if (! client_connect_file) {
if (getenv("XAUTHORITY") != NULL) { if (getenv("XAUTHORITY") != NULL) {
old_xauth = strdup(getenv("XAUTHORITY")); 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); dpy = XOpenDisplay(x11vnc_xdisplay);
} }
if (! dpy) { if (! dpy) {
fprintf(stderr, "gui: could not open x11vnc " rfbLog("gui: could not open x11vnc "
"display: %s\n", NONUL(x11vnc_xdisplay)); "display: %s\n", NONUL(x11vnc_xdisplay));
exit(1); exit(1);
} }
@ -24018,16 +24045,18 @@ void run_gui(char *gui_xdisplay, int connect_to_x11vnc, int simple_gui,
} }
usleep(2200*1000); usleep(2200*1000);
fprintf(stderr, "\n"); 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++) { for (i=0; i<try_max; i++) {
usleep(sleep*1000); usleep(sleep*1000);
fprintf(stderr, "gui: pinging %s try=%d ...\n", rfbLog("gui: pinging %s try=%d ...\n",
NONUL(x11vnc_xdisplay), i+1); NONUL(x11vnc_xdisplay), i+1);
rc = send_remote_cmd("qry=ping", 1, 1); rc = send_remote_cmd("qry=ping", 1, 1);
if (rc == 0) { if (rc == 0) {
break; break;
} }
if (parent && mypid != parent && kill(parent, 0) != 0) { 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); " away: bailing out.\n", parent);
rc = 1; rc = 1;
break; 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")); set_env("X11VNC_AUTH_FILE", getenv("XAUTHORITY"));
} }
if (rc == 0) { if (rc == 0) {
fprintf(stderr, "gui: ping succeeded.\n"); rfbLog("gui: ping succeeded.\n");
set_env("X11VNC_CONNECT", "1"); set_env("X11VNC_CONNECT", "1");
} else { } else {
fprintf(stderr, "gui: could not connect to: '%s', try" rfbLog("gui: could not connect to: '%s', try"
" again manually.\n", x11vnc_xdisplay); " again manually.\n", x11vnc_xdisplay);
} }
if (client_connect_file) { if (client_connect_file) {
@ -24063,6 +24092,7 @@ void run_gui(char *gui_xdisplay, int connect_to_x11vnc, int simple_gui,
} }
free(old_xauth); free(old_xauth);
} }
rfbLogEnable(0);
} }
orig_path = getenv("PATH"); orig_path = getenv("PATH");
@ -24211,7 +24241,7 @@ void do_gui(char *opts, int sleep) {
int got_gui_xdisplay = 0; int got_gui_xdisplay = 0;
int start_x11vnc = 1; int start_x11vnc = 1;
int connect_to_x11vnc = 0; int connect_to_x11vnc = 0;
int simple_gui = 0; int simple_gui = 0, none_gui = 0;
Display *test_dpy; Display *test_dpy;
if (opts) { if (opts) {
@ -24245,6 +24275,8 @@ void do_gui(char *opts, int sleep) {
} else if (!strcmp(p, "wait")) { } else if (!strcmp(p, "wait")) {
start_x11vnc = 0; start_x11vnc = 0;
connect_to_x11vnc = 0; connect_to_x11vnc = 0;
} else if (!strcmp(p, "none")) {
none_gui = 1;
} else if (!strcmp(p, "conn") || !strcmp(p, "connect")) { } else if (!strcmp(p, "conn") || !strcmp(p, "connect")) {
start_x11vnc = 0; start_x11vnc = 0;
connect_to_x11vnc = 1; connect_to_x11vnc = 1;
@ -24255,6 +24287,8 @@ void do_gui(char *opts, int sleep) {
if ((q = strchr(p, '=')) != NULL) { if ((q = strchr(p, '=')) != NULL) {
icon_mode_font = strdup(q+1); icon_mode_font = strdup(q+1);
} }
} else if (!strcmp(p, "full")) {
;
} else if (strstr(p, "tray") == p || strstr(p, "icon") == p) { } else if (strstr(p, "tray") == p || strstr(p, "icon") == p) {
char *q; char *q;
icon_mode = 1; icon_mode = 1;
@ -24279,6 +24313,13 @@ void do_gui(char *opts, int sleep) {
p = strtok(NULL, ","); p = strtok(NULL, ",");
} }
free(s); free(s);
if (none_gui) {
if (!start_x11vnc) {
exit(0);
}
return;
}
if (start_x11vnc) { if (start_x11vnc) {
connect_to_x11vnc = 1; connect_to_x11vnc = 1;
} }
@ -26425,6 +26466,32 @@ int scrollability(Window win, int set) {
return 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 eat_pointer(int max_ptr_eat, int keep) {
int i, count = 0, gp = got_pointer_input; int i, count = 0, gp = got_pointer_input;
@ -29585,7 +29652,9 @@ static void watch_loop(void) {
got_user_input = 0; got_user_input = 0;
got_pointer_input = 0; got_pointer_input = 0;
got_pointer_calls = 0;
got_keyboard_input = 0; got_keyboard_input = 0;
got_keyboard_calls = 0;
urgent_update = 0; urgent_update = 0;
if (! use_threads) { if (! use_threads) {
@ -29614,6 +29683,12 @@ if (debug_scroll) fprintf(stderr, "watch_loop: LOOP-BACK: %d\n", ret);
continue; 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 { } else {
if (0 && use_xrecord) { if (0 && use_xrecord) {
/* XXX not working */ /* XXX not working */
@ -31174,6 +31249,10 @@ static void print_help(int mode) {
" full gui. (To supply more than one, use \"+\" sign).\n" " full gui. (To supply more than one, use \"+\" sign).\n"
" E.g. -gui tray=setpass and -gui icon=0x3600028\n" " E.g. -gui tray=setpass and -gui icon=0x3600028\n"
"\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" " 5) When \"geom=+X+Y\" is specified, that geometry\n"
" is passed to the gui toplevel. This is the icon in\n" " is passed to the gui toplevel. This is the icon in\n"
" icon/tray mode, or the full gui otherwise. You can\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")) { if (!strcmp(argv[i], "-norc")) {
norc = 1; norc = 1;
got_norc = 1;
} }
if (!strcmp(argv[i], "-QD")) { if (!strcmp(argv[i], "-QD")) {
norc = 1; norc = 1;
@ -31909,6 +31989,7 @@ static void check_rcfile(int argc, char **argv) {
norc = 1; norc = 1;
} else { } else {
rc_rcfile = strdup(rcfile); rc_rcfile = strdup(rcfile);
rc_rcfile_default = 1;
} }
} }
} }
@ -31975,7 +32056,7 @@ static void check_rcfile(int argc, char **argv) {
c = *q; c = *q;
q++; q++;
} }
if (q != p) { if (q != p && !cont) {
if (*q == '\0') { if (*q == '\0') {
q--; q--;
} }
@ -32252,7 +32333,7 @@ void nopassword_warning_msg(int gotloc) {
fprintf(stderr, "%s", str1); fprintf(stderr, "%s", str1);
fflush(stderr); fflush(stderr);
usleep(2500 * 1000); usleep(2000 * 1000);
fprintf(stderr, "%s", str2); fprintf(stderr, "%s", str2);
if (gotloc) { if (gotloc) {
fprintf(stderr, "%s", str3); fprintf(stderr, "%s", str3);
@ -32940,6 +33021,10 @@ int main(int argc, char* argv[]) {
if (!got_passwd && !got_rfbauth && !got_passwdfile && !nopw) { if (!got_passwd && !got_rfbauth && !got_passwdfile && !nopw) {
running_without_passwd = 1; running_without_passwd = 1;
} }
if (launch_gui && (query_cmd || remote_cmd)) {
launch_gui = 0;
gui_str = NULL;
}
if (launch_gui) { if (launch_gui) {
int sleep = 0; int sleep = 0;
if (running_without_passwd && !quiet) { if (running_without_passwd && !quiet) {

Loading…
Cancel
Save