diff options
author | runge <runge> | 2006-03-06 16:29:35 +0000 |
---|---|---|
committer | runge <runge> | 2006-03-06 16:29:35 +0000 |
commit | c997e901c4c268438d063a78bdb121b8f5e8d585 (patch) | |
tree | 16f4ecab62e214d9348c9f7fcb008b2af609ada8 /x11vnc/tkx11vnc.h | |
parent | a9a9c812f7feb5bfb1d017575762c6a6390227b9 (diff) | |
download | libtdevnc-c997e901c4c268438d063a78bdb121b8f5e8d585.tar.gz libtdevnc-c997e901c4c268438d063a78bdb121b8f5e8d585.zip |
x11vnc: gui speedup and fixes. -unixpw and -inetd
Diffstat (limited to 'x11vnc/tkx11vnc.h')
-rw-r--r-- | x11vnc/tkx11vnc.h | 168 |
1 files changed, 133 insertions, 35 deletions
diff --git a/x11vnc/tkx11vnc.h b/x11vnc/tkx11vnc.h index ac0c574..e9f120b 100644 --- a/x11vnc/tkx11vnc.h +++ b/x11vnc/tkx11vnc.h @@ -67,6 +67,30 @@ char gui_code[] = ""; "# -- means add a separator\n" "#\n" "\n" +"global env started time_count\n" +"set started \"\"\n" +"proc dtime {{msg \"\"}} {\n" +" global started time_count\n" +" if {$started == \"\"} {\n" +" return\n" +" }\n" +" set diff [expr \"[exec gtod.bin] - $started\"]\n" +" set diff [format \"%.2f\" $diff]\n" +" incr time_count\n" +" if {$msg == \"\"} {\n" +" set msg $time_count\n" +" }\n" +" puts -nonewline stderr \"$msg $diff \" \n" +" puts stderr [clock format [clock seconds]]\n" +"}\n" +"\n" +"if [info exists env(X11VNC_GUI_TIME)] {\n" +" global started time_count\n" +" set started [exec gtod.bin]\n" +" set time_count 0\n" +" dtime \"S\"\n" +"}\n" +"\n" "proc set_template {} {\n" " global template\n" " set template \"\n" @@ -1757,7 +1781,6 @@ char gui_code[] = ""; "\n" "proc push_new_value {item name new {query 1}} {\n" " global menu_var always_update remote_output query_output\n" -" global delay_sleep extra_sleep extra_sleep_split\n" " global query_result_list\n" "\n" " set debug [in_debug_mode]\n" @@ -2996,7 +3019,6 @@ char gui_code[] = ""; "\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" @@ -3420,9 +3442,9 @@ char gui_code[] = ""; " set count 0\n" " foreach client [split $list \",\"] {\n" " if {![regexp {^[a-z0-9]*[a-z0-9]:} $client]} {\n" -" append_text \"Skipping client line: \"\n" -" append_text $client\n" -" append_text \"\\n\"\n" +" #append_text \"Skipping client line: \"\n" +" #append_text $client\n" +" #append_text \"\\n\"\n" " continue\n" " }\n" " regsub -all {[{}()~!$&*|;'\"`{}<>\\[\\]]} $client \"\" client\n" @@ -3989,9 +4011,15 @@ char gui_code[] = ""; " global have_labelframes ffont bfont\n" " global props_buttons icon_noadvanced\n" " global icon_mode icon_mode_at_startup\n" +" global screen_height screen_width\n" "\n" " check_update_vars\n" "\n" +" set pady 1m\n" +" if {$screen_height <= 360} {\n" +" set pady 0m\n" +" }\n" +"\n" " if [info exists menu_var(deny)] {\n" " if {$menu_var(deny) == $unset_str || $menu_var(deny) == 0} {\n" " set props_accept 1\n" @@ -4098,7 +4126,7 @@ char gui_code[] = ""; " pack $vp.l -fill x -expand 1 -padx 1m -pady 0m -side top\n" " }\n" " entry $vp.e -show \"*\" -textvariable props_viewpasswd -font $bfont\n" -" pack $vp.e -fill x -expand 1 -padx 1m -pady 1m -side top\n" +" pack $vp.e -fill x -expand 1 -padx 1m -pady $pady -side top\n" "\n" "\n" " lappend props_buttons $vp.e\n" @@ -4113,7 +4141,7 @@ char gui_code[] = ""; " pack $pw.l -fill x -expand 1 -padx 1m -pady 0m -side top\n" " }\n" " entry $pw.e -show \"*\" -textvariable props_passwd -font $bfont\n" -" pack $pw.e -fill x -expand 1 -padx 1m -pady 1m -side top\n" +" pack $pw.e -fill x -expand 1 -padx 1m -pady $pady -side top\n" "\n" " if {! $icon_mode_at_startup} {\n" " $vp.e configure -state disabled\n" @@ -4132,31 +4160,31 @@ char gui_code[] = ""; " frame $sh\n" " checkbutton $sh.button -text \"Shared\" \\\n" " -variable props_shared -anchor w -font $bfont\n" -" pack $sh.button -fill x -expand 1 -padx 1m -pady 1m\n" +" pack $sh.button -fill x -expand 1 -padx 1m -pady $pady\n" "\n" " set vo \"$w.viewonly\"\n" " frame $vo\n" " checkbutton $vo.button -text \"All Clients ViewOnly\" \\\n" " -variable props_viewonly -anchor w -font $bfont\n" -" pack $vo.button -fill x -expand 1 -padx 1m -pady 1m\n" +" pack $vo.button -fill x -expand 1 -padx 1m -pady $pady\n" "\n" " set cf \"$w.confirm\"\n" " frame $cf\n" " checkbutton $cf.button -text \"Ask for Confirmation\" \\\n" " -variable props_confirm -anchor w -font $bfont\n" -" pack $cf.button -fill x -expand 1 -padx 1m -pady 1m\n" +" pack $cf.button -fill x -expand 1 -padx 1m -pady $pady\n" "\n" " set ac \"$w.accept\"\n" " frame $ac\n" " checkbutton $ac.button -text \"Accept Connections\" \\\n" " -variable props_accept -anchor w -font $bfont\n" -" pack $ac.button -fill x -expand 1 -padx 1m -pady 1m\n" +" pack $ac.button -fill x -expand 1 -padx 1m -pady $pady\n" "\n" " set px \"6m\"\n" -" pack $b1 -side bottom -fill x -pady 1m -padx $px\n" -" pack $b2 -side bottom -fill x -pady 1m -padx $px\n" -" pack $vp -side bottom -fill x -pady 1m -padx $px\n" -" pack $pw -side bottom -fill x -pady 1m -padx $px\n" +" pack $b1 -side bottom -fill x -pady $pady -padx $px\n" +" pack $b2 -side bottom -fill x -pady $pady -padx $px\n" +" pack $vp -side bottom -fill x -pady $pady -padx $px\n" +" pack $pw -side bottom -fill x -pady $pady -padx $px\n" " pack $sh -side bottom -fill x -pady 0m -padx $px\n" " pack $vo -side bottom -fill x -pady 0m -padx $px\n" " pack $cf -side bottom -fill x -pady 0m -padx $px\n" @@ -4169,7 +4197,8 @@ char gui_code[] = ""; " set ms \"$w.msg\"\n" " text $ms -font $ffont -relief ridge -width $tw -height $th\n" " $ms insert 1.0 $msg\n" -" pack $ms -side bottom -fill x -pady 1m -padx $px\n" +" pack $ms -side bottom -fill x -pady $pady -padx $px\n" +" update\n" " }\n" "\n" " lappend props_buttons $ac.button $cf.button $vo.button $sh.button\n" @@ -4357,7 +4386,10 @@ char gui_code[] = ""; " catch {file delete $x11vnc_client_file}\n" " set read_client_info_lock 0\n" " clean_icon_exit\n" -" } elseif {$str != \"skip\"} {\n" +" } elseif {$str == \"skip\"} {\n" +" ;\n" +" } elseif [regexp {^clients:} $str] {\n" +" regsub {^clients:} $str \"\" str\n" " if {$str == \"none\"} {\n" " set str \"\"\n" " }\n" @@ -4498,6 +4530,7 @@ char gui_code[] = ""; " global x11vnc_xdisplay0 menu_var\n" "\n" " set db 0\n" +"#dtime t1\n" " set start 13037\n" " set tries 100\n" " set socket_got_callback 0\n" @@ -4548,8 +4581,12 @@ char gui_code[] = ""; " append_text \"try_client_info_sock: server socket failed.\\n\"\n" " return\n" " }\n" -" run_remote_cmd [list \"-nosync\" \"-R\" \"noop\"]\n" -" after 500\n" +" if {! $x11vnc_started} {\n" +" run_remote_cmd [list \"-nosync\" \"-R\" \"noop\"]\n" +" if {$db} {dtime A}\n" +" after 250\n" +" if {$db} {dtime A}\n" +" }\n" "\n" " # set the cookie to some obscured randomness\n" " set socket_cookie [clock clicks]\n" @@ -4568,8 +4605,18 @@ char gui_code[] = ""; " }\n" " run_remote_cmd [list \"-nosync\" \"-R\" \\\n" " \"client_info_sock:$myaddr:$port:$socket_cookie\"]\n" +"#dtime t2\n" " if {$db} {puts \"client_info_sock:$myaddr:$port:$socket_cookie\"}\n" -" after 500\n" +" for {set i 0} {$i < 10} {incr i} {\n" +" after 50\n" +" update; update idletasks\n" +"#dtime aa\n" +" if {$socket_got_callback != 0} {\n" +"#puts \"break-\"\n" +" break\n" +" }\n" +" }\n" +"#dtime t3\n" "\n" " set aftid \"\"\n" " if {$socket_got_callback == 0} {\n" @@ -4587,6 +4634,7 @@ char gui_code[] = ""; " } else {\n" " setup_client_sock 1\n" " }\n" +"#dtime t4\n" "}\n" "\n" "proc set_icon_label {} {\n" @@ -5033,10 +5081,14 @@ char gui_code[] = ""; " global helptext helpremote helplabel\n" " global icon_mode icon_win props_win full_win\n" " global top_widget_names\n" +" global screen_height screen_width\n" "\n" "\n" " # Make the top label\n" " set label_width 80\n" +" if {$screen_width <= 400} {\n" +" set label_width 64\n" +" }\n" " set info_label \"$top.info\"\n" " label $info_label -textvariable info_str -bd 2 -relief groove \\\n" " -anchor w -width $label_width -font $ffont\n" @@ -5135,8 +5187,14 @@ char gui_code[] = ""; " pack $df -side top -fill x\n" "\n" " # text area\n" +" global text_height\n" " set text_area \"$top.text\"\n" -" text $text_area -height 12 -relief ridge -font $ffont\n" +" if {$screen_width <= 400} {\n" +" text $text_area -height $text_height -width $label_width \\\n" +" -relief ridge -font $ffont\n" +" } else {\n" +" text $text_area -height $text_height -relief ridge -font $ffont\n" +" }\n" " pack $text_area -side top -fill both -expand 1\n" " set top_widget_names(text) $text_area\n" "\n" @@ -5705,6 +5763,24 @@ char gui_code[] = ""; " if {$db} {puts stderr \"run_remote_cmd_via_sock: \\\"$res\\\"\"}\n" " set res [string trim $res]\n" "\n" +" if [regexp {^clients:} $res] {\n" +" regsub {^clients:} $res \"\" tmp\n" +" if {$tmp == \"none\"} {\n" +" set tmp \"\"\n" +" }\n" +" update_clients_menu $tmp\n" +" set client_str $tmp\n" +" set_client_balloon $tmp\n" +"\n" +" if ![regexp {^clients} $opt] {\n" +" # we could block here...\n" +" if {$db} {puts stderr \"run_remote_cmd_via_sock: gets\"}\n" +" gets $client_sock res\n" +" if {$db} {puts stderr \"run_remote_cmd_via_sock: \\\"$res\\\"\"}\n" +" set res [string trim $res]\n" +" }\n" +" }\n" +"\n" " set docmd \"\"\n" "\n" " if {$res != \"\"} {\n" @@ -5817,6 +5893,7 @@ char gui_code[] = ""; " global menu_var unset_str\n" "\n" " set db 0\n" +"#dtime c1\n" "\n" " if {! $connected_to_x11vnc} {\n" " if {[info exists menu_var(display)]} {\n" @@ -5831,6 +5908,7 @@ char gui_code[] = ""; " set_info \"Pinging $x11vnc_xdisplay ...\"\n" " set rargs [list \"-Q\" \"ping\"]\n" " set result [run_remote_cmd $rargs]\n" +"#dtime c2a\n" "\n" " if {$db} {puts \"try_connect: \\\"$result\\\"\"}\n" "\n" @@ -5842,10 +5920,12 @@ char gui_code[] = ""; " set_connected yes\n" "\n" " setup_client_channel\n" +"#dtime c2b\n" " setup_client_sock 1\n" " setup_client_tail\n" "\n" " fetch_displays\n" +"#dtime c3a\n" " return 1\n" " } else {\n" " set str \"x11vnc server.\"\n" @@ -6018,6 +6098,10 @@ char gui_code[] = ""; "############################################################################\n" "# main:\n" "\n" +"if [info exists env(X11VNC_GUI_TIME)] {\n" +" dtime M\n" +"}\n" +"\n" "wm withdraw .\n" "\n" "global env x11vnc_prog x11vnc_cmdline x11vnc_xdisplay x11vnc_connect;\n" @@ -6028,10 +6112,10 @@ char gui_code[] = ""; "global helpall helptext helpremote helplabel hostname osname\n" "global all_settings reply_xdisplay always_update\n" "global max_text_height max_text_width\n" +"global text_height\n" "global menu_var unset_str menus_disabled\n" "global bfont ffont sfont snfont old_labels have_labelframes\n" "global connected_to_x11vnc\n" -"global delay_sleep extra_sleep extra_sleep_split\n" "global cache_all_query_vars\n" "global last_query_all_time query_all_freq client_tail client_sock client_info_read\n" "global icon_mode icon_mode_at_startup\n" @@ -6039,6 +6123,7 @@ char gui_code[] = ""; "global icon_noadvanced icon_minimal\n" "global make_gui_count text_area_str\n" "global gui_argv0 gui_start_mode\n" +"global screen_height screen_width\n" "\n" "set unset_str \"(unset)\"\n" "set vnc_url $unset_str\n" @@ -6046,6 +6131,7 @@ char gui_code[] = ""; "set menus_disabled 0\n" "set max_text_height 40\n" "set max_text_width 90\n" +"set text_height 14\n" "set bfont \"-adobe-helvetica-bold-r-*-*-*-120-*-*-*-*-*-*\"\n" "set sfont \"-adobe-helvetica-bold-r-*-*-*-100-*-*-*-*-*-*\"\n" "set snfont \"-adobe-helvetica-medium-r-*-*-*-100-*-*-*-*-*-*\"\n" @@ -6065,11 +6151,6 @@ char gui_code[] = ""; "set gui_argv0 $argv0\n" "set gui_start_mode \"\"\n" "\n" -"# these are no longer used under x11vnc -sync:\n" -"set delay_sleep 350\n" -"set extra_sleep 1000\n" -"set extra_sleep_split 4\n" -"\n" "if {$tk_version < 8.0} {\n" " puts stderr \"\"\n" " puts stderr \"*** tkx11vnc: tk version is old $tk_version, please use 8.0 or higher.\"\n" @@ -6086,6 +6167,19 @@ char gui_code[] = ""; " set have_labelframes 0\n" "}\n" "\n" +"set screen_height [winfo screenheight .]\n" +"set screen_width [winfo screenwidth .]\n" +"if {$screen_height < 500} {\n" +" # short screen, PDA?\n" +" set max_text_height 22\n" +" set text_height 13\n" +" if {$screen_height <= 360} {\n" +" # very short.\n" +" set max_text_height 16\n" +" set max_text_width 60\n" +" set text_height 11\n" +" }\n" +"}\n" "if {[info exists env(X11VNC_GUI_TEXT_HEIGHT)]} {\n" " set max_text_height $env(X11VNC_GUI_TEXT_HEIGHT)\n" "}\n" @@ -6141,7 +6235,7 @@ char gui_code[] = ""; " if {$client_tail != \"\"} {\n" " gets $client_tail tmp\n" " if [eof $client_tail] {\n" -"puts \"eof $client_tail\"\n" +"#puts \"eof $client_tail\"\n" " clean_client_tail\n" " set client_tail \"\"\n" " }\n" @@ -6310,27 +6404,31 @@ char gui_code[] = ""; "\n" "get_default_vars\n" "\n" +"dtime D\n" +"\n" "if {$icon_mode} {\n" " if {$tray_embed} {\n" " make_gui \"tray\"\n" " } else {\n" " make_gui \"icon\"\n" " }\n" +" dtime G\n" " old_balloon\n" " if {$icon_setpasswd} {\n" -" set m \"You must specify a Session\\n\" \n" -" set m \"${m}Password before VNC clients can\\n\" \n" -" set m \"${m}connect. Enter one in the Password\\n\" \n" -" set m \"${m}field and then Press \\\"OK\\\". This\\n\" \n" -" set m \"${m}password is not stored, it is only\\n\" \n" -" set m \"${m}used for this x11vnc session.\\n\" \n" +" set m \"You must specify a Session Password\\n\" \n" +" set m \"${m}before VNC clients can connect.\\n\" \n" +" set m \"${m}Enter one in the Password field\\n\" \n" +" set m \"${m}and Press \\\"OK\\\". The password(s) is\\n\" \n" +" set m \"${m}only for this x11vnc session.\\n\" \n" " do_props $m\n" -" push_new_value \"unlock\" \"unlock\" 1 0\n" +" #push_new_value \"unlock\" \"unlock\" 1 0\n" " }\n" "} else {\n" " make_gui \"full\"\n" +" dtime G\n" "}\n" "\n" +"\n" "# main loop.\n" #endif /* ifdef NOGUI */ |