Commit 640eb162 authored by runge's avatar runge

x11vnc: more improvements to gui, scary nopassword warning msg.

parent ad02e155
2005-07-10 Karl Runge <runge@karlrunge.com>
* more improvements to gui, default values, save-settings..
* x11vnc scary password warnings. Release settings. -QD option.
add \# to rc files and fix rcfile read bug.
2005-07-09 Karl Runge <runge@karlrunge.com>
* add -grab_buster helper thread to break up grabs (might not be
need any longer due to gett XFlush-ing). Fix scrolls and
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -64,12 +64,17 @@ Row: Displays Screen Tuning Debugging Misc
Actions
=SA start
=RA stop
=DGA attach
--
=DSA attach
=DRA detach
--
=RA ping
=RA update-all
=GA clear-all
--
=GA save-settings
=SFA load-settings:
=SA defaults-all
=0SA clear-all
-- D
=DRA stop+quit
=DGA Quit
......@@ -314,6 +319,23 @@ proc set_internal_help {} {
Launch x11vnc with the settings you have prescribed in the gui.
The x11vnc process is started in an xterm window so you can see the
output, kill it, etc.
By viewing this help item, the command built so far will be displayed
in the gui text area. Have a look. If you Press start it will be shown
as well and you will be asked to confirm running it.
If you want to use a saved profile \"rc file\" you can do \"Misc -> rc\" and
select the file and simply start x11vnc using the rc file. Alternatively,
you could first use the \"Actions -> load-settings\" action to load in
an \"rc file\" and then press \"Actions -> start\" to start up x11vnc
based on those values.
"
set helptext(stop) "
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.
"
set helptext(show-start-cmd) "
......@@ -322,6 +344,9 @@ run by \"Actions -> start\") looks like for the current values of the
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.
"
set helptext(debug_gui) "
......@@ -329,13 +354,22 @@ Set debug_gui to get more output printed in the text area.
"
set helptext(detach) "
No longer be associated with the x11vnc server. Switch to non-connected
state.
No longer be associated with the x11vnc server. Switch to the
non-connected state. The x11vnc server keeps running: it does not exit.
You can either later reattach to it \"Actions -> attach\", or start
up a new x11vnc \"Actions -> start\", or exit \"Actions -> Quit\".
"
set helptext(attach) "
Attach to the x11vnc server, if possible. Switches to connected state
if successful. To change or set the X display use \"Displays -> display\"
Attach to a running x11vnc server, if possible. Switches to connected
state if successful. Usually the channel used to attach is via the X
display (VNC_CONNECT rootwin property) being polled by the x11vnc server.
To change or set the X display to use do \"Displays -> display\".
Sometimes the \"-connect /path/to/filename\" is used as the communcation
channel. The running x11vnc has to know that \"/path/to/filename\"
is the communication channel (i.e. it is using the same -connect option).
"
set helptext(ping) "
......@@ -346,16 +380,60 @@ Check if x11vnc still responds to \"ping\" remote command.
Query the x11vnc server for the current values of all variables.
Populate the values into the gui's database.
Normally the gui will refresh this info every time it interacts
with the x11vnc server, so one doesn't need to use this action
very often (unless something else is changing the state of the
x11vnc server, or new clients have connected, etc).
Normally the gui will refresh this info every time it interacts with
the x11vnc server (including after a few minutes of inactivity), so one
doesn't need to use this action very often (unless something else is
changing the state of the x11vnc server, or new clients have connected,
etc).
"
set helptext(clear-all) "
Forget any variable settings either entered in by you or retrieved
from a running x11vnc server. Basically sets everything to 0 or
the string (unset).
Forget any variable settings either entered in by you or set at the
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).
"
set helptext(defaults-all) "
Reset all variable settings to the default values. Basically sets
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).
"
set helptext(load-settings) "
Read in the \"rc file\" you prescribe in the dialog and then set the
variables to those in the rc-file. Any variables not mentioned in the
rc-file are set to their default value.
You could then do \"Actions -> start\" to start x11vnc with these
parameters. Or you could make some further changes to variables
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).
"
set helptext(save-settings) "
Construct a ~/.x11vncrc file based on the current settings and
offer to save it in a file (default ~/.x11vncrc). If saved in a
file other than the default, you can access the profile by using
the \"-rc <filename>\" option when starting x11vnc.
If an rc file entry begins with \"#d\" that means the current
setting is at the Default value and so you probably want to leave
it commented out with the \"#\" character.
If an rc file entry begins with \"#?\" that means we think
you probably do not really want to force the value to this setting.
In either case, feel free to uncomment the line and/or change any
of the parameter values in the file.
"
set helptext(all-settings) "
......@@ -383,10 +461,11 @@ by the gui process).
set helptext(tail-logfile) "
Run the tail(1) command with -f option on the logfile in an xterm.
(if it exists and is accessible by the gui process).
"
set helptext(Quit) "
Terminate the tkx11vnc gui. Any x11vnc servers will be left running.
Terminate the tkx11vnc gui. Any x11vnc server will be left running.
"
set helptext(current) "
......@@ -539,7 +618,7 @@ the ViewOnly log in aspect: \"Password\" is still required to log in.
set helptext(all) $helpall
set helptext(Misc-Tuning:) "
x11vnc has what seems like hundreds of tuning parameters. In this
x11vnc has what seems like hundreds of tuning parameters! In this
sub-menu we place some lesser used ones. Most likely you'll want to
leave them at their default values, but you can try them out quickly
with the gui to see if they improve things.
......@@ -752,8 +831,8 @@ The items in the sub-menu allow tweaking x11vnc's DAMAGE algorithm.
This sub-menu provides some options regarding SYSV shared memory usage
(shm) by x11vnc. Usually you want shm turned on because the x11vnc
process is nearly always running on the same machine the X server process
is running on. SharedMemory gives a performance speedup. However,
if you need to modify this scenario these options allow you to.
is running on. SharedMemory gives a performance speedup. However, if you
need to modify this scenario for special usage these options allow you to.
"
set helptext(Misc-Debug:) "
......@@ -767,6 +846,7 @@ etc. about your local display and environment.
This sub-menu contains some options centering around the Selection
(also referred to as the Clipboard, Cutbuffers, etc). x11vnc will try
to exchange the selections between the VNC viewers and the X server.
You can adjust that behavior with these options.
"
set helptext(WindowView) "
......@@ -792,7 +872,7 @@ or \"tray\" mode if you bring up the full gui window via \"Properties ->
Advanced\" and then delete it the gui does NOT terminate.
Also note that by default in \"icon\" mode if you delete the icon
window both the gui and the x11vnc server terminate.
window both the gui *and* the x11vnc server terminate.
"
set helptext(gui) "
......@@ -926,34 +1006,35 @@ GUI components:
--- ----------
1) At the top of the gui is a info text label where information will
be posted, e.g. when traversing menu items text indicating how to get
help on the item and its current value will be displayed.
be posted, e.g. when traversing menu items text indicating how to get
help on the item and its current value will be displayed.
2) Below the info label is the area where the menu buttons, Actions,
Clients, etc., are presented. If a menu item has a checkbox,
it corresponds to a boolean on/off variable. Otherwise it is
either a string variable, or an action not associated with a
variable (for the most part).
2) Below the info label is the area where the menu buttons, \"Actions\",
\"Clients\", etc., are presented. If a menu item has a checkbox,
it corresponds to a boolean on/off variable. Otherwise it is
either a string variable, or an action not associated with a
variable (for the most part).
3) Below the menu button area is a text label indicating the current x11vnc
X display being polled and the corresponding VNC display name. Both
will be \"(*none*)\" when there is no connection established.
3) Below the menu button area is a label indicating the current x11vnc
X display being polled and the corresponding VNC display name. Both
will be \"(*none*)\" when there is no connection established.
4) Below the x11 and vnc displays text label is a text area there scrolling
information about actions being taken and commands being run is displayed.
To scroll click in the area and use PageUp/PageDown or the arrow keys.
4) Below the x11 and vnc displays label is a text area there scrolling
information about actions being taken and commands being run is displayed.
To scroll click in the area and use PageUp/PageDown or the arrow keys.
5) At the bottom is an entry area. When one selects a menu item that
requires supplying a string value, the label will be set to the
parameter name and one types in the new value. Then one presses the
\"OK\" button or presses \"Enter\" to set the value. Or you can press
\"Cancel\" or \"Escape\" to avoid changing the variable. Some variables
are boolean toggles (for example, \"Permissions -> viewonly\") or Radio
button selections. Selecting these menu items will not activate the
entry area but rather toggle the variable directly.
requires supplying a string value, the label will be set to the
parameter name and one types in the new value. Then one presses the
\"OK\" button or presses \"Enter\" to set the value. Or you can press
\"Cancel\" or \"Escape\" to avoid changing the variable.
Many variables are boolean toggles (for example, \"Permissions ->
viewonly\") or Radio button selections. Selecting these menu items
will NOT activate the entry area but rather toggle the variable
immediately.
Cascades Bug: There is a bug not yet worked around for the cascade menus
CASCADES BUG: There is a bug not yet worked around for the cascade menus
where the (?) help button gets in the way. To get the mouse over to
the cascade menu click and release mouse to activate the cascade, then
you can click on its items. Dragging with a mouse button held down will
......@@ -1026,7 +1107,7 @@ proc make_toplevel {w {title ""}} {
}
}
proc textwin {name title text} {
proc textwin {name title text {entry ""}} {
global max_text_height max_text_width
global bfont ffont
......@@ -1056,13 +1137,40 @@ proc textwin {name title text} {
bind $w <Enter> "focus $w.f.t"
if {$entry != ""} {
# varname+Label Name
set list [split $entry "+"]
set varname [lindex $list 0]
set labname [lindex $list 1]
frame $w.f.ef -bd 1 -relief groove
label $w.f.ef.l -text "$labname" -anchor w -font $bfont
entry $w.f.ef.e -relief sunken -font $ffont \
-textvariable $varname
button $w.f.ef.b -text "OK" -font $bfont \
-command "set ${varname}_ok 1; destroy $w"
bind $w.f.ef.e <KeyPress-Return> "set ${varname}_ok 1; destroy $w"
pack $w.f.ef.l -side left
pack $w.f.ef.e -side left -fill x -expand 1
pack $w.f.ef.b -side right
}
wm withdraw $w
pack $w.f.b -side bottom -fill x
if {$entry != ""} {
pack $w.f.ef -side bottom -fill x
bind $w <Enter> "focus $w.f.ef.e"
$w.f.ef.e icursor end
} else {
bind $w <Enter> "focus $w.f.t"
}
pack $w.f.y -side right -fill y;
pack $w.f.t -side top -fill both -expand 1;
update
center_win $w
return $w
}
proc active_when_connected {item} {
......@@ -1107,6 +1215,9 @@ proc active_when_starting {item} {
if {$item == "display"} {
return 1
}
if {$item == "attach"} {
return 1
}
if {$item == "debug_gui"} {
return 1
}
......@@ -1205,11 +1316,10 @@ proc help_win {item} {
if {$item == "start"} {
set str [get_start_x11vnc_txt]
append text $str
append_text "$str\n"
append text "\nPossible \$HOME/.x11vncrc settings for this command:\n\n"
set rctxt [get_start_x11vnc_cmd 1]
append text "$rctxt\n"
# append text "\nPossible \$HOME/.x11vncrc settings for this command:\n\n"
# set rctxt [get_start_x11vnc_cmd 1]
# append text "$rctxt\n"
}
regsub -all { } $item " " name
......@@ -2023,6 +2133,75 @@ proc see_if_ok {query item expected} {
}
}
proc get_default_vars {} {
global default_var
set qry [all_query_vars]
append qry ",vncconnect"
set qargs [list "-QD" $qry]
set all [run_remote_cmd $qargs]
if {[regexp {ans=} $all]} {
#append_text "Retrieved all default settings.\n"
} else {
#append_text "Failed to retrieve default settings.\n"
}
set query_result_list [split_query $all]
set default_var(gui) ""
foreach piece $query_result_list {
if {[regexp {^([^:][^:]*):(.*)$} $piece m0 item val]} {
if {$val == "N/A"} {
if {$item == "vncconnect"} {
set val 1
} else {
set val ""
}
}
if {$item == "display"} {
set val ""
} elseif {$item == "desktop"} {
set val ""
} elseif {$item == "auth"} {
set val ""
}
# some hacks we do here for now..
if {$item == "cursor" && $val == ""} {
set val "most"
} elseif {$item == "scrollcopyrect" && $val == ""} {
set val "always"
} elseif {$item == "wirecopyrect" && $val == ""} {
set val "always"
} elseif {$item == "overlay_nocursor" && $val == 0} {
set val 1
}
set default_var($item) $val
#puts "default: $item -> $val"
}
}
}
proc copy_default_vars {} {
global menu_var default_var
foreach item [array names default_var] {
if {[info exists menu_var($item)]} {
if {[info exists default_var($item)]} {
set menu_var($item) $default_var($item)
}
}
}
foreach item [array names menu_var] {
if {[info exists default_var($item)]} {
set menu_var($item) $default_var($item)
}
}
}
proc update_menu_vars {{query ""}} {
global all_settings menu_var query_result_list
......@@ -2060,6 +2239,163 @@ proc update_menu_vars {{query ""}} {
}
}
proc load_settings {} {
global menu_var default_var
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"]}
if {$fh == ""} {
append_text "load_settings: *** failed to open $file ***\n"
return
}
copy_default_vars
set str ""
while {[gets $fh line] > -1} {
regsub -all {\\#} $line {__QUOTED_HASH__} line
if {[regexp {^[ \t]*#} $line]} {
continue
}
for {set i 0} {$i < 5} {incr i} {
regsub {#.*$} $line "" line
}
if {[regexp {^[ \t]*$} $line]} {
continue
}
regsub -all {__QUOTED_HASH__} $line {#} line
if {[regexp {\\$} $line]} {
regsub {\\$} $line " " line
append str "$line"
} else {
append str "$line\n"
}
}
close $fh
foreach line [split $str "\n"] {
set line [string trim $line]
regsub {^--*} $line "" line
regsub -all {[ \t][ \t]*} $line " " line
set list [split $line]
set item [lindex $list 0]
set value [lindex $list 1]
if {[regexp {^[ \t]*$} $item]} {
continue
}
if {[info exists menu_var($item)]} {
if {[value_is_bool $item]} {
set menu_var($item) 1
} elseif {[value_is_string $item]} {
if {$value != ""} {
set menu_var($item) $value
}
}
}
}
}
proc save_settings {} {
set rc_text [get_settings_rcfile]
set top "#
# This file is based on the current x11vnc settings and can be used as
# as a ~/.x11vncrc defaults file. If saved to another filename, these
# settings can be passed to x11vnc at startup via \"-rc <filename>\".
#
# The rc file comment character is \"#\". Use \"\\#\" for the literal char.
# You can continue lines using \"\\\" as the last character of a line.
#
# Lines beginning with \"#d\" indicate the parameter value is at its default
# setting and you probably want to leave it commented out.
#
# Lines beginning with \"#?\" indicate parameters you probably do not
# want to hardwire to the current setting (uncomment if you want that).
#
# Some parameters are boolean, e.g. -forever, and take no value; while
# the others, e.g. -wait 50, take a string or numerical value.
#
# For booleans, the line will end with comment \"default: on\" or
# \"default: off\" indicating the default setting. (Note: often
# \"-nofoobar\" corresponds to option \"-foobar\" and the former is
# \"the default\", e.g. -norepeat).
#
# For string or numerical options, the value \"\" in a line below
# means the default is unset and you will need to supply some non-empty
# value to use the parameter. For reference, if the default differs
# from your value it placed at the end of the line as a comment.
#
# Feel free to uncomment or comment any of the lines or to change any
# of the values of the parameters. Don't be surprised that most if not
# all of the lines below are commented out (x11vnc has so many parameters,
# most of them will be at their default values).
#-------------------------------------------------------------------------
"
set rc_text "$top$rc_text"
global env save_settings_var save_settings_var_ok
if {[info exists env(HOME)]} {
set save_settings_var "$env(HOME)/.x11vncrc"
} else {
set save_settings_var ".x11vncrc"
}
set save_settings_var_ok 0
set w [textwin "save_settings" "Save Settings..." $rc_text \
"save_settings_var+Save as:"]
tkwait window $w
if {$save_settings_var_ok == 1} {
set file $save_settings_var
if {$file == ""} {
return
}
append_text "\nSaving current settings to $file ...\n"
if {[file exists $file]} {
set backup "${file}~"
append_text "Backing up $file -> $backup ...\n"
catch {file delete -force $backup}
set emsg "*** Backup to $backup failed. ***\n"
if {![file exists $backup]} {
catch {file copy -force $file $backup}
if {![file exists $backup]} {
append_text $emsg
bell
}
} else {
append_text $emsg
bell
}
}
set fh ""
catch {set fh [open $file "w"]}
if {$fh != ""} {
puts $fh $rc_text
close $fh
if {![file exists $file]} {
append_text "*** Saving to $file failed. ***\n"
bell
} else {
append_text "Done.\n"
}
} else {
append_text "*** Open of $file failed. ***\n"
bell
}
}
}
proc clear_all {} {
global menu_var unset_str
......@@ -2082,6 +2418,11 @@ proc clear_all {} {
append_text "Cleared all settings.\n"
}
proc defaults_all {} {
copy_default_vars
append_text "Reset all variables to default values.\n"
}
proc all_query_vars {} {
global query_ans_list query_aro_list all_settings
global cache_all_query_vars
......@@ -2121,13 +2462,13 @@ proc query_all {{quiet 0}} {
if {[regexp {ans=} $all]} {
if {! $quiet} {
append_text "Retrieved all settings.\n"
append_text "Retrieved all current settings.\n"
}
set all_settings $all
update_menu_vars $all
} else {
if {! $quiet} {
append_text "Failed to retrieve settings.\n"
append_text "Failed to retrieve current settings.\n"
}
}
set last_query_all_time [clock seconds]
......@@ -2187,7 +2528,7 @@ proc show_logfile {} {
set logfile $menu_var(logfile)
if {$logfile == "" || $logfile == $unset_str} {
set txt "\nNo logfile has been specified.\n\n"
set txt "\nNo logfile was specified at x11vnc startup.\n\n"
} elseif {![file exists $logfile]} {
set txt "\nLogfile \"$logfile\" does not exist.\n\n"
} else {
......@@ -2213,7 +2554,7 @@ proc tail_logfile {} {
set txt ""
if {$logfile == "" || $logfile == $unset_str} {
set txt "\nNo logfile has been specified.\n\n"
set txt "\nNo logfile was specified at x11vnc startup.\n\n"
} elseif {![file exists $logfile]} {
set txt "\nLogfile \"$logfile\" does not exist.\n\n"
} else {
......@@ -2300,6 +2641,12 @@ proc do_action {item} {
} elseif {$item == "clear-all"} {
clear_all
return
} elseif {$item == "defaults-all"} {
defaults_all
return
} elseif {$item == "save-settings"} {
save_settings
return
} elseif {$item == "show-start-cmd"} {
show_start_cmd
return
......@@ -2333,6 +2680,11 @@ proc do_action {item} {
set name $item
}
if {$item == "load-settings"} {
load_settings
return
}
if {! $connected_to_x11vnc} {
;
} elseif {[regexp {^(stop|quit|exit|shutdown)$} $item]} {
......@@ -2359,6 +2711,7 @@ proc do_var {item} {
set debug [in_debug_mode]
set string 0
if {[is_action $item] || $item == "WindowView"} {
# Menu item is action:
......@@ -2370,7 +2723,6 @@ proc do_var {item} {
return
}
if {[value_is_string $item]} {
# Menu item is a string:
if {$item_cascade($item) != ""} {
......@@ -2442,6 +2794,9 @@ proc is_browse {item} {
proc value_is_string {item} {
global item_bool
if {![info exists item_bool($item)]} {
return 0
}
if {! $item_bool($item)} {
return 1
} else {
......@@ -2451,6 +2806,9 @@ proc value_is_string {item} {
proc value_is_bool {item} {
global item_bool
if {![info exists item_bool($item)]} {
return 0
}
if {$item_bool($item)} {
return 1
} else {
......@@ -2825,9 +3183,6 @@ proc toggle_simple_gui {} {
make_menu_items
set_widgets
set_internal_help
# if {$connected_to_x11vnc} {
# query_all
# }
append_text "\n"
}
......@@ -3114,7 +3469,7 @@ proc menu_posted {} {
# puts "menu_posted $refresh"
if {$now > $refresh} {
append_text "Refreshing settings... "
append_text "Refreshing current settings... "
query_all $quiet
if {$quiet} {
append_text "done\n"
......@@ -3195,20 +3550,79 @@ proc props_apply {} {
after 500
}
set fpw 0
if {$props_passwd != $prop0_passwd} {
push_new_value "passwd" "passwd" "$props_passwd" 0
set prop0_passwd $props_passwd
set fpw 1
}
set vpw 0
if {$props_viewpasswd != $prop0_viewpasswd} {
set vpw 1
}
set pw_ord [list]
if {!$fpw && !$vpw } {
# neither change
;
} elseif {$fpw && !$vpw} {
# full password change
if {$props_passwd == ""} {
if {$prop0_viewpasswd != ""} {
# set view to "" as well and first
set props_viewpasswd ""
set pw_ord [list vpw fpw]
} else {
set pw_ord [list fpw]
}
after 500
} else {
# assume view state OK
set pw_ord [list fpw]
}
if {$props_viewpasswd != $prop0_viewpasswd} {
push_new_value "viewpasswd" "viewpasswd" "$props_viewpasswd" 0
} elseif {!$fpw && $vpw} {
# view password change
if {$props_viewpasswd == ""} {
# assume full state OK
set pw_ord [list vpw]
} else {
if {$prop0_passwd == ""} {
# could be trouble, x11vnc makes random
# full passwd...
set pw_ord [list vpw]
} else {
# OK, full non-null.
set pw_ord [list vpw]
}
}
} elseif {$fpw && $vpw} {
# both full and view password change
if {$props_passwd == "" && $props_viewpasswd == ""} {
# OK, do view first
set pw_ord [list vpw fpw]
} elseif {$props_passwd == "" && $props_viewpasswd != ""} {
# Not good, do view first anyway x11vnc will fix.
set pw_ord [list vpw fpw]
} elseif {$props_passwd != "" && $props_viewpasswd == ""} {
# OK, view first
set pw_ord [list vpw fpw]
} elseif {$props_passwd != "" && $props_viewpasswd != ""} {
# OK, full first
set pw_ord [list fpw vpw]
}
}
foreach case $pw_ord {
if {$case == "fpw"} {
push_new_value "passwd" "passwd" "$props_passwd" 1
set prop0_passwd $props_passwd
after 500
}
if {$case == "vpw"} {
push_new_value "viewpasswd" "viewpasswd" "$props_viewpasswd" 1
set prop0_viewpasswd $props_viewpasswd
after 500
}
}
props_widgets normal
}
......@@ -3533,7 +3947,7 @@ proc read_client_info {} {
proc show_client_balloon {} {
global icon_mode icon_win props_win full_win
global client_balloon ffont
global client_balloon ffont connected_to_x11vnc
set noinfo "tkx11vnc: no client information"
set noinfo "$noinfo\navailable from x11vnc ..."
......@@ -3547,11 +3961,16 @@ proc show_client_balloon {} {
set x [expr [winfo rootx $icon_win] + ([winfo width $icon_win]/2)]
set y [expr [winfo rooty $icon_win] + [winfo height $icon_win] + 4]
set infotext $client_balloon
if {!$connected_to_x11vnc} {
set infotext "Not currently attached to x11vnc\nLast available info:\n$infotext"
}
set w .client_balloon
catch {destroy $w}
toplevel $w -bg black -screen [winfo screen $icon_win]
wm overrideredirect $w 1
label $w.l -text "$client_balloon" -relief flat -bg "#ffffaa" -fg black \
label $w.l -text "$infotext" -relief flat -bg "#ffffaa" -fg black \
-padx 2 -pady 0 -anchor w -justify left -font $ffont
pack $w.l -side left -padx 1 -pady 1
......@@ -3975,6 +4394,7 @@ proc make_gui {mode} {
}
if {$make_gui_count == 1} {
copy_default_vars
if {$x11vnc_connect} {
try_connect_and_query_all
}
......@@ -4293,6 +4713,139 @@ proc double_check_noremote {} {
return [warning_dialog $msg "noremote"]
}
proc get_settings_rcfile {} {
global menu_var default_var unset_str
global x11vnc_gui_params
set rc_txt ""
set menu_var(gui) $x11vnc_gui_params
foreach item [lsort [array names menu_var]] {
if {$item == "gui"} {
;
} elseif {![active_when_starting $item]} {
continue
} elseif {[is_action $item]} {
continue
}
if {$item == "debug_gui"} {
continue
}
if {$item == "WindowView"} {
continue
}
if {$item == "rc" || $item == "norc"} {
continue
}
set def ""
if {[info exists default_var($item)]} {
set def $default_var($item)
}
set qst ""
set hmm "#? "
if {$item == "display"} {
set qst $hmm
} elseif {$item == "desktop"} {
set qst $hmm
} elseif {$item == "dontdisconnect"} {
set qst $hmm
} elseif {$item == "alwaysshared"} {
set qst $hmm
} elseif {$item == "nevershared"} {
set qst $hmm
}
if {![info exists menu_var($item)]} {
set mv $def
} else {
set mv $menu_var($item)
}
if {$mv == $unset_str} {
set mv ""
}
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"
}
if {$mv == "" && $def != ""} {
set qst $hmm
}
set n 0
if {$qst != ""} {
append rc_txt $qst
incr n [string length $qst]
} elseif {$mv == $def} {
append rc_txt "#d "
incr n [string length "#d "]
}
set mt $mv
regsub -all {#} $mt {\#} mt
if {$mt == ""} {
set mt {""}
}
append rc_txt "-$nitem $mt"
if {$mv != $def} {
set m [string length "-$nitem $mt"]
incr n $m
set n [expr $n / 8]
set c 0
for {set i $n} {$i <= $ntab} {incr i} {
append rc_txt "\t"
incr c
}
if {$c == 0} {
append rc_txt "\t"
}
regsub -all {#} $def {\#} def
if {$def == ""} {
set def {""}
}
append rc_txt "# default: $def"
}
append rc_txt "\n"
} elseif {[value_is_bool $item]} {
set n 0
if {$qst != ""} {
append rc_txt $qst
incr n [string length $qst]
} elseif {$mv == $def} {
append rc_txt "#d "
incr n [string length "#d "]
}
if {$def == 1} {
set dv "on"
} else {
set dv "off"
}
append rc_txt "-$item"
set m [string length "-$item"]
incr n $m
set n [expr $n / 8]
for {set i $n} {$i <= $ntab} {incr i} {
append rc_txt "\t"
}
append rc_txt "# default: $dv"
append rc_txt "\n"
}
}
return $rc_txt
}
proc double_check_start_x11vnc {} {
global hostname
set msg [get_start_x11vnc_txt]
......@@ -4319,7 +4872,7 @@ proc show_start_cmd {} {
}
proc get_start_x11vnc_cmd {{show_rc 0}} {
global menu_var unset_str x11vnc_prog
global menu_var default_var unset_str x11vnc_prog
set xterm_cmd "xterm -iconic -geometry 80x35 -title x11vnc-console -e"
......@@ -4332,15 +4885,19 @@ proc get_start_x11vnc_cmd {{show_rc 0}} {
set saw_id 0
foreach item [lsort [array names menu_var]] {
if {![active_when_starting $item]} {
if {$item == "gui"} {
;
} elseif {![active_when_starting $item]} {
continue
}
if {[is_action $item]} {
} elseif {[is_action $item]} {
continue
}
if {$item == "debug_gui"} {
continue
}
if {$item == "WindowView"} {
continue
}
if {$item == "id" || $item == "sid"} {
set val $menu_var($item);
if {$val == "0x0" || $val == "root"} {
......@@ -4368,7 +4925,15 @@ proc get_start_x11vnc_cmd {{show_rc 0}} {
if {[value_is_bool $item]} {
if {[info exists menu_var($item)]} {
if {$menu_var($item)} {
set add 1
if {[info exists default_var($item)]} {
if {$menu_var($item) == $default_var($item)} {
set add 0;
}
} elseif {! $menu_var($item)} {
set add 0
}
if {$add} {
lappend cmd "-$item"
append rc_txt "-$item\n"
}
......@@ -4377,6 +4942,7 @@ proc get_start_x11vnc_cmd {{show_rc 0}} {
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"
......@@ -4387,9 +4953,18 @@ proc get_start_x11vnc_cmd {{show_rc 0}} {
} elseif {$nitem == "solid_color"} {
set nitem "solid"
}
if {[info exists default_var($item)]} {
if {$menu_var($item) == $default_var($item)} {
set add 0;
}
}
if {$add} {
lappend cmd "-$nitem"
lappend cmd $menu_var($item)
append rc_txt "-$nitem $menu_var($item)\n"
set mt $menu_var($item)
regsub -all {#} $mt {\#} mt
append rc_txt "-$nitem $mt\n"
}
}
}
}
......@@ -4445,6 +5020,15 @@ proc start_x11vnc {} {
catch {[eval exec $cmd]}
after 500
try_connect_and_query_all 3
if {!$connected_to_x11vnc} {
append_text "\nStarting x11vnc seems to have failed.\n"
if {[regexp -- {-o } $str] || [regexp -- {-logfile} $str]} {
append_text "Examine the logfile (Debugging -> show-logfile) for error messages.\n"
} else {
append_text "Rerun with a logfile (if needed) and examine the logfile\n"
append_text "(Debugging -> show-logfile) for error messages.\n"
}
}
}
proc run_remote_cmd {opts} {
......@@ -4711,6 +5295,7 @@ proc undo_tray_embed {} {
global env x11vnc_prog x11vnc_cmdline x11vnc_xdisplay x11vnc_connect;
global x11vnc_client_file x11vnc_gui_geom x11vnc_started vnc_url
global x11vnc_gui_params
global x11vnc_auth_file x11vnc_connect_file beginner_mode simple_gui_created
global helpall helptext helpremote helplabel hostname osname
global all_settings reply_xdisplay always_update
......@@ -4840,6 +5425,11 @@ if {[info exists env(X11VNC_GUI_GEOM)]} {
} else {
set x11vnc_gui_geom ""
}
if {[info exists env(X11VNC_GUI_PARAMS)]} {
set x11vnc_gui_params $env(X11VNC_GUI_PARAMS);
} else {
set x11vnc_gui_params ""
}
if {[info exists env(X11VNC_CONNECT_FILE)]} {
set x11vnc_connect_file $env(X11VNC_CONNECT_FILE);
......@@ -4954,6 +5544,8 @@ set_name "tkx11vnc"
key_bindings;
get_default_vars
if {$icon_mode} {
if {$tray_embed} {
make_gui "tray"
......
......@@ -70,12 +70,17 @@
"Actions\n"
" =SA start\n"
" =RA stop\n"
" =DGA attach\n"
" --\n"
" =DSA attach\n"
" =DRA detach\n"
" --\n"
" =RA ping\n"
" =RA update-all\n"
" =GA clear-all\n"
" --\n"
" =GA save-settings\n"
" =SFA load-settings:\n"
" =SA defaults-all\n"
" =0SA clear-all\n"
" -- D\n"
" =DRA stop+quit \n"
" =DGA Quit \n"
......@@ -320,6 +325,23 @@
"Launch x11vnc with the settings you have prescribed in the gui.\n"
"The x11vnc process is started in an xterm window so you can see the\n"
"output, kill it, etc.\n"
"\n"
"By viewing this help item, the command built so far will be displayed\n"
"in the gui text area. Have a look. If you Press start it will be shown\n"
"as well and you will be asked to confirm running it.\n"
"\n"
"If you want to use a saved profile \\\"rc file\\\" you can do \\\"Misc -> rc\\\" and\n"
"select the file and simply start x11vnc using the rc file. Alternatively,\n"
"you could first use the \\\"Actions -> load-settings\\\" action to load in\n"
"an \\\"rc file\\\" and then press \\\"Actions -> start\\\" to start up x11vnc\n"
"based on those values.\n"
"\"\n"
" set helptext(stop) \"\n"
"The \\\"Actions -> stop\\\" action sends a signal to the running x11vnc\n"
"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"
"\"\n"
"\n"
" set helptext(show-start-cmd) \"\n"
......@@ -328,6 +350,9 @@
"settings. This can be done even in the attached state. Intended for\n"
"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"
"\"\n"
"\n"
" set helptext(debug_gui) \"\n"
......@@ -335,13 +360,22 @@
"\"\n"
"\n"
" set helptext(detach) \"\n"
"No longer be associated with the x11vnc server. Switch to non-connected\n"
"state.\n"
"No longer be associated with the x11vnc server. Switch to the\n"
"non-connected state. The x11vnc server keeps running: it does not exit.\n"
"\n"
"You can either later reattach to it \\\"Actions -> attach\\\", or start\n"
"up a new x11vnc \\\"Actions -> start\\\", or exit \\\"Actions -> Quit\\\".\n"
"\"\n"
"\n"
" set helptext(attach) \"\n"
"Attach to the x11vnc server, if possible. Switches to connected state\n"
"if successful. To change or set the X display use \\\"Displays -> display\\\"\n"
"Attach to a running x11vnc server, if possible. Switches to connected\n"
"state if successful. Usually the channel used to attach is via the X\n"
"display (VNC_CONNECT rootwin property) being polled by the x11vnc server.\n"
"To change or set the X display to use do \\\"Displays -> display\\\".\n"
"\n"
"Sometimes the \\\"-connect /path/to/filename\\\" is used as the communcation\n"
"channel. The running x11vnc has to know that \\\"/path/to/filename\\\"\n"
"is the communication channel (i.e. it is using the same -connect option).\n"
"\"\n"
"\n"
" set helptext(ping) \"\n"
......@@ -352,16 +386,60 @@
"Query the x11vnc server for the current values of all variables.\n"
"Populate the values into the gui's database.\n"
"\n"
"Normally the gui will refresh this info every time it interacts\n"
"with the x11vnc server, so one doesn't need to use this action\n"
"very often (unless something else is changing the state of the\n"
"x11vnc server, or new clients have connected, etc).\n"
"Normally the gui will refresh this info every time it interacts with\n"
"the x11vnc server (including after a few minutes of inactivity), so one\n"
"doesn't need to use this action very often (unless something else is\n"
"changing the state of the x11vnc server, or new clients have connected,\n"
"etc).\n"
"\"\n"
"\n"
" set helptext(clear-all) \"\n"
"Forget any variable settings either entered in by you or retrieved\n"
"from a running x11vnc server. Basically sets everything to 0 or\n"
"the string (unset).\n"
"Forget any variable settings either entered in by you or set at the\n"
"default. Basically sets everything to 0 or the string (unset).\n"
"\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"
"\"\n"
"\n"
" set helptext(defaults-all) \"\n"
"Reset all variable settings to the default values. Basically sets\n"
"everything to the default queries \\\"x11vnc -QD var\\\" retrieved at startup.\n"
"\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"
"\"\n"
"\n"
" set helptext(load-settings) \"\n"
"Read in the \\\"rc file\\\" you prescribe in the dialog and then set the\n"
"variables to those in the rc-file. Any variables not mentioned in the\n"
"rc-file are set to their default value.\n"
"\n"
"You could then do \\\"Actions -> start\\\" to start x11vnc with these\n"
"parameters. Or you could make some further changes to variables\n"
"using the gui before starting x11vnc.\n"
"\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"
"\"\n"
"\n"
" set helptext(save-settings) \"\n"
"Construct a ~/.x11vncrc file based on the current settings and\n"
"offer to save it in a file (default ~/.x11vncrc). If saved in a\n"
"file other than the default, you can access the profile by using\n"
"the \\\"-rc <filename>\\\" option when starting x11vnc.\n"
"\n"
"If an rc file entry begins with \\\"#d\\\" that means the current\n"
"setting is at the Default value and so you probably want to leave\n"
"it commented out with the \\\"#\\\" character.\n"
"\n"
"If an rc file entry begins with \\\"#?\\\" that means we think\n"
"you probably do not really want to force the value to this setting.\n"
"\n"
"In either case, feel free to uncomment the line and/or change any\n"
"of the parameter values in the file. \n"
"\"\n"
"\n"
" set helptext(all-settings) \"\n"
......@@ -389,10 +467,11 @@
"\n"
" set helptext(tail-logfile) \"\n"
"Run the tail(1) command with -f option on the logfile in an xterm.\n"
"(if it exists and is accessible by the gui process).\n"
"\"\n"
"\n"
" set helptext(Quit) \"\n"
"Terminate the tkx11vnc gui. Any x11vnc servers will be left running.\n"
"Terminate the tkx11vnc gui. Any x11vnc server will be left running.\n"
"\"\n"
"\n"
" set helptext(current) \"\n"
......@@ -545,7 +624,7 @@
" set helptext(all) $helpall\n"
"\n"
" set helptext(Misc-Tuning:) \"\n"
"x11vnc has what seems like hundreds of tuning parameters. In this\n"
"x11vnc has what seems like hundreds of tuning parameters! In this\n"
"sub-menu we place some lesser used ones. Most likely you'll want to\n"
"leave them at their default values, but you can try them out quickly\n"
"with the gui to see if they improve things.\n"
......@@ -758,8 +837,8 @@
"This sub-menu provides some options regarding SYSV shared memory usage\n"
"(shm) by x11vnc. Usually you want shm turned on because the x11vnc\n"
"process is nearly always running on the same machine the X server process\n"
"is running on. SharedMemory gives a performance speedup. However,\n"
"if you need to modify this scenario these options allow you to.\n"
"is running on. SharedMemory gives a performance speedup. However, if you\n"
"need to modify this scenario for special usage these options allow you to.\n"
"\"\n"
"\n"
" set helptext(Misc-Debug:) \"\n"
......@@ -773,6 +852,7 @@
"This sub-menu contains some options centering around the Selection\n"
"(also referred to as the Clipboard, Cutbuffers, etc). x11vnc will try\n"
"to exchange the selections between the VNC viewers and the X server.\n"
"You can adjust that behavior with these options.\n"
"\"\n"
"\n"
" set helptext(WindowView) \"\n"
......@@ -798,7 +878,7 @@
"Advanced\\\" and then delete it the gui does NOT terminate.\n"
"\n"
"Also note that by default in \\\"icon\\\" mode if you delete the icon\n"
"window both the gui and the x11vnc server terminate.\n"
"window both the gui *and* the x11vnc server terminate.\n"
"\"\n"
"\n"
" set helptext(gui) \"\n"
......@@ -932,34 +1012,35 @@
"--- ----------\n"
"\n"
"1) At the top of the gui is a info text label where information will\n"
"be posted, e.g. when traversing menu items text indicating how to get\n"
"help on the item and its current value will be displayed.\n"
" be posted, e.g. when traversing menu items text indicating how to get\n"
" help on the item and its current value will be displayed.\n"
"\n"
"2) Below the info label is the area where the menu buttons, Actions,\n"
"Clients, etc., are presented. If a menu item has a checkbox,\n"
"it corresponds to a boolean on/off variable. Otherwise it is\n"
"either a string variable, or an action not associated with a\n"
"variable (for the most part).\n"
"2) Below the info label is the area where the menu buttons, \\\"Actions\\\",\n"
" \\\"Clients\\\", etc., are presented. If a menu item has a checkbox,\n"
" it corresponds to a boolean on/off variable. Otherwise it is\n"
" either a string variable, or an action not associated with a\n"
" variable (for the most part).\n"
"\n"
"3) Below the menu button area is a text label indicating the current x11vnc\n"
"X display being polled and the corresponding VNC display name. Both\n"
"will be \\\"(*none*)\\\" when there is no connection established.\n"
"3) Below the menu button area is a label indicating the current x11vnc\n"
" X display being polled and the corresponding VNC display name. Both\n"
" will be \\\"(*none*)\\\" when there is no connection established.\n"
"\n"
"4) Below the x11 and vnc displays text label is a text area there scrolling\n"
"information about actions being taken and commands being run is displayed.\n"
"To scroll click in the area and use PageUp/PageDown or the arrow keys.\n"
"4) Below the x11 and vnc displays label is a text area there scrolling\n"
" information about actions being taken and commands being run is displayed.\n"
" To scroll click in the area and use PageUp/PageDown or the arrow keys.\n"
"\n"
"5) At the bottom is an entry area. When one selects a menu item that\n"
"requires supplying a string value, the label will be set to the\n"
"parameter name and one types in the new value. Then one presses the\n"
"\\\"OK\\\" button or presses \\\"Enter\\\" to set the value. Or you can press\n"
"\\\"Cancel\\\" or \\\"Escape\\\" to avoid changing the variable. Some variables\n"
"are boolean toggles (for example, \\\"Permissions -> viewonly\\\") or Radio\n"
"button selections. Selecting these menu items will not activate the\n"
"entry area but rather toggle the variable directly.\n"
" requires supplying a string value, the label will be set to the\n"
" parameter name and one types in the new value. Then one presses the\n"
" \\\"OK\\\" button or presses \\\"Enter\\\" to set the value. Or you can press\n"
" \\\"Cancel\\\" or \\\"Escape\\\" to avoid changing the variable.\n"
"\n"
" Many variables are boolean toggles (for example, \\\"Permissions ->\n"
" viewonly\\\") or Radio button selections. Selecting these menu items\n"
" will NOT activate the entry area but rather toggle the variable\n"
" immediately.\n"
"\n"
"Cascades Bug: There is a bug not yet worked around for the cascade menus\n"
"CASCADES BUG: There is a bug not yet worked around for the cascade menus\n"
"where the (?) help button gets in the way. To get the mouse over to\n"
"the cascade menu click and release mouse to activate the cascade, then\n"
"you can click on its items. Dragging with a mouse button held down will\n"
......@@ -1032,7 +1113,7 @@
" }\n"
"}\n"
"\n"
"proc textwin {name title text} {\n"
"proc textwin {name title text {entry \"\"}} {\n"
" global max_text_height max_text_width\n"
" global bfont ffont\n"
"\n"
......@@ -1062,13 +1143,40 @@
"\n"
" bind $w <Enter> \"focus $w.f.t\"\n"
"\n"
" if {$entry != \"\"} {\n"
" # varname+Label Name\n"
" set list [split $entry \"+\"]\n"
" set varname [lindex $list 0]\n"
" set labname [lindex $list 1]\n"
" frame $w.f.ef -bd 1 -relief groove\n"
" label $w.f.ef.l -text \"$labname\" -anchor w -font $bfont\n"
" entry $w.f.ef.e -relief sunken -font $ffont \\\n"
" -textvariable $varname\n"
" button $w.f.ef.b -text \"OK\" -font $bfont \\\n"
" -command \"set ${varname}_ok 1; destroy $w\" \n"
" bind $w.f.ef.e <KeyPress-Return> \"set ${varname}_ok 1; destroy $w\"\n"
" \n"
" pack $w.f.ef.l -side left\n"
" pack $w.f.ef.e -side left -fill x -expand 1\n"
" pack $w.f.ef.b -side right\n"
" }\n"
"\n"
" wm withdraw $w\n"
" pack $w.f.b -side bottom -fill x \n"
" if {$entry != \"\"} {\n"
" pack $w.f.ef -side bottom -fill x \n"
" bind $w <Enter> \"focus $w.f.ef.e\"\n"
" $w.f.ef.e icursor end\n"
" } else {\n"
" bind $w <Enter> \"focus $w.f.t\"\n"
" }\n"
" pack $w.f.y -side right -fill y;\n"
" pack $w.f.t -side top -fill both -expand 1;\n"
" update\n"
"\n"
" center_win $w\n"
"\n"
" return $w\n"
"}\n"
"\n"
"proc active_when_connected {item} {\n"
......@@ -1113,6 +1221,9 @@
" if {$item == \"display\"} {\n"
" return 1\n"
" }\n"
" if {$item == \"attach\"} {\n"
" return 1\n"
" }\n"
" if {$item == \"debug_gui\"} {\n"
" return 1\n"
" }\n"
......@@ -1211,11 +1322,10 @@
"\n"
" if {$item == \"start\"} {\n"
" set str [get_start_x11vnc_txt]\n"
" append text $str\n"
" append_text \"$str\\n\"\n"
" append text \"\\nPossible \\$HOME/.x11vncrc settings for this command:\\n\\n\"\n"
" set rctxt [get_start_x11vnc_cmd 1]\n"
" append text \"$rctxt\\n\"\n"
"# append text \"\\nPossible \\$HOME/.x11vncrc settings for this command:\\n\\n\"\n"
"# set rctxt [get_start_x11vnc_cmd 1]\n"
"# append text \"$rctxt\\n\"\n"
" }\n"
"\n"
" regsub -all { } $item \" \" name\n"
......@@ -2029,6 +2139,75 @@
" }\n"
"}\n"
"\n"
"proc get_default_vars {} {\n"
" global default_var\n"
"\n"
" set qry [all_query_vars]\n"
"\n"
" append qry \",vncconnect\"\n"
"\n"
" set qargs [list \"-QD\" $qry]\n"
" set all [run_remote_cmd $qargs]\n"
"\n"
" if {[regexp {ans=} $all]} {\n"
" #append_text \"Retrieved all default settings.\\n\"\n"
" } else {\n"
" #append_text \"Failed to retrieve default settings.\\n\"\n"
" }\n"
"\n"
" set query_result_list [split_query $all]\n"
"\n"
" set default_var(gui) \"\"\n"
"\n"
" foreach piece $query_result_list {\n"
" if {[regexp {^([^:][^:]*):(.*)$} $piece m0 item val]} {\n"
" if {$val == \"N/A\"} {\n"
" if {$item == \"vncconnect\"} {\n"
" set val 1\n"
" } else {\n"
" set val \"\"\n"
" }\n"
" }\n"
" if {$item == \"display\"} {\n"
" set val \"\"\n"
" } elseif {$item == \"desktop\"} {\n"
" set val \"\"\n"
" } elseif {$item == \"auth\"} {\n"
" set val \"\"\n"
" } \n"
" # some hacks we do here for now..\n"
" if {$item == \"cursor\" && $val == \"\"} {\n"
" set val \"most\"\n"
" } elseif {$item == \"scrollcopyrect\" && $val == \"\"} {\n"
" set val \"always\"\n"
" } elseif {$item == \"wirecopyrect\" && $val == \"\"} {\n"
" set val \"always\"\n"
" } elseif {$item == \"overlay_nocursor\" && $val == 0} {\n"
" set val 1\n"
" }\n"
"\n"
" set default_var($item) $val\n"
"#puts \"default: $item -> $val\"\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc copy_default_vars {} {\n"
" global menu_var default_var\n"
" foreach item [array names default_var] {\n"
" if {[info exists menu_var($item)]} {\n"
" if {[info exists default_var($item)]} {\n"
" set menu_var($item) $default_var($item)\n"
" }\n"
" }\n"
" }\n"
" foreach item [array names menu_var] {\n"
" if {[info exists default_var($item)]} {\n"
" set menu_var($item) $default_var($item)\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc update_menu_vars {{query \"\"}} {\n"
" global all_settings menu_var query_result_list\n"
"\n"
......@@ -2066,6 +2245,163 @@
" }\n"
"}\n"
"\n"
"proc load_settings {} {\n"
" global menu_var default_var\n"
"\n"
" if {![info exists menu_var(load-settings)]} {\n"
" return\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"
"\n"
" if {$fh == \"\"} {\n"
" append_text \"load_settings: *** failed to open $file ***\\n\"\n"
" return\n"
" }\n"
" copy_default_vars\n"
"\n"
" set str \"\"\n"
" while {[gets $fh line] > -1} {\n"
" regsub -all {\\\\#} $line {__QUOTED_HASH__} line\n"
" if {[regexp {^[ \\t]*#} $line]} {\n"
" continue\n"
" }\n"
" for {set i 0} {$i < 5} {incr i} {\n"
" regsub {#.*$} $line \"\" line\n"
" }\n"
" if {[regexp {^[ \\t]*$} $line]} {\n"
" continue\n"
" }\n"
" regsub -all {__QUOTED_HASH__} $line {#} line\n"
" if {[regexp {\\\\$} $line]} {\n"
" regsub {\\\\$} $line \" \" line\n"
" append str \"$line\"\n"
" } else {\n"
" append str \"$line\\n\"\n"
" }\n"
" }\n"
" close $fh\n"
"\n"
" foreach line [split $str \"\\n\"] {\n"
" set line [string trim $line]\n"
" regsub {^--*} $line \"\" line\n"
" regsub -all {[ \\t][ \\t]*} $line \" \" line\n"
" set list [split $line]\n"
" set item [lindex $list 0]\n"
" set value [lindex $list 1]\n"
" if {[regexp {^[ \\t]*$} $item]} {\n"
" continue\n"
" }\n"
" if {[info exists menu_var($item)]} {\n"
" if {[value_is_bool $item]} {\n"
" set menu_var($item) 1\n"
" } elseif {[value_is_string $item]} {\n"
" if {$value != \"\"} {\n"
" set menu_var($item) $value\n"
" }\n"
" }\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc save_settings {} {\n"
" set rc_text [get_settings_rcfile]\n"
"\n"
" set top \"#\n"
"# This file is based on the current x11vnc settings and can be used as\n"
"# as a ~/.x11vncrc defaults file. If saved to another filename, these\n"
"# settings can be passed to x11vnc at startup via \\\"-rc <filename>\\\".\n"
"#\n"
"# The rc file comment character is \\\"#\\\". Use \\\"\\\\#\\\" for the literal char.\n"
"# You can continue lines using \\\"\\\\\\\" as the last character of a line.\n"
"#\n"
"# Lines beginning with \\\"#d\\\" indicate the parameter value is at its default\n"
"# setting and you probably want to leave it commented out.\n"
"#\n"
"# Lines beginning with \\\"#?\\\" indicate parameters you probably do not\n"
"# want to hardwire to the current setting (uncomment if you want that).\n"
"# \n"
"# Some parameters are boolean, e.g. -forever, and take no value; while\n"
"# the others, e.g. -wait 50, take a string or numerical value.\n"
"#\n"
"# For booleans, the line will end with comment \\\"default: on\\\" or\n"
"# \\\"default: off\\\" indicating the default setting. (Note: often\n"
"# \\\"-nofoobar\\\" corresponds to option \\\"-foobar\\\" and the former is\n"
"# \\\"the default\\\", e.g. -norepeat).\n"
"#\n"
"# For string or numerical options, the value \\\"\\\" in a line below\n"
"# means the default is unset and you will need to supply some non-empty\n"
"# value to use the parameter. For reference, if the default differs\n"
"# from your value it placed at the end of the line as a comment.\n"
"# \n"
"# Feel free to uncomment or comment any of the lines or to change any\n"
"# of the values of the parameters. Don't be surprised that most if not\n"
"# all of the lines below are commented out (x11vnc has so many parameters,\n"
"# most of them will be at their default values).\n"
"#-------------------------------------------------------------------------\n"
"\n"
"\"\n"
"\n"
" set rc_text \"$top$rc_text\"\n"
"\n"
" global env save_settings_var save_settings_var_ok\n"
" if {[info exists env(HOME)]} {\n"
" set save_settings_var \"$env(HOME)/.x11vncrc\"\n"
" } else {\n"
" set save_settings_var \".x11vncrc\"\n"
" }\n"
" set save_settings_var_ok 0\n"
"\n"
" set w [textwin \"save_settings\" \"Save Settings...\" $rc_text \\\n"
" \"save_settings_var+Save as:\"]\n"
"\n"
" tkwait window $w\n"
"\n"
" if {$save_settings_var_ok == 1} {\n"
" set file $save_settings_var\n"
" if {$file == \"\"} {\n"
" return\n"
" }\n"
" append_text \"\\nSaving current settings to $file ...\\n\" \n"
" if {[file exists $file]} {\n"
" set backup \"${file}~\"\n"
" append_text \"Backing up $file -> $backup ...\\n\"\n"
" catch {file delete -force $backup}\n"
" set emsg \"*** Backup to $backup failed. ***\\n\"\n"
" if {![file exists $backup]} {\n"
" catch {file copy -force $file $backup}\n"
" if {![file exists $backup]} {\n"
" append_text $emsg\n"
" bell\n"
" }\n"
" } else {\n"
" append_text $emsg\n"
" bell\n"
" }\n"
" }\n"
" set fh \"\"\n"
" catch {set fh [open $file \"w\"]}\n"
" if {$fh != \"\"} {\n"
" puts $fh $rc_text\n"
" close $fh\n"
" if {![file exists $file]} {\n"
" append_text \"*** Saving to $file failed. ***\\n\"\n"
" bell\n"
" } else {\n"
" append_text \"Done.\\n\"\n"
" }\n"
" } else {\n"
" append_text \"*** Open of $file failed. ***\\n\"\n"
" bell\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc clear_all {} {\n"
" global menu_var unset_str\n"
"\n"
......@@ -2088,6 +2424,11 @@
" append_text \"Cleared all settings.\\n\"\n"
"}\n"
"\n"
"proc defaults_all {} {\n"
" copy_default_vars\n"
" append_text \"Reset all variables to default values.\\n\"\n"
"}\n"
"\n"
"proc all_query_vars {} {\n"
" global query_ans_list query_aro_list all_settings\n"
" global cache_all_query_vars\n"
......@@ -2127,13 +2468,13 @@
"\n"
" if {[regexp {ans=} $all]} {\n"
" if {! $quiet} {\n"
" append_text \"Retrieved all settings.\\n\"\n"
" append_text \"Retrieved all current settings.\\n\"\n"
" }\n"
" set all_settings $all\n"
" update_menu_vars $all\n"
" } else {\n"
" if {! $quiet} {\n"
" append_text \"Failed to retrieve settings.\\n\"\n"
" append_text \"Failed to retrieve current settings.\\n\"\n"
" }\n"
" }\n"
" set last_query_all_time [clock seconds]\n"
......@@ -2193,7 +2534,7 @@
" set logfile $menu_var(logfile)\n"
" \n"
" if {$logfile == \"\" || $logfile == $unset_str} {\n"
" set txt \"\\nNo logfile has been specified.\\n\\n\" \n"
" set txt \"\\nNo logfile was specified at x11vnc startup.\\n\\n\" \n"
" } elseif {![file exists $logfile]} {\n"
" set txt \"\\nLogfile \\\"$logfile\\\" does not exist.\\n\\n\"\n"
" } else {\n"
......@@ -2219,7 +2560,7 @@
" \n"
" set txt \"\"\n"
" if {$logfile == \"\" || $logfile == $unset_str} {\n"
" set txt \"\\nNo logfile has been specified.\\n\\n\" \n"
" set txt \"\\nNo logfile was specified at x11vnc startup.\\n\\n\" \n"
" } elseif {![file exists $logfile]} {\n"
" set txt \"\\nLogfile \\\"$logfile\\\" does not exist.\\n\\n\"\n"
" } else {\n"
......@@ -2306,6 +2647,12 @@
" } elseif {$item == \"clear-all\"} {\n"
" clear_all\n"
" return\n"
" } elseif {$item == \"defaults-all\"} {\n"
" defaults_all\n"
" return\n"
" } elseif {$item == \"save-settings\"} {\n"
" save_settings\n"
" return\n"
" } elseif {$item == \"show-start-cmd\"} {\n"
" show_start_cmd\n"
" return\n"
......@@ -2339,6 +2686,11 @@
" set name $item\n"
" }\n"
"\n"
" if {$item == \"load-settings\"} {\n"
" load_settings\n"
" return\n"
" }\n"
"\n"
" if {! $connected_to_x11vnc} {\n"
" ;\n"
" } elseif {[regexp {^(stop|quit|exit|shutdown)$} $item]} {\n"
......@@ -2365,6 +2717,7 @@
"\n"
" set debug [in_debug_mode]\n"
"\n"
"\n"
" set string 0\n"
" if {[is_action $item] || $item == \"WindowView\"} {\n"
" # Menu item is action:\n"
......@@ -2376,7 +2729,6 @@
" return\n"
" }\n"
"\n"
"\n"
" if {[value_is_string $item]} {\n"
" # Menu item is a string:\n"
" if {$item_cascade($item) != \"\"} {\n"
......@@ -2448,6 +2800,9 @@
"\n"
"proc value_is_string {item} {\n"
" global item_bool\n"
" if {![info exists item_bool($item)]} {\n"
" return 0\n"
" }\n"
" if {! $item_bool($item)} {\n"
" return 1\n"
" } else {\n"
......@@ -2457,6 +2812,9 @@
"\n"
"proc value_is_bool {item} {\n"
" global item_bool\n"
" if {![info exists item_bool($item)]} {\n"
" return 0\n"
" }\n"
" if {$item_bool($item)} {\n"
" return 1\n"
" } else {\n"
......@@ -2831,9 +3189,6 @@
" make_menu_items\n"
" set_widgets\n"
" set_internal_help\n"
"# if {$connected_to_x11vnc} {\n"
"# query_all\n"
"# }\n"
" append_text \"\\n\"\n"
"}\n"
"\n"
......@@ -3120,7 +3475,7 @@
" # puts \"menu_posted $refresh\"\n"
"\n"
" if {$now > $refresh} {\n"
" append_text \"Refreshing settings... \"\n"
" append_text \"Refreshing current settings... \"\n"
" query_all $quiet\n"
" if {$quiet} {\n"
" append_text \"done\\n\"\n"
......@@ -3201,20 +3556,79 @@
" after 500\n"
" }\n"
"\n"
" set fpw 0\n"
" if {$props_passwd != $prop0_passwd} {\n"
" push_new_value \"passwd\" \"passwd\" \"$props_passwd\" 0\n"
" set prop0_passwd $props_passwd\n"
" set fpw 1\n"
" }\n"
" set vpw 0\n"
" if {$props_viewpasswd != $prop0_viewpasswd} {\n"
" set vpw 1\n"
" }\n"
"\n"
" set pw_ord [list]\n"
" if {!$fpw && !$vpw } {\n"
" # neither change\n"
" ;\n"
" } elseif {$fpw && !$vpw} {\n"
" # full password change\n"
" if {$props_passwd == \"\"} {\n"
" if {$prop0_viewpasswd != \"\"} {\n"
" # set view to \"\" as well and first\n"
" set props_viewpasswd \"\"\n"
" set pw_ord [list vpw fpw]\n"
" } else {\n"
" set pw_ord [list fpw]\n"
" }\n"
" } else {\n"
" # assume view state OK\n"
" set pw_ord [list fpw]\n"
" }\n"
" \n"
" } elseif {!$fpw && $vpw} {\n"
" # view password change\n"
" if {$props_viewpasswd == \"\"} {\n"
" # assume full state OK\n"
" set pw_ord [list vpw]\n"
" } else {\n"
" if {$prop0_passwd == \"\"} {\n"
" # could be trouble, x11vnc makes random\n"
" # full passwd...\n"
" set pw_ord [list vpw]\n"
" } else {\n"
" # OK, full non-null.\n"
" set pw_ord [list vpw]\n"
" }\n"
" }\n"
" } elseif {$fpw && $vpw} {\n"
" # both full and view password change\n"
" if {$props_passwd == \"\" && $props_viewpasswd == \"\"} {\n"
" # OK, do view first\n"
" set pw_ord [list vpw fpw]\n"
" } elseif {$props_passwd == \"\" && $props_viewpasswd != \"\"} {\n"
" # Not good, do view first anyway x11vnc will fix.\n"
" set pw_ord [list vpw fpw]\n"
" } elseif {$props_passwd != \"\" && $props_viewpasswd == \"\"} {\n"
" # OK, view first\n"
" set pw_ord [list vpw fpw]\n"
" } elseif {$props_passwd != \"\" && $props_viewpasswd != \"\"} {\n"
" # OK, full first\n"
" set pw_ord [list fpw vpw]\n"
" }\n"
" }\n"
"\n"
" foreach case $pw_ord {\n"
" if {$case == \"fpw\"} {\n"
" push_new_value \"passwd\" \"passwd\" \"$props_passwd\" 1\n"
" set prop0_passwd $props_passwd\n"
" after 500\n"
" }\n"
"\n"
" if {$props_viewpasswd != $prop0_viewpasswd} {\n"
" push_new_value \"viewpasswd\" \"viewpasswd\" \"$props_viewpasswd\" 0\n"
" if {$case == \"vpw\"} {\n"
" push_new_value \"viewpasswd\" \"viewpasswd\" \"$props_viewpasswd\" 1\n"
" set prop0_viewpasswd $props_viewpasswd\n"
" after 500\n"
" }\n"
" }\n"
"\n"
" props_widgets normal\n"
"}\n"
"\n"
......@@ -3539,7 +3953,7 @@
"\n"
"proc show_client_balloon {} {\n"
" global icon_mode icon_win props_win full_win\n"
" global client_balloon ffont\n"
" global client_balloon ffont connected_to_x11vnc\n"
"\n"
" set noinfo \"tkx11vnc: no client information\"\n"
" set noinfo \"$noinfo\\navailable from x11vnc ...\"\n"
......@@ -3553,11 +3967,16 @@
" set x [expr [winfo rootx $icon_win] + ([winfo width $icon_win]/2)]\n"
" set y [expr [winfo rooty $icon_win] + [winfo height $icon_win] + 4]\n"
"\n"
" set infotext $client_balloon\n"
" if {!$connected_to_x11vnc} {\n"
" set infotext \"Not currently attached to x11vnc\\nLast available info:\\n$infotext\"\n"
" }\n"
"\n"
" set w .client_balloon\n"
" catch {destroy $w}\n"
" toplevel $w -bg black -screen [winfo screen $icon_win]\n"
" wm overrideredirect $w 1\n"
" label $w.l -text \"$client_balloon\" -relief flat -bg \"#ffffaa\" -fg black \\\n"
" label $w.l -text \"$infotext\" -relief flat -bg \"#ffffaa\" -fg black \\\n"
" -padx 2 -pady 0 -anchor w -justify left -font $ffont\n"
" pack $w.l -side left -padx 1 -pady 1\n"
"\n"
......@@ -3981,6 +4400,7 @@
" }\n"
"\n"
" if {$make_gui_count == 1} {\n"
" copy_default_vars\n"
" if {$x11vnc_connect} {\n"
" try_connect_and_query_all\n"
" }\n"
......@@ -4299,6 +4719,139 @@
" return [warning_dialog $msg \"noremote\"]\n"
"}\n"
"\n"
"proc get_settings_rcfile {} {\n"
" global menu_var default_var unset_str\n"
" global x11vnc_gui_params\n"
"\n"
" set rc_txt \"\"\n"
"\n"
" set menu_var(gui) $x11vnc_gui_params\n"
"\n"
" foreach item [lsort [array names menu_var]] {\n"
" if {$item == \"gui\"} {\n"
" ;\n"
" } elseif {![active_when_starting $item]} {\n"
" continue\n"
" } elseif {[is_action $item]} {\n"
" continue\n"
" }\n"
" if {$item == \"debug_gui\"} {\n"
" continue\n"
" }\n"
" if {$item == \"WindowView\"} {\n"
" continue\n"
" }\n"
" if {$item == \"rc\" || $item == \"norc\"} {\n"
" continue\n"
" }\n"
" set def \"\"\n"
" if {[info exists default_var($item)]} {\n"
" set def $default_var($item)\n"
" }\n"
"\n"
" set qst \"\"\n"
" set hmm \"#? \"\n"
" if {$item == \"display\"} {\n"
" set qst $hmm\n"
" } elseif {$item == \"desktop\"} {\n"
" set qst $hmm\n"
" } elseif {$item == \"dontdisconnect\"} {\n"
" set qst $hmm\n"
" } elseif {$item == \"alwaysshared\"} {\n"
" set qst $hmm\n"
" } elseif {$item == \"nevershared\"} {\n"
" set qst $hmm\n"
" }\n"
"\n"
" if {![info exists menu_var($item)]} {\n"
" set mv $def\n"
" } else {\n"
" set mv $menu_var($item)\n"
" }\n"
" if {$mv == $unset_str} {\n"
" set mv \"\"\n"
" }\n"
" 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"
"\n"
" if {$mv == \"\" && $def != \"\"} {\n"
" set qst $hmm\n"
" }\n"
" set n 0\n"
" if {$qst != \"\"} {\n"
" append rc_txt $qst\n"
" incr n [string length $qst]\n"
" } elseif {$mv == $def} {\n"
" append rc_txt \"#d \"\n"
" incr n [string length \"#d \"]\n"
" }\n"
" set mt $mv\n"
" regsub -all {#} $mt {\\#} mt\n"
" if {$mt == \"\"} {\n"
" set mt {\"\"}\n"
" }\n"
" append rc_txt \"-$nitem $mt\"\n"
"\n"
" if {$mv != $def} {\n"
" set m [string length \"-$nitem $mt\"]\n"
" incr n $m\n"
" set n [expr $n / 8]\n"
" set c 0\n"
" for {set i $n} {$i <= $ntab} {incr i} {\n"
" append rc_txt \"\\t\"\n"
" incr c\n"
" }\n"
" if {$c == 0} {\n"
" append rc_txt \"\\t\"\n"
" }\n"
" regsub -all {#} $def {\\#} def\n"
" if {$def == \"\"} {\n"
" set def {\"\"}\n"
" }\n"
" append rc_txt \"# default: $def\"\n"
" }\n"
" append rc_txt \"\\n\"\n"
"\n"
" } elseif {[value_is_bool $item]} {\n"
" set n 0\n"
" if {$qst != \"\"} {\n"
" append rc_txt $qst\n"
" incr n [string length $qst]\n"
" } elseif {$mv == $def} {\n"
" append rc_txt \"#d \"\n"
" incr n [string length \"#d \"]\n"
" }\n"
" if {$def == 1} {\n"
" set dv \"on\"\n"
" } else {\n"
" set dv \"off\"\n"
" }\n"
" append rc_txt \"-$item\"\n"
" set m [string length \"-$item\"]\n"
" incr n $m\n"
" set n [expr $n / 8]\n"
" for {set i $n} {$i <= $ntab} {incr i} {\n"
" append rc_txt \"\\t\"\n"
" }\n"
" append rc_txt \"# default: $dv\"\n"
" append rc_txt \"\\n\"\n"
"\n"
" }\n"
" }\n"
" return $rc_txt\n"
"}\n"
"\n"
"proc double_check_start_x11vnc {} {\n"
" global hostname\n"
" set msg [get_start_x11vnc_txt]\n"
......@@ -4325,7 +4878,7 @@
"}\n"
"\n"
"proc get_start_x11vnc_cmd {{show_rc 0}} {\n"
" global menu_var unset_str x11vnc_prog\n"
" global menu_var default_var unset_str x11vnc_prog\n"
"\n"
" set xterm_cmd \"xterm -iconic -geometry 80x35 -title x11vnc-console -e\"\n"
"\n"
......@@ -4338,15 +4891,19 @@
" set saw_id 0\n"
"\n"
" foreach item [lsort [array names menu_var]] {\n"
" if {![active_when_starting $item]} {\n"
" if {$item == \"gui\"} {\n"
" ;\n"
" } elseif {![active_when_starting $item]} {\n"
" continue\n"
" }\n"
" if {[is_action $item]} {\n"
" } elseif {[is_action $item]} {\n"
" continue\n"
" }\n"
" if {$item == \"debug_gui\"} {\n"
" continue\n"
" }\n"
" if {$item == \"WindowView\"} {\n"
" continue\n"
" }\n"
" if {$item == \"id\" || $item == \"sid\"} {\n"
" set val $menu_var($item);\n"
" if {$val == \"0x0\" || $val == \"root\"} {\n"
......@@ -4374,7 +4931,15 @@
"\n"
" if {[value_is_bool $item]} {\n"
" if {[info exists menu_var($item)]} {\n"
" if {$menu_var($item)} {\n"
" set add 1\n"
" if {[info exists default_var($item)]} {\n"
" if {$menu_var($item) == $default_var($item)} {\n"
" set add 0;\n"
" }\n"
" } elseif {! $menu_var($item)} {\n"
" set add 0\n"
" }\n"
" if {$add} {\n"
" lappend cmd \"-$item\"\n"
" append rc_txt \"-$item\\n\"\n"
" }\n"
......@@ -4383,6 +4948,7 @@
" 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"
......@@ -4393,9 +4959,18 @@
" } elseif {$nitem == \"solid_color\"} {\n"
" set nitem \"solid\"\n"
" }\n"
" if {[info exists default_var($item)]} {\n"
" if {$menu_var($item) == $default_var($item)} {\n"
" set add 0;\n"
" }\n"
" }\n"
" if {$add} {\n"
" lappend cmd \"-$nitem\"\n"
" lappend cmd $menu_var($item)\n"
" append rc_txt \"-$nitem $menu_var($item)\\n\"\n"
" set mt $menu_var($item)\n"
" regsub -all {#} $mt {\\#} mt\n"
" append rc_txt \"-$nitem $mt\\n\"\n"
" }\n"
" }\n"
" }\n"
" }\n"
......@@ -4451,6 +5026,15 @@
" catch {[eval exec $cmd]}\n"
" after 500\n"
" try_connect_and_query_all 3\n"
" if {!$connected_to_x11vnc} {\n"
" append_text \"\\nStarting x11vnc seems to have failed.\\n\"\n"
" if {[regexp -- {-o } $str] || [regexp -- {-logfile} $str]} {\n"
" append_text \"Examine the logfile (Debugging -> show-logfile) for error messages.\\n\"\n"
" } else {\n"
" append_text \"Rerun with a logfile (if needed) and examine the logfile\\n\"\n"
" append_text \"(Debugging -> show-logfile) for error messages.\\n\"\n"
" }\n"
" }\n"
"}\n"
"\n"
"proc run_remote_cmd {opts} {\n"
......@@ -4717,6 +5301,7 @@
"\n"
"global env x11vnc_prog x11vnc_cmdline x11vnc_xdisplay x11vnc_connect;\n"
"global x11vnc_client_file x11vnc_gui_geom x11vnc_started vnc_url\n"
"global x11vnc_gui_params\n"
"global x11vnc_auth_file x11vnc_connect_file beginner_mode simple_gui_created\n"
"global helpall helptext helpremote helplabel hostname osname\n"
"global all_settings reply_xdisplay always_update\n"
......@@ -4846,6 +5431,11 @@
"} else {\n"
" set x11vnc_gui_geom \"\"\n"
"}\n"
"if {[info exists env(X11VNC_GUI_PARAMS)]} {\n"
" set x11vnc_gui_params $env(X11VNC_GUI_PARAMS);\n"
"} else {\n"
" set x11vnc_gui_params \"\"\n"
"}\n"
"\n"
"if {[info exists env(X11VNC_CONNECT_FILE)]} {\n"
" set x11vnc_connect_file $env(X11VNC_CONNECT_FILE);\n"
......@@ -4960,6 +5550,8 @@
"\n"
"key_bindings;\n"
"\n"
"get_default_vars\n"
"\n"
"if {$icon_mode} {\n"
" if {$tray_embed} {\n"
" make_gui \"tray\"\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-09
version: 0.7.2, lastmod: 2005-07-10
.SH SYNOPSIS
.B x11vnc
[OPTION]...
......@@ -37,6 +37,8 @@ ssh -L 5900:localhost:5900 far-host 'x11vnc -localhost -display :0'
.IP
vncviewer -encodings 'copyrect tight zrle hextile' localhost:0
.PP
Also, use of a VNC password (-rfbauth or \fB-passwdfile)\fR is strongly recommend.
.PP
For additional info see: http://www.karlrunge.com/x11vnc/
and http://www.karlrunge.com/x11vnc/#faq
.PP
......@@ -45,9 +47,10 @@ line in it is treated as a single command line option. Disable with \fB-norc.\f
For each option name, the leading character "-" is not required. E.g. a
line that is either "forever" or "\fB-forever\fR" may be used and are equivalent.
Likewise "wait 100" or "\fB-wait\fR \fI100\fR" are acceptable and equivalent lines.
The "#" character comments out to the end of the line in the usual way.
Leading and trailing whitespace is trimmed off. Lines may be continued with
a "\\" as the last character of a line (it becomes a space character).
The "#" character comments out to the end of the line in the usual way
(backslash it for a literal). Leading and trailing whitespace is trimmed off.
Lines may be continued with a "\\" as the last character of a line (it
becomes a space character).
.PP
.SH OPTIONS
......@@ -151,19 +154,18 @@ On Solaris there is a problem with image "bleeding"
around transient popup menus (but not for the menu
itself): a workaround is to disable SaveUnders
by passing the "\fB-su\fR" argument to Xsun (in
/etc/dt/config/Xservers). Also note that the mouse
cursor shape is exactly correct in this mode.
/etc/dt/config/Xservers).
.IP
Use \fB-overlay\fR as a workaround for situations like these:
Some legacy applications require the default visual to
be 8bpp (8+24), or they will use 8bpp PseudoColor even
when the default visual is depth 24 TrueColor (24+8).
In these cases colors in some windows will be messed
up in x11vnc unless \fB-overlay\fR is used. Another use of
In these cases colors in some windows will be incorrect
in x11vnc unless \fB-overlay\fR is used. Another use of
\fB-overlay\fR is to enable showing the exact mouse cursor
shape (details below).
.IP
Under \fB-overlay,\fR performance will be somewhat degraded
Under \fB-overlay,\fR performance will be somewhat slower
due to the extra image transformations required.
For optimal performance do not use \fB-overlay,\fR but rather
configure the X server so that the default visual is
......@@ -201,7 +203,7 @@ automatically. Default: :cr
More esoteric options: for compatibility with vncviewers
the scaled width is adjusted to be a multiple of 4:
to disable this use ":n4". ":in" use interpolation
scheme even when shrinking, ":pad", pad scaled width
scheme even when shrinking, ":pad" pad scaled width
and height to be multiples of scaling denominator
(e.g. 3 for 2/3).
.PP
......@@ -238,7 +240,7 @@ as soon as the first client(s) disconnect. Same as \fB-many\fR
\fB-timeout\fR \fIn\fR
.IP
Exit unless a client connects within the first n seconds
of startup.
after startup.
.PP
\fB-inetd\fR
.IP
......@@ -246,7 +248,7 @@ Launched by
.IR inetd (1):
stdio instead of listening socket.
Note: if you are not redirecting stderr to a log file
(via shell 2> or \fB-o\fR option) you must also specify the \fB-q\fR
(via shell 2> or \fB-o\fR option) you MUST also specify the \fB-q\fR
option, otherwise the stderr goes to the viewer which
will cause it to abort. Specifying both \fB-inetd\fR and \fB-q\fR
and no \fB-o\fR will automatically close the stderr.
......@@ -271,10 +273,8 @@ as a file to periodically check for new hosts.
The first line is read and then the file is truncated.
Be careful for this usage mode if x11vnc is running as
root (e.g. via
.IR inetd (1)
or
.IR gdm (1)
).
, etc).
.PP
\fB-vncconnect,\fR \fB-novncconnect\fR
.IP
......@@ -322,7 +322,7 @@ vice versa) to avoid situations where no connections
Do not use gethostbyname() or gethostbyaddr() to look up
host names or IP numbers. Use this if name resolution
is incorrectly set up and leads to long pauses as name
lookup times out, etc.
lookups time out, etc.
.PP
\fB-input\fR \fIstring\fR
.IP
......@@ -337,7 +337,7 @@ E.g. "\fB-input\fR \fIM\fR" means normal users can only move
the mouse and "\fB-input\fR \fIKMB,M\fR" lets normal users do
anything and enables view-only users to move the mouse.
This option is ignored when a global \fB-viewonly\fR is in
effect (all input is discarded).
effect (all input is discarded in that case).
.PP
\fB-viewpasswd\fR \fIstring\fR
.IP
......@@ -357,7 +357,12 @@ for either field the string "__EMPTY__" may be used.
Note: \fB-passwdfile\fR is a simple plaintext passwd, see
also \fB-rfbauth\fR and \fB-storepasswd\fR below for obfuscated
VNC password files. Neither file should be readable
by others.
by untrusted users.
.PP
\fB-nopw\fR
.IP
Disable the big warning message when you use x11vnc
without some sort of password.
.PP
\fB-storepasswd\fR \fIpass\fR \fIfile\fR
.IP
......@@ -403,7 +408,7 @@ in RFB_CLIENT_COUNT. RFB_MODE will be "accept"
If \fIstring\fR is "popup" then a builtin popup window
is used. The popup will time out after 120 seconds,
use "popup:N" to modify the timeout to N seconds
(use 0 for no timeout)
(use 0 for no timeout).
.IP
If \fIstring\fR is "xmessage" then an
.IR xmessage (1)
......@@ -426,7 +431,9 @@ unexpected value). E.g. "no:*" is a good choice.
.IP
Note that x11vnc blocks while the external command
or popup is running (other clients may see no updates
during this period).
during this period). So a person sitting a the physical
display is needed to respond to an popup prompt. (use
a 2nd x11vnc if you lock yourself out).
.IP
More \fB-accept\fR tricks: use "popupmouse" to only allow
mouse clicks in the builtin popup to be recognized.
......@@ -576,11 +583,12 @@ each rectangle.
.IP
If your screen is composed of multiple monitors
glued together via XINERAMA, and that screen is
non-rectangular this option will try to guess the
not a rectangle this option will try to guess the
areas to black out (if your system has libXinerama).
.IP
In general on XINERAMA displays you may need to use the
\fB-xwarppointer\fR option if the mouse pointer misbehaves.
In general, we have noticed on XINERAMA displays you
may need to use the "\fB-xwarppointer\fR" option if the mouse
pointer misbehaves.
.PP
\fB-xtrap\fR
.IP
......@@ -665,7 +673,7 @@ Print program version and last modification date.
.PP
\fB-dbg\fR
.IP
instead of exiting after cleaning up, run a simple
Instead of exiting after cleaning up, run a simple
"debug crash shell" when fatal errors are trapped.
.PP
\fB-q\fR
......@@ -728,7 +736,7 @@ press Shift+Key but then release the Shift before
Key that could give rise to extra unwanted characters
(usually only between keyboards of different languages).
Only use this option if you observe problems with
some keystrokes. This option may be extended.
some keystrokes.
.PP
\fB-skip_dups,\fR \fB-noskip_dups\fR
.IP
......@@ -744,11 +752,11 @@ Default: \fB-noskip_dups\fR
.PP
\fB-add_keysyms,\fR \fB-noadd_keysyms\fR
.IP
If a Keysym is received from a VNC viewer and
that Keysym does not exist in the X server, then
add the Keysym to the X server's keyboard mapping.
Added Keysyms will be removed periodically and also
when x11vnc exits. Default: \fB-add_keysyms\fR
If a Keysym is received from a VNC viewer and that
Keysym does not exist in the X server, then add the
Keysym to the X server's keyboard mapping on an unused
key. Added Keysyms will be removed periodically and
also when x11vnc exits. Default: \fB-add_keysyms\fR
.PP
\fB-clear_mods\fR
.IP
......@@ -779,7 +787,7 @@ To map a key to a button click, use the fake Keysyms
Dead keys: "dead" (or silent, mute) keys are keys that
do not produce a character but must be followed by a 2nd
keystroke. This is often used for accenting characters,
e.g. to put "'" on top of "a" by pressing the dead
e.g. to put "`" on top of "a" by pressing the dead
key and then "a". Note that this interpretation
is not part of core X11, it is up to the toolkit or
application to decide how to react to the sequence.
......@@ -829,7 +837,7 @@ the real X display.
.IP
Use "\fB-norepeat\fR \fIN\fR" to set how many times norepeat will
be reset if something else (e.g. X session manager)
disables it. The default is 2. Use a negative value
undoes it. The default is 2. Use a negative value
for unlimited resets.
.PP
\fB-nofb\fR
......@@ -888,7 +896,7 @@ If the X display supports retrieving the cursor shape
information from the X server, then the default is
to use that mode. On Solaris this can be done with
the SUN_OVL extension using \fB-overlay\fR (see also the
\fB-overlay_nomouse\fR option). A similar overlay scheme
\fB-overlay_nocursor\fR option). A similar overlay scheme
is used on IRIX. Xorg (e.g. Linux) and recent Solaris
Xsun servers support the XFIXES extension to retrieve
the exact cursor shape from the X server. If XFIXES
......@@ -898,10 +906,10 @@ with \fB-nocursor,\fR and also some values of the "mode"
option below.
.IP
Note that under XFIXES cursors with transparency (alpha
channel) will not be exactly represented and one may
find Overlay preferable. See also the \fB-alphacut\fR and
\fB-alphafrac\fR options below as fudge factors to try to
improve the situation for cursors with transparency
channel) will usually not be exactly represented and one
may find Overlay preferable. See also the \fB-alphacut\fR
and \fB-alphafrac\fR options below as fudge factors to try
to improve the situation for cursors with transparency
for a given theme.
.IP
The "mode" string can be used to fine-tune the
......@@ -938,6 +946,7 @@ is not available, \fB-overlay\fR mode will be attempted.
.IP
Choose an alternate "arrow" cursor from a set of
some common ones. n can be 1 to 6. Default is: 1
Ignored when in XFIXES cursor-grabbing mode.
.PP
\fB-noxfixes\fR
.IP
......@@ -947,16 +956,13 @@ shape even if it is available.
\fB-alphacut\fR \fIn\fR
.IP
When using the XFIXES extension for the cursor shape,
cursors with transparency will not be displayed exactly
(but opaque ones will). This option sets n as a cutoff
for cursors that have transparency ("alpha channel"
with values ranging from 0 to 255) Any cursor pixel with
alpha value less than n becomes completely transparent.
Otherwise the pixel is completely opaque. Default 240
.IP
Note: the options \fB-alphacut,\fR \fB-alphafrac,\fR and \fB-alphafrac\fR
may be removed if a more accurate internal method for
handling cursor transparency is implemented.
cursors with transparency will not usually be displayed
exactly (but opaque ones will). This option sets n as
a cutoff for cursors that have transparency ("alpha
channel" with values ranging from 0 to 255) Any cursor
pixel with alpha value less than n becomes completely
transparent. Otherwise the pixel is completely opaque.
Default 240
.PP
\fB-alphafrac\fR \fIfraction\fR
.IP
......@@ -1043,7 +1049,7 @@ Do not update the display during mouse dragging events
(mouse button held down). Greatly improves response on
slow setups, but you lose all visual feedback for drags,
text selection, and some menu traversals. It overrides
any \fB-pointer_mode\fR setting
any \fB-pointer_mode\fR setting.
.PP
\fB-wireframe\fR \fI[str],\fR \fB-nowireframe\fR
.IP
......@@ -1098,8 +1104,9 @@ t2 is how long to wait for the window to start moving
or being resized (for some window managers this can be
rather long), t3 is how long to keep a wireframe moving
before repainting the window. t4 is the minimum time
between sending wireframe "animations". For a slow
link this might be a better choice: 0.25+0.6+6.0+0.15
between sending wireframe "animations". If a slow
link is detected, these values may be automatically
changed to something better for a slow link.
.PP
\fB-wirecopyrect\fR \fImode,\fR \fB-nowirecopyrect\fR
.IP
......@@ -1349,9 +1356,9 @@ it is intended for cases when the \fB-scrollcopyrect\fR or
but it can be used for any scenario. This option
periodically performs costly operations and so
interactive response may be reduced when it is on.
The 3 Alt_L's (the Left "Alt" key) taps in a row
described under \fB-scrollcopyrect\fR can be used instead to
manually request a screen repaint when it is needed.
You can use 3 Alt_L's (the Left "Alt" key) taps in a
row described under \fB-scrollcopyrect\fR instead to manually
request a screen repaint when it is needed.
.IP
\fIstring\fR is a comma separated list of one or more of
the following: "V=t", "C=t", and "X=t". In these
......@@ -1382,18 +1389,19 @@ monitor X server grabs.
.IP
Some of the use of the RECORD extension can leave a
tiny window for XGrabServer deadlock. This is only if
the whole-server grabbing application expects mouse
or keyboard input before releasing the grab. It is
usually a window manager that does this. x11vnc takes
care to avoid the the problem, but if caught x11vnc
will freeze. Without \fB-grab_buster,\fR the only solution
is to go the physical display and give it some input
to satisfy the grabbing app. Or manually kill and
restart the window manager. With \fB-grab_buster,\fR x11vnc
the whole-server grabbing application expects mouse or
keyboard input before releasing the grab. It is usually
a window manager that does this. x11vnc takes care to
avoid the the problem, but if caught x11vnc will freeze.
Without \fB-grab_buster,\fR the only solution is to go the
physical display and give it some input to satisfy the
grabbing app. Or manually kill and restart the window
manager if that is feasible. With \fB-grab_buster,\fR x11vnc
will fork a helper thread and if x11vnc appears to be
stuck in a grab after a period of time (20-30 sec)
then it will inject some user input: button clicks,
Escape, mouse motion, etc to try to break the grab.
stuck in a grab after a period of time (20-30 sec) then
it will inject some user input: button clicks, Escape,
mouse motion, etc to try to break the grab. If you
experience a lot of grab deadlock, please report a bug.
.PP
\fB-debug_grabs\fR
.IP
......@@ -1404,16 +1412,20 @@ XGrabServer() deadlock for \fB-scrollcopyrect__mode_.\fR
.IP
Various pointer motion update schemes. "\fB-pm\fR" is
an alias. The problem is pointer motion can cause
rapid changes on the screen: consider the rapid changes
when you drag a large window around. Neither x11vnc's
screen polling and vnc compression routines nor the
bandwidth to the vncviewers can keep up these rapid
screen changes: everything will bog down when dragging
or scrolling. So a scheme has to be used to "eat"
much of that pointer input before re-polling the screen
and sending out framebuffer updates. The mode number
\fIn\fR can be 0 to 4 and selects one of the schemes
desribed below.
rapid changes on the screen: consider the rapid
changes when you drag a large window around opaquely.
Neither x11vnc's screen polling and vnc compression
routines nor the bandwidth to the vncviewers can keep
up these rapid screen changes: everything will bog down
when dragging or scrolling. So a scheme has to be used
to "eat" much of that pointer input before re-polling
the screen and sending out framebuffer updates. The
mode number \fIn\fR can be 0 to 4 and selects one of
the schemes desribed below.
.IP
Note that the \fB-wireframe\fR and \fB-scrollcopyrect__mode_s\fR
complement \fB-pointer_mode\fR by detecting (and improving)
certain periods of "rapid screen change".
.IP
n=0: does the same as \fB-nodragging.\fR (all screen polling
is suspended if a mouse button is pressed.)
......@@ -1459,21 +1471,23 @@ Default: 10
.IP
x11vnc tries to estimate some speed parameters that
are used to optimize scheduling (e.g. \fB-pointer_mode\fR
4) and other things. Use the \fB-speeds\fR option to set
these manually. The triple \fIrd,bw,lat\fR corresponds
to video h/w read rate in MB/sec, network bandwidth to
clients in KB/sec, and network latency to clients in
milliseconds, respectively. If a value is left blank,
e.g. "\fB-speeds\fR \fI,100,15\fR", then the internal scheme is
used to estimate the empty value(s).
4, \fB-wireframe,\fR \fB-scrollcopyrect)\fR and other things.
Use the \fB-speeds\fR option to set these manually.
The triple \fIrd,bw,lat\fR corresponds to video h/w
read rate in MB/sec, network bandwidth to clients in
KB/sec, and network latency to clients in milliseconds,
respectively. If a value is left blank, e.g. "-speeds
,100,15", then the internal scheme is used to estimate
the empty value(s).
.IP
Typical PC video cards have read rates of 5-10 MB/sec.
If the framebuffer is in main memory instead of video
h/w (e.g. SunRay, shadowfb, Xvfb), the read rate may
be much faster. "x11perf \fB-getimage500"\fR can be used
to get a lower bound (remember to factor in the bytes
per pixel). It is up to you to estimate the network
bandwith and latency to clients. For the latency the
h/w (e.g. SunRay, shadowfb, dummy driver, Xvfb), the
read rate may be much faster. "x11perf \fB-getimage500"\fR
can be used to get a lower bound (remember to factor
in the bytes per pixel). It is up to you to estimate
the network bandwith and latency to clients. For the
latency the
.IR ping (1)
command can be used.
.IP
......@@ -1529,7 +1543,7 @@ with a long build running in it continously streaming
text output. By default x11vnc will try to detect this
(3 screen polls in a row each longer than 0.25 sec with
no user input), and sleep up to 1.5 secs to let things
"catch up". Use this option to disable the detection.
"catch up". Use this option to disable that detection.
.PP
\fB-readtimeout\fR \fIn\fR
.IP
......@@ -1597,7 +1611,8 @@ Broken pipe (SIGPIPE) handling. \fIstring\fR can be
"ignore" or "exit". For "ignore" libvncserver
will handle the abrupt loss of a client and continue,
for "exit" x11vnc will cleanup and exit at the 1st
broken connection. Default: "ignore".
broken connection. Default: "ignore". This option
is obsolete.
.PP
\fB-threads,\fR \fB-nothreads\fR
.IP
......@@ -1636,7 +1651,7 @@ changes, periodically copy all of X display fb into main
memory and examine that copy for changes. Under some
circumstances this will improve interactive response,
or at least make things look smoother, but in others
(many) it will make the response worse. If the video
(most!) it will make the response worse. If the video
h/w fb is such that reading small tiles is very slow
this mode could help. To keep the "framerate" up
the screen size x bpp cannot be too large. Note that
......@@ -1687,17 +1702,18 @@ and
.IR fbset (1)
for the first two examples)
.IP
All user input is discarded. Most of the X11 (screen,
keyboard, mouse) options do not make sense and many
will cause this mode to crash, so please think twice
before setting/changing them.
All user input is discarded by default (but see the
\fB-pipeinput\fR option). Most of the X11 (screen, keyboard,
mouse) options do not make sense and many will cause
this mode to crash, so please think twice before
setting/changing them.
.IP
If you don't want x11vnc to close the X DISPLAY in
rawfb mode, then capitalize the prefix, SHM:, MAP:,
FILE: Keeping the display open enables the default
remote-control channel, which could be useful. Also,
if you also specify \fB-noviewonly,\fR then the mouse and
keyboard input are still sent to the X display, this
keyboard input are STILL sent to the X display, this
usage should be very rare, i.e. doing something strange
with /dev/fb0.
.PP
......@@ -1725,9 +1741,10 @@ to use if it wants. Do 'env | grep X11VNC' for more.
Start up a simple tcl/tk gui based on the the remote
control options \fB-remote/-query\fR described below.
Requires the "wish" program to be installed on the
machine. "gui-opts" is not required: the default is
to start up both the gui and x11vnc with the gui showing
up on the X display in the environment variable DISPLAY.
machine. "gui-opts" is not required: the default
is to start up both the full gui and x11vnc with the
gui showing up on the X display in the environment
variable DISPLAY.
.IP
"gui-opts" can be a comma separated list of items.
Currently there are these types of items: 1) a gui
......@@ -1760,15 +1777,16 @@ display (e.g. localhost:10).
If you do not specify a gui X display in "gui-opts"
then the DISPLAY environment variable and \fB-display\fR
option are tried (in that order). Regarding the x11vnc
X display the gui will try to connect to, it first
tries \fB-display\fR and then DISPLAY. For example, "x11vnc
\fB-display\fR :0 \fB-gui\fR otherhost:0", will remote control an
x11vnc polling :0 and display the gui on otherhost:0
The "tray" mode below reverses this preference.
X display the gui will try to communication with, it
first tries \fB-display\fR and then DISPLAY. For example,
"x11vnc \fB-display\fR :0 \fB-gui\fR otherhost:0", will remote
control an x11vnc polling :0 and display the gui on
otherhost:0 The "tray/icon" mode below reverses this
preference, preferring to display on the x11vnc display.
.IP
4) When "tray" or "icon" is specified, the gui
presents itself as a small icon with behavior typical
of a "system tray" or "dock" applet. The color
of a "system tray" or "dock applet". The color
of the icon indicates status (connected clients) and
there is also a balloon status. Clicking on the icon
gives a menu from which properties, etc, can be set and
......@@ -1778,7 +1796,7 @@ fully functional, the gui mode should be "start"
.IP
For "icon" the gui just a small standalone window.
For "tray" it will attempt to embed itself in the
"system tray". If "=setpass" is appended then
"system tray" if possible. If "=setpass" is appended then
at startup the X11 user will be prompted to set the
VNC session password. If =<hexnumber> is appended
that icon will attempt to embed itself in the window
......@@ -1804,6 +1822,7 @@ with "iconfont=...". The following could be useful:
General examples of the \fB-gui\fR option: "x11vnc \fB-gui",\fR
"x11vnc \fB-gui\fR ez" "x11vnc \fB-gui\fR localhost:10",
"x11vnc \fB-gui\fR conn,host:0", "x11vnc \fB-gui\fR tray,ez"
"x11vnc \fB-gui\fR tray=setpass"
.IP
If you do not intend to start x11vnc from the gui
(i.e. just remote control an existing one), then the
......@@ -1836,10 +1855,6 @@ For example: 'x11vnc \fB-remote\fR stop' (which is the same as
\'x11vnc \fB-R\fR shared' will enable shared connections, and
\'x11vnc \fB-R\fR scale:3/4' will rescale the desktop.
.IP
Note: the more drastic the change induced by the \fB-remote\fR
command, the bigger the chance for bugs or crashes.
Please report reproducible bugs.
.IP
.IP
The following \fB-remote/-R\fR commands are supported:
.IP
......@@ -1989,7 +2004,7 @@ xinerama enable \fB-xinerama\fR mode. (if applicable)
.IP
noxinerama disable \fB-xinerama\fR mode.
.IP
xtrap enable \fB-xtrap\fR input mode.
xtrap enable \fB-xtrap\fR input mode(if applicable)
.IP
noxtrap disable \fB-xtrap\fR input mode.
.IP
......@@ -2143,7 +2158,7 @@ noxrecord disable all use of RECORD extension.
.IP
xrecord enable use of RECORD extension.
.IP
reset_record reset RECORD extension (if avail.).
reset_record reset RECORD extension (if avail.)
.IP
pointer_mode:n set \fB-pointer_mode\fR to n. same as "pm"
.IP
......@@ -2309,16 +2324,24 @@ in these cases the value returned is "N/A". To direct
a query straight to the VNC_CONNECT property or connect
file use "qry=..." instead of "cmd=..."
.IP
Here is the current list of "variables" that can
be supplied to the \fB-query\fR command. This includes the
"N/A" ones that return no useful info. For variables
names that do not correspond to an x11vnc option or
remote command, we hope the name makes it obvious what
the returned value corresponds to (hint: the ext_*
variables correspond to the presence of X extensions):
.IP
ans= stop quit exit shutdown ping blacken zero
refresh reset close disconnect id sid waitmapped
nowaitmapped clip flashcmap noflashcmap shiftcmap
truecolor notruecolor overlay nooverlay overlay_cursor
overlay_yescursor nooverlay_nocursor nooverlay_cursor
nooverlay_yescursor overlay_nocursor visual scale
scale_cursor viewonly noviewonly shared noshared forever
noforever once timeout deny lock nodeny unlock connect
allowonce allow localhost nolocalhost listen lookup
nolookup accept popup gone shm noshm flipbyteorder
scale_cursor viewonly noviewonly shared noshared
forever noforever once timeout deny lock nodeny unlock
connect allowonce allow localhost nolocalhost listen
lookup nolookup accept gone shm noshm flipbyteorder
noflipbyteorder onetile noonetile solid_color solid
nosolid blackout xinerama noxinerama xtrap noxtrap
xrandr noxrandr xrandr_mode padgeom quiet q noquiet
......@@ -2352,9 +2375,9 @@ debug_wireframe debug_scroll nodebug_scroll debug_scroll
debug_tiles dbt nodebug_tiles nodbt debug_tiles
debug_grabs nodebug_grabs dbg nodbg noremote
.IP
aro= display vncdisplay desktopname guess_desktop
http_url auth users rootshift clipshift scale_str
scaled_x scaled_y scale_numer scale_denom
aro= noop display vncdisplay desktopname guess_desktop
http_url auth xauth users rootshift clipshift
scale_str scaled_x scaled_y scale_numer scale_denom
scale_fac scaling_blend scaling_nomult4 scaling_pad
scaling_interpolate inetd privremote unsafe safer nocmds
passwdfile using_shm logfile o flag rc norc h help V
......@@ -2364,7 +2387,13 @@ ext_xtrap ext_xrecord ext_xkb ext_xshm ext_xinerama
ext_overlay ext_xfixes ext_xdamage ext_xrandr rootwin
num_buttons button_mask mouse_x mouse_y bpp depth
indexed_color dpy_x dpy_y wdpy_x wdpy_y off_x off_y
cdpy_x cdpy_y coff_x coff_y rfbauth passwd
cdpy_x cdpy_y coff_x coff_y rfbauth passwd viewpasswd
.PP
\fB-QD\fR \fIvariable\fR
.IP
Just like \fB-query\fR variable, but returns the default
value for that parameter (no running x11vnc server
is consulted)
.PP
\fB-sync\fR
.IP
......@@ -2374,7 +2403,7 @@ exits. Use \fB-sync\fR to have the program wait for an
acknowledgement from the x11vnc server that command was
processed (somehow). On the other hand \fB-query\fR requests
are always processed synchronously because they have
to wait for the result.
to wait for the answer.
.IP
Also note that if both \fB-remote\fR and \fB-query\fR requests are
supplied on the command line, the \fB-remote\fR is processed
......@@ -2419,7 +2448,7 @@ rawfb:setup:<cmd>) because they are associated with
running external programs. If you specify \fB-unsafe,\fR then
these remote-control commands are allowed. Note that
you can still specify these parameters on the command
line, they just cannot be changed via remote-control.
line, they just cannot be invoked via remote-control.
.PP
\fB-safer\fR
.IP
......
......@@ -166,6 +166,7 @@
*
* -DHARDWIRE_PASSWD=... hardwired passwords, quoting necessary.
* -DHARDWIRE_VIEWPASSWD=...
* -DNOPW=1 make -nopw the default (skip warning)
*
* -DWIREFRAME=0 to have -nowireframe as the default.
* -DWIREFRAME_COPYRECT=0 to have -nowirecopyrect as the default.
......@@ -194,6 +195,10 @@
#define REMOTE_CONTROL 1
#endif
#ifndef NOPW
#define NOPW 0
#endif
/*
* Beginning of support for small binary footprint build for embedded
* systems, PDA's etc. It currently just cuts out the low-hanging
......@@ -382,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-09";
char lastmod[] = "0.7.2 lastmod: 2005-07-10";
int hack_val = 0;
/* X display info */
......@@ -814,6 +819,7 @@ int deny_all = 0; /* global locking of new clients */
#define REMOTE_DEFAULT 1
#endif
int accept_remote_cmds = REMOTE_DEFAULT; /* -noremote */
int query_default = 0;
int safe_remote_only = 1; /* -unsafe */
int priv_remote = 0; /* -privremote */
int more_safe = 0; /* -safer */
......@@ -907,7 +913,7 @@ Display *gdpy_ctrl = NULL;
int xserver_grabbed = 0;
/* XXX CHECK BEFORE RELEASE */
int grab_buster = 1;
int grab_buster = 0;
int grab_buster_delay = 20;
int sync_tod_delay = 3;
pid_t grab_buster_pid = 0;
......@@ -5110,7 +5116,7 @@ char *crash_stack_command1 = NULL;
char *crash_stack_command2 = NULL;
char *crash_debug_command = NULL;
/* XXX CHECK BEFORE RELEASE */
int crash_debug = 1;
int crash_debug = 0;
void initialize_crash_handler(void) {
int pid = program_pid;
......@@ -6750,7 +6756,7 @@ void read_vnc_connect_prop(void) {
;
} else if (strstr(vnc_connect_str, "cmd=") &&
strstr(vnc_connect_str, "passwd")) {
rfbLog("read VNC_CONNECT\n");
rfbLog("read VNC_CONNECT: *\n");
} else if (strlen(vnc_connect_str) > 38) {
char trim[100];
trim[0] = '\0';
......@@ -7382,7 +7388,6 @@ int add_keysym(KeySym keysym) {
static int first = 1;
KeySym *keymap;
if (first) {
for (n=0; n < 0x100; n++) {
added_keysyms[n] = NoSymbol;
......@@ -12108,6 +12113,9 @@ void check_keycode_state(void) {
if (! client_count) {
return;
}
if (raw_fb && ! dpy) return; /* raw_fb hack */
/*
* periodically update our model of the keycode_state[]
* by correlating with the Xserver. wait for a pause in
......@@ -12626,10 +12634,16 @@ int send_remote_cmd(char *cmd, int query, int wait) {
return 0;
}
int do_remote_query(char *remote_cmd, char *query_cmd, int remote_sync) {
int do_remote_query(char *remote_cmd, char *query_cmd, int remote_sync,
int qdefault) {
char *rcmd = NULL, *qcmd = NULL;
int rc = 1;
if (qdefault && !query_cmd) {
query_cmd = remote_cmd;
remote_cmd = NULL;
}
if (remote_cmd) {
rcmd = (char *) malloc(strlen(remote_cmd) + 5);
strcpy(rcmd, "cmd=");
......@@ -12640,6 +12654,16 @@ int do_remote_query(char *remote_cmd, char *query_cmd, int remote_sync) {
strcpy(qcmd, "qry=");
strcat(qcmd, query_cmd);
}
if (qdefault) {
char *res;
if (!qcmd) {
return 1;
}
res = process_remote_cmd(qcmd, 1);
fprintf(stdout, "%s\n", res);
fflush(stdout);
return 0;
}
if (rcmd && qcmd) {
rc = send_remote_cmd(rcmd, 0, 1);
......@@ -13067,12 +13091,12 @@ char *process_remote_cmd(char *cmd, int stringonly) {
int query = 0;
static char *prev_cursors_mode = NULL;
if (! accept_remote_cmds) {
if (!query_default && !accept_remote_cmds) {
rfbLog("remote commands disabled: %s\n", cmd);
return NULL;
}
if (priv_remote) {
if (!query_default && priv_remote) {
if (! remote_control_access_ok()) {
rfbLog("** Disabling remote commands in -privremote "
"mode.\n");
......@@ -13846,9 +13870,9 @@ char *process_remote_cmd(char *cmd, int stringonly) {
}
p += strlen("accept:");
if (safe_remote_only) {
if (icon_mode && !strcmp(p, "")) {
if (icon_mode && !strcmp(p, "")) { /* skip-cmd-list */
;
} else if (icon_mode && !strcmp(p, "popup")) {
} else if (icon_mode && !strcmp(p, "popup")) { /* skip-cmd-list */
;
} else {
rfbLog("unsafe: %s\n", p);
......@@ -15310,8 +15334,12 @@ char *process_remote_cmd(char *cmd, int stringonly) {
int d;
COLON_CHECK("deferupdate:")
if (query) {
snprintf(buf, bufn, "ans=%s%s%d", p, co,
screen->deferUpdateTime);
if (!screen) {
d = defer_update;
} else {
d = screen->deferUpdateTime;
}
snprintf(buf, bufn, "ans=%s%s%d", p, co, d);
goto qry;
}
p += strlen("deferupdate:");
......@@ -15325,8 +15353,12 @@ char *process_remote_cmd(char *cmd, int stringonly) {
int d;
COLON_CHECK("defer:")
if (query) {
snprintf(buf, bufn, "ans=%s%s%d", p, co,
screen->deferUpdateTime);
if (!screen) {
d = defer_update;
} else {
d = screen->deferUpdateTime;
}
snprintf(buf, bufn, "ans=%s%s%d", p, co, d);
goto qry;
}
p += strlen("defer:");
......@@ -15352,14 +15384,14 @@ char *process_remote_cmd(char *cmd, int stringonly) {
} else if (!strcmp(p, "wait_bog")) {
if (query) {
snprintf(buf, bufn, "ans=%s%s%d", p, co, wait_bog);
snprintf(buf, bufn, "ans=%s:%d", p, wait_bog);
goto qry;
}
wait_bog = 1;
rfbLog("remote_cmd: setting wait_bog to %d\n", wait_bog);
} else if (!strcmp(p, "nowait_bog")) {
if (query) {
snprintf(buf, bufn, "ans=%s%s%d", p, co, !wait_bog);
snprintf(buf, bufn, "ans=%s:%d", p, !wait_bog);
goto qry;
}
wait_bog = 0;
......@@ -15539,8 +15571,12 @@ char *process_remote_cmd(char *cmd, int stringonly) {
int f;
COLON_CHECK("progressive:")
if (query) {
snprintf(buf, bufn, "ans=%s%s%d", p, co,
screen->progressiveSliceHeight);
if (!screen) {
f = 0;
} else {
f = screen->progressiveSliceHeight;
}
snprintf(buf, bufn, "ans=%s%s%d", p, co, f);
goto qry;
}
p += strlen("progressive:");
......@@ -15551,10 +15587,10 @@ char *process_remote_cmd(char *cmd, int stringonly) {
screen->progressiveSliceHeight = f;
} else if (strstr(p, "rfbport") == p) {
int rp, orig = screen->port;
int rp, orig = screen ? screen->port : 5900;
COLON_CHECK("rfbport:")
if (query) {
snprintf(buf, bufn, "ans=%s%s%d", p, co, screen->port);
snprintf(buf, bufn, "ans=%s%s%d", p, co, orig);
goto qry;
}
p += strlen("rfbport:");
......@@ -15563,8 +15599,8 @@ char *process_remote_cmd(char *cmd, int stringonly) {
} else if (!strcmp(p, "http")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p,
(screen->httpListenSock > -1));
int ls = screen ? screen->httpListenSock : -1;
snprintf(buf, bufn, "ans=%s:%d", p, (ls > -1));
goto qry;
}
if (screen->httpListenSock > -1) {
......@@ -15577,8 +15613,8 @@ char *process_remote_cmd(char *cmd, int stringonly) {
}
} else if (!strcmp(p, "nohttp")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p,
!(screen->httpListenSock > -1));
int ls = screen ? screen->httpListenSock : -1;
snprintf(buf, bufn, "ans=%s:%d", p, !(ls > -1));
goto qry;
}
if (screen->httpListenSock < 0) {
......@@ -15591,11 +15627,10 @@ char *process_remote_cmd(char *cmd, int stringonly) {
}
} else if (strstr(p, "httpport") == p) {
int hp, orig = screen->httpPort;
int hp, orig = screen ? screen->httpPort : 0;
COLON_CHECK("httpport:")
if (query) {
snprintf(buf, bufn, "ans=%s%s%d", p, co,
screen->httpPort);
snprintf(buf, bufn, "ans=%s%s%d", p, co, orig);
goto qry;
}
p += strlen("httpport:");
......@@ -15625,16 +15660,16 @@ char *process_remote_cmd(char *cmd, int stringonly) {
} else if (!strcmp(p, "enablehttpproxy")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p,
screen->httpEnableProxyConnect != 0);
int ht = screen ? screen->httpEnableProxyConnect : 0;
snprintf(buf, bufn, "ans=%s:%d", p, ht != 0);
goto qry;
}
rfbLog("turning on enablehttpproxy.\n");
screen->httpEnableProxyConnect = 1;
} else if (!strcmp(p, "noenablehttpproxy")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p,
screen->httpEnableProxyConnect == 0);
int ht = screen ? screen->httpEnableProxyConnect : 0;
snprintf(buf, bufn, "ans=%s:%d", p, ht == 0);
goto qry;
}
rfbLog("turning off enablehttpproxy.\n");
......@@ -15642,16 +15677,16 @@ char *process_remote_cmd(char *cmd, int stringonly) {
} else if (!strcmp(p, "alwaysshared")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p,
screen->alwaysShared != 0);
int t = screen ? screen->alwaysShared : 0;
snprintf(buf, bufn, "ans=%s:%d", p, t != 0);
goto qry;
}
rfbLog("turning on alwaysshared.\n");
screen->alwaysShared = 1;
} else if (!strcmp(p, "noalwaysshared")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p,
screen->alwaysShared == 0);
int t = screen ? screen->alwaysShared : 0;
snprintf(buf, bufn, "ans=%s:%d", p, t == 0);
goto qry;
}
rfbLog("turning off alwaysshared.\n");
......@@ -15659,16 +15694,16 @@ char *process_remote_cmd(char *cmd, int stringonly) {
} else if (!strcmp(p, "nevershared")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p,
screen->neverShared != 0);
int t = screen ? screen->neverShared : 1;
snprintf(buf, bufn, "ans=%s:%d", p, t != 0);
goto qry;
}
rfbLog("turning on nevershared.\n");
screen->neverShared = 1;
} else if (!strcmp(p, "noalwaysshared")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p,
screen->neverShared == 0);
int t = screen ? screen->neverShared : 1;
snprintf(buf, bufn, "ans=%s:%d", p, t == 0);
goto qry;
}
rfbLog("turning off nevershared.\n");
......@@ -15676,16 +15711,16 @@ char *process_remote_cmd(char *cmd, int stringonly) {
} else if (!strcmp(p, "dontdisconnect")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p,
screen->dontDisconnect != 0);
int t = screen ? screen->dontDisconnect : 1;
snprintf(buf, bufn, "ans=%s:%d", p, t != 0);
goto qry;
}
rfbLog("turning on dontdisconnect.\n");
screen->dontDisconnect = 1;
} else if (!strcmp(p, "nodontdisconnect")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p,
screen->dontDisconnect == 0);
int t = screen ? screen->dontDisconnect : 1;
snprintf(buf, bufn, "ans=%s:%d", p, t == 0);
goto qry;
}
rfbLog("turning off dontdisconnect.\n");
......@@ -15976,8 +16011,7 @@ char *process_remote_cmd(char *cmd, int stringonly) {
snprintf(buf, bufn, "aro=%s:rawfb:%p",
p, raw_fb_addr);
} else if (! dpy) {
snprintf(buf, bufn, "aro=%s:%s", p,
"no-display");
snprintf(buf, bufn, "aro=%s:", p);
} else {
char *d;
d = DisplayString(dpy);
......@@ -15999,14 +16033,16 @@ char *process_remote_cmd(char *cmd, int stringonly) {
snprintf(buf, bufn, "aro=%s:%s", p,
NONUL(guess_desktop()));
} else if (!strcmp(p, "http_url")) {
if (screen->httpListenSock > -1) {
if (!screen) {
snprintf(buf, bufn, "aro=%s:", p);
} else if (screen->httpListenSock > -1) {
snprintf(buf, bufn, "aro=%s:http://%s:%d", p,
NONUL(screen->thisHost), screen->httpPort);
} else {
snprintf(buf, bufn, "aro=%s:%s", p,
"http_not_active");
}
} else if (!strcmp(p, "auth")) {
} else if (!strcmp(p, "auth") || !strcmp(p, "xauth")) {
snprintf(buf, bufn, "aro=%s:%s", p, NONUL(auth_file));
} else if (!strcmp(p, "users")) {
snprintf(buf, bufn, "aro=%s:%s", p, NONUL(users_list));
......@@ -16145,6 +16181,8 @@ char *process_remote_cmd(char *cmd, int stringonly) {
NOTAPPRO
} else if (!strcmp(p, "passwd")) {
NOTAPPRO
} else if (!strcmp(p, "viewpasswd")) {
NOTAPPRO
} else {
NOTAPP
}
......@@ -20751,6 +20789,10 @@ char *guess_desktop() {
return "root";
}
if (! dpy) {
return "";
}
prop = XInternAtom(dpy, "XFCE_DESKTOP_WINDOW", True);
if (prop != None) return "xfce";
......@@ -23923,7 +23965,7 @@ char gui_code[] = "";
#endif
void run_gui(char *gui_xdisplay, int connect_to_x11vnc, int simple_gui,
pid_t parent) {
pid_t parent, char *gui_opts) {
char *x11vnc_xdisplay = NULL;
char extra_path[] = ":/usr/local/bin:/usr/bin/X11:/usr/sfw/bin"
":/usr/X11R6/bin:/usr/openwin/bin:/usr/dt/bin";
......@@ -24067,6 +24109,9 @@ void run_gui(char *gui_xdisplay, int connect_to_x11vnc, int simple_gui,
if (simple_gui) {
set_env("X11VNC_SIMPLE_GUI", "1");
}
if (gui_opts) {
set_env("X11VNC_GUI_PARAMS", gui_opts);
}
if (gui_geometry) {
set_env("X11VNC_GUI_GEOM", gui_geometry);
}
......@@ -24159,7 +24204,7 @@ void run_gui(char *gui_xdisplay, int connect_to_x11vnc, int simple_gui,
exit(0);
}
void do_gui(char *opts) {
void do_gui(char *opts, int sleep) {
char *s, *p;
char *old_xauth = NULL;
char *gui_xdisplay = NULL;
......@@ -24327,8 +24372,11 @@ void do_gui(char *opts) {
perror("fork");
clean_up_exit(1);
} else {
if (sleep > 0) {
usleep(sleep * 1000 * 1000);
}
run_gui(gui_xdisplay, connect_to_x11vnc, simple_gui,
parent);
parent, opts);
exit(1);
}
#else
......@@ -24338,7 +24386,7 @@ void do_gui(char *opts) {
#endif
}
if (!start_x11vnc) {
run_gui(gui_xdisplay, connect_to_x11vnc, simple_gui, 0);
run_gui(gui_xdisplay, connect_to_x11vnc, simple_gui, 0, opts);
exit(1);
}
if (old_xauth) {
......@@ -28756,6 +28804,10 @@ int get_rate(int which) {
double slowest = -1.0, rate;
static double save_rate = 1000 * NETRATE0;
if (!screen) {
return 0;
}
iter = rfbGetClientIterator(screen);
while( (cl = rfbClientIteratorNext(iter)) ) {
ClientData *cd = (ClientData *) cl->clientData;
......@@ -28811,6 +28863,10 @@ int get_latency(void) {
static double save_lat = ((double) LATENCY0)/1000.0;
int count = 0;
if (!screen) {
return 0;
}
iter = rfbGetClientIterator(screen);
while( (cl = rfbClientIteratorNext(iter)) ) {
ClientData *cd = (ClientData *) cl->clientData;
......@@ -29024,6 +29080,10 @@ void measure_send_rates(int init) {
nclients = 0;
if (!screen) {
return;
}
iter = rfbGetClientIterator(screen);
while( (cl = rfbClientIteratorNext(iter)) ) {
int defer, i, cbs, rbs;
......@@ -29715,6 +29775,8 @@ static void print_help(int mode) {
"\n"
" vncviewer -encodings 'copyrect tight zrle hextile' localhost:0\n"
"\n"
"Also, use of a VNC password (-rfbauth or -passwdfile) is strongly recommend.\n"
"\n"
"For additional info see: http://www.karlrunge.com/x11vnc/\n"
" and http://www.karlrunge.com/x11vnc/#faq\n"
"\n"
......@@ -29724,9 +29786,10 @@ static void print_help(int mode) {
"For each option name, the leading character \"-\" is not required. E.g. a\n"
"line that is either \"forever\" or \"-forever\" may be used and are equivalent.\n"
"Likewise \"wait 100\" or \"-wait 100\" are acceptable and equivalent lines.\n"
"The \"#\" character comments out to the end of the line in the usual way.\n"
"Leading and trailing whitespace is trimmed off. Lines may be continued with\n"
"a \"\\\" as the last character of a line (it becomes a space character).\n"
"The \"#\" character comments out to the end of the line in the usual way\n"
"(backslash it for a literal). Leading and trailing whitespace is trimmed off.\n"
"Lines may be continued with a \"\\\" as the last character of a line (it\n"
"becomes a space character).\n"
"\n"
"Options:\n"
"\n"
......@@ -29793,19 +29856,18 @@ static void print_help(int mode) {
" around transient popup menus (but not for the menu\n"
" itself): a workaround is to disable SaveUnders\n"
" by passing the \"-su\" argument to Xsun (in\n"
" /etc/dt/config/Xservers). Also note that the mouse\n"
" cursor shape is exactly correct in this mode.\n"
" /etc/dt/config/Xservers).\n"
"\n"
" Use -overlay as a workaround for situations like these:\n"
" Some legacy applications require the default visual to\n"
" be 8bpp (8+24), or they will use 8bpp PseudoColor even\n"
" when the default visual is depth 24 TrueColor (24+8).\n"
" In these cases colors in some windows will be messed\n"
" up in x11vnc unless -overlay is used. Another use of\n"
" In these cases colors in some windows will be incorrect\n"
" in x11vnc unless -overlay is used. Another use of\n"
" -overlay is to enable showing the exact mouse cursor\n"
" shape (details below).\n"
"\n"
" Under -overlay, performance will be somewhat degraded\n"
" Under -overlay, performance will be somewhat slower\n"
" due to the extra image transformations required.\n"
" For optimal performance do not use -overlay, but rather\n"
" configure the X server so that the default visual is\n"
......@@ -29838,7 +29900,7 @@ static void print_help(int mode) {
" More esoteric options: for compatibility with vncviewers\n"
" the scaled width is adjusted to be a multiple of 4:\n"
" to disable this use \":n4\". \":in\" use interpolation\n"
" scheme even when shrinking, \":pad\", pad scaled width\n"
" scheme even when shrinking, \":pad\" pad scaled width\n"
" and height to be multiples of scaling denominator\n"
" (e.g. 3 for 2/3).\n"
"\n"
......@@ -29859,10 +29921,10 @@ static void print_help(int mode) {
"-forever Keep listening for more connections rather than exiting\n"
" as soon as the first client(s) disconnect. Same as -many\n"
"-timeout n Exit unless a client connects within the first n seconds\n"
" of startup.\n"
" after startup.\n"
"-inetd Launched by inetd(1): stdio instead of listening socket.\n"
" Note: if you are not redirecting stderr to a log file\n"
" (via shell 2> or -o option) you must also specify the -q\n"
" (via shell 2> or -o option) you MUST also specify the -q\n"
" option, otherwise the stderr goes to the viewer which\n"
" will cause it to abort. Specifying both -inetd and -q\n"
" and no -o will automatically close the stderr.\n"
......@@ -29880,7 +29942,7 @@ static void print_help(int mode) {
" as a file to periodically check for new hosts.\n"
" The first line is read and then the file is truncated.\n"
" Be careful for this usage mode if x11vnc is running as\n"
" root (e.g. via inetd(1) or gdm(1)).\n"
" root (e.g. via gdm(1), etc).\n"
"-vncconnect Monitor the VNC_CONNECT X property set by the standard\n"
"-novncconnect VNC program vncconnect(1). When the property is\n"
" set to \"host\" or \"host:port\" establish a reverse\n"
......@@ -29914,7 +29976,7 @@ static void print_help(int mode) {
"-nolookup Do not use gethostbyname() or gethostbyaddr() to look up\n"
" host names or IP numbers. Use this if name resolution\n"
" is incorrectly set up and leads to long pauses as name\n"
" lookup times out, etc.\n"
" lookups time out, etc.\n"
"\n"
"-input string Fine tuning of allowed user input. If \"string\" does\n"
" not contain a comma \",\" the tuning applies only to\n"
......@@ -29927,7 +29989,7 @@ static void print_help(int mode) {
" the mouse and \"-input KMB,M\" lets normal users do\n"
" anything and enables view-only users to move the mouse.\n"
" This option is ignored when a global -viewonly is in\n"
" effect (all input is discarded).\n"
" effect (all input is discarded in that case).\n"
"-viewpasswd string Supply a 2nd password for view-only logins. The -passwd\n"
" (full-access) password must also be supplied.\n"
"-passwdfile filename Specify libvncserver -passwd via the first line of the\n"
......@@ -29939,7 +30001,9 @@ static void print_help(int mode) {
" Note: -passwdfile is a simple plaintext passwd, see\n"
" also -rfbauth and -storepasswd below for obfuscated\n"
" VNC password files. Neither file should be readable\n"
" by others.\n"
" by untrusted users.\n"
"-nopw Disable the big warning message when you use x11vnc\n"
" without some sort of password.\n"
"-storepasswd pass file Store password \"pass\" as the VNC password in the\n"
" file \"file\". Once the password is stored the\n"
" program exits. Use the password via \"-rfbauth file\"\n"
......@@ -29972,7 +30036,7 @@ static void print_help(int mode) {
" If \"string\" is \"popup\" then a builtin popup window\n"
" is used. The popup will time out after 120 seconds,\n"
" use \"popup:N\" to modify the timeout to N seconds\n"
" (use 0 for no timeout)\n"
" (use 0 for no timeout).\n"
"\n"
" If \"string\" is \"xmessage\" then an xmessage(1)\n"
" invocation is used for the command. xmessage must be\n"
......@@ -29994,7 +30058,9 @@ static void print_help(int mode) {
"\n"
" Note that x11vnc blocks while the external command\n"
" or popup is running (other clients may see no updates\n"
" during this period).\n"
" during this period). So a person sitting a the physical\n"
" display is needed to respond to an popup prompt. (use\n"
" a 2nd x11vnc if you lock yourself out).\n"
"\n"
" More -accept tricks: use \"popupmouse\" to only allow\n"
" mouse clicks in the builtin popup to be recognized.\n"
......@@ -30111,11 +30177,12 @@ static void print_help(int mode) {
" each rectangle.\n"
"-xinerama If your screen is composed of multiple monitors\n"
" glued together via XINERAMA, and that screen is\n"
" non-rectangular this option will try to guess the\n"
" not a rectangle this option will try to guess the\n"
" areas to black out (if your system has libXinerama).\n"
"\n"
" In general on XINERAMA displays you may need to use the\n"
" -xwarppointer option if the mouse pointer misbehaves.\n"
" In general, we have noticed on XINERAMA displays you\n"
" may need to use the \"-xwarppointer\" option if the mouse\n"
" pointer misbehaves.\n"
"\n"
"-xtrap Use the DEC-XTRAP extension for keystroke and mouse\n"
" input insertion. For use on legacy systems, e.g. X11R5,\n"
......@@ -30174,7 +30241,7 @@ static void print_help(int mode) {
"-?, -opts Only list the x11vnc options.\n"
"-V, -version Print program version and last modification date.\n"
"\n"
"-dbg instead of exiting after cleaning up, run a simple\n"
"-dbg Instead of exiting after cleaning up, run a simple\n"
" \"debug crash shell\" when fatal errors are trapped.\n"
"\n"
"-q Be quiet by printing less informational output to\n"
......@@ -30195,10 +30262,6 @@ static void print_help(int mode) {
" identical keyboards). Also useful in resolving cases\n"
" where a Keysym is bound to multiple keys (e.g. \"<\" + \">\"\n"
" and \",\" + \"<\" keys). Default: %s\n"
#if 0
"-isolevel3 When in modtweak mode, always send ISO_Level3_Shift to\n"
" the X server instead of Mode_switch (AltGr).\n"
#endif
"-xkb When in modtweak mode, use the XKEYBOARD extension (if\n"
"-noxkb the X display supports it) to do the modifier tweaking.\n"
" This is powerful and should be tried if there are still\n"
......@@ -30221,7 +30284,7 @@ static void print_help(int mode) {
" Key that could give rise to extra unwanted characters\n"
" (usually only between keyboards of different languages).\n"
" Only use this option if you observe problems with\n"
" some keystrokes. This option may be extended.\n"
" some keystrokes.\n"
"-skip_dups Some VNC viewers send impossible repeated key events,\n"
"-noskip_dups e.g. key-down, key-down, key-up, key-up all for the same\n"
" key, or 20 downs in a row for the same modifier key!\n"
......@@ -30231,11 +30294,11 @@ static void print_help(int mode) {
" up's and so you should not set this option for\n"
" these viewers (symptom: some keys do not autorepeat)\n"
" Default: %s\n"
"-add_keysyms If a Keysym is received from a VNC viewer and\n"
"-noadd_keysyms that Keysym does not exist in the X server, then\n"
" add the Keysym to the X server's keyboard mapping.\n"
" Added Keysyms will be removed periodically and also\n"
" when x11vnc exits. Default: %s\n"
"-add_keysyms If a Keysym is received from a VNC viewer and that\n"
"-noadd_keysyms Keysym does not exist in the X server, then add the\n"
" Keysym to the X server's keyboard mapping on an unused\n"
" key. Added Keysyms will be removed periodically and\n"
" also when x11vnc exits. Default: %s\n"
#if 0
"-xkbcompat Ignore the XKEYBOARD extension. Use as a workaround for\n"
" some keyboard mapping problems. E.g. if you are using\n"
......@@ -30264,7 +30327,7 @@ static void print_help(int mode) {
" Dead keys: \"dead\" (or silent, mute) keys are keys that\n"
" do not produce a character but must be followed by a 2nd\n"
" keystroke. This is often used for accenting characters,\n"
" e.g. to put \"'\" on top of \"a\" by pressing the dead\n"
" e.g. to put \"`\" on top of \"a\" by pressing the dead\n"
" key and then \"a\". Note that this interpretation\n"
" is not part of core X11, it is up to the toolkit or\n"
" application to decide how to react to the sequence.\n"
......@@ -30310,7 +30373,7 @@ static void print_help(int mode) {
"\n"
" Use \"-norepeat N\" to set how many times norepeat will\n"
" be reset if something else (e.g. X session manager)\n"
" disables it. The default is 2. Use a negative value\n"
" undoes it. The default is 2. Use a negative value\n"
" for unlimited resets.\n"
"\n"
"-nofb Ignore video framebuffer: only process keyboard and\n"
......@@ -30353,7 +30416,7 @@ static void print_help(int mode) {
" information from the X server, then the default is\n"
" to use that mode. On Solaris this can be done with\n"
" the SUN_OVL extension using -overlay (see also the\n"
" -overlay_nomouse option). A similar overlay scheme\n"
" -overlay_nocursor option). A similar overlay scheme\n"
" is used on IRIX. Xorg (e.g. Linux) and recent Solaris\n"
" Xsun servers support the XFIXES extension to retrieve\n"
" the exact cursor shape from the X server. If XFIXES\n"
......@@ -30363,10 +30426,10 @@ static void print_help(int mode) {
" option below.\n"
" \n"
" Note that under XFIXES cursors with transparency (alpha\n"
" channel) will not be exactly represented and one may\n"
" find Overlay preferable. See also the -alphacut and\n"
" -alphafrac options below as fudge factors to try to\n"
" improve the situation for cursors with transparency\n"
" channel) will usually not be exactly represented and one\n"
" may find Overlay preferable. See also the -alphacut\n"
" and -alphafrac options below as fudge factors to try\n"
" to improve the situation for cursors with transparency\n"
" for a given theme.\n"
"\n"
" The \"mode\" string can be used to fine-tune the\n"
......@@ -30401,20 +30464,19 @@ static void print_help(int mode) {
"\n"
"-arrow n Choose an alternate \"arrow\" cursor from a set of\n"
" some common ones. n can be 1 to %d. Default is: %d\n"
" Ignored when in XFIXES cursor-grabbing mode.\n"
"\n"
"-noxfixes Do not use the XFIXES extension to draw the exact cursor\n"
" shape even if it is available.\n"
"-alphacut n When using the XFIXES extension for the cursor shape,\n"
" cursors with transparency will not be displayed exactly\n"
" (but opaque ones will). This option sets n as a cutoff\n"
" for cursors that have transparency (\"alpha channel\"\n"
" with values ranging from 0 to 255) Any cursor pixel with\n"
" alpha value less than n becomes completely transparent.\n"
" Otherwise the pixel is completely opaque. Default %d\n"
" cursors with transparency will not usually be displayed\n"
" exactly (but opaque ones will). This option sets n as\n"
" a cutoff for cursors that have transparency (\"alpha\n"
" channel\" with values ranging from 0 to 255) Any cursor\n"
" pixel with alpha value less than n becomes completely\n"
" transparent. Otherwise the pixel is completely opaque.\n"
" Default %d\n"
" \n"
" Note: the options -alphacut, -alphafrac, and -alphafrac\n"
" may be removed if a more accurate internal method for\n"
" handling cursor transparency is implemented.\n"
"-alphafrac fraction With the threshold in -alphacut some cursors will become\n"
" almost completely transparent because their alpha values\n"
" are not high enough. For those cursors adjust the\n"
......@@ -30474,7 +30536,7 @@ static void print_help(int mode) {
" (mouse button held down). Greatly improves response on\n"
" slow setups, but you lose all visual feedback for drags,\n"
" text selection, and some menu traversals. It overrides\n"
" any -pointer_mode setting\n"
" any -pointer_mode setting.\n"
"\n"
"-wireframe [str] Try to detect window moves or resizes when a mouse\n"
"-nowireframe button is held down and show a wireframe instead of\n"
......@@ -30527,8 +30589,9 @@ static void print_help(int mode) {
" or being resized (for some window managers this can be\n"
" rather long), t3 is how long to keep a wireframe moving\n"
" before repainting the window. t4 is the minimum time\n"
" between sending wireframe \"animations\". For a slow\n"
" link this might be a better choice: 0.25+0.6+6.0+0.15\n"
" between sending wireframe \"animations\". If a slow\n"
" link is detected, these values may be automatically\n"
" changed to something better for a slow link.\n"
"\n"
"-wirecopyrect mode Since the -wireframe mechanism evidently tracks moving\n"
"-nowirecopyrect windows accurately, a speedup can be obtained by\n"
......@@ -30755,9 +30818,9 @@ static void print_help(int mode) {
" but it can be used for any scenario. This option\n"
" periodically performs costly operations and so\n"
" interactive response may be reduced when it is on.\n"
" The 3 Alt_L's (the Left \"Alt\" key) taps in a row\n"
" described under -scrollcopyrect can be used instead to\n"
" manually request a screen repaint when it is needed.\n"
" You can use 3 Alt_L's (the Left \"Alt\" key) taps in a\n"
" row described under -scrollcopyrect instead to manually\n"
" request a screen repaint when it is needed.\n"
"\n"
" \"string\" is a comma separated list of one or more of\n"
" the following: \"V=t\", \"C=t\", and \"X=t\". In these\n"
......@@ -30782,34 +30845,39 @@ static void print_help(int mode) {
"\n"
"-grab_buster Some of the use of the RECORD extension can leave a\n"
"-nograb_buster tiny window for XGrabServer deadlock. This is only if\n"
" the whole-server grabbing application expects mouse\n"
" or keyboard input before releasing the grab. It is\n"
" usually a window manager that does this. x11vnc takes\n"
" care to avoid the the problem, but if caught x11vnc\n"
" will freeze. Without -grab_buster, the only solution\n"
" is to go the physical display and give it some input\n"
" to satisfy the grabbing app. Or manually kill and\n"
" restart the window manager. With -grab_buster, x11vnc\n"
" the whole-server grabbing application expects mouse or\n"
" keyboard input before releasing the grab. It is usually\n"
" a window manager that does this. x11vnc takes care to\n"
" avoid the the problem, but if caught x11vnc will freeze.\n"
" Without -grab_buster, the only solution is to go the\n"
" physical display and give it some input to satisfy the\n"
" grabbing app. Or manually kill and restart the window\n"
" manager if that is feasible. With -grab_buster, x11vnc\n"
" will fork a helper thread and if x11vnc appears to be\n"
" stuck in a grab after a period of time (20-30 sec)\n"
" then it will inject some user input: button clicks,\n"
" Escape, mouse motion, etc to try to break the grab.\n"
" stuck in a grab after a period of time (20-30 sec) then\n"
" it will inject some user input: button clicks, Escape,\n"
" mouse motion, etc to try to break the grab. If you\n"
" experience a lot of grab deadlock, please report a bug.\n"
"\n"
"-debug_grabs Turn on debugging info printout with respect to\n"
" XGrabServer() deadlock for -scrollcopyrect mode.\n"
"\n"
"-pointer_mode n Various pointer motion update schemes. \"-pm\" is\n"
" an alias. The problem is pointer motion can cause\n"
" rapid changes on the screen: consider the rapid changes\n"
" when you drag a large window around. Neither x11vnc's\n"
" screen polling and vnc compression routines nor the\n"
" bandwidth to the vncviewers can keep up these rapid\n"
" screen changes: everything will bog down when dragging\n"
" or scrolling. So a scheme has to be used to \"eat\"\n"
" much of that pointer input before re-polling the screen\n"
" and sending out framebuffer updates. The mode number\n"
" \"n\" can be 0 to %d and selects one of the schemes\n"
" desribed below.\n"
" rapid changes on the screen: consider the rapid\n"
" changes when you drag a large window around opaquely.\n"
" Neither x11vnc's screen polling and vnc compression\n"
" routines nor the bandwidth to the vncviewers can keep\n"
" up these rapid screen changes: everything will bog down\n"
" when dragging or scrolling. So a scheme has to be used\n"
" to \"eat\" much of that pointer input before re-polling\n"
" the screen and sending out framebuffer updates. The\n"
" mode number \"n\" can be 0 to %d and selects one of\n"
" the schemes desribed below.\n"
"\n"
" Note that the -wireframe and -scrollcopyrect modes\n"
" complement -pointer_mode by detecting (and improving)\n"
" certain periods of \"rapid screen change\".\n"
"\n"
" n=0: does the same as -nodragging. (all screen polling\n"
" is suspended if a mouse button is pressed.)\n"
......@@ -30851,22 +30919,23 @@ static void print_help(int mode) {
"\n"
"-speeds rd,bw,lat x11vnc tries to estimate some speed parameters that\n"
" are used to optimize scheduling (e.g. -pointer_mode\n"
" 4) and other things. Use the -speeds option to set\n"
" these manually. The triple \"rd,bw,lat\" corresponds\n"
" to video h/w read rate in MB/sec, network bandwidth to\n"
" clients in KB/sec, and network latency to clients in\n"
" milliseconds, respectively. If a value is left blank,\n"
" e.g. \"-speeds ,100,15\", then the internal scheme is\n"
" used to estimate the empty value(s).\n"
" 4, -wireframe, -scrollcopyrect) and other things.\n"
" Use the -speeds option to set these manually.\n"
" The triple \"rd,bw,lat\" corresponds to video h/w\n"
" read rate in MB/sec, network bandwidth to clients in\n"
" KB/sec, and network latency to clients in milliseconds,\n"
" respectively. If a value is left blank, e.g. \"-speeds\n"
" ,100,15\", then the internal scheme is used to estimate\n"
" the empty value(s).\n"
"\n"
" Typical PC video cards have read rates of 5-10 MB/sec.\n"
" If the framebuffer is in main memory instead of video\n"
" h/w (e.g. SunRay, shadowfb, Xvfb), the read rate may\n"
" be much faster. \"x11perf -getimage500\" can be used\n"
" to get a lower bound (remember to factor in the bytes\n"
" per pixel). It is up to you to estimate the network\n"
" bandwith and latency to clients. For the latency the\n"
" ping(1) command can be used.\n"
" h/w (e.g. SunRay, shadowfb, dummy driver, Xvfb), the\n"
" read rate may be much faster. \"x11perf -getimage500\"\n"
" can be used to get a lower bound (remember to factor\n"
" in the bytes per pixel). It is up to you to estimate\n"
" the network bandwith and latency to clients. For the\n"
" latency the ping(1) command can be used.\n"
"\n"
" For convenience there are some aliases provided,\n"
" e.g. \"-speeds modem\". The aliases are: \"modem\" for\n"
......@@ -30901,7 +30970,7 @@ static void print_help(int mode) {
" text output. By default x11vnc will try to detect this\n"
" (3 screen polls in a row each longer than 0.25 sec with\n"
" no user input), and sleep up to 1.5 secs to let things\n"
" \"catch up\". Use this option to disable the detection.\n"
" \"catch up\". Use this option to disable that detection.\n"
"-readtimeout n Set libvncserver rfbMaxClientWait to n seconds. On\n"
" slow links that take a long time to paint the first\n"
" screen libvncserver may hit the timeout and drop the\n"
......@@ -30948,7 +31017,8 @@ static void print_help(int mode) {
" \"ignore\" or \"exit\". For \"ignore\" libvncserver\n"
" will handle the abrupt loss of a client and continue,\n"
" for \"exit\" x11vnc will cleanup and exit at the 1st\n"
" broken connection. Default: \"ignore\".\n"
" broken connection. Default: \"ignore\". This option\n"
" is obsolete.\n"
"-threads Whether or not to use the threaded libvncserver\n"
"-nothreads algorithm [rfbRunEventLoop] if libpthread is available\n"
" Default: %s\n"
......@@ -30968,7 +31038,7 @@ static void print_help(int mode) {
" memory and examine that copy for changes. Under some\n"
" circumstances this will improve interactive response,\n"
" or at least make things look smoother, but in others\n"
" (many) it will make the response worse. If the video\n"
" (most!) it will make the response worse. If the video\n"
" h/w fb is such that reading small tiles is very slow\n"
" this mode could help. To keep the \"framerate\" up\n"
" the screen size x bpp cannot be too large. Note that\n"
......@@ -31006,17 +31076,18 @@ static void print_help(int mode) {
"\n"
" (see ipcs(1) and fbset(1) for the first two examples)\n"
"\n"
" All user input is discarded. Most of the X11 (screen,\n"
" keyboard, mouse) options do not make sense and many\n"
" will cause this mode to crash, so please think twice\n"
" before setting/changing them.\n"
" All user input is discarded by default (but see the\n"
" -pipeinput option). Most of the X11 (screen, keyboard,\n"
" mouse) options do not make sense and many will cause\n"
" this mode to crash, so please think twice before\n"
" setting/changing them.\n"
"\n"
" If you don't want x11vnc to close the X DISPLAY in\n"
" rawfb mode, then capitalize the prefix, SHM:, MAP:,\n"
" FILE: Keeping the display open enables the default\n"
" remote-control channel, which could be useful. Also,\n"
" if you also specify -noviewonly, then the mouse and\n"
" keyboard input are still sent to the X display, this\n"
" keyboard input are STILL sent to the X display, this\n"
" usage should be very rare, i.e. doing something strange\n"
" with /dev/fb0.\n"
"\n"
......@@ -31040,9 +31111,10 @@ static void print_help(int mode) {
"-gui [gui-opts] Start up a simple tcl/tk gui based on the the remote\n"
" control options -remote/-query described below.\n"
" Requires the \"wish\" program to be installed on the\n"
" machine. \"gui-opts\" is not required: the default is\n"
" to start up both the gui and x11vnc with the gui showing\n"
" up on the X display in the environment variable DISPLAY.\n"
" machine. \"gui-opts\" is not required: the default\n"
" is to start up both the full gui and x11vnc with the\n"
" gui showing up on the X display in the environment\n"
" variable DISPLAY.\n"
"\n"
" \"gui-opts\" can be a comma separated list of items.\n"
" Currently there are these types of items: 1) a gui\n"
......@@ -31075,15 +31147,16 @@ static void print_help(int mode) {
" If you do not specify a gui X display in \"gui-opts\"\n"
" then the DISPLAY environment variable and -display\n"
" option are tried (in that order). Regarding the x11vnc\n"
" X display the gui will try to connect to, it first\n"
" tries -display and then DISPLAY. For example, \"x11vnc\n"
" -display :0 -gui otherhost:0\", will remote control an\n"
" x11vnc polling :0 and display the gui on otherhost:0\n"
" The \"tray\" mode below reverses this preference.\n"
" X display the gui will try to communication with, it\n"
" first tries -display and then DISPLAY. For example,\n"
" \"x11vnc -display :0 -gui otherhost:0\", will remote\n"
" control an x11vnc polling :0 and display the gui on\n"
" otherhost:0 The \"tray/icon\" mode below reverses this\n"
" preference, preferring to display on the x11vnc display.\n"
"\n"
" 4) When \"tray\" or \"icon\" is specified, the gui\n"
" presents itself as a small icon with behavior typical\n"
" of a \"system tray\" or \"dock\" applet. The color\n"
" of a \"system tray\" or \"dock applet\". The color\n"
" of the icon indicates status (connected clients) and\n"
" there is also a balloon status. Clicking on the icon\n"
" gives a menu from which properties, etc, can be set and\n"
......@@ -31093,7 +31166,7 @@ static void print_help(int mode) {
"\n"
" For \"icon\" the gui just a small standalone window.\n"
" For \"tray\" it will attempt to embed itself in the\n"
" \"system tray\". If \"=setpass\" is appended then\n"
" \"system tray\" if possible. If \"=setpass\" is appended then\n"
" at startup the X11 user will be prompted to set the\n"
" VNC session password. If =<hexnumber> is appended\n"
" that icon will attempt to embed itself in the window\n"
......@@ -31119,6 +31192,7 @@ static void print_help(int mode) {
" General examples of the -gui option: \"x11vnc -gui\",\n"
" \"x11vnc -gui ez\" \"x11vnc -gui localhost:10\",\n"
" \"x11vnc -gui conn,host:0\", \"x11vnc -gui tray,ez\"\n"
" \"x11vnc -gui tray=setpass\"\n"
"\n"
" If you do not intend to start x11vnc from the gui\n"
" (i.e. just remote control an existing one), then the\n"
......@@ -31149,10 +31223,6 @@ static void print_help(int mode) {
" 'x11vnc -R shared' will enable shared connections, and\n"
" 'x11vnc -R scale:3/4' will rescale the desktop.\n"
"\n"
" Note: the more drastic the change induced by the -remote\n"
" command, the bigger the chance for bugs or crashes.\n"
" Please report reproducible bugs.\n"
"\n"
" The following -remote/-R commands are supported:\n"
"\n"
" stop terminate the server, same as \"quit\"\n"
......@@ -31251,7 +31321,7 @@ static void print_help(int mode) {
" rectangle use \"-WxH+X+Y\" to delete one\n"
" xinerama enable -xinerama mode. (if applicable)\n"
" noxinerama disable -xinerama mode.\n"
" xtrap enable -xtrap input mode.\n"
" xtrap enable -xtrap input mode(if applicable)\n"
" noxtrap disable -xtrap input mode.\n"
" xrandr enable -xrandr mode. (if applicable)\n"
" noxrandr disable -xrandr mode.\n"
......@@ -31333,7 +31403,7 @@ static void print_help(int mode) {
" fixscreen:str set -fixscreen to \"str\".\n"
" noxrecord disable all use of RECORD extension.\n"
" xrecord enable use of RECORD extension.\n"
" reset_record reset RECORD extension (if avail.).\n"
" reset_record reset RECORD extension (if avail.)\n"
" pointer_mode:n set -pointer_mode to n. same as \"pm\"\n"
" input_skip:n set -input_skip to n.\n"
" speeds:str set -speeds to str.\n"
......@@ -31426,16 +31496,24 @@ static void print_help(int mode) {
" a query straight to the VNC_CONNECT property or connect\n"
" file use \"qry=...\" instead of \"cmd=...\"\n"
"\n"
" Here is the current list of \"variables\" that can\n"
" be supplied to the -query command. This includes the\n"
" \"N/A\" ones that return no useful info. For variables\n"
" names that do not correspond to an x11vnc option or\n"
" remote command, we hope the name makes it obvious what\n"
" the returned value corresponds to (hint: the ext_*\n"
" variables correspond to the presence of X extensions):\n"
"\n"
" ans= stop quit exit shutdown ping blacken zero\n"
" refresh reset close disconnect id sid waitmapped\n"
" nowaitmapped clip flashcmap noflashcmap shiftcmap\n"
" truecolor notruecolor overlay nooverlay overlay_cursor\n"
" overlay_yescursor nooverlay_nocursor nooverlay_cursor\n"
" nooverlay_yescursor overlay_nocursor visual scale\n"
" scale_cursor viewonly noviewonly shared noshared forever\n"
" noforever once timeout deny lock nodeny unlock connect\n"
" allowonce allow localhost nolocalhost listen lookup\n"
" nolookup accept popup gone shm noshm flipbyteorder\n"
" scale_cursor viewonly noviewonly shared noshared\n"
" forever noforever once timeout deny lock nodeny unlock\n"
" connect allowonce allow localhost nolocalhost listen\n"
" lookup nolookup accept gone shm noshm flipbyteorder\n"
" noflipbyteorder onetile noonetile solid_color solid\n"
" nosolid blackout xinerama noxinerama xtrap noxtrap\n"
" xrandr noxrandr xrandr_mode padgeom quiet q noquiet\n"
......@@ -31469,9 +31547,9 @@ static void print_help(int mode) {
" debug_tiles dbt nodebug_tiles nodbt debug_tiles\n"
" debug_grabs nodebug_grabs dbg nodbg noremote\n"
"\n"
" aro= display vncdisplay desktopname guess_desktop\n"
" http_url auth users rootshift clipshift scale_str\n"
" scaled_x scaled_y scale_numer scale_denom\n"
" aro= noop display vncdisplay desktopname guess_desktop\n"
" http_url auth xauth users rootshift clipshift\n"
" scale_str scaled_x scaled_y scale_numer scale_denom\n"
" scale_fac scaling_blend scaling_nomult4 scaling_pad\n"
" scaling_interpolate inetd privremote unsafe safer nocmds\n"
" passwdfile using_shm logfile o flag rc norc h help V\n"
......@@ -31481,7 +31559,11 @@ static void print_help(int mode) {
" ext_overlay ext_xfixes ext_xdamage ext_xrandr rootwin\n"
" num_buttons button_mask mouse_x mouse_y bpp depth\n"
" indexed_color dpy_x dpy_y wdpy_x wdpy_y off_x off_y\n"
" cdpy_x cdpy_y coff_x coff_y rfbauth passwd\n"
" cdpy_x cdpy_y coff_x coff_y rfbauth passwd viewpasswd\n"
"\n"
"-QD variable Just like -query variable, but returns the default\n"
" value for that parameter (no running x11vnc server\n"
" is consulted)\n"
"\n"
"-sync By default -remote commands are run asynchronously, that\n"
" is, the request is posted and the program immediately\n"
......@@ -31489,7 +31571,7 @@ static void print_help(int mode) {
" acknowledgement from the x11vnc server that command was\n"
" processed (somehow). On the other hand -query requests\n"
" are always processed synchronously because they have\n"
" to wait for the result.\n"
" to wait for the answer.\n"
"\n"
" Also note that if both -remote and -query requests are\n"
" supplied on the command line, the -remote is processed\n"
......@@ -31530,7 +31612,7 @@ static void print_help(int mode) {
" running external programs. If you specify -unsafe, then\n"
" these remote-control commands are allowed. Note that\n"
" you can still specify these parameters on the command\n"
" line, they just cannot be changed via remote-control.\n"
" line, they just cannot be invoked via remote-control.\n"
"-safer Equivalent to: -novncconnect -noremote and prohibiting\n"
" -gui and the -connect file. Shuts off communcation\n"
" channels.\n"
......@@ -31773,7 +31855,7 @@ static int argc2 = 0;
static char **argv2;
static void check_rcfile(int argc, char **argv) {
int i, pwlast, norc = 0, argmax = 1024;
int i, j, pwlast, norc = 0, argmax = 1024;
char *infile = NULL;
char rcfile[1024];
FILE *rc;
......@@ -31787,6 +31869,9 @@ static void check_rcfile(int argc, char **argv) {
if (!strcmp(argv[i], "-norc")) {
norc = 1;
}
if (!strcmp(argv[i], "-QD")) {
norc = 1;
}
if (!strcmp(argv[i], "-rc")) {
if (i+1 >= argc) {
fprintf(stderr, "-rc option requires a "
......@@ -31833,7 +31918,7 @@ static void check_rcfile(int argc, char **argv) {
if (! norc) {
char line[4096], parm[100], tmp[101];
char *buf;
char *buf, *tbuf;
struct stat sbuf;
int sz;
......@@ -31848,13 +31933,28 @@ static void check_rcfile(int argc, char **argv) {
}
buf = (char *) malloc(sz);
buf[0] = '\0';
while (fgets(line, 4096, rc) != NULL) {
char *q, *p = line;
char c = '\0';
char c;
int cont = 0;
q = p;
c = '\0';
while (*q) {
if (*q == '#') {
if (c != '\\') {
*q = '\0';
break;
}
}
c = *q;
q++;
}
q = p;
c = '\0';
while (*q) {
if (*q == '\n') {
if (c == '\\') {
......@@ -31875,9 +31975,19 @@ static void check_rcfile(int argc, char **argv) {
c = *q;
q++;
}
if ( (q = strchr(p, '#')) != NULL) {
if (q != p) {
if (*q == '\0') {
q--;
}
while (isspace(*q)) {
*q = '\0';
if (q == p) {
break;
}
q--;
}
}
p = lblanks(p);
strncat(buf, p, sz - strlen(buf) - 1);
......@@ -31888,6 +31998,22 @@ static void check_rcfile(int argc, char **argv) {
continue;
}
i = 0;
q = buf;
while (*q) {
i++;
if (*q == '\n' || isspace(*q)) {
break;
}
q++;
}
if (i >= 100) {
fprintf(stderr, "invalid rcfile line: %s/%s\n",
p, buf);
exit(1);
}
if (sscanf(buf, "%s", parm) != 1) {
fprintf(stderr, "invalid rcfile line: %s\n", p);
exit(1);
......@@ -31908,12 +32034,26 @@ static void check_rcfile(int argc, char **argv) {
p = buf;
p += strlen(parm);
p = lblanks(p);
if (*p == '\0') {
buf[0] = '\0';
continue;
}
argv2[argc2++] = strdup(p);
tbuf = (char *) calloc(strlen(p) + 1, 1);
j = 0;
while (*p) {
if (*p == '\\' && *(p+1) == '#') {
;
} else {
tbuf[j++] = *p;
}
p++;
}
argv2[argc2++] = strdup(tbuf);
free(tbuf);
if (argc2 >= argmax) {
fprintf(stderr, "too many rcfile options\n");
exit(1);
......@@ -32052,6 +32192,77 @@ void xopen_display_fail_message(char *disp) {
fprintf(stderr, "See also: http://www.karlrunge.com/x11vnc/#faq\n");
}
void nopassword_warning_msg(int gotloc) {
char str1[] =
"###############################################################\n"
"#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#\n"
"#@ @#\n"
"#@ ** WARNING ** WARNING ** WARNING ** WARNING ** @#\n"
"#@ @#\n"
"#@ YOU ARE RUNNING X11VNC WITHOUT A PASSWORD!! @#\n"
"#@ @#\n"
"#@ This means anyone with network access to this computer @#\n"
"#@ will be able to easily view and control your desktop. @#\n"
"#@ @#\n"
"#@ >>> If you did not mean to do this Press CTRL-C now!! <<< @#\n"
"#@ @#\n"
"#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#\n"
;
char str2[] =
"#@ @#\n"
"#@ You can create an x11vnc password file by running: @#\n"
"#@ @#\n"
"#@ x11vnc -storepasswd password /path/to/passfile @#\n"
"#@ @#\n"
"#@ and then starting x11vnc via: @#\n"
"#@ @#\n"
"#@ x11vnc -rfbauth /path/to/passfile @#\n"
"#@ @#\n"
"#@ an existing ~/.vnc/passwd file will work too. @#\n"
"#@ @#\n"
"#@ You can also use the -passwdfile or -passwd options. @#\n"
"#@ (note -passwd is unsafe if local users are not trusted) @#\n"
"#@ @#\n"
"#@ Make sure any -rfbauth and -passwdfile password files @#\n"
"#@ cannot be read by untrusted users. @#\n"
"#@ @#\n"
"#@ Please Read the documention for more info about @#\n"
"#@ passwords, security, and encryption. @#\n"
;
char str3[] =
"#@ @#\n"
"#@ You are using the -localhost option and that is a good @#\n"
"#@ thing!! Especially if you ssh(1) into this machine and @#\n"
"#@ use port redirection. Nevertheless, without a password @#\n"
"#@ other users could possibly do redirection as well to @#\n"
"#@ gain access to your desktop. @#\n"
;
char str4[] =
"#@ @#\n"
"#@ To disable this warning use the -nopw option, or put @#\n"
"#@ the setting in your ~/.x11vncrc file. @#\n"
"#@ @#\n"
"#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#\n"
"###############################################################\n"
;
if (quiet) {
return;
}
fprintf(stderr, "%s", str1);
fflush(stderr);
usleep(2500 * 1000);
fprintf(stderr, "%s", str2);
if (gotloc) {
fprintf(stderr, "%s", str3);
}
fprintf(stderr, "%s", str4);
fflush(stderr);
usleep(500 * 1000);
}
int main(int argc, char* argv[]) {
int i, len, tmpi;
......@@ -32061,7 +32272,9 @@ int main(int argc, char* argv[]) {
char *remote_cmd = NULL;
char *query_cmd = NULL;
char *gui_str = NULL;
int pw_loc = -1, got_passwd = 0, got_rfbauth = 0;
int pw_loc = -1, got_passwd = 0, got_rfbauth = 0, nopw = NOPW;
int got_viewpasswd = 0, got_localhost = 0, got_passwdfile = 0;
int running_without_passwd = 0;
int vpw_loc = -1;
int dt = 0, bg = 0;
int got_rfbwait = 0;
......@@ -32222,6 +32435,7 @@ int main(int argc, char* argv[]) {
allow_list = strdup(argv[++i]);
} else if (!strcmp(arg, "-localhost")) {
allow_list = strdup("127.0.0.1");
got_localhost = 1;
} else if (!strcmp(arg, "-nolookup")) {
host_lookup = 0;
} else if (!strcmp(arg, "-input")) {
......@@ -32231,9 +32445,13 @@ int main(int argc, char* argv[]) {
vpw_loc = i;
CHECK_ARGC
viewonly_passwd = strdup(argv[++i]);
got_viewpasswd = 1;
} else if (!strcmp(arg, "-passwdfile")) {
CHECK_ARGC
passwdfile = strdup(argv[++i]);
got_passwdfile = 1;
} else if (!strcmp(arg, "-nopw")) {
nopw = 1;
} else if (!strcmp(arg, "-storepasswd")) {
if (i+2 >= argc || rfbEncryptAndStorePasswd(argv[i+1],
argv[i+2]) != 0) {
......@@ -32657,6 +32875,10 @@ int main(int argc, char* argv[]) {
query_cmd = strdup(argv[++i]);
quiet = 1;
xkbcompat = 0;
} else if (!strcmp(arg, "-QD")) {
CHECK_ARGC
query_cmd = strdup(argv[++i]);
query_default = 1;
} else if (!strcmp(arg, "-sync")) {
remote_sync = 1;
} else if (!strcmp(arg, "-nosync")) {
......@@ -32715,9 +32937,15 @@ int main(int argc, char* argv[]) {
}
}
}
if (!got_passwd && !got_rfbauth && !got_passwdfile && !nopw) {
running_without_passwd = 1;
}
if (launch_gui) {
do_gui(gui_str);
int sleep = 0;
if (running_without_passwd && !quiet) {
sleep = 3;
}
do_gui(gui_str, sleep);
}
if (logfile) {
int n;
......@@ -32768,13 +32996,19 @@ int main(int argc, char* argv[]) {
}
}
if (client_connect_file && (remote_cmd || query_cmd)) {
/* no need to open DISPLAY, just write it to the file now */
int rc = do_remote_query(remote_cmd, query_cmd, remote_sync);
if (remote_cmd || query_cmd) {
/*
* no need to open DISPLAY, just write it to the file now
* similar for query_default.
*/
if (client_connect_file || query_default) {
int rc = do_remote_query(remote_cmd, query_cmd,
remote_sync, query_default);
fflush(stderr);
fflush(stdout);
exit(rc);
}
}
/*
......@@ -32888,6 +33122,10 @@ int main(int argc, char* argv[]) {
exit(1);
}
if (!got_passwd && !got_rfbauth && !got_passwdfile && !nopw) {
nopassword_warning_msg(got_localhost);
}
if (more_safe) {
if (! quiet) {
rfbLog("-safer mode:\n");
......@@ -33283,7 +33521,8 @@ int main(int argc, char* argv[]) {
}
if (remote_cmd || query_cmd) {
int rc = do_remote_query(remote_cmd, query_cmd, remote_sync);
int rc = do_remote_query(remote_cmd, query_cmd, remote_sync,
query_default);
XFlush(dpy);
fflush(stderr);
fflush(stdout);
......@@ -33667,6 +33906,13 @@ int main(int argc, char* argv[]) {
}
if (! quiet) {
rfbLog("screen setup finished.\n");
if (!got_passwd && !got_rfbauth && !got_passwdfile && !nopw) {
rfbLog("\n");
rfbLog("WARNING: You are running x11vnc WITHOUT"
" a password. See\n");
rfbLog("WARNING: the warning message printed above"
" for more info.\n");
}
}
set_vnc_desktop_name();
......
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