summaryrefslogtreecommitdiffstats
path: root/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/tight-vncviewer-full.patch
diff options
context:
space:
mode:
Diffstat (limited to 'x11vnc/misc/enhanced_tightvnc_viewer/src/patches/tight-vncviewer-full.patch')
-rw-r--r--x11vnc/misc/enhanced_tightvnc_viewer/src/patches/tight-vncviewer-full.patch1371
1 files changed, 608 insertions, 763 deletions
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 2c1b785..8b5c9ab 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
@@ -220,7 +220,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 2007-05-25 23:17:25.000000000 -0400
++++ vnc_unixsrc/vncviewer/argsresources.c 2007-05-30 23:52:19.000000000 -0400
@@ -31,7 +31,7 @@
char *fallback_resources[] = {
@@ -271,7 +271,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
<KeyPress>: SendRFBEvent() HidePopup()",
- "*popupButtonCount: 8",
-+ "*popupButtonCount: 28",
++ "*popupButtonCount: 29",
"*popup*button1.label: Dismiss popup",
"*popup*button1.translations: #override\\n\
@@ -284,7 +284,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,9 +129,166 @@
+@@ -115,9 +129,172 @@
"*popup*button8.translations: #override\\n\
<Btn1Down>,<Btn1Up>: SendRFBEvent(key,F8) HidePopup()",
@@ -390,15 +390,21 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
+ <Visible>: SetTextChatState()\\n\
+ <Btn1Down>,<Btn1Up>: toggle() ToggleTextChat() HidePopup()",
+
-+ "*popup*button27.label: - Single Window",
++ "*popup*button27.label: - File Transfer",
+ "*popup*button27.type: toggle",
+ "*popup*button27.translations: #override\\n\
-+ <Visible>: SetSingleWindowState()\\n\
-+ <Btn1Down>,<Btn1Up>: toggle() ToggleSingleWindow() HidePopup()",
++ <Visible>: SetFileXferState()\\n\
++ <Btn1Down>,<Btn1Up>: toggle() ToggleFileXfer() HidePopup()",
+
-+ "*popup*button28.label: - Disable Remote Input",
++ "*popup*button28.label: - Single Window",
+ "*popup*button28.type: toggle",
+ "*popup*button28.translations: #override\\n\
++ <Visible>: SetSingleWindowState()\\n\
++ <Btn1Down>,<Btn1Up>: toggle() ToggleSingleWindow() HidePopup()",
++
++ "*popup*button29.label: - Disable Remote Input",
++ "*popup*button29.type: toggle",
++ "*popup*button29.translations: #override\\n\
+ <Visible>: SetServerInputState()\\n\
+ <Btn1Down>,<Btn1Up>: toggle() ToggleServerInput() HidePopup()",
+
@@ -451,7 +457,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
/*
* vncServerHost and vncServerPort are set either from the command line or
-@@ -135,6 +306,7 @@
+@@ -135,6 +312,7 @@
*/
AppData appData;
@@ -459,7 +465,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
static XtResource appDataResourceList[] = {
{"shareDesktop", "ShareDesktop", XtRBool, sizeof(Bool),
-@@ -155,14 +327,29 @@
+@@ -155,14 +333,29 @@
{"userLogin", "UserLogin", XtRString, sizeof(String),
XtOffsetOf(AppData, userLogin), XtRImmediate, (XtPointer) 0},
@@ -491,7 +497,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 +366,12 @@
+@@ -179,9 +372,12 @@
{"requestedDepth", "RequestedDepth", XtRInt, sizeof(int),
XtOffsetOf(AppData, requestedDepth), XtRImmediate, (XtPointer) 0},
@@ -505,7 +511,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},
-@@ -206,8 +396,13 @@
+@@ -206,8 +402,13 @@
{"bumpScrollPixels", "BumpScrollPixels", XtRInt, sizeof(int),
XtOffsetOf(AppData, bumpScrollPixels), XtRImmediate, (XtPointer) 20},
@@ -519,7 +525,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 +413,52 @@
+@@ -218,14 +419,55 @@
{"useRemoteCursor", "UseRemoteCursor", XtRBool, sizeof(Bool),
XtOffsetOf(AppData, useRemoteCursor), XtRImmediate, (XtPointer) True},
@@ -569,12 +575,15 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
+ {"chatActive", "ChatActive", XtRBool, sizeof(Bool),
+ XtOffsetOf(AppData, chatActive), XtRImmediate, (XtPointer) False},
+
++ {"fileActive", "FileActive", XtRBool, sizeof(Bool),
++ XtOffsetOf(AppData, fileActive), XtRImmediate, (XtPointer) False},
++
+ {"popupFix", "PopupFix", XtRBool, sizeof(Bool),
+ XtOffsetOf(AppData, popupFix), XtRImmediate, (XtPointer) False}
};
-@@ -242,8 +475,22 @@
+@@ -242,8 +484,22 @@
{"-noraiseonbeep", "*raiseOnBeep", XrmoptionNoArg, "False"},
{"-passwd", "*passwordFile", XrmoptionSepArg, 0},
{"-user", "*userLogin", XrmoptionSepArg, 0},
@@ -598,7 +607,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 +500,19 @@
+@@ -253,7 +509,19 @@
{"-nojpeg", "*enableJPEG", XrmoptionNoArg, "False"},
{"-nocursorshape", "*useRemoteCursor", XrmoptionNoArg, "False"},
{"-x11cursor", "*useX11Cursor", XrmoptionNoArg, "True"},
@@ -619,7 +628,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
};
-@@ -268,6 +527,7 @@
+@@ -268,6 +536,7 @@
{"SendRFBEvent", SendRFBEvent},
{"ShowPopup", ShowPopup},
{"HidePopup", HidePopup},
@@ -627,7 +636,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
{"ToggleFullScreen", ToggleFullScreen},
{"SetFullScreenState", SetFullScreenState},
{"SelectionFromVNC", SelectionFromVNC},
-@@ -277,6 +537,45 @@
+@@ -277,6 +546,47 @@
{"Pause", Pause},
{"RunCommand", RunCommand},
{"Quit", Quit},
@@ -649,6 +658,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
+ {"ToggleServerInput", ToggleServerInput},
+ {"ToggleSingleWindow", ToggleSingleWindow},
+ {"ToggleTextChat", ToggleTextChat},
++ {"ToggleFileXfer", ToggleFileXfer},
+ {"DoServerScale", DoServerScale},
+ {"ShowScaleN", ShowScaleN},
+ {"SetScaleN", SetScaleN},
@@ -669,11 +679,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
+ {"SetRawLocalState", SetRawLocalState},
+ {"SetServerInputState", SetServerInputState},
+ {"SetSingleWindowState", SetSingleWindowState},
-+ {"SetTextChatState", SetTextChatState}
++ {"SetTextChatState", SetTextChatState},
++ {"SetFileXferState", SetFileXferState}
};
-@@ -302,8 +601,8 @@
+@@ -302,8 +612,8 @@
void
usage(void)
{
@@ -684,7 +695,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 +631,142 @@
+@@ -332,10 +642,142 @@
" -autopass\n"
"\n"
"Option names may be abbreviated, e.g. -bgr instead of -bgr233.\n"
@@ -828,7 +839,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
/*
-@@ -350,6 +781,7 @@
+@@ -350,6 +792,7 @@
int i;
char *vncServerName, *colonPos;
int len, portOffset;
@@ -836,7 +847,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 +789,23 @@
+@@ -357,6 +800,23 @@
XtGetApplicationResources(toplevel, &appData, appDataResourceList,
XtNumber(appDataResourceList), 0, 0);
@@ -860,7 +871,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 +825,10 @@
+@@ -376,6 +836,10 @@
return;
}
@@ -871,7 +882,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v
if (argc == 1) {
vncServerName = DoServerDialog();
appData.passwordDialog = True;
-@@ -414,6 +867,13 @@
+@@ -414,6 +878,13 @@
if (!len || strspn(colonPos + 1, "0123456789") != len) {
usage();
}
@@ -3184,7 +3195,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/misc.c vnc_unixsrc/vncviewer/
static int
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer/popup.c
--- vnc_unixsrc.orig/vncviewer/popup.c 2000-06-11 08:00:53.000000000 -0400
-+++ vnc_unixsrc/vncviewer/popup.c 2007-05-21 02:30:10.000000000 -0400
++++ vnc_unixsrc/vncviewer/popup.c 2007-05-31 16:42:36.000000000 -0400
@@ -25,15 +25,44 @@
#include <X11/Xaw/Form.h>
@@ -3232,7 +3243,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer
XSetWMProtocols(dpy, XtWindow(popup), &wmDeleteWindow, 1);
}
-@@ -91,3 +120,230 @@
+@@ -91,3 +120,292 @@
prevButton = button;
}
}
@@ -3290,6 +3301,68 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer
+ }
+}
+
++int filexfer_sock = -1;
++int filexfer_listen = -1;
++
++void HideFile(Widget w, XEvent *event, String *params, Cardinal *num_params) {
++ if (filexfer_sock >= 0) {
++ close(filexfer_sock);
++ filexfer_sock = -1;
++ }
++ if (filexfer_listen >= 0) {
++ close(filexfer_listen);
++ filexfer_listen = -1;
++ }
++}
++
++extern int use_loopback;
++time_t start_listen = 0;
++
++void ShowFile(Widget w, XEvent *event, String *params, Cardinal *num_params) {
++ int i, port0 = 7200, port, sock = -1;
++ char *cmd, *jar;
++ char fmt[] = "java -cp '%s' VncViewer HOST localhost PORT %d delayAuthPanel yes ignoreMSLogonCheck yes disableSSL yes ftpOnly yes graftFtp yes &";
++
++ if (getenv("SSVNC_ULTRA_FTP_JAR")) {
++ jar = getenv("SSVNC_ULTRA_FTP_JAR");
++ cmd = (char *) malloc(strlen(fmt) + strlen(jar) + 10);
++ } else {
++ fprintf(stderr, "Cannot find UltraVNC FTP jar file.\n");
++ return;
++ }
++ use_loopback = 1;
++ for (i = 0; i < 100; i++) {
++ port = port0 + i;
++ sock = ListenAtTcpPort(port);
++ if (sock >= 0) {
++ fprintf(stderr, "listening for filexfer on port: %d sock: %d\n", port, sock);
++ break;
++ }
++ }
++ use_loopback = 0;
++ if (sock >= 0) {
++ int st;
++ pid_t pid = fork();
++ if (pid < 0) {
++ free(cmd);
++ return;
++ } else if (pid == 0) {
++ int i;
++ sprintf(cmd, fmt, jar, port);
++ for (i = 3; i < 100; i++) {
++ close(i);
++ }
++ fprintf(stderr, "\n-- Experimental UltraVNC File Transfer --\n\nRunning cmd:\n\n %s\n\n", cmd);
++ system(cmd);
++ exit(0);
++ }
++ waitpid(pid, &st, 0);
++ start_listen = time(NULL);
++ }
++ free(cmd);
++ filexfer_listen = sock;
++}
++
+Widget chat, entry, text;
+
+static int chat_visible = 0;
@@ -3488,7 +3561,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 2007-05-26 21:53:48.000000000 -0400
++++ vnc_unixsrc/vncviewer/rfbproto.c 2007-06-02 20:37:25.000000000 -0400
@@ -57,6 +57,25 @@
static Bool HandleTight16(int rx, int ry, int rw, int rh);
static Bool HandleTight32(int rx, int ry, int rw, int rh);
@@ -3515,17 +3588,18 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
static void ReadConnFailedReason(void);
static long ReadCompactLen (void);
-@@ -68,6 +87,9 @@
+@@ -68,6 +87,10 @@
int compressedLen);
+int sent_FBU = 0;
+int skip_XtUpdate = 0;
++int skip_XtUpdateAll = 0;
+
int rfbsock;
char *desktopName;
rfbPixelFormat myFormat;
-@@ -177,6 +199,9 @@
+@@ -177,6 +200,9 @@
sig_rfbEncodingPointerPos, "Pointer position update");
CapsAdd(encodingCaps, rfbEncodingLastRect, rfbTightVncVendor,
sig_rfbEncodingLastRect, "LastRect protocol extension");
@@ -3535,7 +3609,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
}
-@@ -187,21 +212,21 @@
+@@ -187,21 +213,21 @@
Bool
ConnectToRFBServer(const char *hostname, int port)
{
@@ -3568,7 +3642,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
}
-@@ -212,211 +237,228 @@
+@@ -212,211 +238,228 @@
Bool
InitialiseRFBConnection(void)
{
@@ -3920,8 +3994,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ return rfbSecTypeTight;
+ }
+ }
-
-- free(secTypes);
++
+ /* Find first supported security type */
+ for (j = 0; j < (int)nSecTypes; j++) {
+ for (i = 0; i < nKnownSecTypes; i++) {
@@ -3938,7 +4011,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ break;
+ }
+ }
-+
+
+- free(secTypes);
+ free(secTypes);
- if (secType == rfbSecTypeInvalid)
@@ -3952,7 +4026,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
}
-@@ -451,6 +493,9 @@
+@@ -451,6 +494,9 @@
return True;
}
@@ -3962,7 +4036,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
/*
* Negotiate authentication scheme (protocol version 3.7t)
-@@ -459,56 +504,61 @@
+@@ -459,56 +505,61 @@
static Bool
PerformAuthenticationTight(void)
{
@@ -4066,7 +4140,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
}
-@@ -519,80 +569,97 @@
+@@ -519,80 +570,97 @@
static Bool
AuthenticateVNC(void)
{
@@ -4227,7 +4301,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
}
/*
-@@ -602,68 +669,71 @@
+@@ -602,68 +670,71 @@
static Bool
AuthenticateUnixLogin(void)
{
@@ -4351,7 +4425,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
}
-@@ -675,19 +745,20 @@
+@@ -675,19 +746,20 @@
static Bool
ReadInteractionCaps(void)
{
@@ -4384,7 +4458,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
}
-@@ -700,17 +771,18 @@
+@@ -700,17 +772,18 @@
static Bool
ReadCapabilityList(CapsContainer *caps, int count)
{
@@ -4412,7 +4486,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
}
-@@ -729,6 +801,10 @@
+@@ -729,6 +802,10 @@
Bool requestCompressLevel = False;
Bool requestQualityLevel = False;
Bool requestLastRectEncoding = False;
@@ -4423,7 +4497,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
spf.type = rfbSetPixelFormat;
spf.format = myFormat;
-@@ -736,6 +812,7 @@
+@@ -736,6 +813,7 @@
spf.format.greenMax = Swap16IfLE(spf.format.greenMax);
spf.format.blueMax = Swap16IfLE(spf.format.blueMax);
@@ -4431,7 +4505,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
if (!WriteExact(rfbsock, (char *)&spf, sz_rfbSetPixelFormatMsg))
return False;
-@@ -754,6 +831,12 @@
+@@ -754,6 +832,12 @@
encStrLen = strlen(encStr);
}
@@ -4444,7 +4518,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
if (strncasecmp(encStr,"raw",encStrLen) == 0) {
encs[se->nEncodings++] = Swap32IfLE(rfbEncodingRaw);
} else if (strncasecmp(encStr,"copyrect",encStrLen) == 0) {
-@@ -775,6 +858,10 @@
+@@ -775,6 +859,10 @@
encs[se->nEncodings++] = Swap32IfLE(rfbEncodingCoRRE);
} else if (strncasecmp(encStr,"rre",encStrLen) == 0) {
encs[se->nEncodings++] = Swap32IfLE(rfbEncodingRRE);
@@ -4455,7 +4529,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
} else {
fprintf(stderr,"Unknown encoding '%.*s'\n",encStrLen,encStr);
}
-@@ -797,7 +884,7 @@
+@@ -797,7 +885,7 @@
if (appData.useRemoteCursor) {
if (se->nEncodings < MAX_ENCODINGS)
encs[se->nEncodings++] = Swap32IfLE(rfbEncodingXCursor);
@@ -4464,7 +4538,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
encs[se->nEncodings++] = Swap32IfLE(rfbEncodingRichCursor);
if (se->nEncodings < MAX_ENCODINGS)
encs[se->nEncodings++] = Swap32IfLE(rfbEncodingPointerPos);
-@@ -806,10 +893,14 @@
+@@ -806,10 +894,14 @@
if (se->nEncodings < MAX_ENCODINGS && requestLastRectEncoding) {
encs[se->nEncodings++] = Swap32IfLE(rfbEncodingLastRect);
}
@@ -4480,7 +4554,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
fprintf(stderr,"Same machine: preferring raw encoding\n");
encs[se->nEncodings++] = Swap32IfLE(rfbEncodingRaw);
} else {
-@@ -819,6 +910,7 @@
+@@ -819,6 +911,7 @@
encs[se->nEncodings++] = Swap32IfLE(rfbEncodingCopyRect);
encs[se->nEncodings++] = Swap32IfLE(rfbEncodingTight);
@@ -4488,7 +4562,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
encs[se->nEncodings++] = Swap32IfLE(rfbEncodingHextile);
encs[se->nEncodings++] = Swap32IfLE(rfbEncodingZlib);
encs[se->nEncodings++] = Swap32IfLE(rfbEncodingCoRRE);
-@@ -844,11 +936,14 @@
+@@ -844,11 +937,14 @@
if (appData.useRemoteCursor) {
encs[se->nEncodings++] = Swap32IfLE(rfbEncodingXCursor);
@@ -4504,7 +4578,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
}
len = sz_rfbSetEncodingsMsg + se->nEncodings * 4;
-@@ -868,8 +963,8 @@
+@@ -868,10 +964,11 @@
Bool
SendIncrementalFramebufferUpdateRequest()
{
@@ -4514,8 +4588,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ si.framebufferHeight, True);
}
++time_t last_filexfer = 0;
-@@ -880,19 +975,26 @@
+ /*
+ * SendFramebufferUpdateRequest.
+@@ -880,19 +977,35 @@
Bool
SendFramebufferUpdateRequest(int x, int y, int w, int h, Bool incremental)
{
@@ -4528,6 +4605,17 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
- 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));
++// return True;
++ x = y = 0;
++ w = h = 1;
++ }
++ }
+
+- if (!WriteExact(rfbsock, (char *)&fur, sz_rfbFramebufferUpdateRequestMsg))
+- return False;
+ fur.type = rfbFramebufferUpdateRequest;
+ fur.incremental = incremental ? 1 : 0;
+ fur.x = Swap16IfLE(x);
@@ -4541,23 +4629,33 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ sent_FBU = 2;
+ }
-- if (!WriteExact(rfbsock, (char *)&fur, sz_rfbFramebufferUpdateRequestMsg))
-- return False;
+- return True;
+ if (!WriteExact(rfbsock, (char *)&fur, sz_rfbFramebufferUpdateRequestMsg)) {
+ return False;
+ }
-
-- return True;
++
+ return True;
}
-@@ -903,19 +1005,20 @@
+@@ -903,19 +1016,27 @@
Bool
SendPointerEvent(int x, int y, int buttonMask)
{
- 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;
++ if (x < 0) x = 0;
++ if (y < 0) y = 0;
- pe.type = rfbPointerEvent;
- pe.buttonMask = buttonMask;
@@ -4570,11 +4668,6 @@ 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);
-+ pe.type = rfbPointerEvent;
-+ pe.buttonMask = buttonMask;
-+ if (x < 0) x = 0;
-+ if (y < 0) y = 0;
-+
+ if (!appData.useX11Cursor) {
+ SoftCursorMove(x, y);
+ }
@@ -4585,7 +4678,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
}
-@@ -926,12 +1029,12 @@
+@@ -926,12 +1047,12 @@
Bool
SendKeyEvent(CARD32 key, Bool down)
{
@@ -4603,21 +4696,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
}
-@@ -942,281 +1045,565 @@
+@@ -942,281 +1063,661 @@
Bool
SendClientCutText(char *str, int len)
{
- rfbClientCutTextMsg cct;
+ rfbClientCutTextMsg cct;
-+
-+ if (serverCutText) {
-+ free(serverCutText);
-+ }
-+ serverCutText = NULL;
-+
-+ if (appData.viewOnly) {
-+ return True;
-+ }
- if (serverCutText)
- free(serverCutText);
@@ -4627,58 +4711,80 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
- cct.length = Swap32IfLE(len);
- return (WriteExact(rfbsock, (char *)&cct, sz_rfbClientCutTextMsg) &&
- WriteExact(rfbsock, str, len));
-+ cct.type = rfbClientCutText;
-+ cct.length = Swap32IfLE(len);
-+ return (WriteExact(rfbsock, (char *)&cct, sz_rfbClientCutTextMsg) &&
-+ WriteExact(rfbsock, str, len));
- }
+-}
++ if (serverCutText) {
++ free(serverCutText);
++ }
++ serverCutText = NULL;
-+Bool
-+SendServerScale(int nfac)
-+{
-+ rfbSetScaleMsg ssc;
-+ if (nfac < 0 || nfac > 100) {
++ if (appData.viewOnly) {
+ return True;
+ }
-/*
- * HandleRFBServerMessage.
- */
-+ ssc.type = rfbSetScale;
-+ ssc.scale = nfac;
-+ return WriteExact(rfbsock, (char *)&ssc, sz_rfbSetScaleMsg);
++ cct.type = rfbClientCutText;
++ cct.length = Swap32IfLE(len);
++ return (WriteExact(rfbsock, (char *)&cct, sz_rfbClientCutTextMsg) &&
++ WriteExact(rfbsock, str, len));
+}
Bool
-HandleRFBServerMessage()
-+SendServerInput(Bool enabled)
++SendServerScale(int nfac)
{
- rfbServerToClientMsg msg;
-+ rfbSetServerInputMsg sim;
++ rfbSetScaleMsg ssc;
++ if (nfac < 0 || nfac > 100) {
++ return True;
++ }
- if (!ReadFromRFBServer((char *)&msg, 1))
- return False;
-+ sim.type = rfbSetServerInput;
-+ sim.status = enabled;
-+ return WriteExact(rfbsock, (char *)&sim, sz_rfbSetServerInputMsg);
++ ssc.type = rfbSetScale;
++ ssc.scale = nfac;
++ return WriteExact(rfbsock, (char *)&ssc, sz_rfbSetScaleMsg);
+}
- switch (msg.type) {
+Bool
-+SendSingleWindow(int x, int y)
++SendServerInput(Bool enabled)
+{
-+ rfbSetSWMsg sw;
++ rfbSetServerInputMsg sim;
- case rfbSetColourMapEntries:
- {
- int i;
- CARD16 rgb[3];
- XColor xc;
-+ fprintf(stderr, "SendSingleWindow: %d %d\n", x, y);
++ sim.type = rfbSetServerInput;
++ sim.status = enabled;
++ return WriteExact(rfbsock, (char *)&sim, sz_rfbSetServerInputMsg);
++}
- if (!ReadFromRFBServer(((char *)&msg) + 1,
- sz_rfbSetColourMapEntriesMsg - 1))
- return False;
++Bool
++SendSingleWindow(int x, int y)
++{
++ rfbSetSWMsg sw;
+
+- msg.scme.firstColour = Swap16IfLE(msg.scme.firstColour);
+- msg.scme.nColours = Swap16IfLE(msg.scme.nColours);
++ fprintf(stderr, "SendSingleWindow: %d %d\n", x, y);
+
+- for (i = 0; i < msg.scme.nColours; i++) {
+- if (!ReadFromRFBServer((char *)rgb, 6))
+- return False;
+- xc.pixel = msg.scme.firstColour + i;
+- xc.red = Swap16IfLE(rgb[0]);
+- xc.green = Swap16IfLE(rgb[1]);
+- xc.blue = Swap16IfLE(rgb[2]);
+- xc.flags = DoRed|DoGreen|DoBlue;
+- XStoreColor(dpy, cmap, &xc);
+- }
+ if (x == -1 && y == -1) {
+ sw.type = rfbSetSW;
+ sw.x = Swap16IfLE(1);
@@ -4692,8 +4798,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ return WriteExact(rfbsock, (char *)&sw, sz_rfbSetSWMsg);
+}
-- msg.scme.firstColour = Swap16IfLE(msg.scme.firstColour);
-- msg.scme.nColours = Swap16IfLE(msg.scme.nColours);
+- break;
+- }
+Bool
+SendTextChat(char *str)
+{
@@ -4710,20 +4816,18 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ return WriteExact(rfbsock, str, strlen(str));
+}
-- for (i = 0; i < msg.scme.nColours; i++) {
-- if (!ReadFromRFBServer((char *)rgb, 6))
-- return False;
-- xc.pixel = msg.scme.firstColour + i;
-- xc.red = Swap16IfLE(rgb[0]);
-- xc.green = Swap16IfLE(rgb[1]);
-- xc.blue = Swap16IfLE(rgb[2]);
-- xc.flags = DoRed|DoGreen|DoBlue;
-- XStoreColor(dpy, cmap, &xc);
-- }
+- case rfbFramebufferUpdate:
+- {
+- rfbFramebufferUpdateRectHeader rect;
+- int linesToRead;
+- int bytesPerLine;
+- int i;
+- int usecs;
+extern void raiseme(void);
-- break;
-- }
+- if (!ReadFromRFBServer(((char *)&msg.fu) + 1,
+- sz_rfbFramebufferUpdateMsg - 1))
+- return False;
+Bool
+SendTextChatOpen(void)
+{
@@ -4736,13 +4840,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ return WriteExact(rfbsock, (char *)&chat, sz_rfbTextChatMsg);
+}
-- case rfbFramebufferUpdate:
-- {
-- rfbFramebufferUpdateRectHeader rect;
-- int linesToRead;
-- int bytesPerLine;
-- int i;
-- int usecs;
+- msg.fu.nRects = Swap16IfLE(msg.fu.nRects);
+Bool
+SendTextChatClose(void)
+{
@@ -4754,9 +4852,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ return WriteExact(rfbsock, (char *)&chat, sz_rfbTextChatMsg);
+}
-- if (!ReadFromRFBServer(((char *)&msg.fu) + 1,
-- sz_rfbFramebufferUpdateMsg - 1))
-- return False;
+- for (i = 0; i < msg.fu.nRects; i++) {
+- if (!ReadFromRFBServer((char *)&rect, sz_rfbFramebufferUpdateRectHeader))
+- return False;
+Bool
+SendTextChatFinished(void)
+{
@@ -4791,25 +4889,64 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ *t_old = t_now;
+ return(dt);
+}
-
-- msg.fu.nRects = Swap16IfLE(msg.fu.nRects);
++
+/* common dtime() activities: */
+double dtime0(double *t_old) {
+ *t_old = 0.0;
+ return dtime(t_old);
+}
-
-- for (i = 0; i < msg.fu.nRects; i++) {
-- if (!ReadFromRFBServer((char *)&rect, sz_rfbFramebufferUpdateRectHeader))
-- return False;
++
+double dnow(void) {
+ double t;
+ return dtime0(&t);
+}
++
++extern int filexfer_sock;
++extern int filexfer_listen;
++
++static char fxfer[65536];
++extern void CheckFileXfer(void);
++
++Bool HandleFileXfer(void) {
++ unsigned char hdr[12];
++ unsigned int len;
++
++ int rfbDirContentRequest = 1;
++ int rfbDirPacket = 2; // Full directory name or full file name.
++ int rfbFileTransferRequest = 3;
++ int rfbFileHeader = 4;
++ int rfbFilePacket = 5; // One slice of the file
++ int rfbEndOfFile = 6;
++ int rfbAbortFileTransfer = 7;
++ int rfbFileTransferOffer = 8;
++ int rfbFileAcceptHeader = 9; // The server accepts or rejects the file
++ int rfbCommand = 10;
++ int rfbCommandReturn = 11;
++ int rfbFileChecksums = 12;
++
++ int rfbRDirContent = 1; // Request a Server Directory contents
++ int rfbRDrivesList = 2; // Request the server's drives list
++
++ int rfbADirectory = 1; // Reception of a directory name
++ int rfbAFile = 2; // Reception of a file name
++ int rfbADrivesList = 3; // Reception of a list of drives
++ int rfbADirCreate = 4; // Response to a create dir command
++ int rfbADirDelete = 5; // Response to a delete dir command
++ int rfbAFileCreate = 6; // Response to a create file command
++ int rfbAFileDelete = 7; // Response to a delete file command
++
++ int rfbCDirCreate = 1; // Request the server to create the given directory
++ int rfbCDirDelete = 2; // Request the server to delete the given directory
++ int rfbCFileCreate = 3; // Request the server to create the given file
++ int rfbCFileDelete = 4; // Request the server to delete the given file
++
++ int rfbRErrorUnknownCmd = 1; // Unknown FileTransfer command.
++ int rfbRErrorCmd = 0xFFFFFFFF;
- rect.encoding = Swap32IfLE(rect.encoding);
- if (rect.encoding == rfbEncodingLastRect)
- break;
++ int db = 0;
- rect.r.x = Swap16IfLE(rect.r.x);
- rect.r.y = Swap16IfLE(rect.r.y);
@@ -4824,21 +4961,17 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
- }
- continue;
- }
-+/*
-+ * HandleRFBServerMessage.
-+ */
++ last_filexfer = time(NULL);
++ //fprintf(stderr, "last_filexfer-1: %d\n", last_filexfer);
- if (rect.encoding == rfbEncodingPointerPos) {
- if (!HandleCursorPos(rect.r.x, rect.r.y)) {
- return False;
-- }
++ if (filexfer_sock < 0) {
++ return True;
+ }
- continue;
- }
-+Bool
-+HandleRFBServerMessage()
-+{
-+ int db = 0;
-+ rfbServerToClientMsg msg;
- if ((rect.r.x + rect.r.w > si.framebufferWidth) ||
- (rect.r.y + rect.r.h > si.framebufferHeight))
@@ -4846,40 +4979,101 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
- fprintf(stderr,"Rect too large: %dx%d at (%d, %d)\n",
- rect.r.w, rect.r.h, rect.r.x, rect.r.y);
- return False;
-+ if (!ReadFromRFBServer((char *)&msg, 1)) {
++ hdr[0] = rfbFileTransfer;
++ skip_XtUpdateAll = 1;
++ if (!ReadFromRFBServer(&hdr[1], 11)) {
++ skip_XtUpdateAll = 0;
+ return False;
++ }
++ write(filexfer_sock, hdr, 12);
++ if (db) fprintf(stderr, "Got rfbFileTransfer hdr\n");
++ if (db) write(2, hdr, 12);
++ if (db) fprintf(stderr, "\n");
++
++ len = (hdr[8] << 24) | (hdr[9] << 16) | (hdr[10] << 8) | hdr[11];
++ if (db) fprintf(stderr, "Got rfbFileTransfer: len %d\n", len);
++ if (len > 0) {
++ if (!ReadFromRFBServer(fxfer, len)) {
++ skip_XtUpdateAll = 0;
++ return False;
++ }
++ 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");
++ len = 4;
++ if (!ReadFromRFBServer(fxfer, len)) {
++ skip_XtUpdateAll = 0;
++ return False;
++ }
++ 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;
- if (rect.r.h * rect.r.w == 0) {
- fprintf(stderr,"Zero size rect - ignoring\n");
- continue;
- }
-+ switch (msg.type) {
++ CheckFileXfer();
++ return True;
++}
++
++/*
++ * HandleRFBServerMessage.
++ */
- /* If RichCursor encoding is used, we should prevent collisions
- between framebuffer updates and cursor drawing operations. */
- SoftCursorLockArea(rect.r.x, rect.r.y, rect.r.w, rect.r.h);
--
+
- switch (rect.encoding) {
++Bool
++HandleRFBServerMessage()
++{
++ int db = 0;
++ rfbServerToClientMsg msg;
+
+- case rfbEncodingRaw:
++ if (!ReadFromRFBServer((char *)&msg, 1)) {
++ return False;
++ }
+
+- bytesPerLine = rect.r.w * myFormat.bitsPerPixel / 8;
+- linesToRead = BUFFER_SIZE / bytesPerLine;
++ if (msg.type == rfbFileTransfer) {
++ return HandleFileXfer();
++ }
+
+- while (rect.r.h > 0) {
+- if (linesToRead > rect.r.h)
+- linesToRead = rect.r.h;
++ switch (msg.type) {
+
+- if (!ReadFromRFBServer(buffer,bytesPerLine * linesToRead))
+- return False;
+ case rfbSetColourMapEntries:
+ {
+ int i;
+ CARD16 rgb[3];
+ XColor xc;
-- case rfbEncodingRaw:
+- CopyDataToScreen(buffer, rect.r.x, rect.r.y, rect.r.w,
+- linesToRead);
+ if (!ReadFromRFBServer(((char *)&msg) + 1, sz_rfbSetColourMapEntriesMsg - 1)) {
+ return False;
+ }
-- bytesPerLine = rect.r.w * myFormat.bitsPerPixel / 8;
-- linesToRead = BUFFER_SIZE / bytesPerLine;
+- rect.r.h -= linesToRead;
+- rect.r.y += linesToRead;
+ msg.scme.firstColour = Swap16IfLE(msg.scme.firstColour);
+ msg.scme.nColours = Swap16IfLE(msg.scme.nColours);
-- while (rect.r.h > 0) {
-- if (linesToRead > rect.r.h)
-- linesToRead = rect.r.h;
+ for (i = 0; i < msg.scme.nColours; i++) {
+ if (!ReadFromRFBServer((char *)rgb, 6)) {
+ return False;
@@ -4896,38 +5090,10 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ }
+ xc.flags = DoRed|DoGreen|DoBlue;
+ XStoreColor(dpy, cmap, &xc);
-+ }
-
-- if (!ReadFromRFBServer(buffer,bytesPerLine * linesToRead))
-- return False;
-+ break;
-+ }
-
-- CopyDataToScreen(buffer, rect.r.x, rect.r.y, rect.r.w,
-- linesToRead);
-+ case rfbFramebufferUpdate:
-+ {
-+ rfbFramebufferUpdateRectHeader rect;
-+ int linesToRead;
-+ int bytesPerLine;
-+ int i;
-+ int usecs;
-+
-+ int area_copyrect = 0;
-+ int area_tight = 0;
-+ int area_zrle = 0;
-+ int area_raw = 0;
-+ if (db) fprintf(stderr, "FBU-0: %.6f\n", dnow());
-
-- rect.r.h -= linesToRead;
-- rect.r.y += linesToRead;
-+ int skip_incFBU = 0;
-+ sent_FBU = -1;
-
-+ if (!ReadFromRFBServer(((char *)&msg.fu) + 1, sz_rfbFramebufferUpdateMsg - 1)) {
-+ return False;
}
-- break;
++
+ break;
++ }
- case rfbEncodingCopyRect:
- {
@@ -4955,11 +5121,33 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
- rect.r.w, rect.r.h);
- XFillRectangle(dpy, desktopWin, srcGC, cr.srcX, cr.srcY,
- rect.r.w, rect.r.h);
-- }
-+ msg.fu.nRects = Swap16IfLE(msg.fu.nRects);
++ case rfbFramebufferUpdate:
++ {
++ rfbFramebufferUpdateRectHeader rect;
++ int linesToRead;
++ int bytesPerLine;
++ int i;
++ int usecs;
++
++ int area_copyrect = 0;
++ int area_tight = 0;
++ int area_zrle = 0;
++ int area_raw = 0;
++ if (db) fprintf(stderr, "FBU-0: %.6f\n", dnow());
++
++ int skip_incFBU = 0;
++ sent_FBU = -1;
++
++ if (!ReadFromRFBServer(((char *)&msg.fu) + 1, sz_rfbFramebufferUpdateMsg - 1)) {
++ return False;
+ }
- XCopyArea(dpy, desktopWin, desktopWin, gc, cr.srcX, cr.srcY,
- rect.r.w, rect.r.h, rect.r.x, rect.r.y);
++ msg.fu.nRects = Swap16IfLE(msg.fu.nRects);
+
+- break;
+- }
+ for (i = 0; i < msg.fu.nRects; i++) {
+ if (!ReadFromRFBServer((char *)&rect, sz_rfbFramebufferUpdateRectHeader)) {
+ return False;
@@ -5256,11 +5444,6 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ return False;
+ }
-- break;
-- }
-+ /* Now we may discard "soft cursor locks". */
-+ if (db) fprintf(stderr, "FBU-SUL1 %.6f\n", dnow());
-
- case rfbEncodingRRE:
- {
- switch (myFormat.bitsPerPixel) {
@@ -5279,7 +5462,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
- }
- break;
- }
-+ SoftCursorUnlockScreen();
++ /* Now we may discard "soft cursor locks". */
++ if (db) fprintf(stderr, "FBU-SUL1 %.6f\n", dnow());
- case rfbEncodingCoRRE:
- {
@@ -5296,10 +5480,10 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
- if (!HandleCoRRE32(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;
- }
++ SoftCursorUnlockScreen();
- case rfbEncodingHextile:
- {
@@ -5316,14 +5500,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
- if (!HandleHextile32(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());
++ if (db) fprintf(stderr, "FBU-SUL2 %.6f\n", dnow());
}
- break;
- }
--
+
- case rfbEncodingZlib:
- {
- switch (myFormat.bitsPerPixel) {
@@ -5339,6 +5520,29 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
- 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
@@ -5360,25 +5564,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ si.framebufferHeight, False);
+ skip_incFBU = 1;
+ }
- }
-- 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;
++ }
+ if (do_fb_update != 0.0) {
+ if (dnow() > do_fb_update + 1.1) {
+ do_fb_update = 0.0;
@@ -5401,7 +5587,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
#ifdef MITSHM
/* if using shared memory PutImage, make sure that the X server has
-@@ -1224,59 +1611,142 @@
+@@ -1224,59 +1725,149 @@
mainly to avoid copyrect using invalid screen contents - not sure
if we'd need it otherwise. */
@@ -5572,12 +5758,19 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
+ fprintf(stderr,"Unknown message type %d from VNC server\n",msg.type);
+ return False;
+ }
++ if (appData.fileActive) {
++ if (filexfer_sock < 0 && filexfer_listen < 0) {
++ appData.fileActive = False;
++ } else {
++ CheckFileXfer();
++ }
++ }
+
+ return True;
}
-@@ -1296,12 +1766,19 @@
+@@ -1296,12 +1887,19 @@
#define CONCAT2(a,b) a##b
#define CONCAT2E(a,b) CONCAT2(a,b)
@@ -5597,7 +5790,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
#undef BPP
#define BPP 16
#include "rre.c"
-@@ -1309,6 +1786,7 @@
+@@ -1309,6 +1907,7 @@
#include "hextile.c"
#include "zlib.c"
#include "tight.c"
@@ -5605,7 +5798,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
#undef BPP
#define BPP 32
#include "rre.c"
-@@ -1316,6 +1794,15 @@
+@@ -1316,6 +1915,15 @@
#include "hextile.c"
#include "zlib.c"
#include "tight.c"
@@ -5621,7 +5814,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
#undef BPP
/*
-@@ -1358,9 +1845,9 @@
+@@ -1358,9 +1966,9 @@
" %s significant bit in each byte is leftmost on the screen.\n",
(format->bigEndian ? "Most" : "Least"));
} else {
@@ -5633,7 +5826,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie
(format->bigEndian ? "Most" : "Least"));
}
if (format->trueColour) {
-@@ -1463,3 +1950,115 @@
+@@ -1463,3 +2071,115 @@
cinfo->src = &jpegSrcManager;
}
@@ -5968,13 +6161,158 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/smake vnc_unixsrc/vncviewer/s
+fi
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncviewer/sockets.c
--- vnc_unixsrc.orig/vncviewer/sockets.c 2001-01-14 22:54:18.000000000 -0500
-+++ vnc_unixsrc/vncviewer/sockets.c 2007-05-20 21:24:33.000000000 -0400
-@@ -63,15 +63,64 @@
++++ vnc_unixsrc/vncviewer/sockets.c 2007-05-31 22:13:52.000000000 -0400
+@@ -63,15 +63,216 @@
XtRemoveInput(*id);
}
+extern int skip_XtUpdate;
++extern int skip_XtUpdateAll;
++extern int filexfer_sock, filexfer_listen;
++extern time_t start_listen;
+extern void CheckTextInput(void);
++extern time_t last_filexfer;
++
++static char fxfer[65536];
++int fxfer_size = 65536;
++
++void CheckFileXfer() {
++ fd_set fds;
++ struct timeval tv;
++ int i, icnt = 0, igot = 0, bytes0 = 0, bytes = 0, grace = 0, n, list = 0;
++ int db = 0;
++
++ if (!appData.fileActive || (filexfer_sock < 0 && filexfer_listen < 0)) {
++ return;
++ }
++
++ if (filexfer_listen >= 0 && time(NULL) > start_listen + 10) {
++ fprintf(stderr, "filexfer closing aging listen socket.\n");
++ close(filexfer_listen);
++ filexfer_listen = -1;
++ return;
++ }
++//fprintf(stderr, "In CheckFileXfer\n");
++
++ if (filexfer_listen >=0) {
++ n = filexfer_listen;
++ list = 1;
++ } else {
++ n = filexfer_sock;
++ }
++
++ while (1) {
++ icnt++;
++ FD_ZERO(&fds);
++ FD_SET(n,&fds);
++ tv.tv_sec = 0;
++ tv.tv_usec = 0;
++ if (select(n+1, &fds, NULL, NULL, &tv) > 0) {
++ if (FD_ISSET(n, &fds)) {
++ if (list) {
++ if (filexfer_sock >= 0) {
++ fprintf(stderr, "filexfer close stale(?) filexfer_sock.\n");
++ close(filexfer_sock);
++ filexfer_sock = -1;
++ }
++ filexfer_sock = AcceptTcpConnection(filexfer_listen);
++ if (filexfer_listen >= 0) {
++ fprintf(stderr, "filexfer accept OK.\n");
++ close(filexfer_listen);
++ filexfer_listen = -1;
++ } else {
++ fprintf(stderr, "filexfer accept failed.\n");
++ }
++ break;
++ } else {
++ ssize_t rn;
++ unsigned char hdr[12];
++ unsigned int len;
++ if (db) fprintf(stderr, "try read filexfer...\n");
++#if 1
++ rn = read(n, fxfer, 1*8192);
++ if (0 || db) fprintf(stderr, "filexfer read[%d] %d.\n", icnt, rn);
++ if (rn < 0) {
++ fprintf(stderr, "filexfer bad read: %d\n", errno);
++ break;
++ } else if (rn == 0) {
++ fprintf(stderr, "filexfer gone.\n");
++ close(n);
++ filexfer_sock = -1;
++ last_filexfer = time(NULL);
++ //fprintf(stderr, "last_filexfer-2a: %d\n", last_filexfer);
++ return;
++ } else if (rn > 0) {
++ if (db) write(2, fxfer, rn);
++ if (db) fprintf(stderr, "\n");
++ bytes += rn;
++ last_filexfer = time(NULL);
++ //fprintf(stderr, "last_filexfer-2b: %d\n", last_filexfer);
++ if (!WriteExact(rfbsock, fxfer, rn)) {
++ return;
++ }
++ igot = 1;
++ }
++#else
++ // not working, not always 7 msg type.
++ rn = read(n, hdr, 12);
++ if (db) fprintf(stderr, "filexfer read %d.\n", rn);
++ if (rn == 0) {
++ fprintf(stderr, "filexfer gone.\n");
++ close(n);
++ filexfer_sock = -1;
++ last_filexfer = time(NULL);
++ return;
++ }
++ if (rn == 12) {
++ len = (hdr[8] << 24) | (hdr[9] << 16) | (hdr[10] << 8) | hdr[11];
++ if (db) fprintf(stderr, "n=%d len=%d\n", rn, len);
++ if (db) write(2, hdr, rn);
++ if (db) fprintf(stderr, "\n");
++ WriteExact(rfbsock, hdr, rn);
++ if (len > 0) {
++ rn = read(len, fxfer, len);
++ if (!WriteExact(rfbsock, fxfer, len)) {
++ last_filexfer = time(NULL);
++ return;
++ }
++ if (db) write(2, fxfer, len);
++ }
++ if (db) fprintf(stderr, "\n");
++ } else {
++ if (db) fprintf(stderr, "bad rn: %d\n", rn);
++ }
++ igot = 1;
++#endif
++ }
++ }
++ } else {
++ if (bytes >= 8192) {
++ int ok = 0;
++ if (bytes0 == 0) {
++ ok = 1;
++ } else if (bytes >= bytes0 + 12) {
++ ok = 1;
++ } else if (grace < 20) {
++ ok = 1;
++ }
++ if (ok) {
++ grace++;
++ bytes0 = bytes;
++ //fprintf(stderr, "grace: %d\n", grace);
++ usleep(10 * 1000);
++ continue;
++ }
++ }
++ break;
++ }
++ }
++ if (igot) {
++ last_filexfer = time(NULL);
++ //fprintf(stderr, "last_filexfer-2c: %d\n", last_filexfer);
++ }
++ return;
++}
+
static void
ProcessXtEvents()
@@ -5985,6 +6323,10 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview
- while (!rfbsockReady) {
- XtAppProcessEvent(appContext, XtIMAll);
- }
++ int y;
++ if (skip_XtUpdateAll) {
++ return;
++ }
+ if (appData.chatActive) {
+ fd_set fds;
+ struct timeval tv;
@@ -6030,21 +6372,33 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview
+ return;
+ }
+
++//fprintf(stderr, "XtAppAddInput: ");
+ rfbsockReady = False;
+ XtAppAddInput(appContext, rfbsock, (XtPointer)XtInputReadMask,
+ rfbsockReadyCallback, NULL);
+
+ while (!rfbsockReady) {
++//fprintf(stderr, ".");
+ XtAppProcessEvent(appContext, XtIMAll);
+ }
++//fprintf(stderr, " done.\n");
}
Bool
-@@ -283,6 +332,10 @@
+@@ -272,6 +473,8 @@
+ * ListenAtTcpPort starts listening at the given TCP port.
+ */
+
++int use_loopback = 0;
++
+ int
+ ListenAtTcpPort(int port)
+ {
+@@ -283,6 +486,10 @@
addr.sin_port = htons(port);
addr.sin_addr.s_addr = INADDR_ANY;
-+ if (getenv("VNCVIEWER_LISTEN_LOCALHOST")) {
++ if (getenv("VNCVIEWER_LISTEN_LOCALHOST") || use_loopback) {
+ addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+ }
+
@@ -6106,542 +6460,9 @@ 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 2007-05-25 23:22:17.000000000 -0400
-@@ -0,0 +1,529 @@
-+'\" 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 encoding is 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 str\fR
-+Useful for logging into x11vnc in -unixpw 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 -unixpw 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 ...
-+ Disable JPEG: ~ -nojpeg
-+ 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
-+
-+ UltraVNC Extensions:
-+ Disable Remote Input Ultravnc ext. Try to prevent input and
-+ viewing of monitor at physical display.
-+ Single Window Ultravnc ext. Grab and view a single window.
-+ (click on the window you want).
-+ Set 1/n Server Scale Ultravnc ext. Scale desktop by 1/n.
-+ prompt is from the terminal.
-+ Text Chat Ultravnc ext. Do Text Chat.
-+
-+ 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).
-+.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 2007-05-27 11:58:44.000000000 -0400
++++ vnc_unixsrc/vncviewer/vncviewer.c 2007-05-31 15:18:09.000000000 -0400
@@ -22,6 +22,7 @@
*/
@@ -6821,7 +6642,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,813 @@
+@@ -45,89 +203,834 @@
listenForIncomingConnections() returns, setting the listenSpecified
flag. */
@@ -7337,11 +7158,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi
+Bool _sw2_ = False;
+Bool _sw3_ = False;
+Bool selectingSingleWindow = False;
-
-- Cleanup();
++
+extern Cursor bogoCursor;
-
-- return 0;
++
+void
+ToggleSingleWindow(Widget w, XEvent *ev, String *params, Cardinal *num_params)
+{
@@ -7396,6 +7215,18 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi
+ }
+}
+
++void
++ToggleFileXfer(Widget w, XEvent *ev, String *params, Cardinal *num_params)
++{
++ if (appData.fileActive) {
++ HideFile(w, ev, params, num_params);
++ appData.fileActive= False;
++ } else {
++ ShowFile(w, ev, params, num_params);
++ appData.fileActive = True;
++ }
++}
++
+static int fooHandler(Display *dpy, XErrorEvent *error) {
+ return 0;
+}
@@ -7532,7 +7363,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi
+ XtVaSetValues(w, XtNstate, False, NULL);
+ }
+}
-+
+
+- Cleanup();
+void
+SetFullColorState(Widget w, XEvent *ev, String *params, Cardinal *num_params)
+{
@@ -7544,7 +7376,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi
+ if (b16 != NULL) XtVaSetValues(b16, XtNstate, False, NULL);
+ }
+}
-+
+
+- return 0;
+void
+Set256ColorsState(Widget w, XEvent *ev, String *params, Cardinal *num_params)
+{
@@ -7670,11 +7503,20 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi
+ XtVaSetValues(w, XtNstate, True, NULL);
+ else
+ XtVaSetValues(w, XtNstate, False, NULL);
++}
++
++void
++SetFileXferState(Widget w, XEvent *ev, String *params, Cardinal *num_params)
++{
++ if (appData.fileActive)
++ XtVaSetValues(w, XtNstate, True, NULL);
++ else
++ XtVaSetValues(w, XtNstate, False, NULL);
}
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 2007-05-27 11:53:21.000000000 -0400
-@@ -68,51 +68,72 @@
++++ vnc_unixsrc/vncviewer/vncviewer.h 2007-05-30 23:52:07.000000000 -0400
+@@ -68,51 +68,73 @@
/* argsresources.c */
typedef struct {
@@ -7780,6 +7622,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
+ Bool singleWindow;
+ int serverScale;
+ Bool chatActive;
++ Bool fileActive;
} AppData;
@@ -7788,7 +7631,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
extern char *fallback_resources[];
extern char vncServerHost[];
-@@ -130,10 +151,11 @@
+@@ -130,10 +152,11 @@
/* colour.c */
extern unsigned long BGR233ToPixel[];
@@ -7801,7 +7644,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
extern void SetVisualAndCmap();
-@@ -157,11 +179,18 @@
+@@ -157,11 +180,18 @@
extern void DesktopInitBeforeRealization();
extern void DesktopInitAfterRealization();
@@ -7820,7 +7663,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
/* dialogs.c */
extern void ServerDialogDone(Widget w, XEvent *event, String *params,
-@@ -207,6 +236,10 @@
+@@ -207,6 +237,10 @@
Cardinal *num_params);
extern void CreatePopup();
@@ -7831,7 +7674,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
/* rfbproto.c */
extern int rfbsock;
-@@ -229,6 +262,15 @@
+@@ -229,6 +263,15 @@
extern Bool SendClientCutText(char *str, int len);
extern Bool HandleRFBServerMessage();
@@ -7847,7 +7690,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
extern void PrintPixelFormat(rfbPixelFormat *format);
/* selection.c */
-@@ -241,8 +283,9 @@
+@@ -241,8 +284,9 @@
/* shm.c */
@@ -7858,7 +7701,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
/* sockets.c */
-@@ -271,3 +314,48 @@
+@@ -271,3 +315,50 @@
extern XtAppContext appContext;
extern Display* dpy;
extern Widget toplevel;
@@ -7886,6 +7729,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
+extern void ShowScaleN(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+extern void SetScaleN(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+extern void ToggleTextChat(Widget w, XEvent *ev, String *params, Cardinal *num_params);
++extern void ToggleFileXfer(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+extern void ToggleTermTextChat(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+
+extern void SetViewOnlyState(Widget w, XEvent *ev, String *params, Cardinal *num_params);
@@ -7907,6 +7751,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi
+extern void SetSingleWindowState(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+extern void SetTextChatState(Widget w, XEvent *ev, String *params, Cardinal *num_params);
+extern void SetTermTextChatState(Widget w, XEvent *ev, String *params, Cardinal *num_params);
++extern void SetFileXferState(Widget w, XEvent *ev, String *params, Cardinal *num_params);
diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.man vnc_unixsrc/vncviewer/vncviewer.man
--- vnc_unixsrc.orig/vncviewer/vncviewer.man 2004-03-11 13:14:40.000000000 -0500
+++ vnc_unixsrc/vncviewer/vncviewer.man 2007-05-25 23:22:17.000000000 -0400