summaryrefslogtreecommitdiffstats
path: root/x11vnc/tkx11vnc.h
diff options
context:
space:
mode:
authorrunge <runge>2005-02-11 04:14:20 +0000
committerrunge <runge>2005-02-11 04:14:20 +0000
commit86ccf267b18b30a3c0d4f5b96b6738f3c2b17e2b (patch)
tree519106dc628376f40e8cf065742cda1396fe8084 /x11vnc/tkx11vnc.h
parent5b18d40136b20695b4048a69fcfbd0631ad7bb81 (diff)
downloadlibtdevnc-86ccf267b18b30a3c0d4f5b96b6738f3c2b17e2b.tar.gz
libtdevnc-86ccf267b18b30a3c0d4f5b96b6738f3c2b17e2b.zip
x11vnc -input to fine tune allow user input. per-client settings -R
Diffstat (limited to 'x11vnc/tkx11vnc.h')
-rw-r--r--x11vnc/tkx11vnc.h369
1 files changed, 345 insertions, 24 deletions
diff --git a/x11vnc/tkx11vnc.h b/x11vnc/tkx11vnc.h
index cc60b8b..1604b31 100644
--- a/x11vnc/tkx11vnc.h
+++ b/x11vnc/tkx11vnc.h
@@ -202,6 +202,8 @@
" forever\n"
" timeout:\n"
" --\n"
+" input:\n"
+" --\n"
" =SA alwaysshared\n"
" =SA nevershared\n"
" =SA dontdisconnect\n"
@@ -285,6 +287,11 @@
" set helptext(update-all) \"\n"
"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"
"\"\n"
"\n"
" set helptext(clear-all) \"\n"
@@ -327,10 +334,29 @@
" set helptext(current) \"\n"
"Shows a menu of currently connected VNC clients on the x11vnc server.\n"
"\n"
-"Allows you to find more information about them or disconnect them.\n"
+"Allows you to find more information about them, change their input\n"
+"permissions, or disconnect them.\n"
+"\n"
"You will be prompted to confirm any disconnections.\n"
"\"\n"
"\n"
+" set helptext(client) \"\n"
+"After selecting a VNC client from the \\\"Clients -> current\\\" menu,\n"
+"you will be presented with a dialog that shows the information\n"
+"about the VNC client.\n"
+"\n"
+"You can chose to disconnect the client by clicking on the \n"
+"\\\"Disconnect\\\" checkbox and pressing \\\"OK\\\". There will be a\n"
+"confirmation dialog to doublecheck.\n"
+"\n"
+"Alternatively, you can fine tune the VNC client's input permissions\n"
+"by selecting any of the Keystrokes, Mouse Motion, or Button Clicks\n"
+"checkboxes and pressing \\\"OK\\\". This is like the \\\"-input\\\" option\n"
+"but on a per-client basis.\n"
+"\n"
+"To not change any aspects of the VNC client press \\\"Skip\\\".\n"
+"\"\n"
+"\n"
" set helptext(solid_color) \"\n"
"Set the -solid color value.\n"
"\"\n"
@@ -476,12 +502,18 @@
" return $count\n"
"}\n"
"\n"
+"proc set_name {name} {\n"
+" wm title . \"$name\"\n"
+" wm iconname . \"$name\"\n"
+"}\n"
+"\n"
"proc make_toplevel {w {title \"\"}} {\n"
" catch {destroy $w}\n"
" toplevel $w;\n"
" bind $w <Escape> \"destroy $w\"\n"
" if {$title != \"\"} {\n"
-" wm title $w $title\n"
+" wm title $w $title\n"
+" wm iconname $w $title\n"
" }\n"
"}\n"
"\n"
@@ -1060,6 +1092,195 @@
" }\n"
"}\n"
"\n"
+"proc set_kmb_str {} {\n"
+" global vl_bk vl_bm vl_bb vr_bk vr_bm vr_bb \n"
+"\n"
+" set str \"\"\n"
+" if {$vl_bk} {\n"
+" append str \"K\"\n"
+" }\n"
+" if {$vl_bm} {\n"
+" append str \"M\"\n"
+" }\n"
+" if {$vl_bb} {\n"
+" append str \"B\"\n"
+" }\n"
+" if {$vr_bk || $vr_bm || $vr_bb} {\n"
+" append str \",\"\n"
+" }\n"
+" if {$vr_bk} {\n"
+" append str \"K\"\n"
+" }\n"
+" if {$vr_bm} {\n"
+" append str \"M\"\n"
+" }\n"
+" if {$vr_bb} {\n"
+" append str \"B\"\n"
+" }\n"
+" entry_insert $str\n"
+"}\n"
+"\n"
+"proc insert_input_window {} {\n"
+" global text_area cleanup_window\n"
+" global ffont menu_var\n"
+" global vl_bk vl_bm vl_bb vr_bk vr_bm vr_bb \n"
+"\n"
+" append_text \"\\nUse these checkboxes to set the input permissions, \"\n"
+" append_text \"or type in the \\\"KMB...\\\"\\n-input string manually. \"\n"
+" append_text \"Then press \\\"OK\\\" or \\\"Skip\\\".\\n\\n\"\n"
+" set w \"$text_area.wk_f\"\n"
+" catch {destroy $w}\n"
+" frame $w -bd 1 -relief ridge -cursor {top_left_arrow}\n"
+" set fl $w.fl\n"
+" frame $fl\n"
+" set fr $w.fr\n"
+" frame $fr\n"
+" label $fl.l -font $ffont -text \"Normal clients: \"\n"
+" checkbutton $fl.bk -pady 1 -font $ffont -anchor w -variable vl_bk \\\n"
+" -pady 1 -command set_kmb_str -text \"Keystrokes\" \n"
+" checkbutton $fl.bm -font $ffont -anchor w -variable vl_bm \\\n"
+" -pady 1 -command set_kmb_str -text \"Mouse Motion\" \n"
+" checkbutton $fl.bb -font $ffont -anchor w -variable vl_bb \\\n"
+" -pady 1 -command set_kmb_str -text \"Button Clicks\"\n"
+" label $fr.l -pady 1 -font $ffont -text \"View-only clients:\"\n"
+" checkbutton $fr.bk -font $ffont -anchor w -variable vr_bk \\\n"
+" -pady 1 -command set_kmb_str -text \"Keystrokes\" \n"
+" checkbutton $fr.bm -font $ffont -anchor w -variable vr_bm \\\n"
+" -pady 1 -command set_kmb_str -text \"Mouse Motion\" \n"
+" checkbutton $fr.bb -font $ffont -anchor w -variable vr_bb \\\n"
+" -pady 1 -command set_kmb_str -text \"Button Clicks\"\n"
+"\n"
+" if {[info exists menu_var(input)]} {\n"
+" set input_str $menu_var(input)\n"
+" } else {\n"
+" set input_str \"\"\n"
+" }\n"
+"\n"
+" if {[regexp {(.*),(.*)} $input_str match normal viewonly]} {\n"
+" ;\n"
+" } else {\n"
+" set normal $input_str\n"
+" set viewonly \"\"\n"
+" }\n"
+" set vl_bk 0\n"
+" set vl_bm 0\n"
+" set vl_bb 0\n"
+" set vr_bk 0\n"
+" set vr_bm 0\n"
+" set vr_bb 0\n"
+"\n"
+" if {[regexp -nocase {K} $normal]} {\n"
+" set vl_bk 1\n"
+" }\n"
+" if {[regexp -nocase {M} $normal]} {\n"
+" set vl_bm 1\n"
+" }\n"
+" if {[regexp -nocase {B} $normal]} {\n"
+" set vl_bb 1\n"
+" }\n"
+" if {[regexp -nocase {K} $viewonly]} {\n"
+" set vr_bk 1\n"
+" }\n"
+" if {[regexp -nocase {M} $viewonly]} {\n"
+" set vr_bm 1\n"
+" }\n"
+" if {[regexp -nocase {B} $viewonly]} {\n"
+" set vr_bb 1\n"
+" }\n"
+"\n"
+" pack $fl.l $fl.bk $fl.bm $fl.bb -side top -fill x\n"
+" pack $fr.l $fr.bk $fr.bm $fr.bb -side top -fill x\n"
+" pack $fl $fr -side left\n"
+" update\n"
+" update idletasks\n"
+" $text_area window create end -window $w\n"
+" $text_area see end\n"
+" $text_area insert end \"\\n\"\n"
+"# $text_area insert end \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\n"
+"\n"
+" set cleanup_window $w\n"
+"}\n"
+"\n"
+"proc set_ca_str {w} {\n"
+" global ca_bk ca_bm ca_bb ca_bk ca_di\n"
+"\n"
+" if {$ca_di} {\n"
+" entry_insert \"disconnect\"\n"
+" $w.bk configure -state disabled\n"
+" $w.bm configure -state disabled\n"
+" $w.bb configure -state disabled\n"
+" return\n"
+" }\n"
+"\n"
+" $w.bk configure -state normal\n"
+" $w.bm configure -state normal\n"
+" $w.bb configure -state normal\n"
+"\n"
+" set str \"\"\n"
+" if {$ca_bk} {\n"
+" append str \"K\"\n"
+" }\n"
+" if {$ca_bm} {\n"
+" append str \"M\"\n"
+" }\n"
+" if {$ca_bb} {\n"
+" append str \"B\"\n"
+" }\n"
+" entry_insert $str\n"
+"}\n"
+"\n"
+"proc insert_client_action_window {input} {\n"
+" global text_area cleanup_window\n"
+" global ffont menu_var\n"
+" global ca_bk ca_bm ca_bb ca_bk ca_di\n"
+"\n"
+" append_text \"\\nUse these checkboxes to set the input permissions \"\n"
+" append_text \"for this client\\n-or- whether to disconnect it instead. \"\n"
+" append_text \"Then press \\\"OK\\\" or \\\"Skip\\\".\\n\\n\"\n"
+" set w \"$text_area.ca_f\"\n"
+" catch {destroy $w}\n"
+" frame $w -bd 1 -relief ridge -cursor {top_left_arrow}\n"
+" checkbutton $w.di -pady 1 -font $ffont -anchor w -variable ca_di \\\n"
+" -pady 1 -command \"set_ca_str $w\" -text \"Disconnect \" \n"
+" checkbutton $w.bk -font $ffont -anchor w -variable ca_bk \\\n"
+" -pady 1 -command \"set_ca_str $w\" -text \"Keystrokes\" \n"
+" checkbutton $w.bm -font $ffont -anchor w -variable ca_bm \\\n"
+" -pady 1 -command \"set_ca_str $w\" -text \"Mouse Motion\" \n"
+" checkbutton $w.bb -font $ffont -anchor w -variable ca_bb \\\n"
+" -pady 1 -command \"set_ca_str $w\" -text \"Button Clicks\"\n"
+"\n"
+" set ca_di 0\n"
+" set ca_bk 0\n"
+" set ca_bm 0\n"
+" set ca_bb 0\n"
+"\n"
+" if {[regexp -nocase {K} $input]} {\n"
+" set ca_bk 1\n"
+" }\n"
+" if {[regexp -nocase {M} $input]} {\n"
+" set ca_bm 1\n"
+" }\n"
+" if {[regexp -nocase {B} $input]} {\n"
+" set ca_bb 1\n"
+" }\n"
+"\n"
+" pack $w.di $w.bk $w.bm $w.bb -side left\n"
+" update\n"
+" update idletasks\n"
+" $text_area window create end -window $w\n"
+" $text_area see end\n"
+" $text_area insert end \"\\n\"\n"
+"\n"
+" set cleanup_window $w\n"
+"}\n"
+"\n"
+"proc cleanup_text_window {} {\n"
+" global cleanup_window\n"
+" if {[info exists cleanup_window]} {\n"
+" catch {destroy $cleanup_window}\n"
+" }\n"
+"}\n"
+"\n"
"# For updating a string variable. Also used for simple OK/Skip dialogs\n"
"# with entry = 0.\n"
"proc entry_dialog {item {entry 1}} {\n"
@@ -1090,6 +1311,13 @@
" entry_disable box\n"
" }\n"
"\n"
+" set clean_text_window 0;\n"
+"\n"
+" if {$item == \"input\"} {\n"
+" insert_input_window\n"
+" set clean_text_window 1\n"
+" }\n"
+"\n"
" update\n"
"\n"
" # wait for user reply:\n"
@@ -1107,6 +1335,11 @@
" entry_delete\n"
" entry_disable\n"
" menus_enable\n"
+"\n"
+" if {$clean_text_window} {\n"
+" cleanup_text_window;\n"
+" }\n"
+"\n"
" update\n"
"\n"
" if {! $entry} {\n"
@@ -1211,7 +1444,8 @@
" } elseif {[regexp {:[0-9]\\.[0-9]} $expected]} {\n"
" append_text \"\\t($msg)\\n\"\n"
" return 1\n"
-" } elseif {$item == \"connect\" || $item == \"disconnect\"} {\n"
+" } elseif {$item == \"connect\" || $item == \"disconnect\"\n"
+" || $item == \"client\" || $item == \"client_input\"} {\n"
" append_text \"\\t($msg)\\n\"\n"
" return 1\n"
" } else {\n"
@@ -1265,7 +1499,7 @@
" continue\n"
" }\n"
" if {[info exists menu_var($item)]} {\n"
-" if [is_action $item] {\n"
+" if {[is_action $item]} {\n"
" set menu_var($item) \"\"\n"
" } elseif {[value_is_bool $item]} {\n"
" set menu_var($item) 0\n"
@@ -1500,7 +1734,7 @@
" push_new_value $item $name $new 0\n"
" set_connected no\n"
" \n"
-" } elseif [opt_match Q $item] {\n"
+" } elseif {[opt_match Q $item]} {\n"
" push_new_value $item $name $new 1\n"
" } else {\n"
" push_new_value $item $name $new 0\n"
@@ -1666,7 +1900,7 @@
"proc set_x11_display {name} {\n"
" global x11_display\n"
" set x11_display \"x11vnc X display: $name\"\n"
-" wm title . \"tkx11vnc - $name\"\n"
+" set_name \"tkx11vnc - $name\"\n"
"}\n"
"proc set_vnc_display {name} {\n"
" global vnc_display\n"
@@ -1678,7 +1912,7 @@
"}\n"
"proc no_x11_display {} {\n"
" set_x11_display \"(*none*)\"\n"
-" wm title . \"tkx11vnc\"\n"
+" set_name \"tkx11vnc\"\n"
"}\n"
"proc no_vnc_display {} {\n"
" set_vnc_display \"(*none*)\"\n"
@@ -1719,20 +1953,99 @@
" }\n"
"}\n"
"\n"
+"proc client_dialog {client} {\n"
+" set cid \"\"\n"
+" set host \"\"\n"
+" set ip \"\"\n"
+" global menu_var text_area cleanup_window item_bool\n"
+"\n"
+" append_text \"\\nClient info string: $client\\n\\n\"\n"
+" if {[regexp {^(.*):(.*):(.*):(.*):(.*):(.*)$} \\\n"
+" $client m0 m1 m2 m3 m4 m5 m6]} {\n"
+" # id:ip:port:hostname:input:loginvo\n"
+" set cid $m1\n"
+" set ip $m2\n"
+" set port $m3\n"
+" set host $m4\n"
+" regsub {\\..*$} $host \"\" host\n"
+" set input $m5\n"
+" set logvo $m6\n"
+" append_text \"Host: $host, Port: $port, IP: $ip, Id: $cid\\n\"\n"
+" append_text \" - originally logged in as: \"\n"
+" if {$logvo == \"1\" } {\n"
+" append_text \"View-Only Client\\n\"\n"
+" } else {\n"
+" append_text \"Normal Client\\n\"\n"
+" }\n"
+" append_text \" - currently allowed input: \"\n"
+" set sk 0\n"
+" set sm 0\n"
+" set sb 0\n"
+" if {[regexp -nocase {K} $input]} {\n"
+" append_text \"Keystroke\"\n"
+" set sk 1\n"
+" }\n"
+" if {[regexp -nocase {M} $input]} {\n"
+" if {$sk} {\n"
+" append_text \", \"\n"
+" }\n"
+" append_text \"Mouse-Motion\"\n"
+" set sm 1\n"
+" }\n"
+" if {[regexp -nocase {B} $input]} {\n"
+" if {$sk || $sm} {\n"
+" append_text \", \"\n"
+" }\n"
+" append_text \"Button-Click\"\n"
+" set sb 1\n"
+" }\n"
+" if {! $sk && ! $sm && ! $sb} {\n"
+" append_text \"None\"\n"
+" }\n"
+" append_text \"\\n\"\n"
+" }\n"
+" if {$cid == \"\"} {\n"
+" append_text \"Invalid client info string: $client\\n\"\n"
+" return\n"
+" }\n"
+"\n"
+" regsub -all {_} $input \"\" input\n"
+" set menu_var(client) \"$input\"\n"
+" set item_bool(client) 0\n"
+"\n"
+" insert_client_action_window $input\n"
+" set rc [entry_dialog client 1]\n"
+"\n"
+" cleanup_text_window\n"
+"\n"
+" set val $menu_var(client)\n"
+" #puts \"rc: $rc val: $val\"\n"
+"\n"
+" if {! $rc} {\n"
+" return;\n"
+" } elseif {[regexp -nocase {(disconnect|close)} $val]} {\n"
+" disconnect_dialog $client\n"
+" } else {\n"
+" regsub -all -nocase {[^KMB]} $val \"\" \n"
+" set item_bool(client_input) 0\n"
+" push_new_value \"client_input\" \"client_input\" \"$cid:$val\" 0\n"
+" }\n"
+"}\n"
+"\n"
"proc disconnect_dialog {client} {\n"
" set cid \"\"\n"
" set host \"\"\n"
" set msg \"\\n\"\n"
" append msg \"*** Client info string: $client\\n\"\n"
-" if {[regexp {^(.*):(.*)/(.*)-(.*)$} $client m0 m1 m2 m3 m4]} {\n"
-" if {$m4 == \"ro\"} {\n"
-" set view \"(viewonly)\"\n"
-" } else {\n"
-" set view \"(interactive)\"\n"
-" }\n"
-" set host $m1\n"
-" set cid $m3\n"
-" append msg \"*** Host: $m1, Port: $m2 Id: $m3 $view\\n\"\n"
+" if {[regexp {^(.*):(.*):(.*):(.*):(.*):(.*)$} $client m0 m1 m2 m3 m4 m5 m6]} {\n"
+" set cid $m1\n"
+" set ip $m2\n"
+" set port $m3\n"
+" set host $m4\n"
+" regsub {\\..*$} $host \"\" host\n"
+" set input $m5\n"
+" set logvo $m6\n"
+" append_text \"Host: $host, Port: $port, IP: $ip, Id: $cid\\n\"\n"
" }\n"
" if {$cid == \"\"} {\n"
" append_text \"Invalid client info string: $client\\n\"\n"
@@ -1740,7 +2053,7 @@
" }\n"
" append msg \"*** To *DISCONNECT* this client press \\\"OK\\\", otherwise press \\\"Skip\\\"\\n\"\n"
" bell\n"
-" if [warning_dialog $msg \"current\"] {\n"
+" if {[warning_dialog $msg \"current\"]} {\n"
" push_new_value \"disconnect\" \"disconnect\" $cid 1\n"
" } else {\n"
" append_text \"disconnect cancelled.\\n\"\n"
@@ -1762,7 +2075,7 @@
" continue\n"
" }\n"
" set name [$casc entrycget $i -label]\n"
-" if {[regexp {^#} $name]} {\n"
+" if {[regexp {^num-clients} $name]} {\n"
" continue\n"
" }\n"
" if {[regexp {^refresh-list} $name]} {\n"
@@ -1789,12 +2102,20 @@
" $subm add separator\n"
" set count 0\n"
" foreach client [split $list \",\"] {\n"
-" regsub {:[0-9][0-9]*/} $client {/} lab\n"
-" $subm add command -label \"$client\" \\\n"
-" -command \"disconnect_dialog $client\"\n"
+" if {[regexp {^(.*):(.*):(.*):(.*):(.*):(.*)$} \\\n"
+" $client m0 m1 m2 m3 m4 m5 m6]} {\n"
+" # id:ip:port:hostname:input:loginvo\n"
+" set host $m4\n"
+" regsub {\\..*$} $host \"\" host\n"
+" set clabel \"$host $m1\"\n"
+" } else {\n"
+" regsub {:.*$} $client \"\" clabel\n"
+" }\n"
+" $subm add command -label \"$clabel\" \\\n"
+" -command \"client_dialog $client\"\n"
" incr count\n"
" }\n"
-" $subm entryconfigure 0 -label \"#clients: $count\"\n"
+" $subm entryconfigure 0 -label \"num-clients: $count\"\n"
"}\n"
"\n"
"proc set_widgets {} {\n"
@@ -2082,7 +2403,7 @@
" pack $df -side top -fill x\n"
"\n"
" # text area\n"
-" text .text -height 11 -relief ridge -font $ffont\n"
+" text .text -height 12 -relief ridge -font $ffont\n"
" set text_area .text\n"
" pack .text -side top -fill both -expand 1\n"
"\n"
@@ -2628,7 +2949,7 @@
"\n"
"set_template\n"
"\n"
-"wm title . \"tkx11vnc\"\n"
+"set_name \"tkx11vnc\"\n"
"make_widgets;\n"
"\n"
"menu_bindings;\n"