summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrunge <runge>2008-05-12 00:53:11 +0000
committerrunge <runge>2008-05-12 00:53:11 +0000
commitb2306270d0e356108fde0a0710fefa5acb38f6e7 (patch)
tree65695b420f242840d2103bfaa9fb0fc5885bb7c4
parentabbdf92a704790374a12d6da5125b4e95595aaac (diff)
downloadlibtdevnc-b2306270.tar.gz
libtdevnc-b2306270.zip
Many improvement to the frontend and unix viewer. UltraVNC proxy support,
and other proxy improvements.
-rw-r--r--x11vnc/misc/enhanced_tightvnc_viewer/README1
-rwxr-xr-xx11vnc/misc/enhanced_tightvnc_viewer/Windows/util/connect_br.tcl148
-rwxr-xr-xx11vnc/misc/enhanced_tightvnc_viewer/bin/ssvnc7
-rwxr-xr-xx11vnc/misc/enhanced_tightvnc_viewer/bin/ssvnc_cmd7
-rwxr-xr-xx11vnc/misc/enhanced_tightvnc_viewer/bin/util/ss_vncviewer374
-rwxr-xr-xx11vnc/misc/enhanced_tightvnc_viewer/bin/util/ssvnc.tcl524
-rw-r--r--x11vnc/misc/enhanced_tightvnc_viewer/src/patches/tight-vncviewer-full.patch1234
7 files changed, 1805 insertions, 490 deletions
diff --git a/x11vnc/misc/enhanced_tightvnc_viewer/README b/x11vnc/misc/enhanced_tightvnc_viewer/README
index 3f0c645..69f1d12 100644
--- a/x11vnc/misc/enhanced_tightvnc_viewer/README
+++ b/x11vnc/misc/enhanced_tightvnc_viewer/README
@@ -196,6 +196,7 @@ Unix and Mac OS X:
have the XDarwin X server installed, you can set DISPLAY before starting
ssvnc (or type DISPLAY=... in Host:Disp and hit Return). Then our
enhanced TightVNC viewer will be used instead of COTVNC.
+ Update: there is now a 'Use X11 vncviewer on MacOSX' under Options ...
If you want a SSH-only tool (without the distractions of SSL) run
diff --git a/x11vnc/misc/enhanced_tightvnc_viewer/Windows/util/connect_br.tcl b/x11vnc/misc/enhanced_tightvnc_viewer/Windows/util/connect_br.tcl
index a20b6bf..fcf140d 100755
--- a/x11vnc/misc/enhanced_tightvnc_viewer/Windows/util/connect_br.tcl
+++ b/x11vnc/misc/enhanced_tightvnc_viewer/Windows/util/connect_br.tcl
@@ -1,4 +1,5 @@
#!/usr/bin/wish
+
proc check_callback {} {
global debug
if {$debug} {
@@ -20,6 +21,11 @@ proc getout {} {
after $delay
catch {close $server_fh}
after $delay
+
+ global bmesg_cnt
+ if [info exists bmesg_cnt] {
+ catch {tkwait window .bmesg$bmesg_cnt}
+ }
destroy .
exit
}
@@ -48,7 +54,8 @@ proc check_closed {} {
proc xfer_in_to_out {} {
global client_fh server_fh debug
if {$client_fh != "" && ![eof $client_fh]} {
- set str [read $client_fh 4096]
+ set str ""
+ catch {set str [read $client_fh 4096]}
if {$debug} {
puts stderr "xfer_in_to_out: $str"
}
@@ -63,7 +70,8 @@ proc xfer_in_to_out {} {
proc xfer_out_to_in {} {
global client_fh server_fh debug
if {$server_fh != "" && ![eof $server_fh]} {
- set str [read $server_fh 4096]
+ set str ""
+ catch {set str [read $server_fh 4096]}
if {$debug} {
puts stderr "xfer_out_to_in: $str"
}
@@ -75,6 +83,22 @@ proc xfer_out_to_in {} {
check_closed
}
+proc bmesg {msg} {
+ return
+
+ global bmesg_cnt
+ if {! [info exists bmesg_cnt]} {
+ set bmesg_cnt 0
+ }
+ incr bmesg_cnt
+ set w .bmesg$bmesg_cnt
+ catch {destroy $w}
+ toplevel $w
+ label $w.l -width 70 -text "$msg"
+ pack $w.l
+ update
+}
+
proc do_connect_http {sock hostport which} {
global debug cur_proxy
set con ""
@@ -83,6 +107,7 @@ proc do_connect_http {sock hostport which} {
append con "Connection: close\r\n\r\n"
puts stderr "pxy=$which CONNECT $hostport HTTP/1.1 via $cur_proxy"
+ bmesg "H: $which CONNECT $hostport HTTP/1.1 $cur_proxy";
puts -nonewline $sock $con
flush $sock
@@ -323,6 +348,38 @@ proc do_connect_socks5 {sock hostport which} {
}
}
+proc do_connect_repeater {sock hostport which repeater} {
+ global debug cur_proxy
+
+ # 250 is UltraVNC buffer size.
+ set con [binary format a250 $repeater]
+
+ puts stderr "pxy=$which REPEATER $repeater via $cur_proxy"
+ bmesg "R: $which CONNECT $hostport | $repeater $cur_proxy";
+
+ puts -nonewline $sock $con
+ flush $sock
+
+ set r ""
+ set cnt 0
+ while {1} {
+ incr cnt
+ set c [read $sock 1]
+ if {$c == ""} {
+ check_closed
+ after 20
+ }
+ append r $c
+ if {[string length $r] >= 12} {
+ puts stderr "do_connect_repeater: $r"
+ break
+ }
+ if {$cnt > 30000} {
+ break
+ }
+ }
+}
+
proc do_connect {sock type hostport which} {
if {$type == "http"} {
do_connect_http $sock $hostport $which
@@ -330,6 +387,9 @@ proc do_connect {sock type hostport which} {
do_connect_socks4 $sock $hostport $which
} elseif {$type == "socks5"} {
do_connect_socks5 $sock $hostport $which
+ } elseif [regexp -nocase {^repeater:} $type] {
+ regsub -nocase {^repeater:} $type "" repeater
+ do_connect_repeater $sock $hostport $which $repeater
}
}
@@ -376,11 +436,11 @@ proc handle_connection {fh host port} {
set cur_proxy $proxy1
if {$proxy2 != ""} {
- do_connect $sock $proxy1_type $proxy2 1
+ do_connect $sock $proxy1_type "$proxy2_host:$proxy2_port" 1
set cur_proxy $proxy2
if {$proxy3 != ""} {
- do_connect $sock $proxy2_type $proxy3 2
+ do_connect $sock $proxy2_type "$proxy3_host:$proxy3_port" 2
set cur_proxy $proxy3
do_connect $sock $proxy3_type $dest 3
@@ -406,11 +466,22 @@ proc proxy_type {proxy} {
return "http"
} elseif [regexp -nocase {^https://} $proxy] {
return "http"
+ } elseif [regexp -nocase {^repeater://.*\+(.*)$} $proxy mat idstr] {
+ return "repeater:$idstr"
} else {
return "http"
}
}
+proc proxy_hostport {proxy} {
+ regsub -nocase {^[a-z][a-z]*://} $proxy "" hp
+ regsub {\+.*$} $hp "" hp
+ if {! [regexp {:[0-9]} $hp] && [regexp {^repeater:} $proxy]} {
+ set hp "$hp:5900"
+ }
+ return $hp
+}
+
global env
set proxy1 ""
@@ -437,7 +508,7 @@ if {$debug} {
if {! [info exists env(SSVNC_PROXY)]} {
destroy .; exit;
}
- if {! [info exists env(SSVNC_LISTEN)]} {
+ if {! [info exists env(SSVNC_LISTEN)] && ! [info exists env(SSVNC_REVERSE)]} {
destroy .; exit;
}
}
@@ -453,10 +524,10 @@ if [regexp {,} $env(SSVNC_PROXY)] {
set proxy1 $env(SSVNC_PROXY)
}
-set proxy1_type [proxy_type $proxy1]
-regsub {^[A-z0-9][A-z0-9]*://} $proxy1 "" proxy1
+set proxy1_type [proxy_type $proxy1]
+set proxy1_hp [proxy_hostport $proxy1]
-set s [split $proxy1 ":"]
+set s [split $proxy1_hp ":"]
set proxy1_host [lindex $s 0]
set proxy1_port [lindex $s 1]
@@ -464,39 +535,58 @@ set proxy2_type ""
set proxy2_host ""
set proxy2_port ""
-set proxy3_type ""
-set proxy3_host ""
-set proxy3_port ""
-
if {$proxy2 != ""} {
- set proxy2_type [proxy_type $proxy2]
- regsub {^[A-z0-9][A-z0-9]*://} $proxy2 "" proxy2
- set s [split $proxy2 ":"]
+ set proxy2_type [proxy_type $proxy2]
+ set proxy2_hp [proxy_hostport $proxy2]
+ set s [split $proxy2_hp ":"]
set proxy2_host [lindex $s 0]
set proxy2_port [lindex $s 1]
}
+set proxy3_type ""
+set proxy3_host ""
+set proxy3_port ""
+
if {$proxy3 != ""} {
- set proxy3_type [proxy_type $proxy3]
- regsub {^[A-z0-9][A-z0-9]*://} $proxy3 "" proxy3
- set s [split $proxy3 ":"]
+ set proxy3_type [proxy_type $proxy3]
+ set proxy3_hp [proxy_hostport $proxy3]
+ set s [split $proxy3_hp ":"]
set proxy3_host [lindex $s 0]
set proxy3_port [lindex $s 1]
}
-set lport $env(SSVNC_LISTEN)
+bmesg "1: '$proxy1_host' '$proxy1_port' '$proxy1_type'";
+bmesg "2: '$proxy2_host' '$proxy2_port' '$proxy2_type'";
+bmesg "3: '$proxy3_host' '$proxy3_port' '$proxy3_type'";
set got_connection 0
-set rc [catch {set lsock [socket -myaddr 127.0.0.1 -server handle_connection $lport]}]
-if {$rc != 0} {
- puts stderr "error listening"
- destroy .
- exit
-}
-if {1} {
+proc setb {} {
wm withdraw .
+ button .b -text "CONNECT_BR" -command {destroy .}
+ pack .b
+ after 1000 check_callback
+}
+
+if [info exists env(SSVNC_REVERSE)] {
+ set s [split $env(SSVNC_REVERSE) ":"]
+ set rhost [lindex $s 0]
+ set rport [lindex $s 1]
+ set rc [catch {set lsock [socket $rhost $rport]}]
+ if {$rc != 0} {
+ puts stderr "error reversing"
+ destroy .; exit 1
+ }
+ puts stderr "SSVNC_REVERSE to $rhost $rport OK";
+ setb
+ handle_connection $lsock $rhost $rport
+} else {
+ set lport $env(SSVNC_LISTEN)
+ set rc [catch {set lsock [socket -myaddr 127.0.0.1 -server handle_connection $lport]}]
+ if {$rc != 0} {
+ puts stderr "error listening"
+ destroy .; exit 1
+ }
+ puts stderr "SSVNC_LISTEN on $lport OK";
+ setb
}
-button .b -text "CONNECT_BR" -command {destroy .}
-pack .b
-after 1000 check_callback
diff --git a/x11vnc/misc/enhanced_tightvnc_viewer/bin/ssvnc b/x11vnc/misc/enhanced_tightvnc_viewer/bin/ssvnc
index f5d4d3f..a9753ce 100755
--- a/x11vnc/misc/enhanced_tightvnc_viewer/bin/ssvnc
+++ b/x11vnc/misc/enhanced_tightvnc_viewer/bin/ssvnc
@@ -52,10 +52,15 @@ if [ "X$name" = "X" ]; then
name=`uname -sm | sed -e 's/ /./g' -e 's,/.*,,' -e 's/Linux\.i.86/Linux.i686/'`
fi
+dL="-L"
+if uname -sr | egrep 'SunOS 5\.[5-8]' > /dev/null; then
+ dL="-h"
+fi
+
f="$0"
for t in 1 2 3 4 5
do
- if [ -L "$f" ]; then
+ if [ $dL "$f" ]; then
f0="$f"
f=`ls -l "$f" | sed -e 's/^.* -> //'`
if echo "$f" | grep '^/' > /dev/null; then
diff --git a/x11vnc/misc/enhanced_tightvnc_viewer/bin/ssvnc_cmd b/x11vnc/misc/enhanced_tightvnc_viewer/bin/ssvnc_cmd
index de1d255..7f01a22 100755
--- a/x11vnc/misc/enhanced_tightvnc_viewer/bin/ssvnc_cmd
+++ b/x11vnc/misc/enhanced_tightvnc_viewer/bin/ssvnc_cmd
@@ -123,10 +123,15 @@ if [ "X$name" = "X" ]; then
name=`uname -sm | sed -e 's/ /./g' -e 's,/.*,,' -e 's/Linux\.i.86/Linux.i686/'`
fi
+dL="-L"
+if uname -sr | egrep 'SunOS 5\.[5-8]' > /dev/null; then
+ dL="-h"
+fi
+
f="$0"
for t in 1 2 3 4 5 6
do
- if [ -L "$f" ]; then
+ if [ $dL "$f" ]; then
f0="$f"
f=`ls -l "$f" | sed -e 's/^.* -> //'`
if echo "$f" | grep '^/' > /dev/null; then
diff --git a/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ss_vncviewer b/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ss_vncviewer
index cffe6df..6becd63 100755
--- a/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ss_vncviewer
+++ b/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ss_vncviewer
@@ -3,7 +3,7 @@
# ss_vncviewer: wrapper for vncviewer to use an stunnel SSL tunnel
# or an SSH tunnel.
#
-# Copyright (c) 2006-2007 by Karl J. Runge <runge@karlrunge.com>
+# Copyright (c) 2006-2008 by Karl J. Runge <runge@karlrunge.com>
#
# You must have stunnel(8) installed on the system and in your PATH
# (however, see the -ssh option below, in which case you will need ssh(1)
@@ -39,7 +39,7 @@
# and then a 2nd CONNECT to the destination VNC server.)
#
# Use socks://host:port, socks4://host:port, or socks5://host,port
-# to force usage of a SOCKS proxy.
+# to force usage of a SOCKS proxy. Also repeater://host:port.
#
# -showcert Only fetch the certificate using the 'openssl s_client'
# command (openssl(1) must in installed).
@@ -259,8 +259,12 @@ if [ "X$reverse" != "X" ]; then
# check proxy usage under reverse connection:
if [ "X$use_ssh" = "X" -a "X$use_sshssl" = "X" ]; then
echo ""
- echo "*Warning*: SSL -listen and a Web proxy does not make sense."
- sleep 3
+ if echo "$proxy" | egrep "repeater://" > /dev/null; then
+ :
+ else
+ echo "*Warning*: SSL -listen and a Web proxy does not make sense."
+ sleep 3
+ fi
elif echo "$proxy" | grep "," > /dev/null; then
:
else
@@ -502,6 +506,11 @@ rchk() {
}
rchk
+dL="-L"
+if uname -sr | egrep 'SunOS 5\.[5-8]' > /dev/null; then
+ dL="-h"
+fi
+
# a portable, but not absolutely safe, tmp file creator
mytmp() {
tf=$1
@@ -509,7 +518,7 @@ mytmp() {
if [ -d "$tf" ]; then
echo "tmp file $tf still exists as a directory."
exit 1
- elif [ -L "$tf" ]; then
+ elif [ $dL "$tf" ]; then
echo "tmp file $tf still exists as a symlink."
exit 1
elif [ -f "$tf" ]; then
@@ -564,50 +573,43 @@ pcode() {
use IO::Socket::INET;
-my ($first, $second, $third) = split(/,/, $ENV{PPROXY_PROXY}, 3);
+if (exists $ENV{PPROXY_SLEEP}) {
+ print STDERR "PPROXY_PID: $$\n";
+ sleep $ENV{PPROXY_SLEEP};
+}
-if ($first =~ m,^socks4?://(\S*)$,i) {
- $ENV{PPROXY_SOCKS} = 1;
- $first = $1;
-} elsif ($first =~ m,^socks5://(\S*)$,i) {
- $ENV{PPROXY_SOCKS} = 5;
- $first = $1;
-} elsif ($first =~ m,^https?://(\S*)$,i) {
- $ENV{PPROXY_SOCKS} = "";
- $first = $1;
+foreach my $var (qw(PPROXY_PROXY PPROXY_SOCKS PPROXY_DEST PPROXY_LISTEN
+ PPROXY_REVERSE PPROXY_REPEATER PPROXY_REMOVE PPROXY_KILLPID PPROXY_SLEEP)) {
+ if (0 || $ENV{SS_DEBUG}) {
+ print STDERR "$var: $ENV{$var}\n";
+ }
+}
+
+if ($ENV{PPROXY_SOCKS} ne "" && $ENV{PPROXY_PROXY} !~ m,^socks5?://,i) {
+ if ($ENV{PPROXY_SOCKS} eq "5") {
+ $ENV{PPROXY_PROXY} = "socks5://$ENV{PPROXY_PROXY}";
+ } else {
+ $ENV{PPROXY_PROXY} = "socks://$ENV{PPROXY_PROXY}";
+ }
}
+my ($first, $second, $third) = split(/,/, $ENV{PPROXY_PROXY}, 3);
+my ($mode_1st, $mode_2nd, $mode_3rd) = ("", "", "");
+
+($first, $mode_1st) = url_parse($first);
+
my ($proxy_host, $proxy_port) = split(/:/, $first);
my $connect = $ENV{PPROXY_DEST};
-my $mode_2nd = "";
if ($second ne "") {
- if ($second =~ m,^socks4?://(\S*)$,i) {
- $mode_2nd = "socks4";
- $second = $1;
- } elsif ($second =~ m,^socks5://(\S*)$,i) {
- $mode_2nd = "socks5";
- $second = $1;
- } elsif ($second =~ m,^https?://(\S*)$,i) {
- $mode_2nd = "http";
- $second = $1;
- }
+ ($second, $mode_2nd) = url_parse($second);
}
-my $mode_3rd = "";
if ($third ne "") {
- if ($third =~ m,^socks4?://(\S*)$,i) {
- $mode_3rd = "socks4";
- $third = $1;
- } elsif ($third =~ m,^socks5://(\S*)$,i) {
- $mode_3rd = "socks5";
- $third = $1;
- } elsif ($third =~ m,^https?://(\S*)$,i) {
- $mode_3rd = "http";
- $third = $1;
- }
+ ($third, $mode_3rd) = url_parse($third);
}
+
print STDERR "\n";
print STDERR "PPROXY v0.2: a tool for Web proxies and SOCKS connections.\n";
print STDERR "proxy_host: $proxy_host\n";
@@ -615,10 +617,29 @@ print STDERR "proxy_port: $proxy_port\n";
print STDERR "proxy_connect: $connect\n";
print STDERR "pproxy_params: $ENV{PPROXY_PROXY}\n";
print STDERR "pproxy_listen: $ENV{PPROXY_LISTEN}\n";
+print STDERR "pproxy_reverse: $ENV{PPROXY_REVERSE}\n";
print STDERR "\n";
+if (1) {
+ print STDERR "pproxy 1st: $first\t- $mode_1st\n";
+ print STDERR "pproxy 2nd: $second\t- $mode_2nd\n";
+ print STDERR "pproxy 3rd: $third\t- $mode_3rd\n";
+ print STDERR "\n";
+}
my $listen_handle = "";
-if ($ENV{PPROXY_LISTEN} != "") {
+if ($ENV{PPROXY_REVERSE} ne "") {
+ my ($rhost, $rport) = split(/:/, $ENV{PPROXY_REVERSE});
+ $rport = 5900 unless $rport;
+ $listen_handle = IO::Socket::INET->new(
+ PeerAddr => $rhost,
+ PeerPort => $rport,
+ Proto => "tcp"
+ );
+ if (! $listen_handle) {
+ die "pproxy: $! -- PPROXY_REVERSE\n";
+ }
+ print STDERR "PPROXY_REVERSE: connected to $rhost $rport\n";
+} elsif ($ENV{PPROXY_LISTEN} ne "") {
my $listen_sock = IO::Socket::INET->new(
Listen => 2,
LocalAddr => "localhost",
@@ -626,7 +647,7 @@ if ($ENV{PPROXY_LISTEN} != "") {
Proto => "tcp"
);
if (! $listen_sock) {
- die "pproxy: $!\n";
+ die "pproxy: $! -- PPROXY_LISTEN\n";
}
my $ip;
($listen_handle, $ip) = $listen_sock->accept();
@@ -647,6 +668,112 @@ if (! $sock) {
die "pproxy: $err\n";
}
+unlink($0) if $ENV{PPROXY_REMOVE};
+
+$cur_proxy = $first;
+setmode($mode_1st);
+
+if ($second ne "") {
+ connection($second, 1);
+
+ setmode($mode_2nd);
+ $cur_proxy = $second;
+
+ if ($third ne "") {
+ connection($third, 2);
+ setmode($mode_3rd);
+ $cur_proxy = $third;
+ connection($connect, 3);
+ } else {
+ connection($connect, 2);
+ }
+} else {
+ connection($connect, 1);
+}
+
+$parent = $$;
+$child = fork;
+if (! defined $child) {
+ kill "TERM", $ENV{PPROXY_KILLPID} if $ENV{PPROXY_KILLPID};
+ exit 1;
+}
+
+if ($child) {
+ print STDERR "pproxy parent\[$$] STDIN -> socket\n";
+ if ($listen_handle) {
+ xfer($listen_handle, $sock);
+ } else {
+ xfer(STDIN, $sock);
+ }
+ select(undef, undef, undef, 0.25);
+ if (kill 0, $child) {
+ select(undef, undef, undef, 1.5);
+ #print STDERR "pproxy\[$$]: kill TERM $child\n";
+ kill "TERM", $child;
+ }
+} else {
+ print STDERR "pproxy child \[$$] socket -> STDOUT\n";
+ if ($listen_handle) {
+ xfer($sock, $listen_handle);
+ } else {
+ xfer($sock, STDOUT);
+ }
+ select(undef, undef, undef, 0.25);
+ if (kill 0, $parent) {
+ select(undef, undef, undef, 1.5);
+ #print STDERR "pproxy\[$$]: kill TERM $parent\n";
+ kill "TERM", $parent;
+ }
+}
+if ($ENV{PPROXY_KILLPID} ne "") {
+ if ($ENV{PPROXY_KILLPID} =~ /^(\+|-)/) {
+ $ENV{PPROXY_KILLPID} = $$ + $ENV{PPROXY_KILLPID};
+ }
+ print STDERR "kill TERM, $ENV{PPROXY_KILLPID}\n";
+ kill "TERM", $ENV{PPROXY_KILLPID};
+}
+exit;
+
+sub url_parse {
+ my $hostport = shift;
+ my $mode = "http";
+ if ($hostport =~ m,^socks4?://(\S*)$,i) {
+ $mode = "socks4";
+ $hostport = $1;
+ } elsif ($hostport =~ m,^socks5://(\S*)$,i) {
+ $mode = "socks5";
+ $hostport = $1;
+ } elsif ($hostport =~ m,^https?://(\S*)$,i) {
+ $mode = "http";
+ $hostport = $1;
+ } elsif ($hostport =~ m,^repeater://(\S*)\+(\S*)$,i) {
+ # ultravnc repeater proxy.
+ $hostport = $1;
+ $mode = "repeater:$2";
+ if ($hostport !~ /:\d+/) {
+ $hostport .= ":5900";
+ }
+ }
+ return ($hostport, $mode);
+}
+
+sub setmode {
+ my $mode = shift;
+ $ENV{PPROXY_REPEATER} = "";
+ if ($mode =~ /^socks/) {
+ if ($mode =~ /^socks5/) {
+ $ENV{PPROXY_SOCKS} = 5;
+ } else {
+ $ENV{PPROXY_SOCKS} = 1;
+ }
+ } elsif ($mode =~ /^repeater:(.*)/) {
+ $ENV{PPROXY_REPEATER} = $1;
+ $ENV{PPROXY_SOCKS} = "";
+ } else {
+ $ENV{PPROXY_SOCKS} = "";
+ }
+}
+
sub connection {
my ($CONNECT, $w) = @_;
@@ -771,6 +898,18 @@ sub connection {
close $sock;
exit(1);
}
+ } elsif ($ENV{PPROXY_REPEATER} ne "") {
+ my $rep = $ENV{PPROXY_REPEATER};
+ print STDERR "repeater: $rep\n";
+ $rep .= pack("x") x 250;
+ syswrite($sock, $rep, 250);
+
+ my $ok = 1;
+ for (my $i = 0; $i < 12; $i++) {
+ my $c;
+ sysread($sock, $c, 1);
+ print STDERR $c;
+ }
} else {
# Web Proxy:
@@ -799,76 +938,6 @@ sub connection {
}
}
-unlink($0) if $ENV{PPROXY_REMOVE};
-
-$cur_proxy = $first;
-
-if ($second ne "") {
- connection($second, 1);
-
- setmode($mode_2nd);
- $cur_proxy = $second;
-
- if ($third ne "") {
- connection($third, 2);
- setmode($mode_3rd);
- $cur_proxy = $third;
- connection($connect, 3);
- } else {
- connection($connect, 2);
- }
-} else {
- connection($connect, 1);
-}
-
-$parent = $$;
-$child = fork;
-if (! defined $child) {
- exit 1;
-}
-
-if ($child) {
- print STDERR "pproxy parent\[$$] STDIN -> socket\n";
- if ($listen_handle) {
- xfer($listen_handle, $sock);
- } else {
- xfer(STDIN, $sock);
- }
- select(undef, undef, undef, 0.25);
- if (kill 0, $child) {
- select(undef, undef, undef, 1.5);
- #print STDERR "pproxy\[$$]: kill TERM $child\n";
- kill "TERM", $child;
- }
-} else {
- print STDERR "pproxy child \[$$] socket -> STDOUT\n";
- if ($listen_handle) {
- xfer($sock, $listen_handle);
- } else {
- xfer($sock, STDOUT);
- }
- select(undef, undef, undef, 0.25);
- if (kill 0, $parent) {
- select(undef, undef, undef, 1.5);
- #print STDERR "pproxy\[$$]: kill TERM $parent\n";
- kill "TERM", $parent;
- }
-}
-exit;
-
-sub setmode {
- my $mode = shift;
- if ($mode =~ /^socks/) {
- if ($mode =~ /^socks5/) {
- $ENV{PPROXY_SOCKS} = 5;
- } else {
- $ENV{PPROXY_SOCKS} = 1;
- }
- } else {
- $ENV{PPROXY_SOCKS} = "";
- }
-}
-
sub xfer {
my($in, $out) = @_;
$RIN = $WIN = $EIN = "";
@@ -1182,6 +1251,7 @@ Kecho proxy=$proxy
fi
if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
+ echo "sleep $SSVNC_EXTRA_SLEEP"
sleep $SSVNC_EXTRA_SLEEP
fi
@@ -1281,12 +1351,12 @@ Kecho proxy=$proxy
sleep 5
fi
echo ""
+ #reset
+ stty sane
if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
- #echo T sleep $SSVNC_EXTRA_SLEEP
+ echo "sleep $SSVNC_EXTRA_SLEEP"
sleep $SSVNC_EXTRA_SLEEP
fi
- #reset
- stty sane
#echo "pssh=\"$pssh\""
if [ "X$use_sshssl" = "X" -a "X$getport" = "X" ]; then
echo "Running viewer:"
@@ -1351,12 +1421,15 @@ if [ "X$proxy" != "X" ]; then
PPROXY_REMOVE=1; export PPROXY_REMOVE
pcode "$ptmp"
if [ "X$showcert" != "X1" -a "X$direct_connect" = "X" ]; then
- if uname | grep Darwin >/dev/null; then
+ if uname | egrep 'Darwin|SunOS' >/dev/null; then
# on mac we need to listen on socket instead of stdio:
nd=`findfree 6700`
PPROXY_LISTEN=$nd
export PPROXY_LISTEN
- $ptmp 2>/dev/null &
+ if [ "X$reverse" = "X" ]; then
+ #$ptmp 2>/dev/null &
+ $ptmp &
+ fi
#sleep 3
sleep 2
host="localhost"
@@ -1423,7 +1496,7 @@ if [ "X$direct_connect" != "X" ]; then
disp="$N"
fi
if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
- #echo T sleep $SSVNC_EXTRA_SLEEP
+ echo "T sleep $SSVNC_EXTRA_SLEEP"
sleep $SSVNC_EXTRA_SLEEP
fi
if [ "X$reverse" = "X" ]; then
@@ -1453,29 +1526,9 @@ fi
tmp=/tmp/ss_vncviewer${RANDOM}.$$
mytmp "$tmp"
-if [ "X$reverse" = "X" ]; then
-
- cat > "$tmp" <<END
-foreground = yes
-pid =
-client = yes
-debug = 6
-$STUNNEL_EXTRA_OPTS
-$verify
-$cert
-
-[vnc_stunnel]
-accept = localhost:$use
-$connect
-
-END
-else
-
- p2=`expr 5500 + $N`
- connect="connect = localhost:$p2"
- if [ "X$cert" = "X" ]; then
- tcert="/tmp/tcert${RANDOM}.$$"
- cat > $tcert <<END
+make_tcert() {
+ tcert="/tmp/tcert${RANDOM}.$$"
+ cat > $tcert <<END
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAvkfXxb0wcxgrjV2ziFikjII+ze8iKcTBt47L0GM/c21efelN
+zZpJUUXLu4zz8Ryq8Q+sQgfNy7uTOpN9bUUaOk1TnD7gaDQnQWiNHmqbW2kL+DS
@@ -1527,8 +1580,40 @@ wAH966SAOvd2s6yOHMvyDRIL7WHxfESB6rDHsdIW/yny1fBePjv473KrxyXtbz7I
dMw1yW09l+eEo4A7GzwOdw==
-----END CERTIFICATE-----
END
- chmod 600 $tcert
- cert="cert = $tcert"
+ chmod 600 $tcert
+ echo "$tcert"
+}
+
+if [ "X$reverse" = "X" ]; then
+
+ if echo "$proxy" | grep repeater:// > /dev/null; then
+ if [ "X$cert" = "X" ]; then
+ ttcert=`make_tcert`
+ cert="cert = $ttcert"
+ fi
+ fi
+
+ cat > "$tmp" <<END
+foreground = yes
+pid =
+client = yes
+debug = 6
+$STUNNEL_EXTRA_OPTS
+$verify
+$cert
+
+[vnc_stunnel]
+accept = localhost:$use
+$connect
+
+END
+else
+
+ p2=`expr 5500 + $N`
+ connect="connect = localhost:$p2"
+ if [ "X$cert" = "X" ]; then
+ ttcert=`make_tcert`
+ cert="cert = $ttcert"
fi
STUNNEL_EXTRA_OPTS=`echo "$STUNNEL_EXTRA_OPTS" | sed -e 's/maxconn/#maxconn/'`
@@ -1551,7 +1636,6 @@ accept = $hloc$port
$connect
END
-
fi
echo ""
@@ -1583,8 +1667,10 @@ fi
sleep 1
rm -f "$tmp"
+
echo ""
if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
+ echo "sleep $SSVNC_EXTRA_SLEEP"
sleep $SSVNC_EXTRA_SLEEP
fi
echo "Running viewer:"
@@ -1607,6 +1693,12 @@ else
echo "$VNCVIEWERCMD" "$@" -listen $N
trap "final" 0 2 15
echo ""
+ if [ "X$proxy" != "X" ]; then
+ PPROXY_REVERSE="localhost:$port"; export PPROXY_REVERSE
+ PPROXY_SLEEP=1; export PPROXY_SLEEP;
+ PPROXY_KILLPID=+1; export PPROXY_KILLPID;
+ $ptmp &
+ fi
$VNCVIEWERCMD "$@" -listen $N
fi
diff --git a/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ssvnc.tcl b/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ssvnc.tcl
index 2f52e7e..d99763e 100755
--- a/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ssvnc.tcl
+++ b/x11vnc/misc/enhanced_tightvnc_viewer/bin/util/ssvnc.tcl
@@ -33,6 +33,16 @@ proc center_win {w} {
update
}
+proc mac_raise {} {
+ global uname
+ if {$uname == "Darwin"} {
+ catch {exec /bin/sh -c {osascript -e 'tell application "Wish Shell" to activate' >/dev/null 2>&1 &}}
+ after 150
+ update
+ update idletasks
+ }
+}
+
proc toplev {w} {
catch {destroy $w}
toplevel $w
@@ -105,16 +115,18 @@ proc ts_help {} {
The Terminal Services VNC Viewer uses SSH to establish an encrypted
and authenticated connection to the remote server.
- On the remote server x11vnc is run in terminal services mode to find
- or create your desktop session. x11vnc is used for both the session
- management and the VNC transport.
+ Through the SSH channel, it automatically starts x11vnc in terminal
+ services mode on the remote server to find or create your desktop
+ session. x11vnc is used for both the session management and the
+ VNC transport.
You MUST be able to log in via SSH to the remote terminal server.
Ask your administrator to set this up for you if it isn't already.
- Also see "Requirements" below.
+ x11vnc must also be installed on the remote server machine.
+ See "Requirements" below.
This mode is started by the commands 'tsvnc' or 'ssvnc -ts' or
- toggling by pressing Ctrl-t. "SSVNC Mode" under Options -> Advanced
+ toggled by pressing Ctrl-t. "SSVNC Mode" under Options -> Advanced
will also return to the full SSVNC.
Or in your ~/.ssvncrc (or ~/ssvnc_rc on Windows) put "mode=tsvnc"
@@ -322,11 +334,11 @@ proc help {} {
set msg {
Hosts and Displays:
- Enter the VNC host and display in the 'VNC Host:Display' entry box.
+ Enter the VNC host and display in the 'VNC Host:Display' entry box.
It is of the form "host:number", where "host" is the hostname of the
machine running the VNC Server and "number" is the VNC display number;
- it is often "0". Examples:
+ it is often "0". Some Examples:
snoopy:0
@@ -336,13 +348,13 @@ proc help {} {
24.67.132.27:0
- Then click on "Connect". When you do so the STUNNEL program will be
+ Then click on "Connect". When you do the STUNNEL program will be
started locally to provide you with an outgoing SSL tunnel.
Once the STUNNEL is running, the TightVNC Viewer (Or Chicken of the
- VNC on Mac OS X) will be automatically started directed to the local
- port of the SSL tunnel which, in turn, encrypts and redirects the
- connection to the remote VNC server.
+ VNC on Mac OS X, or one you set under Options) will be automatically
+ started directed to the local port of the SSL tunnel which, in turn,
+ encrypts and redirects the connection to the remote VNC server.
The remote VNC server MUST support an initial SSL handshake before
using the VNC protocol (i.e. VNC is tunnelled through the SSL channel
@@ -351,15 +363,21 @@ proc help {} {
Automatic SSH tunnels are described below.
- If you are using a port less than the default VNC port 5900 (usually
- the VNC display = port - 5900), use the full port number itself, e.g.:
+ See tip 5) below for how to disable encryption.
+
- 24.67.132.27:443
+ Port numbers:
- Note, however, if the number n after the colon is < 200, then a
- port number 5900 + n is assumed; i.e. n is the VNC display number.
- If you must use a TCP port less than 200, specify a negative value,
- e.g.: 24.67.132.27:-80
+ If you are using a port less than the default VNC port 5900
+ (usually the VNC display = port - 5900), use the full port number
+ itself, e.g.:
+
+ 24.67.132.27:443
+
+ Note, however, if the number n after the colon is < 200, then a
+ port number 5900 + n is assumed; i.e. n is the VNC display number.
+ If you must use a TCP port less than 200, specify a negative value,
+ e.g.: 24.67.132.27:-80
SSL Certificate Verification:
@@ -377,21 +395,29 @@ proc help {} {
and so the first time you connect to a new server you may need to
follow a few dialogs to inspect and save the server certificate.
See the "Certs... -> Help" for information on how to manage certificates.
+ "Verify All Certs" is on by default.
- "Fetch Cert" and "Verify All Certs" are currently disabled in the rare
- "SSH + SSL" usage mode (e.g. SSH is used to enter a firewall gateway,
- and then SSL is tunneled through that to reach the workstation).
+ However, "Fetch Cert" and "Verify All Certs" are currently disabled
+ in the rare "SSH + SSL" usage mode (e.g. SSH is used to enter a
+ firewall gateway, and then SSL is tunneled through that to reach
+ the workstation).
Windows STUNNEL:
- Note that on Windows when the Viewer connection is finished you may
- need to terminate STUNNEL manually from the System Tray (right click
- on dark green icon) and selecting "Exit". Double clicking that icon
- will show you its log file (useful for debugging connections).
+ Note that on Windows when the Viewer connection is finished you
+ will be prompted if you want SSVNC to try to kill the STUNNEL process
+ for you. Usually you will say Yes, however if there are problems
+ connecting you may want to look at the STUNNEL Log first.
+
+ Double clicking the STUNNEL tray icon (dark green) will show you
+ its Log file (useful for debugging connections).
+
+ SSVNC will kill the STUNNEL process for you, but you may still need
+ to move the mouse over the icon to make it go away.
- SSVNC will try to kill the STUNNEL process for you, but you may still
- need to move the mouse over the icon to make it go away.
+ In some cases you may need to terminate STUNNEL manually from the
+ System Tray (right click on dark green icon) and selecting "Exit".
VNC Password:
@@ -406,7 +432,7 @@ proc help {} {
On Windows TightVNC viewer should prompt you when a password is required.
- NOTE: when you Save a VNC profile, the password is not saved (you
+ NOTE: when you Save a VNC profile, the password is NOT saved (you
need to enter it each time).
@@ -414,6 +440,7 @@ proc help {} {
Click on "Use SSH" if you want to use an *SSH* tunnel instead of SSL
(then the VNC Server does not need to speak SSL or use STUNNEL).
+
You will need to be able to login to your account on the remote host
via SSH (e.g. via password or ssh-agent).
@@ -435,6 +462,50 @@ proc help {} {
the -ssh command line option or "sshvnc".
+ Remote SSH Command:
+
+ In SSH or SSH + SSL mode you can also specify a remote command
+ to run on the remote ssh host in the "Remote SSH Command" entry.
+ The default is just to sleep a bit (e.g. sleep 30) to make sure
+ the port tunnels are established. Alternatively you could have the
+ remote command start the VNC server, e.g.
+
+ x11vnc -display :0 -rfbport 5900 -localhost -nopw
+
+ When starting the VNC server this way, note that sometimes you
+ will need to correlate the VNC Display number with the "-rfbport"
+ (or similar) option of the server. E.g.:
+
+ VNC Host:Display username@somehost.com:2
+ Remote SSH Command: x11vnc -find -rfbport 5902 -nopw
+
+ See the the Tip below (11) for using x11vnc PORT=NNNN feature (or
+ vncserver(1) output) to not need to specify the VNC display number
+ or the x11vnc -rfbport option.
+
+
+ Profiles:
+
+ Use "Save" to save a profile (i.e. a host:display and its specific
+ settings) with a name.
+
+ To load in a saved Options profile, click on the "Load" button.
+
+ To list your profiles from the command line use:
+
+ ssvnc -profiles (or -list)
+
+ You can launch ssvnc and have it immediately connect to the server
+ by invoking it something like this:
+
+ ssvnc profile1 (launches profile named "profile1")
+ ssvnc hostname:0 (connect to hostname VNC disp 0 via SSL)
+ ssvnc vnc+ssl://hostname:0 (same)
+ ssvnc vnc+ssh://hostname:0 (connect to hostname VNC disp 0 via SSH)
+
+ see the Tips 5 and 9 below for more about the URL-like syntax.
+
+
Proxies/Gateways:
If an intermediate proxy is needed to make the SSL connection
@@ -466,12 +537,12 @@ proc help {} {
You can prefix web proxies with http:// but it doesn't matter since
that is the default.
- Note that Web proxies are often configured to only allow outgoing
+ Note that Web proxies are often configured to ONLY allow outgoing
connections to ports 443 (HTTPS) and 563 (SNEWS), so you might
have run the VNC server (or router port redirector) on those ports.
SOCKS proxies usually have no restrictions on port number.
- On Unix you can chain up to 3 proxies (any combination of http:// and
+ You can chain up to 3 proxies (any combination of http:// and
socks://) by separating them with commas (i.e. first,second,third).
See the ss_vncviewer description and x11vnc FAQ for info on proxies:
@@ -523,6 +594,7 @@ proc help {} {
will also work going to a different internal machine, e.g. "joes-pc:0"
instead of "localhost:0", as in the first example.
+
A Web or SOCKS proxy can also be used with SSH. Use this if you are
inside a firewall that prohibits direct connections to remote SSH servers.
@@ -536,7 +608,7 @@ proc help {} {
use socks5://... to force the SOCKS5 version.
- On Unix you can chain up to 3 proxies (any combination of http:// and
+ You can chain up to 3 proxies (any combination of http:// and
socks://) by separating them with commas (i.e. first,second,third).
For a non-standard SSH port and a Web or SOCKS proxy try:
@@ -551,26 +623,75 @@ proc help {} {
Proxy/Gateway: http://mysocks.west:1080,ssh.company.com,joes-pc
- Remote SSH Command:
+ UltraVNC Proxies/Gateways:
- In SSH or SSH + SSL mode you can also specify a remote command
- to run on the remote ssh host in the "Remote SSH Command" entry.
- The default is just to sleep a bit (e.g. sleep 30) to make sure
- the port tunnels are established. Alternatively you could have the
- remote command start the VNC server, e.g.
+ UltraVNC has a "repeater" tool (http://www.uvnc.com/addons/repeater.html
+ and http://koti.mbnet.fi/jtko/) that acts as an VNC proxy. SSVNC can
+ work with both mode I and mode II schemes of this repeater.
- x11vnc -display :0 -rfbport 5900 -localhost -nopw
+ Note: only SSL (or unencrypted) SSVNC connections make sense with
+ the UltraVNC repeater. SSH connections (previous section) do not
+ seem to (let us know if you find a way to use it).
- When starting the VNC server this way, note that sometimes you
- will need to correlate the VNC Display number with the "-rfbport"
- (or similar) option of the server. E.g.:
+ For mode I repeater the viewer initiates the connection and passes
+ a string that is the internal VNC server's IP address (or hostname)
+ and port or display:
- VNC Host:Display username@somehost.com:2
- Remote SSH Command: x11vnc -find -rfbport 5902 -nopw
+ VNC Host:Display: :0
+ Proxy/Gateway: repeater://myproxy.west:5900+joes-pc:1
- See the the Tip below (11) for using x11vnc PORT=NNNN feature (or
- vncserver(1) output) to not need to specify the VNC display number
- or the x11vnc -rfbport option.
+ Note here that the VNC Host:Display can be anything; we use :0.
+
+ The Proxy/Gateway format is repeater://proxy:port+vncserver:display.
+ The string after the "+" sign is passed to the repeater server for
+ it to interpret. For this example, instead of joes-pc:1 it could
+ be joes-pc:5901 or 192.168.1.4:1, 192.168.1.4:5901, etc.
+
+ If you do not supply a proxy port, then the default 5900 is assumed,
+ e.g. repeater://myproxy.west+joes-pc:1
+
+
+ For mode II repeater both the VNC viewer and VNC server initiate
+ connections to the repeater proxy. In this case they pass a string
+ that identifies their mutual connection via "ID:NNNN":
+
+ VNC Host:Display: :0
+ Proxy/Gateway: repeater://myproxy.west:5900+ID:1234
+
+ again, the default proxy port is 5900 if not supplied.
+
+ In this case, mode II, you MUST set Options -> Reverse VNC Connection.
+ That is to say a "Listening Connection". The reason for this is that
+ the VNC server acts as a SSL *client* and so requires the Viewer end
+ to have an SSL cert, etc.
+
+ Set REPEATER_FORCE=1 in the Host:Display (hit Enter, and then clear
+ it) to force SSVNC to try to a forward connection in this situation.
+
+ We have also found that usually the Listening viewer must be started
+ BEFORE the VNC Server connects to the proxy. This is a likely bug
+ in the repeater tool.
+
+
+ For mode II, you probably should also disable "Verify All Certs"
+ unless you have taken the steps beforehand to save the VNC server's
+ certificate, or have previously accepted it using another method.
+
+ Also, after the connection you MUST terminate the listening VNC Viewer
+ (Ctrl-C) and connect again (the proxy only runs once.) In Windows,
+ go to the System Tray and terminate the Listening VNC Viewer.
+
+ BTW, the x11vnc VNC server command for the mode II case would be
+ something like:
+
+ x11vnc -ssl SAVE -connect repeater=ID:1234+myproxy.west:5500 ...
+
+ It also supports -connect repeater://myproxy.west:5500+ID:1234
+ notation.
+
+ For mode I operation x11vnc simply runs as a normal SSL/VNC server
+
+ x11vnc -ssl SAVE
SSL Certificates:
@@ -599,10 +720,10 @@ proc help {} {
the other one in the "Certs ..." dialog.
Alternatively you can use the "Import Certificate" action to paste
- in a certificate or read one in from a file or use the "Fetch Cert"
- button on the main panel. If "Verify All Certs" is checked, you
- will be forced to check Certs of any new servers the first time
- you connect.
+ in a certificate or read one in from a file. Or you can use the
+ "Fetch Cert" button on the main panel. If "Verify All Certs" is
+ checked, you will be forced to check Certs of any new servers the
+ first time you connect.
Note that "Verify All Certs" is on by default so that users who do
not understand the SSL Man-In-The-Middle problem will not be left
@@ -620,27 +741,6 @@ proc help {} {
number of colors used. click on the "Options ..." button and read
the Help there.
- Profiles:
-
- Use "Save" to save a profile (i.e. a host:display and its specific
- settings) with a name.
-
- To load in a saved Options profile, click on the "Load" button.
-
- To list your profiles from the command line use:
-
- ssvnc -profiles (or -list)
-
- You can launch ssvnc and have it immediately connect to the server
- by invoking it something like this:
-
- ssvnc profile1 (launches profile named "profile1")
- ssvnc hostname:0 (connect to hostname VNC disp 0 via SSL)
- ssvnc vnc+ssl://hostname:0 (same)
- ssvnc vnc+ssh://hostname:0 (connect to hostname VNC disp 0 via SSH)
-
- see the Tips 5 and 9 below for more about the URL-like syntax.
-
More Info:
@@ -662,20 +762,25 @@ proc help {} {
line: "user@hostname cmd=SHELL") then you get an SSH shell only:
no VNC viewer will be launched. On Windows "PUTTY" will try
to use putty.exe (better terminal emulation than plink.exe).
+
A ShortCut for this is Ctrl-S as long as user@hostname is present
in the entry box.
3) If you use "KNOCK" for the "Remote SSH Command" (or int he display
line "user@hostname cmd=KNOCK") then only the port-knocking is
- performed. A ShortCut for this is Ctrl-P as long as hostname
- is present in the entry box. If it is KNOCKF, i.e. an extra
- "F", then the port-knocking "FINISH" sequence is sent, if any.
- A ShortCut for this Shift-Ctrl-P as long as hostname is present.
+ performed.
+
+ A ShortCut for this is Ctrl-P as long as hostname is present in
+ the entry box.
+
+ If it is KNOCKF, i.e. an extra "F", then the port-knocking
+ "FINISH" sequence is sent, if any. A ShortCut for this
+ Shift-Ctrl-P as long as hostname is present.
4) Pressing the "Load" button or pressing Ctrl-L or Clicking the Right
mouse button on the main GUI will invoke the Load dialog.
- 5) If you want to do a Direct VNC connection, WITH **NO(* SSL OR SSH
+ 5) If you want to do a Direct VNC connection, WITH **NO** SSL OR SSH
ENCRYPTION, use the "vnc://" prefix, e.g. vnc://far-away.east:0
This also works for reverse connections (see below).
@@ -720,11 +825,13 @@ proc help {} {
10) Mobile USB memory stick / flash drive usage: You can unpack
ssvnc to a flash drive for impromptu usage (e.g. from a friends
- computer) If you create a directory "Home" in the toplevel ssvnc
- directory, then that will be the default location for your VNC
- profiles and certs. So they follow the drive this way. If you
- run like this: "ssvnc ." or "ssvnc.exe ." the "Home" directory
- will be created for you.
+ computer).
+
+ If you create a directory "Home" in the toplevel ssvnc directory,
+ then that will be the default location for your VNC profiles
+ and certs. So they follow the drive this way. If you run like
+ this: "ssvnc ." or "ssvnc.exe ." the "Home" directory will be
+ created for you.
WARNING: if you use ssvnc from an "Internet Cafe", i.e. an
untrusted computer, an unscrupulous person may be capturing
@@ -773,10 +880,12 @@ proc help {} {
This only works with x11vnc (not vncserver).
12) You can change the X DISPLAY variable by typing DISPLAY=... into
- VNC Host:Display and hitting Return or clicking Connect. Same for
- HOME=. Setting SLEEP=n increases the amount of time waited before
- starting the viewer. On Mac, you can set DYLD_LIBRARY_PATH=... too.
- It should propagate down the the viewer.
+ VNC Host:Display and hitting Return or clicking Connect. Same
+ for HOME=. Setting SLEEP=n increases the amount of time waited
+ before starting the viewer. The env. var. SSVNC_EXTRA_SLEEP
+ also does this (and also Sleep: Option setting) On Mac, you
+ can set DYLD_LIBRARY_PATH=... too. It should propagate down
+ the the viewer.
13) If you want this application to be SSH only, then supply the
command line option "-ssh" or set the env. var SSVNC_SSH_ONLY=1.
@@ -1777,6 +1886,7 @@ proc ts_x11vnc_cmd {} {
global choose_filexfer ts_filexfer
global ts_x11vnc_opts ts_x11vnc_path ts_x11vnc_autoport choose_x11vnc_opts
global ts_othervnc choose_othervnc ts_xlogin
+ global choose_sleep extra_sleep
set cmd ""
if {$choose_x11vnc_opts && $ts_x11vnc_path != ""} {
@@ -1798,6 +1908,12 @@ proc ts_x11vnc_cmd {} {
set type "Xvnc.redirect"
}
+ if [info exists choose_sleep] {
+ if {! $choose_sleep} {
+ set extra_sleep ""
+ }
+ }
+
if {$choose_othervnc && $ts_othervnc != "find"} {
set cmd "$cmd -redirect $ts_othervnc"
} elseif {$type == ""} {
@@ -1921,7 +2037,7 @@ proc set_defaults {} {
global choose_xserver ts_xserver_type choose_desktop ts_desktop_type ts_unixpw ts_vncshared
global choose_filexfer ts_filexfer
global ts_x11vnc_opts choose_x11vnc_opts ts_x11vnc_path ts_x11vnc_autoport ts_xlogin
- global ts_othervnc choose_othervnc
+ global ts_othervnc choose_othervnc choose_sleep
global choose_ncache ts_ncache choose_multisession ts_multisession
global ts_mode ts_desktop_size ts_desktop_depth choose_desktop_geom
global additional_port_redirs additional_port_redirs_list
@@ -1929,7 +2045,7 @@ proc set_defaults {} {
global sound_daemon_local_cmd sound_daemon_local_port sound_daemon_local_kill sound_daemon_x11vnc sound_daemon_local_start
global smb_su_mode smb_mount_list
global use_port_knocking port_knocking_list
- global ycrop_string use_listen use_unixpw use_x11vnc_find unixpw_username
+ global ycrop_string extra_sleep use_listen use_unixpw use_x11vnc_find unixpw_username
global include_list
@@ -2010,8 +2126,9 @@ proc set_defaults {} {
set defs(sound_daemon_local_kill) 0
set defs(sound_daemon_x11vnc) 0
- set defs(use_port_knocking) 0
set defs(ycrop_string) ""
+ set defs(extra_sleep) ""
+ set defs(use_port_knocking) 0
set defs(port_knocking_list) ""
set defs(include_list) ""
@@ -2131,20 +2248,24 @@ proc do_viewer_windows {n} {
}
set msg "
- About to start the Listening VNC Viewer.
+ About to start the Listening VNC Viewer (Reverse Connection).
- VNC Viewer command to be run:
+ The VNC Viewer command to be run is:
$cmd
- The VNC server should then Reverse connect to:
+ After the Viewer starts listening, the VNC server should
+ then Reverse connect to:
$ln
- To stop the Viewer: right click on the VNC Icon in the tray
- and select 'Close listening daemon' (or similar).
+ When the VNC Connection has ended **YOU MUST MANUALLY STOP**
+ the Listening VNC Viewer.
- You will then return to this GUI.
+ To stop the Listening Viewer: right click on the VNC Icon in
+ the tray and select 'Close listening daemon' (or similar).
+
+ ONLY AFTER THAT will you return to the SSVNC GUI.
Click OK now to start the Listening VNC Viewer.
"
@@ -2159,7 +2280,7 @@ proc do_viewer_windows {n} {
set wll_done 0
- eval text .wll.t -width 60 -height 19 $help_font
+ eval text .wll.t -width 64 -height 22 $help_font
button .wll.d -text "OK" -command {destroy .wll; set wll_done 1}
pack .wll.t .wll.d -side top -fill x
@@ -2188,6 +2309,13 @@ proc do_viewer_windows {n} {
set t [expr "$t * 1000"]
after $t
}
+ global extra_sleep
+ if {$extra_sleep != ""} {
+ set t $extra_sleep
+ mesg "sleeping an extra $t seconds..."
+ set t [expr "$t * 1000"]
+ after $t
+ }
mesg $cmd
set emess ""
@@ -2426,12 +2554,33 @@ proc ssh_split {str} {
return [list $ssh_user $ssh_host $ssh_port]
}
+proc check_debug_netstat {port str wn} {
+ global debug_netstat
+ if {! [info exists debug_netstat]} {
+ return
+ }
+ if {$debug_netstat == "0" || $debug_netstat == ""} {
+ return
+ }
+ mesg "DBG: $wn"
+
+ toplev .dbns
+
+ scroll_text_dismiss .dbns.f 82 35
+ center_win .dbns
+ .dbns.f.t insert end "LOOKING FOR PORT: $port\n\n$str"
+ jiggle_text .dbns.f.t
+ update
+ after 1000
+}
+
proc launch_windows_ssh {hp file n} {
global is_win9x env
global use_sshssl use_ssh putty_pw
global port_knocking_list
global use_listen listening_name
global ts_only
+ global debug_netstat
set hpnew [get_ssh_hp $hp]
set proxy [get_ssh_proxy $hp]
@@ -2500,7 +2649,7 @@ proc launch_windows_ssh {hp file n} {
set double_ssh ""
set p_port ""
if {$proxy != ""} {
- if [regexp -nocase {(http|https|socks|socks4|socks5)://} $proxy] {
+ if [regexp -nocase {(http|https|socks|socks4|socks5|repeater)://} $proxy] {
set pproxy ""
set sproxy1 ""
set sproxy_rest ""
@@ -2511,7 +2660,7 @@ proc launch_windows_ssh {hp file n} {
if {[regexp {^[ ]*$} $part]} {
continue
}
- if [regexp -nocase {^(http|https|socks|socks4|socks5)://} $part] {
+ if [regexp -nocase {^(http|https|socks|socks4|socks5|repeater)://} $part] {
if {$pproxy == ""} {
set pproxy $part
} else {
@@ -2933,6 +3082,7 @@ proc launch_windows_ssh {hp file n} {
}
set ns [get_netstat]
set re ":$p_port"
+ check_debug_netstat $p_port $ns $waited
append re {[ ][ ]*[0:.][0:.]*[ ][ ]*LISTEN}
if [regexp $re $ns] {
set gotit 1
@@ -2945,8 +3095,17 @@ proc launch_windows_ssh {hp file n} {
}
}
+ set wdraw 1
+ if [info exists debug_netstat] {
+ if {$debug_netstat != "" && $debug_netstat != "0"} {
+ set wdraw 0
+ }
+ }
+
if {$is_win9x} {
- wm withdraw .
+ if {$wdraw} {
+ wm withdraw .
+ }
update
win9x_plink_msg $file
global win9x_plink_msg_done
@@ -3012,7 +3171,9 @@ proc launch_windows_ssh {hp file n} {
if {! $do_shell} {
make_plink
}
- wm withdraw .
+ if {$wdraw} {
+ wm withdraw .
+ }
update
if {$do_shell && [regexp {FINISH} $port_knocking_list]} {
catch {exec $com /c $file}
@@ -3046,6 +3207,7 @@ proc launch_windows_ssh {hp file n} {
}
set ns [get_netstat]
set re ":$use"
+ check_debug_netstat $use $ns $waited
append re {[ ][ ]*[0:.][0:.]*[ ][ ]*LISTEN}
if [regexp $re $ns] {
set plink_status yes
@@ -3228,6 +3390,7 @@ proc darwin_terminal_cmd {{title ""} {cmd ""} {bg 0}} {
if {! [info exists darwin_terminal]} {
raise .
tk_messageBox -type ok -icon error -message "Cannot find Darwin Terminal program." -title "Cannot find Terminal program"
+ mac_raise
return
}
@@ -3244,6 +3407,7 @@ proc darwin_terminal_cmd {{title ""} {cmd ""} {bg 0}} {
if {$fh == ""} {
raise .
tk_messageBox -type ok -icon error -message "Cannot open temporary file: $tmp" -title "Cannot open file"
+ mac_raise
return
}
global env
@@ -3268,6 +3432,7 @@ proc darwin_terminal_cmd {{title ""} {cmd ""} {bg 0}} {
puts $fh { echo termpid-find-fail: termpid=$termpid mypid=$$}
puts $fh {fi}
puts $fh {trap "rm -f $tmp; kill -TERM $termpid; kill -TERM $mypid; kill -KILL $mypid; exit 0" 0 2 15}
+ puts $fh {osascript -e 'tell application "Terminal" to activate' >/dev/null 2>&1 &}
puts $fh "$cmd"
puts $fh "sleep 1"
puts $fh {rm -f $tmp}
@@ -3559,12 +3724,14 @@ proc fetch_cert {save} {
mesg "No host:disp supplied."
bell
catch {raise .}
+ mac_raise
return
}
if {[regexp -- {--nohost--} $tt]} {
mesg "No host:disp supplied."
bell
catch {raise .}
+ mac_raise
return
}
if {! [regexp ":" $hp]} {
@@ -4160,6 +4327,39 @@ proc tpid {} {
return $p
}
+proc repeater_proxy_check {proxy} {
+ if [regexp {^repeater://.*\+ID:[0-9]} $proxy] {
+ global env
+ set force 0
+ if [info exists env(REPEATER_FORCE)] {
+ if {$env(REPEATER_FORCE) != "" && $env(REPEATER_FORCE) != "0"} {
+ set force 1
+ }
+ }
+ global use_listen
+ if {! $use_listen} {
+ if {$force} {
+ mesg "WARNING: repeater:// ID:nnn proxy must use Listen Mode"
+ after 1000
+ } else {
+ bell
+ mesg "ERROR: repeater:// ID:nnn proxy must use Listen Mode"
+ after 1000
+ return 0
+ }
+ }
+ global always_verify_ssl
+ if [info exists always_verify_ssl] {
+ if {$always_verify_ssl} {
+ bell
+ mesg "WARNING: repeater:// ID:nnn Verify All Certs may fail"
+ after 2500
+ }
+ }
+ }
+ return 1
+}
+
proc fini_unixpw {} {
global named_pipe_fh unixpw_tmp
@@ -4477,6 +4677,11 @@ proc launch_unix {hp} {
set cmd "ssvnc_cmd"
set hpnew [get_ssh_hp $hp]
set proxy [get_ssh_proxy $hp]
+
+ if {! [repeater_proxy_check $proxy]} {
+ return
+ }
+
if {! $do_direct && ![regexp -nocase {ssh://} $hpnew]} {
if {$mycert != ""} {
set cmd "$cmd -mycert '$mycert'"
@@ -4519,6 +4724,7 @@ proc launch_unix {hp} {
}
}
+
if {$use_alpha} {
set cmd "$cmd -alpha"
}
@@ -4775,12 +4981,30 @@ proc launch_unix {hp} {
if {$ts_only} {
set te ""
}
+
+ global extra_sleep
+ set ssvnc_extra_sleep_save ""
+ if {$extra_sleep != ""} {
+ if [info exists env(SSVNC_EXTRA_SLEEP)] {
+ set ssvnc_extra_sleep_save $env(SSVNC_EXTRA_SLEEP)
+ }
+ set env(SSVNC_EXTRA_SLEEP) $extra_sleep
+ }
+
unix_terminal_cmd $geometry "SSL/SSH VNC Viewer $hp" \
"$te$cmd; set +xv; ulimit -c 0; trap 'printf \"Paused. Press Enter to exit:\"; read x' QUIT; echo; echo $m; echo; echo sleep 5; echo; sleep 6" 0 $xrm1 $xrm2 $xrm3
set env(SS_VNCVIEWER_SSH_CMD) ""
set env(SS_VNCVIEWER_USE_C) ""
+ if {$extra_sleep != ""} {
+ if {$ssvnc_extra_sleep_save != ""} {
+ set env(SSVNC_EXTRA_SLEEP) $ssvnc_extra_sleep_save
+ } else {
+ catch {unset env(SSVNC_EXTRA_SLEEP)}
+ }
+ }
+
if {$use_sound && $sound_daemon_local_kill && $sound_daemon_local_cmd != ""} {
# XXX need to kill just one...
set daemon [string trim $sound_daemon_local_cmd]
@@ -4804,6 +5028,7 @@ proc launch_unix {hp} {
catch {file delete $passwdfile}
}
wm deiconify .
+ mac_raise
mesg "Disconnected from $hp"
if {[regexp {FINISH} $port_knocking_list]} {
do_port_knock $pk_hp finish
@@ -5035,6 +5260,7 @@ proc launch {{hp ""}} {
global pids_before pids_after pids_new
global env
global use_ssl use_ssh use_sshssl use_listen
+ global vncdisplay
set debug 0
if {$hp == ""} {
@@ -5051,6 +5277,7 @@ proc launch {{hp ""}} {
set t [string trim $t]
set env(SSVNC_HOME) $t
mesg "set SSVNC_HOME to $t"
+ set vncdisplay ""
return 0
}
if {[regexp {^DISPLAY=} $hpt] || [regexp {^SSVNC_DISPLAY=} $hpt]} {
@@ -5059,6 +5286,7 @@ proc launch {{hp ""}} {
set t [string trim $t]
set env(DISPLAY) $t
mesg "set DISPLAY to $t"
+ set vncdisplay ""
global uname darwin_cotvnc
if {$uname == "Darwin"} {
if {$t != ""} {
@@ -5076,6 +5304,7 @@ proc launch {{hp ""}} {
set env(DYLD_LIBRARY_PATH) $t
set env(SSVNC_DYLD_LIBRARY_PATH) $t
mesg "set DYLD_LIBRARY_PATH to $t"
+ set vncdisplay ""
return 0
}
if {[regexp {^SLEEP=} $hpt] || [regexp {^SSVNC_EXTRA_SLEEP=} $hpt]} {
@@ -5084,6 +5313,24 @@ proc launch {{hp ""}} {
set t [string trim $t]
set env(SSVNC_EXTRA_SLEEP) $t
mesg "set SSVNC_EXTRA_SLEEP to $t"
+ set vncdisplay ""
+ return 0
+ }
+ if {[regexp {^DEBUG_NETSTAT=} $hpt]} {
+ set t $hpt
+ regsub {^.*DEBUG_NETSTAT=} $t "" t
+ global debug_netstat
+ set debug_netstat $t
+ mesg "set DEBUG_NETSTAT to $t"
+ set vncdisplay ""
+ return 0
+ }
+ if {[regexp {^REPEATER_FORCE=} $hpt]} {
+ set t $hpt
+ regsub {^.*REPEATER_FORCE=} $t "" t
+ set env(REPEATER_FORCE) $t
+ mesg "set REPEATER_FORCE to $t"
+ set vncdisplay ""
return 0
}
if {[regexp -nocase {^SSH.?ONLY} $hpt]} {
@@ -5112,12 +5359,14 @@ proc launch {{hp ""}} {
mesg "No host:disp supplied."
bell
catch {raise .}
+ mac_raise
return
}
if {[regexp -- {--nohost--} $tt]} {
mesg "No host:disp supplied."
bell
catch {raise .}
+ mac_raise
return
}
if {! [regexp ":" $hp]} {
@@ -5243,6 +5492,9 @@ proc launch {{hp ""}} {
if {$use_sshssl} {
set proxy ""
}
+ if {! [repeater_proxy_check $proxy]} {
+ return
+ }
for {set i 30} {$i < 90} {incr i} {
set try "$prefix-$i.$suffix"
@@ -5295,6 +5547,7 @@ proc launch {{hp ""}} {
set did_port_knock 1
} elseif {$use_ssh} {
launch_windows_ssh $hp $file $n
+ # WE ARE DONE.
return
}
@@ -5340,8 +5593,12 @@ proc launch {{hp ""}} {
mesg "WARNING: SSL proxy contains \"@\" sign"
after 2000
}
+ if {$use_listen} {
+ set env(SSVNC_REVERSE) "localhost:$port"
+ } else {
+ set env(SSVNC_LISTEN) [expr "$n2 + 5900"]
+ }
set env(SSVNC_PROXY) $proxy
- set env(SSVNC_LISTEN) [expr "$n2 + 5900"]
set env(SSVNC_DEST) "$host:$port"
}
@@ -5442,7 +5699,7 @@ proc launch {{hp ""}} {
if {$hn == ""} {
set hn "this-computer"
}
- set listening_name "$hn:$port (or IP:$port, etc.)"
+ set listening_name "$hn:$port (or nn.nn.nn.nn:$port, etc.)"
}
puts $fh "accept = $hloc$port"
puts $fh "connect = localhost:$port2"
@@ -5471,6 +5728,7 @@ proc launch {{hp ""}} {
set proxy_pid [exec "connect_br.exe" &]
unset -nocomplain env(SSVNC_PROXY)
unset -nocomplain env(SSVNC_LISTEN)
+ unset -nocomplain env(SSVNC_REVERSE)
unset -nocomplain env(SSVNC_DEST)
}
@@ -8380,6 +8638,46 @@ proc ts_othervnc_dialog {} {
focus .ovnc.c.e
}
+proc ts_sleep_dialog {} {
+
+ toplev .eslp
+ wm title .eslp "Extra Sleep"
+
+ scroll_text .eslp.f 80 5
+
+ global extra_sleep
+
+ set msg {
+ Sleep: Enter a number to indicate how many extra seconds to sleep
+ while waiting for the VNC viewer to start up. On Windows this
+ can give extra time to enter the Putty/Plink password, etc.
+}
+ .eslp.f.t insert end $msg
+
+ frame .eslp.c
+ label .eslp.c.l -anchor w -text "Extra Sleep:"
+ entry .eslp.c.e -width 20 -textvariable extra_sleep
+ pack .eslp.c.l -side left
+ pack .eslp.c.e -side left -expand 1 -fill x
+
+ button .eslp.cancel -text "Cancel" -command {destroy .eslp; set choose_sleep 0}
+ bind .eslp <Escape> {destroy .eslp; set choose_sleep 0}
+ wm protocol .eslp WM_DELETE_WINDOW {destroy .eslp; set choose_sleep 0}
+ button .eslp.done -text "Done" -command {destroy .eslp; set choose_sleep 1}
+ bind .eslp.c.e <Return> {destroy .eslp; set choose_sleep 1}
+
+ global choose_sleep
+ if {! $choose_sleep} {
+ set extra_sleep ""
+ }
+
+ pack .eslp.done .eslp.cancel .eslp.c -side bottom -fill x
+ pack .eslp.f -side top -fill both -expand 1
+
+ center_win .eslp
+ focus .eslp.c.e
+}
+
proc ts_ncache_dialog {} {
toplev .nche
@@ -9911,6 +10209,10 @@ proc help_advanced_opts {} {
in them will be applied first, and then any values in the loaded
Profile will override them.
+ Sleep: Enter a number to indicate how many extra seconds to sleep
+ while waiting for the VNC viewer to start up. On Windows this
+ can give extra time to enter the Putty/Plink password, etc.
+
ssh-agent: On Unix only: restart the GUI in the presence of
ssh-agent(1) (e.g. in case you forgot to start your agent before
starting this GUI). An xterm will be used to enter passphrases,
@@ -10906,7 +11208,7 @@ proc set_ts_options {} {
proc set_ts_adv_options {} {
global ts_only ts_unixpw ts_vncshared
global ts_ncache ts_multisession
- global choose_othervnc darwin_cotvnc
+ global choose_othervnc darwin_cotvnc choose_sleep
if {! $ts_only} {
return
@@ -10957,6 +11259,11 @@ proc set_ts_adv_options {} {
-command {if {$choose_x11vnc_opts} {ts_x11vnc_opts_dialog}}
incr i
+ checkbutton .ot2.b$i -anchor w -variable choose_sleep -text \
+ "Extra Sleep" \
+ -command {if {$choose_sleep} {ts_sleep_dialog}}
+ incr i
+
global env
if {![info exists env(SSVNC_TS_ALWAYS)]} {
button .ot2.b$i -anchor w -text " SSVNC Mode" \
@@ -11059,6 +11366,15 @@ proc set_advanced_options {} {
incr i
+ global extra_sleep
+ frame .oa.b$i
+ label .oa.b$i.l -text "Sleep: "
+ entry .oa.b$i.e -width 10 -textvariable extra_sleep
+ pack .oa.b$i.l -side left
+ pack .oa.b$i.e -side right -expand 1 -fill x
+
+ incr i
+
if {$is_windows} {
.oa.b$ix configure -state disabled
.oa.b$ia configure -state disabled
@@ -11389,7 +11705,7 @@ proc set_options {} {
incr i
checkbutton .o.b$i -anchor w -variable use_listen -text \
- "Reverse VNC Connection (-listen)" -command {listen_adjust; if {$vncdisplay == ""} {set vncdisplay ":0"}}
+ "Reverse VNC Connection (-LISTEN)" -command {listen_adjust; if {$vncdisplay == ""} {set vncdisplay ":0"}}
#if {$is_windows} {.o.b$i configure -state disabled}
if {$darwin_cotvnc} {.o.b$i configure -state disabled}
incr i
@@ -12042,6 +12358,8 @@ bind .f0.l <ButtonPress> {set button_gui_top 1}
update
+mac_raise
+
set didload 0
for {set i 0} {$i < $argc} {incr i} {
diff --git a/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/tight-vncviewer-full.patch b/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/tight-vncviewer-full.patch
index 74d30e0..2120959 100644
--- a/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/tight-vncviewer-full.patch
+++ b/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/tight-vncviewer-full.patch
@@ -446,7 +446,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/Vncviewer vnc_unixsrc/vncview
+
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/vncviewer/argsresources.c
--- vnc_unixsrc.orig/vncviewer/argsresources.c 2007-02-04 17:10:31.000000000 -0500
-+++ vnc_unixsrc/vncviewer/argsresources.c 2008-02-17 13:34:30.000000000 -0500
++++ vnc_unixsrc/vncviewer/argsresources.c 2008-04-28 21:30:05.000000000 -0400
@@ -31,7 +31,7 @@
char *fallback_resources[] = {
@@ -456,7 +456,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
"Vncviewer.translations:\
<Enter>: SelectionToVNC()\\n\
-@@ -45,8 +45,14 @@
+@@ -45,8 +45,58 @@
"*viewport.useRight: True",
"*viewport*Scrollbar*thumb: None",
@@ -465,6 +465,50 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
+ "vncviewer*viewport.horizontal.height: 6 ",
+ "vncviewer*viewport.vertical.width: 6 ",
+
++ "*viewport.horizontal.translations: #override\\n\
++ <KeyPress>Right: StartScroll(Forward)\\n\
++ <KeyRelease>Right: NotifyScroll(FullLength) EndScroll()\\n\
++ <KeyPress>Left: StartScroll(Backward)\\n\
++ <KeyRelease>Left: NotifyScroll(FullLength) EndScroll()\\n\
++ <KeyPress>Next: StartScroll(Forward)\\n\
++ <KeyRelease>Next: NotifyScroll(FullLength) EndScroll()\\n\
++ <KeyPress>Prior: StartScroll(Backward)\\n\
++ <KeyRelease>Prior: NotifyScroll(FullLength) EndScroll()\\n\
++ <KeyPress>z: StartScroll(Forward)\\n\
++ <KeyRelease>z: NotifyScroll(FullLength) EndScroll()\\n\
++ <KeyPress>a: StartScroll(Backward)\\n\
++ <KeyRelease>a: NotifyScroll(FullLength) EndScroll()\\n\
++ <KeyPress>f: StartScroll(Forward)\\n\
++ <KeyRelease>f: NotifyScroll(FullLength) EndScroll()\\n\
++ <KeyPress>b: StartScroll(Backward)\\n\
++ <KeyRelease>b: NotifyScroll(FullLength) EndScroll()\\n\
++ <KeyPress>Down: StartScroll(Forward)\\n\
++ <KeyRelease>Down: NotifyScroll(FullLength) EndScroll()\\n\
++ <KeyPress>Up: StartScroll(Backward)\\n\
++ <KeyRelease>Up: NotifyScroll(FullLength) EndScroll()",
++
++ "*viewport.vertical.translations: #override\\n\
++ <KeyPress>Down: StartScroll(Forward)\\n\
++ <KeyRelease>Down: NotifyScroll(FullLength) EndScroll()\\n\
++ <KeyPress>Up: StartScroll(Backward)\\n\
++ <KeyRelease>Up: NotifyScroll(FullLength) EndScroll()\\n\
++ <KeyPress>Next: StartScroll(Forward)\\n\
++ <KeyRelease>Next: NotifyScroll(FullLength) EndScroll()\\n\
++ <KeyPress>Prior: StartScroll(Backward)\\n\
++ <KeyRelease>Prior: NotifyScroll(FullLength) EndScroll()\\n\
++ <KeyPress>z: StartScroll(Forward)\\n\
++ <KeyRelease>z: NotifyScroll(FullLength) EndScroll()\\n\
++ <KeyPress>a: StartScroll(Backward)\\n\
++ <KeyRelease>a: NotifyScroll(FullLength) EndScroll()\\n\
++ <KeyPress>f: StartScroll(Forward)\\n\
++ <KeyRelease>f: NotifyScroll(FullLength) EndScroll()\\n\
++ <KeyPress>b: StartScroll(Backward)\\n\
++ <KeyRelease>b: NotifyScroll(FullLength) EndScroll()\\n\
++ <KeyPress>Right: StartScroll(Forward)\\n\
++ <KeyRelease>Right: NotifyScroll(FullLength) EndScroll()\\n\
++ <KeyPress>Left: StartScroll(Backward)\\n\
++ <KeyRelease>Left: NotifyScroll(FullLength) EndScroll()",
++
"*desktop.baseTranslations:\
- <Key>F8: ShowPopup()\\n\
+ <Key>F8: ShowPopup()\\n\
@@ -472,7 +516,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
<ButtonPress>: SendRFBEvent()\\n\
<ButtonRelease>: SendRFBEvent()\\n\
<Motion>: SendRFBEvent()\\n\
-@@ -58,23 +64,58 @@
+@@ -58,23 +108,58 @@
"*serverDialog.dialog.value.translations: #override\\n\
<Key>Return: ServerDialogDone()",
@@ -536,7 +580,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
"*popup*button1.label: Dismiss popup",
"*popup*button1.translations: #override\\n\
-@@ -84,7 +125,7 @@
+@@ -84,7 +169,7 @@
"*popup*button2.translations: #override\\n\
<Btn1Down>,<Btn1Up>: Quit()",
@@ -545,7 +589,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
"*popup*button3.type: toggle",
"*popup*button3.translations: #override\\n\
<Visible>: SetFullScreenState()\\n\
-@@ -115,6 +156,305 @@
+@@ -115,6 +200,305 @@
"*popup*button8.translations: #override\\n\
<Btn1Down>,<Btn1Up>: SendRFBEvent(key,F8) HidePopup()",
@@ -851,7 +895,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
NULL
};
-@@ -135,6 +475,7 @@
+@@ -135,6 +519,7 @@
*/
AppData appData;
@@ -859,13 +903,16 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
static XtResource appDataResourceList[] = {
{"shareDesktop", "ShareDesktop", XtRBool, sizeof(Bool),
-@@ -155,14 +496,29 @@
+@@ -155,14 +540,32 @@
{"userLogin", "UserLogin", XtRString, sizeof(String),
XtOffsetOf(AppData, userLogin), XtRImmediate, (XtPointer) 0},
+ {"unixPW", "UnixPW", XtRString, sizeof(String),
+ XtOffsetOf(AppData, unixPW), XtRImmediate, (XtPointer) 0},
+
++ {"repeaterUltra", "RepeaterUltra", XtRString, sizeof(String),
++ XtOffsetOf(AppData, repeaterUltra), XtRImmediate, (XtPointer) 0},
++
{"passwordDialog", "PasswordDialog", XtRBool, sizeof(Bool),
XtOffsetOf(AppData, passwordDialog), XtRImmediate, (XtPointer) False},
@@ -891,7 +938,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
{"nColours", "NColours", XtRInt, sizeof(int),
XtOffsetOf(AppData, nColours), XtRImmediate, (XtPointer) 256},
-@@ -179,9 +535,12 @@
+@@ -179,9 +582,12 @@
{"requestedDepth", "RequestedDepth", XtRInt, sizeof(int),
XtOffsetOf(AppData, requestedDepth), XtRImmediate, (XtPointer) 0},
@@ -905,7 +952,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
{"wmDecorationWidth", "WmDecorationWidth", XtRInt, sizeof(int),
XtOffsetOf(AppData, wmDecorationWidth), XtRImmediate, (XtPointer) 4},
-@@ -191,6 +550,9 @@
+@@ -191,6 +597,9 @@
{"popupButtonCount", "PopupButtonCount", XtRInt, sizeof(int),
XtOffsetOf(AppData, popupButtonCount), XtRImmediate, (XtPointer) 0},
@@ -915,7 +962,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
{"debug", "Debug", XtRBool, sizeof(Bool),
XtOffsetOf(AppData, debug), XtRImmediate, (XtPointer) False},
-@@ -206,8 +568,13 @@
+@@ -206,8 +615,13 @@
{"bumpScrollPixels", "BumpScrollPixels", XtRInt, sizeof(int),
XtOffsetOf(AppData, bumpScrollPixels), XtRImmediate, (XtPointer) 20},
@@ -929,7 +976,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
{"qualityLevel", "QualityLevel", XtRInt, sizeof(int),
XtOffsetOf(AppData, qualityLevel), XtRImmediate, (XtPointer) 6},
-@@ -218,14 +585,55 @@
+@@ -218,14 +632,55 @@
{"useRemoteCursor", "UseRemoteCursor", XtRBool, sizeof(Bool),
XtOffsetOf(AppData, useRemoteCursor), XtRImmediate, (XtPointer) True},
@@ -987,11 +1034,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
};
-@@ -242,8 +650,22 @@
+@@ -242,8 +697,23 @@
{"-noraiseonbeep", "*raiseOnBeep", XrmoptionNoArg, "False"},
{"-passwd", "*passwordFile", XrmoptionSepArg, 0},
{"-user", "*userLogin", XrmoptionSepArg, 0},
+ {"-unixpw", "*unixPW", XrmoptionSepArg, 0},
++ {"-repeater", "*repeaterUltra", XrmoptionSepArg, 0},
{"-encodings", "*encodings", XrmoptionSepArg, 0},
- {"-bgr233", "*useBGR233", XrmoptionNoArg, "True"},
+ {"-bgr233", "*useBGR233", XrmoptionNoArg, "256"},
@@ -1011,7 +1059,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
{"-owncmap", "*forceOwnCmap", XrmoptionNoArg, "True"},
{"-truecolor", "*forceTrueColour", XrmoptionNoArg, "True"},
{"-truecolour", "*forceTrueColour", XrmoptionNoArg, "True"},
-@@ -253,7 +675,19 @@
+@@ -253,7 +723,19 @@
{"-nojpeg", "*enableJPEG", XrmoptionNoArg, "False"},
{"-nocursorshape", "*useRemoteCursor", XrmoptionNoArg, "False"},
{"-x11cursor", "*useX11Cursor", XrmoptionNoArg, "True"},
@@ -1032,7 +1080,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
};
-@@ -268,15 +702,73 @@
+@@ -268,15 +750,77 @@
{"SendRFBEvent", SendRFBEvent},
{"ShowPopup", ShowPopup},
{"HidePopup", HidePopup},
@@ -1040,6 +1088,10 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
+ {"HideQuality", HideQuality},
+ {"HideCompress", HideCompress},
{"ToggleFullScreen", ToggleFullScreen},
++ {"JumpLeft", JumpLeft},
++ {"JumpRight", JumpRight},
++ {"JumpUp", JumpUp},
++ {"JumpDown", JumpDown},
{"SetFullScreenState", SetFullScreenState},
{"SelectionFromVNC", SelectionFromVNC},
{"SelectionToVNC", SelectionToVNC},
@@ -1106,7 +1158,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
};
-@@ -302,8 +794,8 @@
+@@ -302,8 +846,8 @@
void
usage(void)
{
@@ -1117,7 +1169,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
"\n"
"Usage: %s [<OPTIONS>] [<HOST>][:<DISPLAY#>]\n"
" %s [<OPTIONS>] [<HOST>][::<PORT#>]\n"
-@@ -332,10 +824,148 @@
+@@ -332,10 +876,154 @@
" -autopass\n"
"\n"
"Option names may be abbreviated, e.g. -bgr instead of -bgr233.\n"
@@ -1223,6 +1275,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
+ " it is taken as username@password. Otherwise, the program\n"
+ " exits with an error. Got all that?\n"
+ "\n"
++ " -repeater str This is for use with UltraVNC repeater proxy described\n"
++ " here: http://www.uvnc.com/addons/repeater.html. The \"str\"\n"
++ " is the ID string to be sent to the repeater. E.g. ID:1234\n"
++ " In this case host:dpy on the command line is the repeater\n"
++ " server, not the VNC server. The repeater will connect you.\n"
++ "\n"
+ " New Popup actions:\n"
+ "\n"
+ " ViewOnly: ~ -viewonly\n"
@@ -1267,7 +1325,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
/*
-@@ -350,6 +980,7 @@
+@@ -350,6 +1038,7 @@
int i;
char *vncServerName, *colonPos;
int len, portOffset;
@@ -1275,7 +1333,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
/* Turn app resource specs into our appData structure for the rest of the
program to use */
-@@ -357,6 +988,23 @@
+@@ -357,6 +1046,23 @@
XtGetApplicationResources(toplevel, &appData, appDataResourceList,
XtNumber(appDataResourceList), 0, 0);
@@ -1299,7 +1357,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
/* Add our actions to the actions table so they can be used in widget
resource specs */
-@@ -376,6 +1024,10 @@
+@@ -376,6 +1082,10 @@
return;
}
@@ -1310,7 +1368,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
if (argc == 1) {
vncServerName = DoServerDialog();
appData.passwordDialog = True;
-@@ -414,6 +1066,13 @@
+@@ -414,6 +1124,13 @@
if (!len || strspn(colonPos + 1, "0123456789") != len) {
usage();
}
@@ -3492,8 +3550,18 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/dialogs.c vnc_unixsrc/vncview
while (!passwordDialogDone) {
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncviewer/fullscreen.c
--- vnc_unixsrc.orig/vncviewer/fullscreen.c 2003-10-09 05:23:49.000000000 -0400
-+++ vnc_unixsrc/vncviewer/fullscreen.c 2007-02-17 16:32:23.000000000 -0500
-@@ -85,10 +85,14 @@
++++ vnc_unixsrc/vncviewer/fullscreen.c 2008-02-22 09:03:22.000000000 -0500
+@@ -27,7 +27,9 @@
+ #include <X11/Xaw/Toggle.h>
+
+ static Bool DoBumpScroll();
++static Bool DoJumpScroll();
+ static void BumpScrollTimerCallback(XtPointer clientData, XtIntervalId *id);
++static void JumpScrollTimerCallback(XtPointer clientData, XtIntervalId *id);
+ static XtIntervalId timer;
+ static Bool timerSet = False;
+ static Bool scrollLeft, scrollRight, scrollUp, scrollDown;
+@@ -85,10 +87,14 @@
Dimension oldViewportWidth, oldViewportHeight, clipWidth, clipHeight;
Position viewportX, viewportY;
@@ -3508,7 +3576,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv
XtVaSetValues(viewport, XtNforceBars, True, NULL);
XtVaGetValues(viewport, XtNwidth, &oldViewportWidth,
XtNheight, &oldViewportHeight, NULL);
-@@ -105,16 +109,23 @@
+@@ -105,16 +111,23 @@
toplevelWidth = dpyWidth;
}
@@ -3534,7 +3602,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv
toplevelWidth = dpyWidth;
toplevelHeight = dpyHeight;
}
-@@ -129,7 +140,12 @@
+@@ -129,7 +142,12 @@
reparenting our window to the root. The window manager will get a
ReparentNotify and hopefully clean up its frame window. */
@@ -3547,7 +3615,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv
XReparentWindow(dpy, XtWindow(toplevel), DefaultRootWindow(dpy), 0, 0);
-@@ -139,6 +155,8 @@
+@@ -139,6 +157,8 @@
with XReparentWindow. The last XSync seems to prevent losing
focus, but I don't know why. */
XSync(dpy, False);
@@ -3556,7 +3624,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv
XMoveWindow(dpy, XtWindow(toplevel), 0, 0);
XSync(dpy, False);
-@@ -164,25 +182,67 @@
+@@ -164,25 +184,67 @@
XtManageChild(viewport);
@@ -3631,7 +3699,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv
}
}
-@@ -210,8 +270,14 @@
+@@ -210,8 +272,14 @@
appData.fullScreen = False;
@@ -3648,7 +3716,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv
XtUnmapWidget(toplevel);
-@@ -238,6 +304,9 @@
+@@ -238,6 +306,9 @@
XtManageChild(viewport);
XtVaSetValues(toplevel, XtNoverrideRedirect, False, NULL);
@@ -3658,7 +3726,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv
if ((toplevelWidth + appData.wmDecorationWidth) >= dpyWidth)
toplevelWidth = dpyWidth - appData.wmDecorationWidth;
-@@ -345,7 +414,9 @@
+@@ -345,7 +416,9 @@
}
if (scrollDown) {
@@ -3669,6 +3737,122 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv
desktopY += appData.bumpScrollPixels;
if (desktopY > si.framebufferHeight - dpyHeight)
desktopY = si.framebufferHeight - dpyHeight;
+@@ -375,3 +448,115 @@
+ {
+ DoBumpScroll();
+ }
++
++/* not working: */
++
++Bool
++JumpScroll(int up, int vert) {
++ scrollLeft = scrollRight = scrollUp = scrollDown = False;
++
++
++ if (appData.fullScreen) {
++ return True;
++ }
++ fprintf(stderr, "JumpScroll(%d, %d)\n", up, vert);
++
++ if (vert) {
++ if (up) {
++ scrollUp = True;
++ } else {
++ scrollDown = True;
++ }
++ } else {
++ if (up) {
++ scrollRight = True;
++ } else {
++ scrollLeft = True;
++ }
++ }
++
++ if (scrollLeft || scrollRight || scrollUp || scrollDown) {
++ if (timerSet) {
++ return True;
++ }
++
++ XtVaGetValues(desktop, XtNx, &desktopX, XtNy, &desktopY, NULL);
++ desktopX = -desktopX;
++ desktopY = -desktopY;
++ return DoJumpScroll();
++ }
++
++ if (timerSet) {
++ XtRemoveTimeOut(timer);
++ timerSet = False;
++ }
++
++ return False;
++}
++
++static Bool
++DoJumpScroll() {
++ int oldx = desktopX, oldy = desktopY;
++ int jumpH = si.framebufferWidth / 4;
++ int jumpV = si.framebufferHeight / 4;
++
++ if (scrollRight) {
++ if (desktopX < si.framebufferWidth - dpyWidth) {
++ desktopX += jumpH;
++ if (desktopX > si.framebufferWidth - dpyWidth)
++ desktopX = si.framebufferWidth - dpyWidth;
++ }
++ } else if (scrollLeft) {
++ if (desktopX > 0) {
++ desktopX -= jumpH;
++ if (desktopX < 0)
++ desktopX = 0;
++ }
++ }
++
++ if (scrollDown) {
++ if (appData.yCrop > 0 && desktopY + dpyHeight >= appData.yCrop) {
++ ;
++ } else if (desktopY < si.framebufferHeight - dpyHeight) {
++ desktopY += jumpV;
++ if (desktopY > si.framebufferHeight - dpyHeight)
++ desktopY = si.framebufferHeight - dpyHeight;
++ }
++ } else if (scrollUp) {
++ if (desktopY > 0) {
++ desktopY -= jumpV;
++ if (desktopY < 0)
++ desktopY = 0;
++ }
++ }
++
++ if (oldx != desktopX || oldy != desktopY) {
++ XawViewportSetCoordinates(viewport, desktopX, desktopY);
++ timer = XtAppAddTimeOut(appContext, appData.bumpScrollTime,
++ JumpScrollTimerCallback, NULL);
++ timerSet = True;
++ return True;
++ }
++
++ timerSet = False;
++ return False;
++}
++
++static void
++JumpScrollTimerCallback(XtPointer clientData, XtIntervalId *id) {
++ DoJumpScroll();
++}
++void JumpRight(Widget w, XEvent *ev, String *params, Cardinal *num_params) {
++ JumpScroll(1, 0);
++}
++void JumpLeft(Widget w, XEvent *ev, String *params, Cardinal *num_params) {
++ JumpScroll(0, 0);
++}
++void JumpUp(Widget w, XEvent *ev, String *params, Cardinal *num_params) {
++ JumpScroll(1, 1);
++}
++void JumpDown(Widget w, XEvent *ev, String *params, Cardinal *num_params) {
++ JumpScroll(0, 1);
++}
++
++
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/hextile.c vnc_unixsrc/vncviewer/hextile.c
--- vnc_unixsrc.orig/vncviewer/hextile.c 2007-02-17 22:33:46.000000000 -0500
+++ vnc_unixsrc/vncviewer/hextile.c 2007-02-17 22:48:39.000000000 -0500
@@ -4403,7 +4587,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup_ad vnc_unixsrc/vncviewe
+}
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncviewer/rfbproto.c
--- vnc_unixsrc.orig/vncviewer/rfbproto.c 2004-03-11 13:14:39.000000000 -0500
-+++ vnc_unixsrc/vncviewer/rfbproto.c 2008-02-17 10:38:27.000000000 -0500
++++ vnc_unixsrc/vncviewer/rfbproto.c 2008-05-11 11:20:45.000000000 -0400
@@ -57,6 +57,44 @@
static Bool HandleTight16(int rx, int ry, int rw, int rh);
static Bool HandleTight32(int rx, int ry, int rw, int rh);
@@ -4875,14 +5059,14 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ break;
+ }
+ }
-+
+
+- return (int)secType;
+ free(secTypes);
+
+ if (secType == rfbSecTypeInvalid) {
+ fprintf(stderr, "Server did not offer supported security type\n");
+ }
-
-- return (int)secType;
++
+ return (int)secType;
}
@@ -5470,13 +5654,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
{
- rfbFramebufferUpdateRequestMsg fur;
+ rfbFramebufferUpdateRequestMsg fur;
-
-- fur.type = rfbFramebufferUpdateRequest;
-- fur.incremental = incremental ? 1 : 0;
-- fur.x = Swap16IfLE(x);
-- fur.y = Swap16IfLE(y);
-- fur.w = Swap16IfLE(w);
-- fur.h = Swap16IfLE(h);
++
+ if (appData.fileActive) {
+ if (time(NULL) < last_filexfer + 2) {
+// fprintf(stderr, "skip SendFramebufferUpdateRequest: %d - %d\n", last_filexfer, time(NULL));
@@ -5486,8 +5664,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ }
+ }
-- if (!WriteExact(rfbsock, (char *)&fur, sz_rfbFramebufferUpdateRequestMsg))
-- return False;
+- fur.type = rfbFramebufferUpdateRequest;
+- fur.incremental = incremental ? 1 : 0;
+- fur.x = Swap16IfLE(x);
+- fur.y = Swap16IfLE(y);
+- fur.w = Swap16IfLE(w);
+- fur.h = Swap16IfLE(h);
+ fur.type = rfbFramebufferUpdateRequest;
+ fur.incremental = incremental ? 1 : 0;
+ fur.x = Swap16IfLE(x);
@@ -5501,11 +5683,13 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ sent_FBU = 2;
+ }
-- return True;
+- if (!WriteExact(rfbsock, (char *)&fur, sz_rfbFramebufferUpdateRequestMsg))
+- return False;
+ if (!WriteExact(rfbsock, (char *)&fur, sz_rfbFramebufferUpdateRequestMsg)) {
+ return False;
+ }
-+
+
+- return True;
+ return True;
}
@@ -5516,13 +5700,6 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
{
- rfbPointerEventMsg pe;
+ rfbPointerEventMsg pe;
-+
-+ if (appData.fileActive) {
-+ if (time(NULL) < last_filexfer + 2) {
-+ //fprintf(stderr, "skip SendPointerEvent: %d - %d\n", last_filexfer, time(NULL));
-+ return True;
-+ }
-+ }
- pe.type = rfbPointerEvent;
- pe.buttonMask = buttonMask;
@@ -5535,6 +5712,13 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
- pe.x = Swap16IfLE(x);
- pe.y = Swap16IfLE(y);
- return WriteExact(rfbsock, (char *)&pe, sz_rfbPointerEventMsg);
++ if (appData.fileActive) {
++ if (time(NULL) < last_filexfer + 2) {
++ //fprintf(stderr, "skip SendPointerEvent: %d - %d\n", last_filexfer, time(NULL));
++ return True;
++ }
++ }
++
+ pe.type = rfbPointerEvent;
+ pe.buttonMask = buttonMask;
+ if (x < 0) x = 0;
@@ -5568,7 +5752,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
}
-@@ -942,281 +1093,675 @@
+@@ -942,281 +1093,716 @@
Bool
SendClientCutText(char *str, int len)
{
@@ -5872,7 +6056,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ if (db) write(2, fxfer, len);
+ if (db) fprintf(stderr, "\n");
+ write(filexfer_sock, fxfer, len);
- }
++ }
+ len = (hdr[4] << 24) | (hdr[5] << 16) | (hdr[6] << 8) | hdr[7];
+ if (hdr[1] == rfbFileHeader && len != rfbRErrorCmd) {
+ if (db) fprintf(stderr, "Got rfbFileTransfer: rfbFileHeader\n");
@@ -5884,7 +6068,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ if (db) write(2, fxfer, len);
+ if (db) fprintf(stderr, "\n");
+ write(filexfer_sock, fxfer, len);
-+ }
+ }
+ if (db) fprintf(stderr, "Got rfbFileTransfer done.\n");
+ skip_XtUpdateAll = 0;
@@ -5909,43 +6093,81 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+Bool
+HandleRFBServerMessage()
+{
-+ int db = 0;
++ static int db = -1;
+ rfbServerToClientMsg msg;
- bytesPerLine = rect.r.w * myFormat.bitsPerPixel / 8;
- linesToRead = BUFFER_SIZE / bytesPerLine;
-+ if (!ReadFromRFBServer((char *)&msg, 1)) {
-+ return False;
++ if (db < 0) {
++ if (getenv("DEBUG_RFB_SMSG")) {
++ db = 1;
++ } else {
++ db = 0;
++ }
+ }
- while (rect.r.h > 0) {
- if (linesToRead > rect.r.h)
- linesToRead = rect.r.h;
-+ if (msg.type == rfbFileTransfer) {
-+ return HandleFileXfer();
++ if (!ReadFromRFBServer((char *)&msg, 1)) {
++ return False;
+ }
- if (!ReadFromRFBServer(buffer,bytesPerLine * linesToRead))
- return False;
-+ switch (msg.type) {
++ if (msg.type == rfbFileTransfer) {
++ return HandleFileXfer();
++ }
- CopyDataToScreen(buffer, rect.r.x, rect.r.y, rect.r.w,
- linesToRead);
++ switch (msg.type) {
+
+- rect.r.h -= linesToRead;
+- rect.r.y += linesToRead;
+ case rfbSetColourMapEntries:
+ {
+ int i;
+ CARD16 rgb[3];
+ XColor xc;
-- rect.r.h -= linesToRead;
-- rect.r.y += linesToRead;
+ if (!ReadFromRFBServer(((char *)&msg) + 1, sz_rfbSetColourMapEntriesMsg - 1)) {
+ return False;
-+ }
+ }
+- break;
+- case rfbEncodingCopyRect:
+- {
+- rfbCopyRect cr;
+-
+- if (!ReadFromRFBServer((char *)&cr, sz_rfbCopyRect))
+- return False;
+-
+- cr.srcX = Swap16IfLE(cr.srcX);
+- cr.srcY = Swap16IfLE(cr.srcY);
+-
+- /* If RichCursor encoding is used, we should extend our
+- "cursor lock area" (previously set to destination
+- rectangle) to the source rectangle as well. */
+- SoftCursorLockArea(cr.srcX, cr.srcY, rect.r.w, rect.r.h);
+-
+- if (appData.copyRectDelay != 0) {
+- XFillRectangle(dpy, desktopWin, srcGC, cr.srcX, cr.srcY,
+- rect.r.w, rect.r.h);
+- XFillRectangle(dpy, desktopWin, dstGC, rect.r.x, rect.r.y,
+- rect.r.w, rect.r.h);
+- XSync(dpy,False);
+- usleep(appData.copyRectDelay * 1000);
+- XFillRectangle(dpy, desktopWin, dstGC, rect.r.x, rect.r.y,
+- rect.r.w, rect.r.h);
+- XFillRectangle(dpy, desktopWin, srcGC, cr.srcX, cr.srcY,
+- rect.r.w, rect.r.h);
+- }
+ msg.scme.firstColour = Swap16IfLE(msg.scme.firstColour);
+ msg.scme.nColours = Swap16IfLE(msg.scme.nColours);
-+
+
+- XCopyArea(dpy, desktopWin, desktopWin, gc, cr.srcX, cr.srcY,
+- rect.r.w, rect.r.h, rect.r.x, rect.r.y);
+ for (i = 0; i < msg.scme.nColours; i++) {
+ if (!ReadFromRFBServer((char *)rgb, 6)) {
+ return False;
@@ -5962,11 +6184,30 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ }
+ xc.flags = DoRed|DoGreen|DoBlue;
+ XStoreColor(dpy, cmap, &xc);
- }
-+
++ }
+
break;
+- }
+ }
-+
+
+- case rfbEncodingRRE:
+- {
+- switch (myFormat.bitsPerPixel) {
+- case 8:
+- if (!HandleRRE8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
+- return False;
+- break;
+- case 16:
+- if (!HandleRRE16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
+- return False;
+- break;
+- case 32:
+- if (!HandleRRE32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
+- return False;
+- break;
+- }
+- break;
+- }
+ case rfbFramebufferUpdate:
+ {
+ rfbFramebufferUpdateRectHeader rect;
@@ -5981,43 +6222,84 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ int area_raw = 0;
+ if (db) fprintf(stderr, "FBU-0: %.6f\n", dnow());
-- case rfbEncodingCopyRect:
+- case rfbEncodingCoRRE:
- {
-- rfbCopyRect cr;
--
-- if (!ReadFromRFBServer((char *)&cr, sz_rfbCopyRect))
-- return False;
--
-- cr.srcX = Swap16IfLE(cr.srcX);
-- cr.srcY = Swap16IfLE(cr.srcY);
--
-- /* If RichCursor encoding is used, we should extend our
-- "cursor lock area" (previously set to destination
-- rectangle) to the source rectangle as well. */
-- SoftCursorLockArea(cr.srcX, cr.srcY, rect.r.w, rect.r.h);
--
-- if (appData.copyRectDelay != 0) {
-- XFillRectangle(dpy, desktopWin, srcGC, cr.srcX, cr.srcY,
-- rect.r.w, rect.r.h);
-- XFillRectangle(dpy, desktopWin, dstGC, rect.r.x, rect.r.y,
-- rect.r.w, rect.r.h);
-- XSync(dpy,False);
-- usleep(appData.copyRectDelay * 1000);
-- XFillRectangle(dpy, desktopWin, dstGC, rect.r.x, rect.r.y,
-- rect.r.w, rect.r.h);
-- XFillRectangle(dpy, desktopWin, srcGC, cr.srcX, cr.srcY,
-- rect.r.w, rect.r.h);
+- switch (myFormat.bitsPerPixel) {
+- case 8:
+- if (!HandleCoRRE8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
+- return False;
+- break;
+- case 16:
+- if (!HandleCoRRE16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
+- return False;
+- break;
+- case 32:
+- if (!HandleCoRRE32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
+- return False;
+- break;
+- }
+- break;
+- }
+ int skip_incFBU = 0;
+ sent_FBU = -1;
-+
+
+- case rfbEncodingHextile:
+- {
+- switch (myFormat.bitsPerPixel) {
+- case 8:
+- if (!HandleHextile8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
+- return False;
+- break;
+- case 16:
+- if (!HandleHextile16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
+- return False;
+- break;
+- case 32:
+- if (!HandleHextile32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
+- return False;
+- break;
+ if (!ReadFromRFBServer(((char *)&msg.fu) + 1, sz_rfbFramebufferUpdateMsg - 1)) {
+ return False;
}
+- break;
+- }
-- XCopyArea(dpy, desktopWin, desktopWin, gc, cr.srcX, cr.srcY,
-- rect.r.w, rect.r.h, rect.r.x, rect.r.y);
+- case rfbEncodingZlib:
+- {
+- switch (myFormat.bitsPerPixel) {
+- case 8:
+- if (!HandleZlib8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
+- return False;
+- break;
+- case 16:
+- if (!HandleZlib16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
+- return False;
+- break;
+- case 32:
+- if (!HandleZlib32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
+- return False;
+- break;
+- }
+- break;
+- }
+ msg.fu.nRects = Swap16IfLE(msg.fu.nRects);
+- case rfbEncodingTight:
+- {
+- switch (myFormat.bitsPerPixel) {
+- case 8:
+- if (!HandleTight8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
+- return False;
+- break;
+- case 16:
+- if (!HandleTight16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
+- return False;
+- break;
+- case 32:
+- if (!HandleTight32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
+- return False;
+- break;
+- }
- break;
- }
+ for (i = 0; i < msg.fu.nRects; i++) {
@@ -6300,8 +6582,41 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ unsigned int maxColor=(myFormat.redMax<<myFormat.redShift)|
+ (myFormat.greenMax<<myFormat.greenShift)|
+ (myFormat.blueMax<<myFormat.blueShift);
++ static int ZRLE32 = -1;
++
++ if (ZRLE32 < 0) {
++ /* for debugging or workaround e.g. BE display to LE */
++ if (getenv("ZRLE32")) {
++ if (strstr(getenv("ZRLE32"), "24Up")) {
++ ZRLE32 = 3;
++ } else if (strstr(getenv("ZRLE32"), "24Down")) {
++ ZRLE32 = 2;
++ } else {
++ ZRLE32 = 1;
++ }
++ } else {
++ ZRLE32 = 0;
++ }
++ }
++
+if (db) fprintf(stderr, "maxColor: 0x%x mfbigEnding: %d\n", maxColor, myFormat.bigEndian);
-+ if ((myFormat.bigEndian && (maxColor&0xff)==0) || (!myFormat.bigEndian && (maxColor&0xff000000)==0)) {
++
++ if (ZRLE32 == 1) {
++if (db) fprintf(stderr, "HandleZRLE32\n");
++ if (!HandleZRLE32(rect.r.x,rect.r.y,rect.r.w,rect.r.h)) {
++ return False;
++ }
++ } else if (ZRLE32 == 2) {
++if (db) fprintf(stderr, "HandleZRLE24Down\n");
++ if (!HandleZRLE24Down(rect.r.x,rect.r.y,rect.r.w,rect.r.h)) {
++ return False;
++ }
++ } else if (ZRLE32 == 3) {
++if (db) fprintf(stderr, "HandleZRLE24Up\n");
++ if (!HandleZRLE24Up(rect.r.x,rect.r.y,rect.r.w,rect.r.h)) {
++ return False;
++ }
++ } else if ((myFormat.bigEndian && (maxColor&0xff)==0) || (!myFormat.bigEndian && (maxColor&0xff000000)==0)) {
+if (db) fprintf(stderr, "HandleZRLE24\n");
+ if (!HandleZRLE24(rect.r.x,rect.r.y,rect.r.w,rect.r.h)) {
+ return False;
@@ -6330,105 +6645,27 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ return False;
+ }
-- case rfbEncodingRRE:
-- {
-- switch (myFormat.bitsPerPixel) {
-- case 8:
-- if (!HandleRRE8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
-- return False;
-- break;
-- case 16:
-- if (!HandleRRE16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
-- return False;
-- break;
-- case 32:
-- if (!HandleRRE32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
-- return False;
-- break;
-- }
-- break;
+- default:
+- fprintf(stderr,"Unknown rect encoding %d\n",
+- (int)rect.encoding);
+- return False;
- }
+ /* Now we may discard "soft cursor locks". */
+ if (db) fprintf(stderr, "FBU-SUL1 %.6f\n", dnow());
-- case rfbEncodingCoRRE:
-- {
-- switch (myFormat.bitsPerPixel) {
-- case 8:
-- if (!HandleCoRRE8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
-- return False;
-- break;
-- case 16:
-- if (!HandleCoRRE16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
-- return False;
-- break;
-- case 32:
-- if (!HandleCoRRE32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
-- return False;
-- break;
-- }
-- break;
-- }
+- /* Now we may discard "soft cursor locks". */
+- SoftCursorUnlockScreen();
+- }
+ SoftCursorUnlockScreen();
-
-- case rfbEncodingHextile:
-- {
-- switch (myFormat.bitsPerPixel) {
-- case 8:
-- if (!HandleHextile8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
-- return False;
-- break;
-- case 16:
-- if (!HandleHextile16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
-- return False;
-- break;
-- case 32:
-- if (!HandleHextile32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
-- return False;
-- break;
++
+ if (db) fprintf(stderr, "FBU-SUL2 %.6f\n", dnow());
- }
-- break;
-- }
-
-- case rfbEncodingZlib:
-- {
-- switch (myFormat.bitsPerPixel) {
-- case 8:
-- if (!HandleZlib8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
-- return False;
-- break;
-- case 16:
-- if (!HandleZlib16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
-- return False;
-- break;
-- case 32:
-- if (!HandleZlib32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
-- return False;
-- break;
++ }
++
+ if (1 || area_copyrect) {
+ if (db) fprintf(stderr, "FBU-XSN1 %.6f\n", dnow());
+ XSync(dpy, False);
+ if (db) fprintf(stderr, "FBU-XSN2 %.6f\n", dnow());
- }
-- break;
-- }
--
-- case rfbEncodingTight:
-- {
-- switch (myFormat.bitsPerPixel) {
-- case 8:
-- if (!HandleTight8(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
-- return False;
-- break;
-- case 16:
-- if (!HandleTight16(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
-- return False;
-- break;
-- case 32:
-- if (!HandleTight32(rect.r.x,rect.r.y,rect.r.w,rect.r.h))
-- return False;
-- break;
++ }
+ sent_FBU = 0;
+ /*
+ * we need to be careful since Xt events are processed
@@ -6457,23 +6694,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ SendFramebufferUpdateRequest(0, 0, si.framebufferWidth,
+ si.framebufferHeight, False);
+ }
- }
-- break;
-- }
--
-- default:
-- fprintf(stderr,"Unknown rect encoding %d\n",
-- (int)rect.encoding);
-- return False;
-- }
--
-- /* Now we may discard "soft cursor locks". */
-- SoftCursorUnlockScreen();
-- }
++ }
#ifdef MITSHM
/* if using shared memory PutImage, make sure that the X server has
-@@ -1224,59 +1769,149 @@
+@@ -1224,59 +1810,149 @@
mainly to avoid copyrect using invalid screen contents - not sure
if we'd need it otherwise. */
@@ -6504,12 +6729,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
{
- Window toplevelWin;
+ Window toplevelWin;
-
-- XBell(dpy, 0);
++
+ if (appData.useBell) {
+ XBell(dpy, 0);
+ }
-+
+
+- XBell(dpy, 0);
+ if (appData.raiseOnBeep) {
+ toplevelWin = XtWindow(toplevel);
+ XMapRaised(dpy, toplevelWin);
@@ -6656,7 +6881,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
}
-@@ -1296,26 +1931,47 @@
+@@ -1296,26 +1972,47 @@
#define CONCAT2(a,b) a##b
#define CONCAT2E(a,b) CONCAT2(a,b)
@@ -6704,7 +6929,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
#undef BPP
/*
-@@ -1358,9 +2014,9 @@
+@@ -1358,9 +2055,9 @@
" %s significant bit in each byte is leftmost on the screen.\n",
(format->bigEndian ? "Most" : "Least"));
} else {
@@ -6716,7 +6941,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
(format->bigEndian ? "Most" : "Least"));
}
if (format->trueColour) {
-@@ -1462,4 +2118,3 @@
+@@ -1462,4 +2159,3 @@
cinfo->src = &jpegSrcManager;
}
@@ -7263,9 +7488,557 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/tunnel.c vnc_unixsrc/vncviewe
}
sprintf(lastArgv, "localhost::%d", localPort);
+diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer._man vnc_unixsrc/vncviewer/vncviewer._man
+--- vnc_unixsrc.orig/vncviewer/vncviewer._man 1969-12-31 19:00:00.000000000 -0500
++++ vnc_unixsrc/vncviewer/vncviewer._man 2008-02-17 13:52:41.000000000 -0500
+@@ -0,0 +1,544 @@
++'\" t
++.\" ** The above line should force tbl to be a preprocessor **
++.\" Man page for X vncviewer
++.\"
++.\" Copyright (C) 1998 Marcus.Brinkmann@ruhr-uni-bochum.de
++.\" Copyright (C) 2000,2001 Red Hat, Inc.
++.\" Copyright (C) 2001-2003 Constantin Kaplinsky <const@ce.cctpu.edu.ru>
++.\"
++.\" You may distribute under the terms of the GNU General Public
++.\" License as specified in the file LICENCE.TXT that comes with the
++.\" TightVNC distribution.
++.\"
++.TH vncviewer 1 "January 2003" "" "TightVNC"
++.SH NAME
++vncviewer \- an X viewer client for VNC
++.SH SYNOPSIS
++.B vncviewer
++.RI [\| options \|]
++.RI [\| host \|][\| :display \|]
++.br
++.B vncviewer
++.RI [\| options \|]
++.RI [\| host \|][\| ::port \|]
++.br
++.B vncviewer
++.RI [\| options \|]
++.IR \-listen
++.RI [\| display \|]
++.br
++.B vncviewer
++.IR \-help
++.br
++.SH DESCRIPTION
++.B vncviewer
++is an Xt\-based client application for the VNC (Virtual Network
++Computing) system. It can connect to any VNC\-compatible server such
++as \fBXvnc\fR or WinVNC, allowing you to control desktop environment
++of a different machine.
++
++You can use F8 to display a pop\-up utility menu. Press F8 twice to
++pass single F8 to the remote side.
++.SH OPTIONS
++.TP
++\fB\-help\fR
++Prints a short usage notice to stderr.
++.TP
++\fB\-listen\fR
++Make the viewer listen on port 5500+\fIdisplay\fR for reverse
++connections from a server. WinVNC supports reverse connections using
++the "Add New Client" menu option, or the \-connect command line
++option. \fBXvnc\fR requires the use of the helper program
++\fBvncconnect\fR.
++.TP
++\fB\-via\fR \fIgateway\fR
++Automatically create encrypted TCP tunnel to the \fIgateway\fR machine
++before connection, connect to the \fIhost\fR through that tunnel
++(TightVNC\-specific). By default, this option invokes SSH local port
++forwarding, assuming that SSH client binary can be accessed as
++/usr/bin/ssh. Note that when using the \fB\-via\fR option, the host
++machine name should be specified as known to the gateway machine, e.g.
++"localhost" denotes the \fIgateway\fR, not the machine where vncviewer
++was launched. See the ENVIRONMENT section below for the information on
++configuring the \fB\-via\fR option.
++.TP
++\fB\-shared\fR
++When connecting, specify that a shared connection is requested. In
++TightVNC, this is the default mode, allowing you to share the desktop
++with other clients already using it.
++.TP
++\fB\-noshared\fR
++When connecting, specify that the session may not be shared. This
++would either disconnect other connected clients or refuse your
++connection, depending on the server configuration.
++.TP
++\fB\-viewonly\fR
++Disable transfer of mouse and keyboard events from the client to the
++server.
++.TP
++\fB\-fullscreen\fR
++Start in full\-screen mode. Please be aware that operating in
++full\-screen mode may confuse X window managers. Typically, such
++conflicts cause incorrect handling of input focus or make the viewer
++window disappear mysteriously. See the grabKeyboard setting in the
++RESOURCES section below for a method to solve input focus problem.
++.TP
++\fB\-noraiseonbeep\fR
++By default, the viewer shows and raises its window on remote beep
++(bell) event. This option disables such behaviour
++(TightVNC\-specific).
++.TP
++\fB\-user\fR \fIusername\fR
++User name for Unix login authentication. Default is to use current
++Unix user name. If this option was given, the viewer will prefer Unix
++login authentication over the standard VNC authentication.
++.TP
++\fB\-passwd\fR \fIpasswd\-file\fR
++File from which to get the password (as generated by the
++\fBvncpasswd\fR(1) program). This option affects only the standard VNC
++authentication.
++.TP
++\fB\-encodings\fR \fIencoding\-list\fR
++TightVNC supports several different compression methods to encode
++screen updates; this option specifies a set of them to use in order of
++preference. Encodings are specified separated with spaces, and must
++thus be enclosed in quotes if more than one is specified. Available
++encodings, in default order for a remote connection, are "copyrect
++tight hextile zlib corre rre raw". For a local connection (to the same
++machine), the default order to try is "raw copyrect tight hextile zlib
++corre rre". Raw encoding is always assumed as a last option if no
++other encoding can be used for some reason. For more information on
++encodings, see the section ENCODINGS below.
++.TP
++\fB\-bgr233\fR
++Always use the BGR233 format to encode pixel data. This reduces
++network traffic, but colors may be represented inaccurately. The
++bgr233 format is an 8\-bit "true color" format, with 2 bits blue, 3
++bits green, and 3 bits red.
++.TP
++\fB\-owncmap\fR
++Try to use a PseudoColor visual and a private colormap. This allows
++the VNC server to control the colormap.
++.TP
++\fB\-truecolour\fR, \fB\-truecolor\fR
++Try to use a TrueColor visual.
++.TP
++\fB\-depth\fR \fIdepth\fR
++On an X server which supports multiple TrueColor visuals of different
++depths, attempt to use the specified one (in bits per pixel); if
++successful, this depth will be requested from the VNC server.
++.TP
++\fB\-compresslevel \fIlevel\fR
++Use specified compression \fIlevel\fR (0..9) for "tight" and "zlib"
++encodings (TightVNC\-specific). Level 1 uses minimum of CPU time and
++achieves weak compression ratios, while level 9 offers best
++compression but is slow in terms of CPU time consumption on the server
++side. Use high levels with very slow network connections, and low
++levels when working over high\-speed LANs. It's not recommended to use
++compression level 0, reasonable choices start from the level 1.
++.TP
++\fB\-quality \fIlevel\fR
++Use the specified JPEG quality \fIlevel\fR (0..9) for the "tight"
++encoding (TightVNC\-specific). Quality level 0 denotes bad image
++quality but very impressive compression ratios, while level 9 offers
++very good image quality at lower compression ratios. Note that the
++"tight" encoder uses JPEG to encode only those screen areas that look
++suitable for lossy compression, so quality level 0 does not always
++mean unacceptable image quality.
++.TP
++\fB\-nojpeg\fR
++Disable lossy JPEG compression in Tight encoding (TightVNC\-specific).
++Disabling JPEG compression is not a good idea in typical cases, as
++that makes the Tight encoder less efficient. You might want to use
++this option if it's absolutely necessary to achieve perfect image
++quality (see also the \fB\-quality\fR option).
++.TP
++\fB\-nocursorshape\fR
++Disable cursor shape updates, protocol extensions used to handle
++remote cursor movements locally on the client side
++(TightVNC\-specific). Using cursor shape updates decreases delays with
++remote cursor movements, and can improve bandwidth usage dramatically.
++.TP
++\fB\-x11cursor\fR
++Use a real X11 cursor with X-style cursor shape updates, instead of
++drawing the remote cursor on the framebuffer. This option also
++disables the dot cursor, and disables cursor position updates in
++non-fullscreen mode.
++.TP
++\fB\-autopass\fR
++Read a plain-text password from stdin. This option affects only the
++standard VNC authentication.
++
++.SH Enhanced TightVNC Viewer (SSVNC) OPTIONS
++.TP
++Enhanced TightVNC Viewer (SSVNC) web page is located at:
++.TP
++http://www.karlrunge.com/x11vnc/ssvnc.html
++.TP
++Note: ZRLE and ZYWRLE encodings are now supported.
++.TP
++Note: F9 is shortcut to Toggle FullScreen mode.
++.TP
++\fB\-use64\fR
++In \fB\-bgr233\fR mode, use 64 colors instead of 256.
++.TP
++\fB\-bgr222\fR
++Same as \fB\-use64\fR.
++.TP
++\fB\-use8\fR
++In \fB\-bgr233\fR mode, use 8 colors instead of 256.
++.TP
++\fB\-bgr111\fR
++Same as \fB\-use8\fR.
++.TP
++\fB\-16bpp\fR
++If the vnc viewer X display is depth 24 at 32bpp
++request a 16bpp format from the VNC server to cut
++network traffic by up to 2X, then tranlate the
++pixels to 32bpp locally.
++.TP
++\fB\-bgr565\fR
++Same as \fB\-16bpp\fR.
++.TP
++\fB\-grey\fR
++Use a grey scale for the 16- and 8\fB\-bpp\fR modes.
++.TP
++\fB\-alpha\fR
++Use alphablending transparency for local cursors
++requires: x11vnc server, both client and server
++must be 32bpp and same endianness.
++.TP
++\fB\-ycrop\fR n
++Only show the top n rows of the framebuffer. For
++use with x11vnc \fB\-ncache\fR client caching option
++to help "hide" the pixel cache region.
++Use a negative value (e.g. \fB\-1\fR) for autodetection.
++Autodetection will always take place if the remote
++fb height is more than 2 times the width.
++.TP
++\fB\-sbwidth\fR n
++Scrollbar width for x11vnc \fB\-ncache\fR mode (\fB\-ycrop\fR),
++default is very narrow: 2 pixels, it is narrow to
++avoid distraction in \fB\-ycrop\fR mode.
++.TP
++\fB\-nobell\fR
++Disable bell.
++.TP
++\fB\-rawlocal\fR
++Prefer raw encoding for localhost, default is
++no, i.e. assumes you have a SSH tunnel instead.
++.TP
++\fB\-graball\fR
++Grab the entire X server when in fullscreen mode,
++needed by some old window managers like fvwm2.
++.TP
++\fB\-popupfix\fR
++Warp the popup back to the pointer position,
++needed by some old window managers like fvwm2.
++.TP
++\fB\-grabkbd\fR
++Grab the X keyboard when in fullscreen mode,
++needed by some window managers. Same as \fB\-grabkeyboard\fR.
++\fB\-grabkbd\fR is the default, use \fB\-nograbkbd\fR to disable.
++.TP
++\fB\-bs\fR, \fB\-nobs\fR
++Whether or not to use X server Backingstore for the
++main viewer window. The default is to not, mainly
++because most Linux, etc, systems X servers disable
++*all* Backingstore by default. To re\fB\-enable\fR it put
++Option "Backingstore"
++in the Device section of /etc/X11/xorg.conf.
++In \fB\-bs\fR mode with no X server backingstore, whenever an
++area of the screen is re\fB\-exposed\fR it must go out to the
++VNC server to retrieve the pixels. This is too slow.
++In \fB\-nobs\fR mode, memory is allocated by the viewer to
++provide its own backing of the main viewer window. This
++actually makes some activities faster (changes in large
++regions) but can appear to "flash" too much.
++.TP
++\fB\-noshm\fR
++Disable use of MIT shared memory extension (not recommended)
++.TP
++\fB\-termchat\fR
++Do the UltraVNC chat in the terminal vncviewer is in
++instead of in an independent window.
++.TP
++\fB\-unixpw\fR
++str Useful for logging into x11vnc in \fB\-unixpw\fR mode. "str" is a
++string that allows many ways to enter the Unix Username
++and Unix Password. These characters: username, newline,
++password, newline are sent to the VNC server after any VNC
++authentication has taken place. Under x11vnc they are
++used for the \fB\-unixpw\fR login. Other VNC servers could do
++something similar.
++You can also indicate "str" via the environment
++variable SSVNC_UNIXPW.
++Note that the Escape key is actually sent first to tell
++x11vnc to not echo the Unix Username back to the VNC
++viewer. Set SSVNC_UNIXPW_NOESC=1 to override this.
++If str is ".", then you are prompted at the command line
++for the username and password in the normal way. If str is
++"-" the stdin is read via getpass(3) for username@password.
++Otherwise if str is a file, it is opened and the first line
++read is taken as the Unix username and the 2nd as the
++password. If str prefixed by "rm:" the file is removed
++after reading. Otherwise, if str has a "@" character,
++it is taken as username@password. Otherwise, the program
++exits with an error. Got all that?
++.TP
++\fB New Popup actions:\fR
++
++ ViewOnly: ~ -viewonly
++ Disable Bell: ~ -nobell
++ Cursor Shape: ~ -nocursorshape
++ X11 Cursor: ~ -x11cursor
++ Cursor Alphablend: ~ -alpha
++ Toggle Tight/ZRLE: ~ -encodings ...
++ Toggle ZRLE/ZYWRLE: ~ -encodings zywrle...
++ Quality Level ~ -quality (both Tight and ZYWRLE)
++ Compress Level ~ -compresslevel
++ Disable JPEG: ~ -nojpeg (Tight)
++ Full Color as many colors as local screen allows.
++ Grey scale (16 & 8-bpp) ~ -grey, for low colors 16/8bpp modes only.
++ 16 bit color (BGR565) ~ -16bpp / -bgr565
++ 8 bit color (BGR233) ~ -bgr233
++ 256 colors ~ -bgr233 default # of colors.
++ 64 colors ~ -bgr222 / -use64
++ 8 colors ~ -bgr111 / -use8
++ Set Y Crop (y-max) ~ -ycrop
++ Set Scrollbar Width ~ -sbwidth
++
++ UltraVNC Extensions:
++
++ Set 1/n Server Scale Ultravnc ext. Scale desktop by 1/n.
++ Text Chat Ultravnc ext. Do Text Chat.
++ File Transfer Ultravnc ext. File xfer via Java helper.
++ Single Window Ultravnc ext. Grab and view a single window.
++ (select then click on the window you want).
++ Disable Remote Input Ultravnc ext. Try to prevent input and
++ viewing of monitor at physical display.
++
++ Note: the Ultravnc extensions only apply to servers that support
++ them. x11vnc/libvncserver supports some of them.
++
++.SH ENCODINGS
++The server supplies information in whatever format is desired by the
++client, in order to make the client as easy as possible to implement.
++If the client represents itself as able to use multiple formats, the
++server will choose one.
++
++.I Pixel format
++refers to the representation of an individual pixel. The most common
++formats are 24 and 16 bit "true\-color" values, and 8\-bit "color map"
++representations, where an arbitrary map converts the color number to
++RGB values.
++
++.I Encoding
++refers to how a rectangle of pixels are sent (all pixel information in
++VNC is sent as rectangles). All rectangles come with a header giving
++the location and size of the rectangle and an encoding type used by
++the data which follows. These types are listed below.
++.TP
++.B Raw
++The raw encoding simply sends width*height pixel values. All clients
++are required to support this encoding type. Raw is also the fastest
++when the server and viewer are on the same machine, as the connection
++speed is essentially infinite and raw encoding minimizes processing
++time.
++.TP
++.B CopyRect
++The Copy Rectangle encoding is efficient when something is being
++moved; the only data sent is the location of a rectangle from which
++data should be copied to the current location. Copyrect could also be
++used to efficiently transmit a repeated pattern.
++.TP
++.B RRE
++The Rise\-and\-Run\-length\-Encoding is basically a 2D version of
++run\-length encoding (RLE). In this encoding, a sequence of identical
++pixels are compressed to a single value and repeat count. In VNC, this
++is implemented with a background color, and then specifications of an
++arbitrary number of subrectangles and color for each. This is an
++efficient encoding for large blocks of constant color.
++.TP
++.B CoRRE
++This is a minor variation on RRE, using a maximum of 255x255 pixel
++rectangles. This allows for single\-byte values to be used, reducing
++packet size. This is in general more efficient, because the savings
++from sending 1\-byte values generally outweighs the losses from the
++(relatively rare) cases where very large regions are painted the same
++color.
++.TP
++.B Hextile
++Here, rectangles are split up in to 16x16 tiles, which are sent in a
++predetermined order. The data within the tiles is sent either raw or
++as a variant on RRE. Hextile encoding is usually the best choice for
++using in high\-speed network environments (e.g. Ethernet local\-area
++networks).
++.TP
++.B Zlib
++Zlib is a very simple encoding that uses zlib library to compress raw
++pixel data. This encoding achieves good compression, but consumes a
++lot of CPU time. Support for this encoding is provided for
++compatibility with VNC servers that might not understand Tight
++encoding which is more efficient than Zlib in nearly all real\-life
++situations.
++.TP
++.B Tight
++Like Zlib encoding, Tight encoding uses zlib library to compress the
++pixel data, but it pre\-processes data to maximize compression ratios,
++and to minimize CPU usage on compression. Also, JPEG compression may
++be used to encode color\-rich screen areas (see the description of
++\-quality and \-nojpeg options above). Tight encoding is usually the
++best choice for low\-bandwidth network environments (e.g. slow modem
++connections).
++.TP
++.B ZRLE
++The SSVNC viewer has ported the RealVNC (www.realvnc.com) ZRLE encoding
++to the unix tightvnc viewer.
++.TP
++.B ZYWRLE
++The SSVNC viewer has ported the Hitachi lossy wavelet based ZRLE
++encoding from http://mobile.hitachi-system.co.jp/publications/ZYWRLE/
++to the unix tightvnc viewer.
++.SH RESOURCES
++X resources that \fBvncviewer\fR knows about, aside from the
++normal Xt resources, are as follows:
++.TP
++.B shareDesktop
++Equivalent of \fB\-shared\fR/\fB\-noshared\fR options. Default true.
++.TP
++.B viewOnly
++Equivalent of \fB\-viewonly\fR option. Default false.
++.TP
++.B fullScreen
++Equivalent of \fB\-fullscreen\fR option. Default false.
++.TP
++.B grabKeyboard
++Grab keyboard in full-screen mode. This can help to solve problems
++with losing keyboard focus. Default false.
++.TP
++.B raiseOnBeep
++Equivalent of \fB\-noraiseonbeep\fR option, when set to false. Default
++true.
++.TP
++.B passwordFile
++Equivalent of \fB\-passwd\fR option.
++.TP
++.B userLogin
++Equivalent of \fB\-user\fR option.
++.TP
++.B passwordDialog
++Whether to use a dialog box to get the password (true) or get it from
++the tty (false). Irrelevant if \fBpasswordFile\fR is set. Default
++false.
++.TP
++.B encodings
++Equivalent of \fB\-encodings\fR option.
++.TP
++.B compressLevel
++Equivalent of \fB\-compresslevel\fR option (TightVNC\-specific).
++.TP
++.B qualityLevel
++Equivalent of \fB\-quality\fR option (TightVNC\-specific).
++.TP
++.B enableJPEG
++Equivalent of \fB\-nojpeg\fR option, when set to false. Default true.
++.TP
++.B useRemoteCursor
++Equivalent of \fB\-nocursorshape\fR option, when set to false
++(TightVNC\-specific). Default true.
++.TP
++.B useBGR233
++Equivalent of \fB\-bgr233\fR option. Default false.
++.TP
++.B nColours
++When using BGR233, try to allocate this many "exact" colors from the
++BGR233 color cube. When using a shared colormap, setting this resource
++lower leaves more colors for other X clients. Irrelevant when using
++truecolor. Default is 256 (i.e. all of them).
++.TP
++.B useSharedColours
++If the number of "exact" BGR233 colors successfully allocated is less
++than 256 then the rest are filled in using the "nearest" colors
++available. This resource says whether to only use the "exact" BGR233
++colors for this purpose, or whether to use other clients' "shared"
++colors as well. Default true (i.e. use other clients' colors).
++.TP
++.B forceOwnCmap
++Equivalent of \fB\-owncmap\fR option. Default false.
++.TP
++.B forceTrueColour
++Equivalent of \fB\-truecolour\fR option. Default false.
++.TP
++.B requestedDepth
++Equivalent of \fB\-depth\fR option.
++.TP
++.B useSharedMemory
++Use MIT shared memory extension if on the same machine as the X
++server. Default true.
++.TP
++.B wmDecorationWidth, wmDecorationHeight
++The total width and height taken up by window manager decorations.
++This is used to calculate the maximum size of the VNC viewer window.
++Default is width 4, height 24.
++.TP
++.B bumpScrollTime, bumpScrollPixels
++When in full screen mode and the VNC desktop is bigger than the X
++display, scrolling happens whenever the mouse hits the edge of the
++screen. The maximum speed of scrolling is bumpScrollPixels pixels
++every bumpScrollTime milliseconds. The actual speed of scrolling will
++be slower than this, of course, depending on how fast your machine is.
++Default 20 pixels every 25 milliseconds.
++.TP
++.B popupButtonCount
++The number of buttons in the popup window. See the README file for
++more information on how to customize the buttons.
++.TP
++.B debug
++For debugging. Default false.
++.TP
++.B rawDelay, copyRectDelay
++For debugging, see the README file for details. Default 0 (off).
++.SH ENVIRONMENT
++When started with the \fB\-via\fR option, vncviewer reads the
++\fBVNC_VIA_CMD\fR environment variable, expands patterns beginning
++with the "%" character, and executes result as a command assuming that
++it would create TCP tunnel that should be used for VNC connection. If
++not set, this environment variable defaults to "/usr/bin/ssh -f -L
++%L:%H:%R %G sleep 20".
++
++The following patterns are recognized in the \fBVNC_VIA_CMD\fR (note
++that all the patterns %G, %H, %L and %R must be present in the command
++template):
++.TP
++.B %%
++A literal "%";
++.TP
++.B %G
++gateway host name;
++.TP
++.B %H
++remote VNC host name, as known to the gateway;
++.TP
++.B %L
++local TCP port number;
++.TP
++.B %R
++remote TCP port number.
++.SH SEE ALSO
++\fBvncserver\fR(1), \fBXvnc\fR(1), \fBvncpasswd\fR(1),
++\fBvncconnect\fR(1), \fBssh\fR(1)
++.SH AUTHORS
++Original VNC was developed in AT&T Laboratories Cambridge. TightVNC
++additions was implemented by Constantin Kaplinsky. Many other people
++participated in development, testing and support.
++
++\fBMan page authors:\fR
++.br
++Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>,
++.br
++Terran Melconian <terran@consistent.org>,
++.br
++Tim Waugh <twaugh@redhat.com>,
++.br
++Constantin Kaplinsky <const@ce.cctpu.edu.ru>
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncviewer/vncviewer.c
--- vnc_unixsrc.orig/vncviewer/vncviewer.c 2004-01-13 09:22:05.000000000 -0500
-+++ vnc_unixsrc/vncviewer/vncviewer.c 2008-02-17 13:27:17.000000000 -0500
++++ vnc_unixsrc/vncviewer/vncviewer.c 2008-04-28 21:20:06.000000000 -0400
@@ -22,6 +22,7 @@
*/
@@ -7445,7 +8218,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi
/* The -listen option is used to make us a daemon process which listens for
incoming connections from servers, rather than actively connecting to a
-@@ -45,89 +203,1154 @@
+@@ -45,89 +203,1172 @@
listenForIncomingConnections() returns, setting the listenSpecified
flag. */
@@ -7540,6 +8313,24 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi
+ if (!ConnectToRFBServer(vncServerHost, vncServerPort)) {
+ exit(1);
+ }
++ if (appData.repeaterUltra != NULL) {
++ char tmp[256];
++ if (ReadFromRFBServer(tmp, 12)) {
++ if (strstr(tmp, "RFB 000.000") == tmp) {
++ int i;
++ for (i=0; i<256; i++) {
++ tmp[i] = '\0';
++ }
++ for (i=0; i<250; i++) {
++ if (i >= strlen(appData.repeaterUltra)) {
++ break;
++ }
++ tmp[i] = appData.repeaterUltra[i];
++ }
++ WriteExact(rfbsock, tmp,250);
++ }
++ }
++ }
+ }
/* Initialise the VNC connection, including reading the password */
@@ -8638,7 +9429,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi
}
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncviewer/vncviewer.h
--- vnc_unixsrc.orig/vncviewer/vncviewer.h 2004-03-11 13:14:40.000000000 -0500
-+++ vnc_unixsrc/vncviewer/vncviewer.h 2008-02-17 12:36:58.000000000 -0500
++++ vnc_unixsrc/vncviewer/vncviewer.h 2008-04-28 21:08:16.000000000 -0400
@@ -51,7 +51,7 @@
(((l) & 0x0000ff00) << 8) | \
(((l) & 0x000000ff) << 24)) : (l))
@@ -8648,7 +9439,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
#define FLASH_PORT_OFFSET 5400
#define LISTEN_PORT_OFFSET 5500
-@@ -68,51 +68,74 @@
+@@ -68,51 +68,75 @@
/* argsresources.c */
typedef struct {
@@ -8723,6 +9514,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
+
+ char *userLogin;
+ char *unixPW;
++ char *repeaterUltra;
+
+ char *passwordFile;
+ Bool passwordDialog;
@@ -8764,7 +9556,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
extern char *fallback_resources[];
extern char vncServerHost[];
-@@ -130,10 +153,11 @@
+@@ -130,10 +154,11 @@
/* colour.c */
extern unsigned long BGR233ToPixel[];
@@ -8777,7 +9569,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
extern void SetVisualAndCmap();
-@@ -157,13 +181,40 @@
+@@ -157,13 +182,40 @@
extern void DesktopInitBeforeRealization();
extern void DesktopInitAfterRealization();
@@ -8818,7 +9610,19 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
extern void ServerDialogDone(Widget w, XEvent *event, String *params,
Cardinal *num_params);
extern char *DoServerDialog();
-@@ -207,6 +258,18 @@
+@@ -181,6 +233,11 @@
+ extern void FullScreenOn();
+ extern void FullScreenOff();
+
++extern void JumpLeft(Widget w, XEvent *event, String *params, Cardinal *num_params);
++extern void JumpRight(Widget w, XEvent *event, String *params, Cardinal *num_params);
++extern void JumpUp(Widget w, XEvent *event, String *params, Cardinal *num_params);
++extern void JumpDown(Widget w, XEvent *event, String *params, Cardinal *num_params);
++
+ /* listen.c */
+
+ extern void listenForIncomingConnections();
+@@ -207,6 +264,18 @@
Cardinal *num_params);
extern void CreatePopup();
@@ -8837,7 +9641,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
/* rfbproto.c */
extern int rfbsock;
-@@ -229,6 +292,15 @@
+@@ -229,6 +298,15 @@
extern Bool SendClientCutText(char *str, int len);
extern Bool HandleRFBServerMessage();
@@ -8853,7 +9657,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
extern void PrintPixelFormat(rfbPixelFormat *format);
/* selection.c */
-@@ -241,8 +313,9 @@
+@@ -241,8 +319,9 @@
/* shm.c */
@@ -8864,7 +9668,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
/* sockets.c */
-@@ -271,3 +344,63 @@
+@@ -271,3 +350,63 @@
extern XtAppContext appContext;
extern Display* dpy;
extern Widget toplevel;