diff options
author | runge <runge@karlrunge.com> | 2010-04-09 19:19:15 -0400 |
---|---|---|
committer | runge <runge@karlrunge.com> | 2010-04-09 19:19:15 -0400 |
commit | 91d0e2fd3a6babd9099fedbad37b2c3dd2931200 (patch) | |
tree | 022821d4e543d39fee7b2c4c912e7a882d2679bf /x11vnc/misc/enhanced_tightvnc_viewer/src | |
parent | 97540de56ca8a975ed31d86879d0e5c4cf169173 (diff) | |
download | libtdevnc-91d0e2fd3a6babd9099fedbad37b2c3dd2931200.tar.gz libtdevnc-91d0e2fd3a6babd9099fedbad37b2c3dd2931200.zip |
Synchronize ssvnc 1.0.26. Improvements to perl scripts desktop.cgi, connect_switch and inet6to4.
Diffstat (limited to 'x11vnc/misc/enhanced_tightvnc_viewer/src')
3 files changed, 984 insertions, 564 deletions
diff --git a/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/_bundle b/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/_bundle index d04ae89..940c9f1 100755 --- a/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/_bundle +++ b/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/_bundle @@ -1,7 +1,7 @@ #!/bin/sh rm -rf ./src/tmp/* || exit 1 -vers=1.0.25 +vers=1.0.27 cd .. || exit 1 diff --git a/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/_getpatches b/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/_getpatches index 8e1ddcc..d12e1d1 100755 --- a/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/_getpatches +++ b/x11vnc/misc/enhanced_tightvnc_viewer/src/patches/_getpatches @@ -1,5 +1,10 @@ #!/bin/sh +if [ ! -f ./_getpatches ]; then + ls -l ./_getpatches + exit 1 +fi + cp -p /dist/src/apps/VNC/tight_vnc_1.3dev5/tight-vncviewer*patch . cp -p /dist/src/apps/VNC/tight_vnc_1.3dev5/vnc_unixsrc_vncviewer.patched.tar ../zips/ 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 a511c03..6c4a993 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 @@ -664,7 +664,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 2009-11-25 00:02:42.000000000 -0500 ++++ vnc_unixsrc/vncviewer/argsresources.c 2010-02-25 21:52:30.000000000 -0500 @@ -31,9 +31,9 @@ char *fallback_resources[] = { @@ -2099,7 +2099,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v /* -@@ -343,77 +1536,234 @@ +@@ -343,77 +1536,233 @@ * not already processed by XtVaAppInitialize(). It sets vncServerHost and * vncServerPort and all the fields in appData. */ @@ -2111,8 +2111,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v - int i; - char *vncServerName, *colonPos; - int len, portOffset; -+ int i; -+ char *vncServerName, *colonPos; ++ char *vncServerName = NULL, *colonPos; + int len, portOffset; + int disp; @@ -2375,7 +2374,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v + len--; + portOffset = 0; + } -+ if (!len || strspn(colonPos + 1, "0123456789") != len) { ++ if (!len || strspn(colonPos + 1, "0123456789") != (size_t) len) { + usage(); + } +#if 0 @@ -2391,7 +2390,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/argsresources.c vnc_unixsrc/v } diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/colour.c vnc_unixsrc/vncviewer/colour.c --- vnc_unixsrc.orig/vncviewer/colour.c 2002-04-30 09:07:31.000000000 -0400 -+++ vnc_unixsrc/vncviewer/colour.c 2009-11-29 22:31:14.000000000 -0500 ++++ vnc_unixsrc/vncviewer/colour.c 2010-02-25 22:02:19.000000000 -0500 @@ -31,9 +31,12 @@ #define BGR233_SIZE 256 unsigned long BGR233ToPixel[BGR233_SIZE]; @@ -2524,6 +2523,15 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/colour.c vnc_unixsrc/vncviewe } return bpp; +@@ -374,7 +442,7 @@ + if (!exactBGR233[i] && + XAllocColor(dpy, cmap, &cmapEntry[i])) { + +- if (cmapEntry[i].pixel == i) { ++ if ((long) cmapEntry[i].pixel == i) { + + shared[i] = True; /* probably shared */ + @@ -394,16 +462,43 @@ for (r = 0; r < 8; r++) { for (g = 0; g < 8; g++) { @@ -2582,7 +2590,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/colour.c vnc_unixsrc/vncviewe if (shared[nearestPixel] && !usedAsNearest[nearestPixel]) nSharedUsed++; usedAsNearest[nearestPixel] = True; -@@ -433,6 +528,57 @@ +@@ -433,6 +528,59 @@ } } @@ -2591,7 +2599,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/colour.c vnc_unixsrc/vncviewe +{ + int r, g, b; + int r2, g2, b2; -+ long i, idx; ++ long idx; + int cnt = 0; + unsigned long pixel = 0; + @@ -2628,19 +2636,21 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/colour.c vnc_unixsrc/vncviewe + } else { + idx = (b<<bs) | (g<<gs) | (r<<rs); + } -+ if (0) fprintf(stderr, "cnt: %5d idx: %5d pixel: 0x%08x\n", cnt, idx, pixel); ++ if (0) fprintf(stderr, "cnt: %5d idx: %lu pixel: 0x%08x\n", cnt, idx, (unsigned int) pixel); + BGR565ToPixel[idx] = pixel; + cnt++; + } + } + } ++ green_mask = 0; ++ blue_mask = 0; +} + + /* * AllocateExactBGR233Colours() attempts to allocate each of the colours in the -@@ -484,8 +630,13 @@ +@@ -484,8 +632,13 @@ ri = rn; for (gi = 0; gi < gn; gi++) { for (bi = 0; bi < bn; bi++) { @@ -2656,7 +2666,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/colour.c vnc_unixsrc/vncviewe } } rn++; -@@ -496,8 +647,13 @@ +@@ -496,8 +649,13 @@ gi = gn; for (ri = 0; ri < rn; ri++) { for (bi = 0; bi < bn; bi++) { @@ -2672,7 +2682,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/colour.c vnc_unixsrc/vncviewe } } gn++; -@@ -507,8 +663,13 @@ +@@ -507,8 +665,13 @@ bi = bn; for (ri = 0; ri < rn; ri++) { for (gi = 0; gi < gn; gi++) { @@ -2688,7 +2698,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/colour.c vnc_unixsrc/vncviewe } } bn++; -@@ -529,18 +690,36 @@ +@@ -529,18 +692,36 @@ AllocateBGR233Colour(int r, int g, int b) { XColor c; @@ -2818,7 +2828,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/cp_it vnc_unixsrc/vncviewer/c +ls -l ./vncviewer* $dest $yy* $HOME/etv_col/Linux.i686/vncviewer* diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/cursor.c vnc_unixsrc/vncviewer/cursor.c --- vnc_unixsrc.orig/vncviewer/cursor.c 2003-01-15 04:46:52.000000000 -0500 -+++ vnc_unixsrc/vncviewer/cursor.c 2008-10-18 09:35:02.000000000 -0400 ++++ vnc_unixsrc/vncviewer/cursor.c 2010-02-25 22:04:28.000000000 -0500 @@ -38,8 +38,11 @@ @@ -2858,6 +2868,24 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/cursor.c vnc_unixsrc/vncviewe Bool HandleXCursor(int xhot, int yhot, int width, int height) { +@@ -124,7 +134,7 @@ + XQueryBestCursor(dpy, dr, width, height, &wret, &hret); + } + +- if (width * height == 0 || wret < width || hret < height) { ++ if (width * height == 0 || (int) wret < width || (int) hret < height) { + /* Free resources */ + if (buf != NULL) + free(buf); +@@ -139,7 +149,7 @@ + fg.green = (unsigned short)colors.foreGreen << 8 | colors.foreGreen; + fg.blue = (unsigned short)colors.foreBlue << 8 | colors.foreBlue; + +- for (i = 0; i < bytesData * 2; i++) ++ for (i = 0; (size_t) i < bytesData * 2; i++) + buf[i] = (char)_reverse_byte[(int)buf[i] & 0xFF]; + + source = XCreateBitmapFromData(dpy, dr, buf, width, height); @@ -167,148 +177,179 @@ Bool HandleCursorShape(int xhot, int yhot, int width, int height, CARD32 enc) @@ -3176,7 +3204,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/cursor.c vnc_unixsrc/vncviewe - x = si.framebufferWidth - 1; - if (y >= si.framebufferHeight) - y = si.framebufferHeight - 1; -+ //fprintf(stderr, "xy: %d %d\n", x, y); ++ /* fprintf(stderr, "xy: %d %d\n", x, y); */ - SoftCursorMove(x, y); - return True; @@ -3309,7 +3337,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/cursor.c vnc_unixsrc/vncviewe } -@@ -429,41 +479,170 @@ +@@ -429,41 +479,169 @@ rcLockY + rcLockHeight > rcCursorY - rcHotY); } @@ -3372,7 +3400,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/cursor.c vnc_unixsrc/vncviewe + +static void SoftCursorCopyArea(int oper) { + int x, y, w, h; -+ int xs, ys, ws, hs; ++ int xs = 0, ys = 0, ws = 0, hs = 0; + static int scale_saved = 0, ss_w, ss_h; + int db = 0; + @@ -3398,7 +3426,6 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/cursor.c vnc_unixsrc/vncviewe + } + + if (image_scale != NULL && scale_x > 0) { -+ int i, t = 1; + xs = (int) (x * scale_factor_x); + ys = (int) (y * scale_factor_y); + ws = scale_round(w, scale_factor_x); @@ -3513,7 +3540,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/cursor.c vnc_unixsrc/vncviewe } static void SoftCursorDraw(void) -@@ -472,43 +651,182 @@ +@@ -472,43 +650,182 @@ int offset, bytesPerPixel; char *pos; @@ -3726,8 +3753,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/cursor.c vnc_unixsrc/vncviewe - diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncviewer/desktop.c --- vnc_unixsrc.orig/vncviewer/desktop.c 2004-05-28 13:29:29.000000000 -0400 -+++ vnc_unixsrc/vncviewer/desktop.c 2009-11-29 22:05:55.000000000 -0500 -@@ -28,28 +28,498 @@ ++++ vnc_unixsrc/vncviewer/desktop.c 2010-02-25 22:32:49.000000000 -0500 +@@ -28,28 +28,497 @@ #include <X11/extensions/XShm.h> #endif @@ -3757,7 +3784,6 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview +int image_is_shm = 0; static Cursor CreateDotCursor(); -+static Cursor CreateBogoCursor(); static void CopyBGR233ToScreen(CARD8 *buf, int x, int y, int width,int height); static void HandleBasicDesktopEvent(Widget w, XtPointer ptr, XEvent *ev, Boolean *cont); @@ -3851,7 +3877,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview +void put_image(int src_x, int src_y, int dst_x, int dst_y, int width, int height, int solid); +void create_image(); + -+// toplevel -> form -> viewport -> desktop ++/* toplevel -> form -> viewport -> desktop */ + +void adjust_Xt_win(int w, int h) { + int x, y, dw, dh, h0 = h; @@ -3932,7 +3958,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + + if (image_scale == NULL) { + /* switching from not scaled */ -+ int i, start_over = 0; ++ int i; + int Bpl = image->bytes_per_line; + char *dst, *src = image->data; + @@ -4049,7 +4075,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + + SoftCursorUnlockScreen(); + -+ fprintf(stderr, "rescale: image_scale=0x%x image=0x%x image_ycrop=0x%x\n", image_scale, image, image_ycrop); ++ fprintf(stderr, "rescale: image_scale=%p image=%p image_ycrop=%p\n", (void *) image_scale, (void *) image, (void *) image_ycrop); + last_rescale = dnow(); + +} @@ -4222,7 +4248,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + int h = si.framebufferHeight; + if (h > 2 * w) { + fprintf(stderr, "Tall display (%dx%d) suspect 'x11vnc -ncache' mode,\n", w, h); -+ fprintf(stderr, " setting auto -ycrop detection.\n", w, h); ++ fprintf(stderr, " setting auto -ycrop detection.\n"); + appData.yCrop = -1; + } + } @@ -4230,7 +4256,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview /* * DesktopInitBeforeRealization creates the "desktop" widget and the viewport -@@ -59,92 +529,1017 @@ +@@ -59,91 +528,1023 @@ void DesktopInitBeforeRealization() { @@ -4285,7 +4311,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview - for (i = 0; i < 256; i++) - modifierPressed[i] = False; + if (appData.yCrop) { -+ int wm, hm; ++ int hm; + if (appData.yCrop < 0) { + appData.yCrop = guessCrop(); + fprintf(stderr, "Set -ycrop to: %d\n", appData.yCrop); @@ -4301,20 +4327,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview - if (!image) - appData.useShm = False; - } --#endif + hm *= frac_y; - -- if (!image) { -- image = XCreateImage(dpy, vis, visdepth, ZPixmap, 0, NULL, -- si.framebufferWidth, si.framebufferHeight, -- BitmapPad(dpy), 0); -- -- image->data = malloc(image->bytes_per_line * image->height); -- if (!image->data) { -- fprintf(stderr,"malloc failed\n"); -- exit(1); -- } -- } ++ + XtVaSetValues(toplevel, XtNmaxHeight, hm, XtNheight, hm, NULL); + XtVaSetValues(form, XtNmaxHeight, hm, XtNheight, hm, NULL); + XtVaSetValues(viewport, XtNforceBars, False, NULL); @@ -4331,11 +4345,25 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + create_image(); +} + ++#if 0 +static Widget scrollbar_y = NULL; -+ +static int xsst = 2; + #endif + +- if (!image) { +- image = XCreateImage(dpy, vis, visdepth, ZPixmap, 0, NULL, +- si.framebufferWidth, si.framebufferHeight, +- BitmapPad(dpy), 0); +- +- image->data = malloc(image->bytes_per_line * image->height); +- if (!image->data) { +- fprintf(stderr,"malloc failed\n"); +- exit(1); +- } +- } +#include <X11/Xaw/Scrollbar.h> + ++#if 0 +static XtCallbackProc Scrolled(Widget w, XtPointer closure, XtPointer call_data) { + Position x, y; + XtVaGetValues(desktop, XtNx, &x, XtNy, &y, NULL); @@ -4350,6 +4378,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + float t = 0.0; + XtVaSetValues(w, XtNtopOfThumb, &t, NULL); + } ++ if (closure) {} } +static XtCallbackProc Jumped(Widget w, XtPointer closure, XtPointer call_data) { @@ -4369,12 +4398,13 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + XtVaSetValues(w, XtNtopOfThumb, *(XtArgVal*)&t, XtNshown, *(XtArgVal*)&s, NULL); + } + } ++ if (closure) {} +} ++#endif + +extern double dnow(void); + +void check_things() { -+ static int installed_callback = 0; + static int first = 1; + static double last_scrollbar = 0.0; + int w = si.framebufferWidth; @@ -4399,7 +4429,6 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + wv = XtNameToWidget(viewport, "vertical"); + wh = XtNameToWidget(viewport, "horizontal"); + if (wc && wv && wh) { -+ int doit = 1; + int sb = appData.sbWidth; + XtVaGetValues(wv, XtNwidth, &w0, XtNheight, &h0, XtNborderWidth, &b0, XtNx, &x0, XtNy, &y0, NULL); + XtVaGetValues(wh, XtNwidth, &w1, XtNheight, &h1, XtNborderWidth, &b1, XtNx, &x1, XtNy, &y1, NULL); @@ -4562,8 +4591,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + appData.useXserverBackingStore = False; + } + } - -- XChangeWindowAttributes(dpy, desktopWin, valuemask, &attr); ++ + if (appData.useXserverBackingStore) { + XtVaGetApplicationResources(desktop, (XtPointer)&attr.backing_store, + desktopBackingStoreResources, 1, NULL); @@ -4597,13 +4625,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + +extern void FreeX11Cursor(void); +extern void FreeSoftCursor(void); -+ + +- XChangeWindowAttributes(dpy, desktopWin, valuemask, &attr); +void +DesktopCursorOff() +{ -+ XSetWindowAttributes attr; -+ unsigned long valuemask; -+ + if (dotCursor3 == None) { + dotCursor3 = CreateDotCursor(3); + dotCursor4 = CreateDotCursor(4); @@ -4615,9 +4641,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + } + FreeX11Cursor(); + FreeSoftCursor(); - } - - ++} ++ ++ +#define CEIL(x) ( (double) ((int) (x)) == (x) ? \ + (double) ((int) (x)) : (double) ((int) (x) + 1) ) +#define FLOOR(x) ( (double) ((int) (x)) ) @@ -4630,7 +4656,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + i = n - 1; + } + return i; -+} + } +#else +#define nfix(i, n) ( i < 0 ? 0 : ( (i >= n) ? (n - 1) : i ) ) +#endif @@ -4653,7 +4679,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + + double w, wx, wy, wtot; /* pixel weights */ + -+ double x1, y1, x2, y2; /* x-y coords for destination pixels edges */ ++ double x1 = 0, y1, x2 = 0, y2; /* x-y coords for destination pixels edges */ + double dx, dy; /* size of destination pixel */ + double ddx=0, ddy=0; /* for interpolation expansion */ + @@ -4674,7 +4700,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + /* internal */ + + int X1, X2, Y1, Y2; -+ + + int Nx = si.framebufferWidth; + int Ny = si.framebufferHeight; + @@ -4688,7 +4714,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + unsigned long main_red_mask = image->red_mask; + unsigned long main_green_mask = image->green_mask; + unsigned long main_blue_mask = image->blue_mask; -+ int mark = 1, n; ++ int mark = 1; + + char *src_fb = image_scale->data; + char *dst_fb = image->data; @@ -4696,7 +4722,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + static int nosolid = -1; + int sbdy = 3; + double fmax = factor_x > factor_y ? factor_x : factor_y; ++#if 0 + double fmin = factor_x < factor_y ? factor_x : factor_y; ++#endif + + X1 = *px; + X2 = *px + *pw; @@ -4708,7 +4736,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + sbdy = (int) (2.0 * fmax * sbdy); + } + -+ //fprintf(stderr, "scale_rect: %dx%d+%d+%d\n", *pw, *ph, *px, *py); ++ /* fprintf(stderr, "scale_rect: %dx%d+%d+%d\n", *pw, *ph, *px, *py); */ + + *px = (int) (*px * factor_x); + *py = (int) (*py * factor_y); @@ -4808,7 +4836,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + mag_int = n; + } + } -+if (0) fprintf(stderr, "X1: %d Y1: %d X2: %d Y2: %d\n", X1, Y1, X2, Y2);//G ++if (0) fprintf(stderr, "X1: %d Y1: %d X2: %d Y2: %d\n", X1, Y1, X2, Y2); + + if (mark && !shrink && blend) { + /* @@ -4892,7 +4920,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + * Loop over destination pixels in scaled fb: + */ + for (j=j1; j<j2; j++) { -+ int jbdy = 1, I1_solid; ++ int jbdy = 1, I1_solid = 0; + + y1 = j * dy; /* top edge */ + if (y1 > Ny - 1) { @@ -4987,7 +5015,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + I2 = I1 + 1; /* simple interpolation */ + ddx = x1 - I1; + } -+//if (first) fprintf(stderr, " I1=%d I2=%d J1=%d J2=%d\n", I1, I2, J1, J2);//G ++#if 0 ++if (first) fprintf(stderr, " I1=%d I2=%d J1=%d J2=%d\n", I1, I2, J1, J2); ++#endif + + /* Zero out accumulators for next pixel average: */ + for (b=0; b<4; b++) { @@ -5281,9 +5311,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + } +} + -+//fprintf(stderr, "non-shmB image %d %d %d %d %d %d\n", src_x, src_y, dst_x, dst_y, width, height); -+//fprintf(stderr, "shm image_ycrop %d %d %d %d %d %d\n", 0, 0, dst_x, dst_y, width, height); -+//fprintf(stderr, "non-shmA image %d %d %d %d %d %d\n", src_x, src_y, dst_x, dst_y, width, height); ++#if 0 ++fprintf(stderr, "non-shmB image %d %d %d %d %d %d\n", src_x, src_y, dst_x, dst_y, width, height); ++fprintf(stderr, "shm image_ycrop %d %d %d %d %d %d\n", 0, 0, dst_x, dst_y, width, height); ++fprintf(stderr, "non-shmA image %d %d %d %d %d %d\n", src_x, src_y, dst_x, dst_y, width, height); ++#endif + +void releaseAllPressedModifiers(void) { + int i; @@ -5306,25 +5338,25 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview +} + +#define PR_EXPOSE fprintf(stderr, "Expose: %04dx%04d+%04d+%04d %04d/%04d/%04d now: %8.4f rescale: %8.4f fullscreen: %8.4f\n", width, height, x, y, si.framebufferWidth, appData.yCrop, si.framebufferHeight, now - start_time, now - last_rescale, now - last_fullscreen); -+ + /* * HandleBasicDesktopEvent - deal with expose and leave events. - */ -@@ -152,42 +1547,528 @@ +@@ -152,42 +1553,529 @@ static void HandleBasicDesktopEvent(Widget w, XtPointer ptr, XEvent *ev, Boolean *cont) { - int i; -+ int i, x, y, width, height; -+ static double last_expose = 0.0; ++ int x, y, width, height; + double now = dnow(); + +- switch (ev->type) { ++ if (w || ptr || cont) {} + + if (0) { + PR_EXPOSE; + } -- switch (ev->type) { - ++ + switch (ev->type) { case Expose: case GraphicsExpose: @@ -5452,8 +5484,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + break; } + check_things(); - } - ++} ++ +extern Position desktopX, desktopY; + +void x11vnc_appshare(char *cmd) { @@ -5548,7 +5580,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + + x2 = -x; + y2 = -y; - ++ + if (amount == -1.0) { + int dx = horiz; + int dy = vert; @@ -5593,8 +5625,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + } else if (amount == -1.0) { + XSync(dpy, False); + } -+} -+ + } + +void scale_desktop(int bigger, double frac) { + double current, new; + char tmp[100]; @@ -5631,7 +5663,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + if (0.99 < new && new < 1.01) { + new = 1.0; + } -+ + + if (new > 5.0) { + fprintf(stderr, "scale_desktop: not scaling > 5.0: %f\n", new); + return; @@ -5861,7 +5893,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview /* * SendRFBEvent is an action which sends an RFB event. It can be used in two * ways. Without any parameters it simply sends an RFB event corresponding to -@@ -201,127 +2082,406 @@ +@@ -201,127 +2089,406 @@ * button2 down, 3 for both, etc). */ @@ -5917,7 +5949,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + } + return; + } -+ + +- if (appData.viewOnly) return; + if (appData.fullScreen && ev->type == MotionNotify && !escape_drag_in_progress) { + if (BumpScroll(ev)) { + return; @@ -6163,8 +6196,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + if (appData.viewOnly) { + return; + } - -- if (appData.viewOnly) return; ++ + if (*num_params != 0) { + if (strncasecmp(params[0],"key",3) == 0) { + if (*num_params != 2) { @@ -6376,14 +6408,30 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview } -@@ -329,26 +2489,207 @@ +@@ -329,68 +2496,255 @@ * CreateDotCursor. */ +#ifndef very_small_dot_cursor -+static Cursor + static Cursor +-CreateDotCursor() +CreateDotCursor(int which) -+{ + { +- Cursor cursor; +- Pixmap src, msk; +- static char srcBits[] = { 0, 14,14,14, 0 }; +- static char mskBits[] = { 14,31,31,31,14 }; +- XColor fg, bg; +- +- src = XCreateBitmapFromData(dpy, DefaultRootWindow(dpy), srcBits, 5, 5); +- msk = XCreateBitmapFromData(dpy, DefaultRootWindow(dpy), mskBits, 5, 5); +- XAllocNamedColor(dpy, DefaultColormap(dpy,DefaultScreen(dpy)), "black", +- &fg, &fg); +- XAllocNamedColor(dpy, DefaultColormap(dpy,DefaultScreen(dpy)), "white", +- &bg, &bg); +- cursor = XCreatePixmapCursor(dpy, src, msk, &fg, &bg, 2, 2); +- XFreePixmap(dpy, src); +- XFreePixmap(dpy, msk); + Cursor cursor; + Pixmap src, msk; + static char srcBits3[] = { 0x00, 0x02, 0x00 }; @@ -6406,28 +6454,14 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + cursor = XCreatePixmapCursor(dpy, src, msk, &fg, &bg, 1, 1); + XFreePixmap(dpy, src); + XFreePixmap(dpy, msk); -+ + +- return cursor; + return cursor; -+} + } +#else - static Cursor - CreateDotCursor() - { -- Cursor cursor; -- Pixmap src, msk; -- static char srcBits[] = { 0, 14,14,14, 0 }; -- static char mskBits[] = { 14,31,31,31,14 }; -- XColor fg, bg; -- -- src = XCreateBitmapFromData(dpy, DefaultRootWindow(dpy), srcBits, 5, 5); -- msk = XCreateBitmapFromData(dpy, DefaultRootWindow(dpy), mskBits, 5, 5); -- XAllocNamedColor(dpy, DefaultColormap(dpy,DefaultScreen(dpy)), "black", -- &fg, &fg); -- XAllocNamedColor(dpy, DefaultColormap(dpy,DefaultScreen(dpy)), "white", -- &bg, &bg); -- cursor = XCreatePixmapCursor(dpy, src, msk, &fg, &bg, 2, 2); -- XFreePixmap(dpy, src); -- XFreePixmap(dpy, msk); ++static Cursor ++CreateDotCursor() ++{ + Cursor cursor; + Pixmap src, msk; + static char srcBits[] = { 0, 14, 0 }; @@ -6443,11 +6477,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + cursor = XCreatePixmapCursor(dpy, src, msk, &fg, &bg, 1, 1); + XFreePixmap(dpy, src); + XFreePixmap(dpy, msk); -+ + + return cursor; +} +#endif -+ + +int skip_maybe_sync = 0; +void maybe_sync(int width, int height) { + static int singles = 0, always_skip = -1; @@ -6486,13 +6520,17 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + } +#endif +} -+/* + /* +- * CopyDataToScreen. + * FillImage. -+ */ -+ -+void + */ + + void +-CopyDataToScreen(char *buf, int x, int y, int width, int height) +FillScreen(int x, int y, int width, int height, unsigned long fill) -+{ + { +- if (appData.rawDelay != 0) { +- XFillRectangle(dpy, desktopWin, gc, x, y, width, height); + XImage *im = image_scale ? image_scale : image; + int bpp = im->bits_per_pixel; + int Bpp = im->bits_per_pixel / 8; @@ -6505,13 +6543,17 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + unsigned int *uip; + char *scr; + int b0, b1, b2; -+ -+//fprintf(stderr, "FillImage bpp=%d %04dx%04d+%04d+%04d -- 0x%x\n", bpp, width, height, x, y, fill); + +- XSync(dpy,False); ++#if 0 ++fprintf(stderr, "FillImage bpp=%d %04dx%04d+%04d+%04d -- 0x%x\n", bpp, width, height, x, y, fill); ++#endif + if (appData.chatOnly) { + return; + } -- return cursor; +- usleep(appData.rawDelay * 1000); +- } + if (widthInBytes > buflen || !buf) { + if (buf) { + free(buf); @@ -6528,7 +6570,23 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + } else { + b0 = 2; b1 = 1; b2 = 0; + } -+ + +- if (!appData.useBGR233) { +- int h; +- int widthInBytes = width * myFormat.bitsPerPixel / 8; +- int scrWidthInBytes = si.framebufferWidth * myFormat.bitsPerPixel / 8; +- +- char *scr = (image->data + y * scrWidthInBytes +- + x * myFormat.bitsPerPixel / 8); +- +- for (h = 0; h < height; h++) { +- memcpy(scr, buf, widthInBytes); +- buf += widthInBytes; +- scr += scrWidthInBytes; +- } +- } else { +- CopyBGR233ToScreen((CARD8 *)buf, x, y, width, height); +- } + for (h = 0; h < width; h++) { + if (bpp == 8) { + *(ucp+h) = (unsigned char) fill; @@ -6542,7 +6600,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + *(uip+h) = (unsigned int) fill; + } + } -+ + +-#ifdef MITSHM +- if (appData.useShm) { +- XShmPutImage(dpy, desktopWin, gc, image, x, y, x, y, width, height, False); +- return; +- } + scr = im->data + y * Bpl + x * Bpp; + + for (h = 0; h < height; h++) { @@ -6561,7 +6624,10 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + int Bpl = im->bytes_per_line; + int did2 = 0; + -+//fprintf(stderr, "copy_rect: %04dx%04d+%04d+%04d -- %04d %04d Bpp=%d Bpl=%d\n", width, height, x, y, src_x, src_y, Bpp, Bpl); ++#if 0 ++fprintf(stderr, "copy_rect: %04dx%04d+%04d+%04d -- %04d %04d Bpp=%d Bpl=%d\n", width, height, x, y, src_x, src_y, Bpp, Bpl); + #endif +- XPutImage(dpy, desktopWin, gc, image, x, y, x, y, width, height); + copyrect2: + + if (y < src_y) { @@ -6597,20 +6663,16 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + did2 = 1; + goto copyrect2; + } - } - - -@@ -359,38 +2700,39 @@ - void - CopyDataToScreen(char *buf, int x, int y, int width, int height) - { -- if (appData.rawDelay != 0) { -- XFillRectangle(dpy, desktopWin, gc, x, y, width, height); -- -- XSync(dpy,False); -- -- usleep(appData.rawDelay * 1000); -- } ++} ++ ++ ++/* ++ * CopyDataToScreen. ++ */ ++ ++void ++CopyDataToScreen(char *buf, int x, int y, int width, int height) ++{ + if (appData.chatOnly) { + return; + } @@ -6619,23 +6681,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + XSync(dpy,False); + usleep(appData.rawDelay * 1000); + } - -- if (!appData.useBGR233) { -- int h; -- int widthInBytes = width * myFormat.bitsPerPixel / 8; -- int scrWidthInBytes = si.framebufferWidth * myFormat.bitsPerPixel / 8; -- -- char *scr = (image->data + y * scrWidthInBytes -- + x * myFormat.bitsPerPixel / 8); -- -- for (h = 0; h < height; h++) { -- memcpy(scr, buf, widthInBytes); -- buf += widthInBytes; -- scr += scrWidthInBytes; -- } -- } else { -- CopyBGR233ToScreen((CARD8 *)buf, x, y, width, height); -- } ++ + if (appData.useBGR233) { + CopyBGR233ToScreen((CARD8 *)buf, x, y, width, height); + } else if (appData.useBGR565) { @@ -6644,11 +6690,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + int h; + int widthInBytes = width * myFormat.bitsPerPixel / 8; + int scrWidthInBytes = si.framebufferWidth * myFormat.bitsPerPixel / 8; ++ char *scr; + XImage *im = image_scale ? image_scale : image; + + if (scrWidthInBytes != im->bytes_per_line) scrWidthInBytes = im->bytes_per_line; + -+ char *scr = (im->data + y * scrWidthInBytes ++ scr = (im->data + y * scrWidthInBytes + + x * myFormat.bitsPerPixel / 8); + + for (h = 0; h < height; h++) { @@ -6657,20 +6704,13 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + scr += scrWidthInBytes; + } + } - --#ifdef MITSHM -- if (appData.useShm) { -- XShmPutImage(dpy, desktopWin, gc, image, x, y, x, y, width, height, False); -- return; -- } --#endif -- XPutImage(dpy, desktopWin, gc, image, x, y, x, y, width, height); ++ + put_image(x, y, x, y, width, height, 0); + maybe_sync(width, height); } -@@ -401,62 +2743,339 @@ +@@ -401,62 +2755,338 @@ static void CopyBGR233ToScreen(CARD8 *buf, int x, int y, int width, int height) { @@ -6912,7 +6952,6 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview + fprintf(stderr, "Set -ycrop to: %d\n", appData.yCrop); + } else { + int w1 = si.framebufferWidth; -+ int w0 = old_width; + appData.yCrop = (w1 * appData.yCrop) / old_width; + if (appData.yCrop <= 100) { + appData.yCrop = guessCrop(); @@ -7066,8 +7105,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/desktop.c vnc_unixsrc/vncview } diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/dialogs.c vnc_unixsrc/vncviewer/dialogs.c --- vnc_unixsrc.orig/vncviewer/dialogs.c 2000-10-26 15:19:19.000000000 -0400 -+++ vnc_unixsrc/vncviewer/dialogs.c 2009-10-27 00:14:05.000000000 -0400 -@@ -25,75 +25,549 @@ ++++ vnc_unixsrc/vncviewer/dialogs.c 2010-02-25 22:33:06.000000000 -0500 +@@ -25,75 +25,564 @@ #include <X11/Xaw/Dialog.h> static Bool serverDialogDone = False; @@ -7096,12 +7135,14 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/dialogs.c vnc_unixsrc/vncview +ScaleDialogDone(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + scaleDialogDone = True; ++ if (w || event || params || num_params) {} +} + +void +EscapeDialogDone(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + escapeDialogDone = True; ++ if (w || event || params || num_params) {} +} + +void dialog_over(Widget wid) { @@ -7256,6 +7297,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/dialogs.c vnc_unixsrc/vncview +YCropDialogDone(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + ycropDialogDone = True; ++ if (w || event || params || num_params) {} +} + +char * @@ -7301,6 +7343,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/dialogs.c vnc_unixsrc/vncview +ScbarDialogDone(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + scbarDialogDone = True; ++ if (w || event || params || num_params) {} +} + +char * @@ -7346,6 +7389,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/dialogs.c vnc_unixsrc/vncview +ScaleNDialogDone(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + scaleNDialogDone = True; ++ if (w || event || params || num_params) {} +} + +char * @@ -7392,6 +7436,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/dialogs.c vnc_unixsrc/vncview +QualityDialogDone(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + qualityDialogDone = True; ++ if (w || event || params || num_params) {} +} + +char * @@ -7437,6 +7482,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/dialogs.c vnc_unixsrc/vncview +CompressDialogDone(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + compressDialogDone = True; ++ if (w || event || params || num_params) {} +} + +char * @@ -7487,6 +7533,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/dialogs.c vnc_unixsrc/vncview { - serverDialogDone = True; + serverDialogDone = True; ++ if (w || event || params || num_params) {} } char * @@ -7521,7 +7568,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/dialogs.c vnc_unixsrc/vncview + } else { + xtmove(pshell); + } -+ //dialog_input(pshell); ++#if 0 ++ dialog_input(pshell); ++#endif + wm_delete(pshell, "ServerDialogDone()"); + + serverDialogDone = False; @@ -7547,6 +7596,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/dialogs.c vnc_unixsrc/vncview +UserDialogDone(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + userDialogDone = True; ++ if (w || event || params || num_params) {} +} - XtPopdown(pshell); @@ -7573,7 +7623,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/dialogs.c vnc_unixsrc/vncview + } else { + xtmove(pshell); + } -+ //dialog_input(pshell); ++#if 0 ++ dialog_input(pshell); ++#endif + wm_delete(pshell, "UserDialogDone()"); + + userDialogDone = False; @@ -7591,11 +7643,13 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/dialogs.c vnc_unixsrc/vncview } void - PasswordDialogDone(Widget w, XEvent *event, String *params, - Cardinal *num_params) +-PasswordDialogDone(Widget w, XEvent *event, String *params, +- Cardinal *num_params) ++PasswordDialogDone(Widget w, XEvent *event, String *params, Cardinal *num_params) { - passwordDialogDone = True; + passwordDialogDone = True; ++ if (w || event || params || num_params) {} } char * @@ -7637,7 +7691,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/dialogs.c vnc_unixsrc/vncview + } else { + xtmove(pshell); + } -+ //dialog_input(pshell); ++#if 0 ++ dialog_input(pshell); ++#endif + wm_delete(pshell, "PasswordDialogDone()"); + + passwordDialogDone = False; @@ -7657,8 +7713,14 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/dialogs.c vnc_unixsrc/vncview } 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 2008-10-25 18:22:14.000000000 -0400 -@@ -27,15 +27,18 @@ ++++ vnc_unixsrc/vncviewer/fullscreen.c 2010-02-25 22:37:49.000000000 -0500 +@@ -22,20 +22,24 @@ + */ + + #include <vncviewer.h> ++#include <time.h> + #include <X11/Xaw/Form.h> + #include <X11/Xaw/Viewport.h> #include <X11/Xaw/Toggle.h> static Bool DoBumpScroll(); @@ -7678,7 +7740,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv /* * FullScreenOn goes into full-screen mode. It makes the toplevel window -@@ -78,112 +81,450 @@ +@@ -78,112 +82,456 @@ * variables so that FullScreenOff can use them. */ @@ -7807,7 +7869,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv + + int _NET_WM_STATE_REMOVE = 0; + int _NET_WM_STATE_ADD = 1; ++#if 0 + int _NET_WM_STATE_TOGGLE = 2; ++#endif + Atom _NET_WM_STATE = XInternAtom(dpy, "_NET_WM_STATE", False); + Atom _NET_WM_STATE_FULLSCREEN = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False); + XEvent xev; @@ -8084,8 +8148,10 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv + XUnmapWindow(dpy, topwin); + + XtVaSetValues(toplevel, XtNoverrideRedirect, True, NULL); -+ //XtVaSetValues(viewport, XtNoverrideRedirect, True, NULL); -+ //XtVaSetValues(desktop, XtNoverrideRedirect, True, NULL); ++#if 0 ++ XtVaSetValues(viewport, XtNoverrideRedirect, True, NULL); ++ XtVaSetValues(desktop, XtNoverrideRedirect, True, NULL); ++#endif + XtVaSetValues(popup, XtNoverrideRedirect, True, NULL); + + XReparentWindow(dpy, topwin, DefaultRootWindow(dpy), 0, 0); @@ -8133,8 +8199,10 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv + + /* Now we can set "toplevel" to its proper size. */ + -+// XtVaSetValues(toplevel, XtNwidth, toplevelWidth, XtNheight, toplevelHeight, NULL); -+// XtResizeWidget(toplevel, toplevelWidth, toplevelHeight, 0); ++#if 0 ++ XtVaSetValues(toplevel, XtNwidth, toplevelWidth, XtNheight, toplevelHeight, NULL); ++ XtResizeWidget(toplevel, toplevelWidth, toplevelHeight, 0); ++#endif + XResizeWindow(dpy, topwin, toplevelWidth, toplevelHeight); + + if (do_net_wm) { @@ -8204,7 +8272,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv - XSetInputFocus(dpy, DefaultRootWindow(dpy), RevertToPointerRoot, - CurrentTime); -+ // original vnc: DefaultRootWindow(dpy) instead of PointerRoot ++ /* original vnc: DefaultRootWindow(dpy) instead of PointerRoot */ + XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); - /* Optionally, grab the keyboard. */ @@ -8220,7 +8288,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv } -@@ -205,28 +546,52 @@ +@@ -205,28 +553,52 @@ void FullScreenOff() { @@ -8287,7 +8355,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv XtNhorizDistance, 0, XtNvertDistance, 0, XtNleft, XtChainLeft, -@@ -235,24 +600,40 @@ +@@ -235,24 +607,42 @@ XtNbottom, XtChainBottom, NULL); @@ -8312,8 +8380,10 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv - XtVaSetValues(popup, XtNoverrideRedirect, False, NULL); + if (!do_net_wm) { + XtVaSetValues(toplevel, XtNoverrideRedirect, False, NULL); -+ //XtVaSetValues(viewport, XtNoverrideRedirect, False, NULL); -+ //XtVaSetValues(desktop, XtNoverrideRedirect, False, NULL); ++#if 0 ++ XtVaSetValues(viewport, XtNoverrideRedirect, False, NULL); ++ XtVaSetValues(desktop, XtNoverrideRedirect, False, NULL); ++#endif + XtVaSetValues(popup, XtNoverrideRedirect, False, NULL); + } + @@ -8345,7 +8415,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv } -@@ -264,10 +645,11 @@ +@@ -264,10 +654,12 @@ void SetFullScreenState(Widget w, XEvent *ev, String *params, Cardinal *num_params) { @@ -8358,10 +8428,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} } -@@ -278,11 +660,11 @@ +@@ -278,11 +670,12 @@ void ToggleFullScreen(Widget w, XEvent *ev, String *params, Cardinal *num_params) { @@ -8375,10 +8446,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv + } else { + FullScreenOn(); + } ++ if (w || ev || params || num_params) {} } -@@ -294,84 +676,220 @@ +@@ -294,84 +687,226 @@ Bool BumpScroll(XEvent *ev) { @@ -8545,6 +8617,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv { - DoBumpScroll(); + DoBumpScroll(); ++ if (clientData || id) {} +} + +/* not working: */ @@ -8651,18 +8724,23 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/fullscreen.c vnc_unixsrc/vncv +static void +JumpScrollTimerCallback(XtPointer clientData, XtIntervalId *id) { + DoJumpScroll(); ++ if (clientData || id) {} +} +void JumpRight(Widget w, XEvent *ev, String *params, Cardinal *num_params) { + JumpScroll(1, 0); ++ if (w || ev || params || num_params) {} +} +void JumpLeft(Widget w, XEvent *ev, String *params, Cardinal *num_params) { + JumpScroll(0, 0); ++ if (w || ev || params || num_params) {} +} +void JumpUp(Widget w, XEvent *ev, String *params, Cardinal *num_params) { + JumpScroll(1, 1); ++ if (w || ev || params || num_params) {} } +void JumpDown(Widget w, XEvent *ev, String *params, Cardinal *num_params) { + JumpScroll(0, 1); ++ if (w || ev || params || num_params) {} +} + + @@ -8858,17 +8936,21 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/hextile.c vnc_unixsrc/vncview +#undef FillRectangle diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/listen.c vnc_unixsrc/vncviewer/listen.c --- vnc_unixsrc.orig/vncviewer/listen.c 2001-01-16 03:07:57.000000000 -0500 -+++ vnc_unixsrc/vncviewer/listen.c 2009-11-24 18:26:13.000000000 -0500 -@@ -32,6 +32,7 @@ ++++ vnc_unixsrc/vncviewer/listen.c 2010-02-25 22:38:43.000000000 -0500 +@@ -32,14 +32,88 @@ #define FLASHDELAY 1 /* seconds */ Bool listenSpecified = False; +pid_t listenParent = 0; int listenPort = 0, flashPort = 0; ++#if 0 static Font flashFont; -@@ -40,6 +41,77 @@ +- + static void getFlashFont(Display *d); static void flashDisplay(Display *d, char *user); ++#endif ++ static Bool AllXEventsPredicate(Display *d, XEvent *ev, char *arg); +void raiseme(int force); @@ -8945,7 +9027,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/listen.c vnc_unixsrc/vncviewe /* * listenForIncomingConnections() - listen for incoming connections from * servers, and fork a new process to deal with each connection. We must do -@@ -58,8 +130,11 @@ +@@ -58,14 +132,18 @@ int n; int i; char *displayname = NULL; @@ -8957,17 +9039,28 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/listen.c vnc_unixsrc/vncviewe for (i = 1; i < *argc; i++) { if (strcmp(argv[i], "-display") == 0 && i+1 < *argc) { -@@ -108,23 +183,40 @@ + displayname = argv[i+1]; + } + } ++ if (sock || flashUser || n) {} + + if (listenArgIndex+1 < *argc && argv[listenArgIndex+1][0] >= '0' && + argv[listenArgIndex+1][0] <= '9') { +@@ -108,23 +186,44 @@ exit(1); } - getFlashFont(d); -+//getFlashFont(d); ++#if 0 ++getFlashFont(d); ++#endif listenSocket = ListenAtTcpPort(listenPort); - flashSocket = ListenAtTcpPort(flashPort); + -+//flashSocket = ListenAtTcpPort(flashPort); ++#if 0 ++flashSocket = ListenAtTcpPort(flashPort); ++#endif + flashSocket = 1234; if ((listenSocket < 0) || (flashSocket < 0)) exit(1); @@ -9004,12 +9097,13 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/listen.c vnc_unixsrc/vncviewe /* discard any X events */ while (XCheckIfEvent(d, &ev, AllXEventsPredicate, NULL)) -@@ -132,12 +224,24 @@ +@@ -132,12 +231,26 @@ FD_ZERO(&fds); -- FD_SET(flashSocket, &fds); -+// FD_SET(flashSocket, &fds); ++#if 0 + FD_SET(flashSocket, &fds); ++#endif FD_SET(listenSocket, &fds); FD_SET(ConnectionNumber(d), &fds); @@ -9030,7 +9124,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/listen.c vnc_unixsrc/vncviewe if (FD_ISSET(flashSocket, &fds)) { sock = AcceptTcpConnection(flashSocket); -@@ -151,11 +255,66 @@ +@@ -151,11 +264,66 @@ } close(sock); } @@ -9100,12 +9194,13 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/listen.c vnc_unixsrc/vncviewe XCloseDisplay(d); -@@ -170,18 +329,28 @@ +@@ -170,18 +338,32 @@ case 0: /* child - return to caller */ close(listenSocket); -- close(flashSocket); -+// close(flashSocket); ++#if 0 + close(flashSocket); ++#endif + if (sml != NULL && !accept_popup_check(argc, argv, sip, sih)) { + close(rfbsock); + rfbsock = -1; @@ -9122,8 +9217,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/listen.c vnc_unixsrc/vncviewe programName, XDisplayName(displayname)); exit(1); } -- getFlashFont(d); -+// getFlashFont(d); ++#if 0 + getFlashFont(d); ++#endif + fprintf(stderr,"\n\n%s -listen: Listening on port %d\n", + programName,listenPort); + fprintf(stderr,"%s -listen: Cmdline errors are not reported until " @@ -9131,21 +9227,24 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/listen.c vnc_unixsrc/vncviewe break; } } -@@ -200,6 +369,13 @@ - char **fontNames; - int nFontNames; +@@ -193,9 +375,16 @@ + * getFlashFont + */ -+#if 1 ++#if 0 + static void + getFlashFont(Display *d) + { + ++#if 1 + /* no longer used */ ++ if (d) {} + return; -+ +#else -+ - sprintf(fontName,"-*-courier-bold-r-*-*-%d-*-*-*-*-*-iso8859-1", - FLASHWIDTH); - fontNames = XListFonts(d, fontName, 1, &nFontNames); -@@ -209,6 +385,9 @@ + char fontName[256]; + char **fontNames; + int nFontNames; +@@ -209,6 +398,9 @@ sprintf(fontName,"fixed"); } flashFont = XLoadFont(d, fontName); @@ -9155,19 +9254,19 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/listen.c vnc_unixsrc/vncviewe } -@@ -222,6 +401,11 @@ - Window w1, w2, w3, w4; - XSetWindowAttributes attr; - +@@ -219,6 +411,11 @@ + static void + flashDisplay(Display *d, char *user) + { +#if 1 + /* no longer used */ ++ if (d || user) {} + return; +#else -+ - XBell(d, 0); + Window w1, w2, w3, w4; + XSetWindowAttributes attr; - XForceScreenSaver(d, ScreenSaverReset); -@@ -284,6 +468,9 @@ +@@ -284,7 +481,11 @@ XDestroyWindow(d, w3); XDestroyWindow(d, w4); XFlush(d); @@ -9175,12 +9274,29 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/listen.c vnc_unixsrc/vncviewe +#endif + } ++#endif /* + * AllXEventsPredicate is needed to make XCheckIfEvent return all events. +@@ -293,5 +494,6 @@ + static Bool + AllXEventsPredicate(Display *d, XEvent *ev, char *arg) + { ++ if (d || ev || arg) {} + return True; + } diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/misc.c vnc_unixsrc/vncviewer/misc.c --- vnc_unixsrc.orig/vncviewer/misc.c 2003-01-15 02:58:32.000000000 -0500 -+++ vnc_unixsrc/vncviewer/misc.c 2009-11-28 00:44:24.000000000 -0500 -@@ -33,12 +33,14 @@ ++++ vnc_unixsrc/vncviewer/misc.c 2010-02-25 22:44:09.000000000 -0500 +@@ -23,6 +23,7 @@ + + #include <vncviewer.h> + #include <signal.h> ++#include <sys/wait.h> + #include <fcntl.h> + + static void CleanupSignalHandler(int sig); +@@ -33,12 +34,20 @@ Dimension dpyWidth, dpyHeight; Atom wmDeleteWindow, wmState; @@ -9192,10 +9308,16 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/misc.c vnc_unixsrc/vncviewer/ static XtErrorHandler defaultXtErrorHandler; +int XError_ign = 0; ++ ++void check_tall(void); ++int guessCrop(void); ++void get_scale_values(double *fx, double *fy); ++int scale_round(int n, double factor); ++Bool SendTextChatFinished(void); /* * ToplevelInitBeforeRealization sets the title, geometry and other resources -@@ -48,87 +50,122 @@ +@@ -48,87 +57,122 @@ void ToplevelInitBeforeRealization() { @@ -9395,7 +9517,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/misc.c vnc_unixsrc/vncviewer/ } -@@ -141,14 +178,22 @@ +@@ -141,14 +185,22 @@ void ToplevelInitAfterRealization() { @@ -9426,7 +9548,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/misc.c vnc_unixsrc/vncviewer/ } -@@ -157,9 +202,7 @@ +@@ -157,9 +209,7 @@ * CurrentTime if the event has no time field. */ @@ -9437,7 +9559,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/misc.c vnc_unixsrc/vncviewer/ switch (ev->type) { case KeyPress: case KeyRelease: -@@ -192,18 +235,15 @@ +@@ -192,18 +242,16 @@ * generated by SendRFBEvent. */ @@ -9461,10 +9583,19 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/misc.c vnc_unixsrc/vncviewer/ + msec = atoi(params[0]); + } + usleep(msec * 1000); ++ if (w || event || params || num_params) {} } -@@ -264,11 +304,9 @@ +@@ -256,6 +304,7 @@ + /* Wait for Child 1 to die */ + wait(&childstatus); + ++ if (w || event || params || num_params) {} + return; + } + +@@ -264,11 +313,10 @@ * Quit action - called when we get a "delete window" message. */ @@ -9475,11 +9606,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/misc.c vnc_unixsrc/vncviewer/ - exit(0); +void Quit(Widget w, XEvent *event, String *params, Cardinal *num_params) { + Cleanup(); ++ if (w || event || params || num_params) {} + exit(0); } -@@ -276,49 +314,93 @@ +@@ -276,49 +324,94 @@ * Cleanup - perform any cleanup operations prior to exiting. */ @@ -9549,7 +9681,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/misc.c vnc_unixsrc/vncviewer/ + if (XGetErrorText(dpy, error->error_code, str, 4096)) { + fprintf(stderr, "%s", str); + } -+ return; ++ return 0; + } + fprintf(stderr,"CleanupXErrorHandler called\n"); + check_dbg(); @@ -9590,14 +9722,29 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/misc.c vnc_unixsrc/vncviewer/ + fprintf(stderr,"CleanupSignalHandler called\n"); + check_dbg(); + Cleanup(); ++ if (sig) {} + exit(1); } +@@ -362,7 +455,7 @@ + if (!XQueryTree(dpy, w, &dummy, &dummy, &children, &nchildren)) + return False; + +- for (i = 0; i < nchildren; i++) { ++ for (i = 0; i < (int) nchildren; i++) { + if (IconifyNamedWindow(children[i], name, undo)) { + XFree ((char *)children); + return True; 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 2009-10-27 00:14:17.000000000 -0400 -@@ -25,22 +25,59 @@ ++++ vnc_unixsrc/vncviewer/popup.c 2010-02-25 22:52:14.000000000 -0500 +@@ -22,25 +22,69 @@ + */ + + #include "vncviewer.h" ++#include <time.h> ++#include <sys/wait.h> #include <X11/Xaw/Form.h> #include <X11/Xaw/Command.h> @@ -9609,6 +9756,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer + Widget popup, fullScreenToggle; ++Bool SendTextChatFinished(void); ++ +void popupFixer(Widget wid) { + Window rr, cr; + unsigned int m; @@ -9631,7 +9780,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer +} + +void Noop(Widget w, XEvent *event, String *params, Cardinal *num_params) { -+ //fprintf(stderr, "No-op\n"); ++ if (0) fprintf(stderr, "No-op\n"); ++ if (w || event || params || num_params) {} +} + void @@ -9652,6 +9802,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer + } + XSetWMProtocols(dpy, XtWindow(popup), &wmDeleteWindow, 1); + XtOverrideTranslations(popup, XtParseTranslationTable ("<Message>WM_PROTOCOLS: HidePopup()")); ++ if (w || event || params || num_params) {} } void @@ -9660,16 +9811,17 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer - XtPopdown(popup); +HidePopup(Widget w, XEvent *event, String *params, Cardinal *num_params) { + XtPopdown(popup); ++ if (w || event || params || num_params) {} } -@@ -52,42 +89,786 @@ +@@ -52,42 +96,805 @@ }; void -CreatePopup() +CreatePopup() { -+ Widget buttonForm1, buttonForm2, twoForm, button, prevButton = NULL; ++ Widget buttonForm1, buttonForm2, twoForm, button = 0, prevButton = NULL; + int i; + char buttonName[12]; + String buttonType; @@ -9729,12 +9881,14 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer + } + XSetWMProtocols(dpy, XtWindow(scaleN), &wmDeleteWindow, 1); + XtOverrideTranslations(scaleN, XtParseTranslationTable ("<Message>WM_PROTOCOLS: HideScaleN()")); ++ if (w || event || params || num_params) {} +} + +void +HideScaleN(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + XtPopdown(scaleN); ++ if (w || event || params || num_params) {} +} + + @@ -9804,6 +9958,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer + appData.qualityLevel=qual; + UpdateQual(); +#endif ++ if (w || client || p) {} +} + +void qualJumpProc(Widget w, XtPointer client, XtPointer p) { @@ -9813,6 +9968,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer + appData.qualityLevel=qual; + UpdateQual(); +#endif ++ if (w || client || p) {} +} + +void UpdateSubsampButtons(void) { @@ -9852,12 +10008,14 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer + } + XSetWMProtocols(dpy, XtWindow(turbovncW), &wmDeleteWindow, 1); + XtOverrideTranslations(turbovncW, XtParseTranslationTable ("<Message>WM_PROTOCOLS: HideTurboVNC()")); ++ if (w || event || params || num_params) {} +} + +void +HideTurboVNC(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + XtPopdown(turbovncW); ++ if (w || event || params || num_params) {} +} + +void @@ -9920,12 +10078,14 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer + } + XSetWMProtocols(dpy, XtWindow(qualityW), &wmDeleteWindow, 1); + XtOverrideTranslations(qualityW, XtParseTranslationTable ("<Message>WM_PROTOCOLS: HideQuality()")); ++ if (w || event || params || num_params) {} +} + +void +HideQuality(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + XtPopdown(qualityW); ++ if (w || event || params || num_params) {} +} + + @@ -9977,12 +10137,14 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer + } + XSetWMProtocols(dpy, XtWindow(compressW), &wmDeleteWindow, 1); + XtOverrideTranslations(compressW, XtParseTranslationTable ("<Message>WM_PROTOCOLS: HideCompress()")); ++ if (w || event || params || num_params) {} +} + +void +HideCompress(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + XtPopdown(compressW); ++ if (w || event || params || num_params) {} +} + + @@ -10031,6 +10193,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer + close(filexfer_listen); + filexfer_listen = -1; + } ++ if (w || event || params || num_params) {} +} + +extern int use_loopback; @@ -10095,6 +10258,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer + } + free(cmd); + filexfer_listen = sock; ++ if (w || event || params || num_params) {} +} + +Widget chat, entry, text; @@ -10120,6 +10284,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer + XSync(dpy, False); + usleep(200 * 1000); + } ++ if (w || event || params || num_params) {} +} + +void hidechat(void) { @@ -10142,12 +10307,14 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer + SendTextChatClose(); + SendTextChatFinished(); + hidechat(); ++ if (w || event || params || num_params) {} +} + +void dismiss_proc(Widget w, XtPointer client_data, XtPointer call_data) { + SendTextChatClose(); + SendTextChatFinished(); + hidechat(); ++ if (w || client_data || call_data) {} +} + +extern void printChat(char *, Bool); @@ -10170,6 +10337,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer + } + if (db) fprintf(stderr, "ChatTextCallback: %.4f\n", dnow() - start_time); + CheckTextInput(); ++ if (clientData || id) {} +} + +void CheckTextInput(void) { @@ -10286,7 +10454,6 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer +} + +void AppendChatInput(char *in) { -+ int len; + XawTextPosition beg, end; + static XawTextPosition pos = 0; + XawTextBlock txt; @@ -10298,7 +10465,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer + XawTextSetInsertionPoint(text, pos); + beg = XawTextGetInsertionPoint(text); + end = beg; -+ //fprintf(stderr, "AppendChatInput: pos=%d in= '%s'\n", beg, in); ++#if 0 ++ fprintf(stderr, "AppendChatInput: pos=%d in= '%s'\n", beg, in); ++#endif + + txt.firstPos = 0; + txt.length = strlen(in); @@ -10309,18 +10478,19 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer + XawTextSetInsertionPoint(text, beg + txt.length); + + pos = XawTextGetInsertionPoint(text); -+ //fprintf(stderr, "AppendChatInput done pos=%d\n", pos); ++#if 0 ++ fprintf(stderr, "AppendChatInput done pos=%d\n", pos); ++#endif +} + ++#if 0 +static char errorbuf[1] = {0}; ++#endif + +void CreateChat(void) { + + Widget myform, dismiss; -+ int i, n; + Dimension w = 400, h = 300; -+ Dimension x = 33, y = 33; -+ Arg args[10]; + + chat = XtVaCreatePopupShell("chat", topLevelShellWidgetClass, toplevel, XtNmappedWhenManaged, False, NULL); + @@ -10353,7 +10523,6 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer +Widget msgwin, msgtext; + +void AppendMsg(char *in) { -+ int len; + XawTextPosition beg, end; + static XawTextPosition pos = 0; + XawTextBlock txt; @@ -10381,6 +10550,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer + msg_visible = 0; + XSync(dpy, False); + usleep(200 * 1000); ++ if (w || client_data || call_data) {} +} + +void msg_NO_proc(Widget w, XtPointer client_data, XtPointer call_data) { @@ -10389,13 +10559,14 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/popup.c vnc_unixsrc/vncviewer + msg_NO_clicked = 1; + XSync(dpy, False); + usleep(200 * 1000); ++ if (w || client_data || call_data) {} +} + +int CreateMsg(char *msg, int wait) { + + Widget myform, dismiss, reject; + char *p; -+ int i, n, run, wmax = 0; ++ int n, run, wmax = 0; + int ret = 1; + Dimension w, h; + @@ -10493,16 +10664,19 @@ 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 2008-09-05 19:51:24.000000000 -0400 -+++ vnc_unixsrc/vncviewer/rfbproto.c 2009-11-27 11:50:35.000000000 -0500 -@@ -23,6 +23,7 @@ ++++ vnc_unixsrc/vncviewer/rfbproto.c 2010-02-25 23:27:38.000000000 -0500 +@@ -23,7 +23,10 @@ * rfbproto.c - functions to deal with client side of RFB protocol. */ +#include <sys/stat.h> #include <unistd.h> ++#include <time.h> ++#include <ctype.h> #include <errno.h> #include <pwd.h> -@@ -31,6 +32,9 @@ + #include <vncviewer.h> +@@ -31,6 +34,9 @@ #include <zlib.h> #include <jpeglib.h> @@ -10512,7 +10686,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie static void InitCapabilities(void); static Bool SetupTunneling(void); static int ReadSecurityType(void); -@@ -57,6 +61,44 @@ +@@ -57,6 +63,47 @@ static Bool HandleTight16(int rx, int ry, int rw, int rh); static Bool HandleTight32(int rx, int ry, int rw, int rh); @@ -10525,6 +10699,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie +static Bool HandleZRLE24Down(int rx, int ry, int rw, int rh); +static Bool HandleZRLE32(int rx, int ry, int rw, int rh); + ++extern Bool HandleCursorPos(int x, int y); ++extern void printChat(char *, Bool); ++ +typedef struct { + unsigned long length; +} rfbZRLEHeader; @@ -10557,10 +10734,13 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie static void ReadConnFailedReason(void); static long ReadCompactLen (void); -@@ -67,6 +109,22 @@ +@@ -67,6 +114,25 @@ static void JpegSetSrcManager(j_decompress_ptr cinfo, CARD8 *compressedData, int compressedLen); ++extern void deskey(unsigned char *, int); ++extern void des(unsigned char *, unsigned char *); ++ +extern int currentMsg; +extern double scale_factor_x; +extern double scale_factor_y; @@ -10580,7 +10760,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie int rfbsock; char *desktopName; -@@ -75,6 +133,14 @@ +@@ -75,6 +141,14 @@ char *serverCutText = NULL; Bool newServerCutText = False; @@ -10595,7 +10775,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie int endianTest = 1; static Bool tightVncProtocol = False; -@@ -177,8 +243,26 @@ +@@ -177,8 +251,26 @@ sig_rfbEncodingPointerPos, "Pointer position update"); CapsAdd(encodingCaps, rfbEncodingLastRect, rfbTightVncVendor, sig_rfbEncodingLastRect, "LastRect protocol extension"); @@ -10622,7 +10802,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie /* * ConnectToRFBServer. -@@ -187,24 +271,167 @@ +@@ -187,24 +279,167 @@ Bool ConnectToRFBServer(const char *hostname, int port) { @@ -10782,7 +10962,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + if (type == rfbSecTypeAnonTls) str = "rfbSecTypeAnonTls"; + if (type == rfbSecTypeVencrypt) str = "rfbSecTypeVencrypt"; + -+ if (type == rfbUltraVncMsLogon) str = "rfbUltraVncMsLogon"; ++ if (type == (int) rfbUltraVncMsLogon) str = "rfbUltraVncMsLogon"; + return str; +} + @@ -10802,7 +10982,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie /* * InitialiseRFBConnection. */ -@@ -212,211 +439,649 @@ +@@ -212,211 +447,654 @@ Bool InitialiseRFBConnection(void) { @@ -11164,7 +11344,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + } + dt_out_sc = dnow(); + msg_sz = Swap32IfBE(msg_sz); -+ if (msg_sz < 0 || msg_sz > 1024) { ++ if (msg_sz > 1024) { + fprintf(stderr, "UVNC msg size too big: %d\n", msg_sz); + exit(1); + } @@ -11290,7 +11470,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + switch (secType) { + case rfbSecTypeNone: + fprintf(stderr, "No VNC authentication needed\n"); -+ if (viewer_minor == 8) { ++ if (viewer_minor >= 8) { + CARD32 authResult; + + if (!ReadFromRFBServer((char *)&authResult, 4)) { @@ -11300,9 +11480,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + authResult = Swap32IfLE(authResult); + + if (authResult == rfbVncAuthOK) { -+ fprintf(stderr, "VNC authentication succeeded (%d) for rfbSecTypeNone (RFB 3.8)\n", authResult); ++ fprintf(stderr, "VNC authentication succeeded (%d) for rfbSecTypeNone (RFB 3.8)\n", (int) authResult); + } else { -+ sprintf(msgbuf, "VNC authentication failed (%d) for rfbSecTypeNone (RFB 3.8)\n\n", authResult); ++ sprintf(msgbuf, "VNC authentication failed (%d) for rfbSecTypeNone (RFB 3.8)\n\n", (int) authResult); + wmsg(msgbuf, 1); + return False; + } @@ -11503,6 +11683,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + CARD8 secType = rfbSecTypeInvalid; + int i, j; + ++ if (secTypeNames) {} ++ + /* Read the list of security types. */ + if (!ReadFromRFBServer((char *)&nSecTypes, sizeof(nSecTypes))) { + return rfbSecTypeInvalid; @@ -11547,18 +11729,18 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + if (!ReadFromRFBServer((char *)secTypes, nSecTypes)) { + return rfbSecTypeInvalid; + } - -- free(secTypes); ++ + if (getenv("SSVNC_DEBUG_SEC_TYPES")) { + for (j = 0; j < (int)nSecTypes; j++) { + fprintf(stderr, "sec-type[%d] %d\n", j, (int) secTypes[j]); + } + } - -- if (secType == rfbSecTypeInvalid) -- fprintf(stderr, "Server did not offer supported security type\n"); ++ + /* Find out if the server supports TightVNC protocol extensions */ + for (j = 0; j < (int)nSecTypes; j++) { ++ if (getenv("VNCVIEWER_NO_SEC_TYPE_TIGHT")) { ++ break; ++ } + if (getenv("SSVNC_NO_SEC_TYPE_TIGHT")) { + break; + } @@ -11592,14 +11774,17 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + break; + } + } -+ + +- free(secTypes); + if (secType == rfbSecTypeInvalid) { + fprintf(stderr, "Server did not offer supported security type:\n"); + for (j = 0; j < (int)nSecTypes; j++) { + fprintf(stderr, " sectype[%d] %d\n", j, (int) secTypes[j]); + } + } -+ + +- if (secType == rfbSecTypeInvalid) +- fprintf(stderr, "Server did not offer supported security type\n"); + free(secTypes); - return (int)secType; @@ -11607,7 +11792,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie } -@@ -451,6 +1116,9 @@ +@@ -451,6 +1129,9 @@ return True; } @@ -11617,7 +11802,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie /* * Negotiate authentication scheme (protocol version 3.7t) -@@ -459,58 +1127,388 @@ +@@ -459,58 +1140,406 @@ static Bool PerformAuthenticationTight(void) { @@ -11648,6 +11833,23 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie - } + if (!caps.nAuthTypes) { + fprintf(stderr, "No VNC authentication needed\n\n"); ++ if (viewer_minor >= 8) { ++ CARD32 authResult; ++ ++ if (!ReadFromRFBServer((char *)&authResult, 4)) { ++ return False; ++ } ++ ++ authResult = Swap32IfLE(authResult); ++ ++ if (authResult == rfbVncAuthOK) { ++ fprintf(stderr, "VNC authentication succeeded (%d) for PerformAuthenticationTight rfbSecTypeNone (RFB 3.8)\n", (int) authResult); ++ } else { ++ sprintf(msgbuf, "VNC authentication failed (%d) for PerformAuthenticationTight rfbSecTypeNone (RFB 3.8)\n\n", (int) authResult); ++ wmsg(msgbuf, 1); ++ return False; ++ } ++ } + return True; + } @@ -11713,7 +11915,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + return False; + } + } -+ + +- fprintf(stderr, "No suitable authentication schemes offered by server\n"); +- return False; + sprintf(msgbuf, "No suitable authentication schemes offered by server\n"); + wmsg(msgbuf, 1); + return False; @@ -11780,11 +11984,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + return False; + } + } -+} + } +#endif -- fprintf(stderr, "No suitable authentication schemes offered by server\n"); -- return False; +static void hexprint(char *label, char *data, int len) { + int i; + fprintf(stderr, "%s: ", label); @@ -11821,6 +12023,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie +} + +static void try_invert(char *wireuser, char *wirepass, unsigned long long actual_key) { ++ if (wireuser || wirepass || actual_key) {} + return; +} + @@ -11837,8 +12040,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + } + } + return result; - } - ++} ++ +/* + * UltraVNC MS-Logon authentication (for v1.0.5 and later.) + */ @@ -11903,7 +12106,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + + /* make a random long long: */ + uprv = 0xffffffff * (now - (unsigned int) now); -+ uprv << 32; ++ uprv = uprv << 32; + uprv |= (unsigned long long) urandom(); + uprv = uprv % max_dh; + @@ -12048,7 +12251,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie /* * Standard VNC authentication. -@@ -519,80 +1517,115 @@ +@@ -519,80 +1548,119 @@ static Bool AuthenticateVNC(void) { @@ -12067,10 +12270,35 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + int restart = 0; - fprintf(stderr, "Performing standard VNC authentication\n"); -+ fprintf(stderr, "\nPerforming standard VNC authentication\n"); ++ if (authScheme) {} - if (!ReadFromRFBServer((char *)challenge, CHALLENGESIZE)) - return False; ++ fprintf(stderr, "\nPerforming standard VNC authentication\n"); + +- if (appData.passwordFile) { +- passwd = vncDecryptPasswdFromFile(appData.passwordFile); +- if (!passwd) { +- fprintf(stderr, "Cannot read valid password from file \"%s\"\n", +- appData.passwordFile); +- return False; +- } +- } else if (appData.autoPass) { +- passwd = buffer; +- cstatus = fgets(buffer, sizeof buffer, stdin); +- if (cstatus == NULL) +- buffer[0] = '\0'; +- else +- { +- len = strlen(buffer); +- if (len > 0 && buffer[len - 1] == '\n') +- buffer[len - 1] = '\0'; +- } +- } else if (appData.passwordDialog) { +- passwd = DoPasswordDialog(); +- } else { +- passwd = getpass("Password: "); +- } + if (!ReadFromRFBServer((char *)challenge, CHALLENGESIZE)) { + return False; + } @@ -12107,33 +12335,6 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + passwd = getpass("VNC Password: "); + } -- if (appData.passwordFile) { -- passwd = vncDecryptPasswdFromFile(appData.passwordFile); -- if (!passwd) { -- fprintf(stderr, "Cannot read valid password from file \"%s\"\n", -- appData.passwordFile); -- return False; -- } -- } else if (appData.autoPass) { -- passwd = buffer; -- cstatus = fgets(buffer, sizeof buffer, stdin); -- if (cstatus == NULL) -- buffer[0] = '\0'; -- else -- { -- len = strlen(buffer); -- if (len > 0 && buffer[len - 1] == '\n') -- buffer[len - 1] = '\0'; -- } -- } else if (appData.passwordDialog) { -- passwd = DoPasswordDialog(); -- } else { -- passwd = getpass("Password: "); -- } -+ if (getenv("VNCVIEWER_PASSWORD")) { -+ putenv("VNCVIEWER_PASSWORD=none"); -+ } - - if (!passwd || strlen(passwd) == 0) { - fprintf(stderr, "Reading password failed\n"); - return False; @@ -12141,6 +12342,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie - if (strlen(passwd) > 8) { - passwd[8] = '\0'; - } ++ if (getenv("VNCVIEWER_PASSWORD")) { ++ putenv("VNCVIEWER_PASSWORD=none"); ++ } + +- vncEncryptBytes(challenge, passwd); + if (restart) { +#define EN0 0 +#define DE1 1 @@ -12158,26 +12364,23 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + } + } -- vncEncryptBytes(challenge, passwd); -+ vncEncryptBytes(challenge, passwd); -+ - - /* Lose the password from memory */ - memset(passwd, '\0', strlen(passwd)); ++ vncEncryptBytes(challenge, passwd); ++ - if (!WriteExact(rfbsock, (char *)challenge, CHALLENGESIZE)) - return False; -+// /* Lose the password from memory */ -+// memset(passwd, '\0', strlen(passwd)); - if (!ReadFromRFBServer((char *)&authResult, 4)) - return False; -+ if (!WriteExact(rfbsock, (char *)challenge, CHALLENGESIZE)) { -+ return False; -+ } ++#if 0 ++ /* Lose the password from memory */ ++ memset(passwd, '\0', strlen(passwd)); ++#endif - authResult = Swap32IfLE(authResult); -+ if (!ReadFromRFBServer((char *)&authResult, 4)) { ++ if (!WriteExact(rfbsock, (char *)challenge, CHALLENGESIZE)) { + return False; + } @@ -12196,9 +12399,13 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie - (int)authResult); - return False; - } -+ authResult = Swap32IfLE(authResult); ++ if (!ReadFromRFBServer((char *)&authResult, 4)) { ++ return False; ++ } - return True; ++ authResult = Swap32IfLE(authResult); ++ + switch (authResult) { + case rfbVncAuthOK: + fprintf(stderr, "VNC authentication succeeded\n\n"); @@ -12227,7 +12434,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie } /* -@@ -602,68 +1635,75 @@ +@@ -602,68 +1670,77 @@ static Bool AuthenticateUnixLogin(void) { @@ -12304,8 +12511,10 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie - /* Lose the password from memory */ - memset(passwd, '\0', strlen(passwd)); -+// /* Lose the password from memory */ -+// memset(passwd, '\0', strlen(passwd)); ++#if 0 ++ /* Lose the password from memory */ ++ memset(passwd, '\0', strlen(passwd)); ++#endif - if (!ReadFromRFBServer((char *)&authResult, sizeof(authResult))) - return False; @@ -12355,7 +12564,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie } -@@ -675,19 +1715,20 @@ +@@ -675,19 +1752,20 @@ static Bool ReadInteractionCaps(void) { @@ -12388,21 +12597,21 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie } -@@ -700,19 +1741,67 @@ - static Bool - ReadCapabilityList(CapsContainer *caps, int count) - { +@@ -697,22 +1775,70 @@ + * many records to read from the socket. + */ + +-static Bool +-ReadCapabilityList(CapsContainer *caps, int count) +-{ - rfbCapabilityInfo msginfo; - int i; ++static Bool ++ReadCapabilityList(CapsContainer *caps, int count) ++{ + rfbCapabilityInfo msginfo; + int i; - -- for (i = 0; i < count; i++) { -- if (!ReadFromRFBServer((char *)&msginfo, sz_rfbCapabilityInfo)) -- return False; -- msginfo.code = Swap32IfLE(msginfo.code); -- CapsEnable(caps, &msginfo); -- } ++ + for (i = 0; i < count; i++) { + if (!ReadFromRFBServer((char *)&msginfo, sz_rfbCapabilityInfo)) { + return False; @@ -12410,14 +12619,20 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + msginfo.code = Swap32IfLE(msginfo.code); + CapsEnable(caps, &msginfo); + } - -- return True; ++ + return True; +} + -+ + +- for (i = 0; i < count; i++) { +- if (!ReadFromRFBServer((char *)&msginfo, sz_rfbCapabilityInfo)) +- return False; +- msginfo.code = Swap32IfLE(msginfo.code); +- CapsEnable(caps, &msginfo); +- } +/* used to have !tunnelSpecified */ -+ + +- return True; +static int guess_compresslevel(void) { + int n; + if (latency > 200.0) { @@ -12465,7 +12680,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie /* * SetFormatAndEncodings. -@@ -729,6 +1818,17 @@ +@@ -729,6 +1855,21 @@ Bool requestCompressLevel = False; Bool requestQualityLevel = False; Bool requestLastRectEncoding = False; @@ -12479,11 +12694,15 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + tQLmax = 100; +#endif + -+// fprintf(stderr, "SetFormatAndEncodings: sent_FBU state: %2d\n", sent_FBU); ++ if (requestTextChatEncoding || requestSubsampLevel || tQL) {} ++ ++#if 0 ++ fprintf(stderr, "SetFormatAndEncodings: sent_FBU state: %2d\n", sent_FBU); ++#endif spf.type = rfbSetPixelFormat; spf.format = myFormat; -@@ -736,15 +1836,32 @@ +@@ -736,15 +1877,32 @@ spf.format.greenMax = Swap16IfLE(spf.format.greenMax); spf.format.blueMax = Swap16IfLE(spf.format.blueMax); @@ -12516,7 +12735,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie do { char *nextEncStr = strchr(encStr, ' '); if (nextEncStr) { -@@ -754,50 +1871,102 @@ +@@ -754,50 +1912,102 @@ encStrLen = strlen(encStr); } @@ -12635,7 +12854,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 +1975,16 @@ +@@ -806,10 +2016,16 @@ if (se->nEncodings < MAX_ENCODINGS && requestLastRectEncoding) { encs[se->nEncodings++] = Swap32IfLE(rfbEncodingLastRect); } @@ -12655,7 +12874,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 { -@@ -818,44 +1993,84 @@ +@@ -818,44 +2034,84 @@ } encs[se->nEncodings++] = Swap32IfLE(rfbEncodingCopyRect); @@ -12762,7 +12981,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie return True; } -@@ -868,31 +2083,86 @@ +@@ -868,31 +2124,86 @@ Bool SendIncrementalFramebufferUpdateRequest() { @@ -12792,14 +13011,6 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie - rfbFramebufferUpdateRequestMsg fur; + rfbFramebufferUpdateRequestMsg fur; + static int db = -1; -+ -+ if (db < 0) { -+ if (getenv("SSVNC_DEBUG_RECTS")) { -+ db = atoi(getenv("SSVNC_DEBUG_RECTS")); -+ } else { -+ db = 0; -+ } -+ } - fur.type = rfbFramebufferUpdateRequest; - fur.incremental = incremental ? 1 : 0; @@ -12807,10 +13018,19 @@ 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 (db) fprintf(stderr, "SendFramebufferUpdateRequest(%d, %d, %d, %d, incremental=%d)\n", x, y, w, h, (int) incremental); ++ if (db < 0) { ++ if (getenv("SSVNC_DEBUG_RECTS")) { ++ db = atoi(getenv("SSVNC_DEBUG_RECTS")); ++ } else { ++ db = 0; ++ } ++ } - if (!WriteExact(rfbsock, (char *)&fur, sz_rfbFramebufferUpdateRequestMsg)) - return False; ++ if (db) fprintf(stderr, "SendFramebufferUpdateRequest(%d, %d, %d, %d, incremental=%d)\n", x, y, w, h, (int) incremental); + +- return True; + if (dyn < 0) { + struct stat sb; + if (getenv("USER") && !strcmp(getenv("USER"), "runge")) { @@ -12825,8 +13045,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + dyn = 1; + } + } - -- return True; ++ + if (appData.fileActive && filexfer_sock >= 0) { + static int first = 1; + if (first) { @@ -12862,7 +13081,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie } -@@ -903,19 +2173,36 @@ +@@ -903,19 +2214,38 @@ Bool SendPointerEvent(int x, int y, int buttonMask) { @@ -12871,7 +13090,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + + if (appData.fileActive) { + if (!dyn || time(NULL) < last_filexfer + delay_filexfer) { -+ //fprintf(stderr, "skip SendPointerEvent: %d - %d\n", last_filexfer, time(NULL)); ++#if 0 ++ fprintf(stderr, "skip SendPointerEvent: %d - %d\n", last_filexfer, time(NULL)); ++#endif + return True; + } + } @@ -12911,7 +13132,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie } -@@ -926,12 +2213,20 @@ +@@ -926,12 +2256,22 @@ Bool SendKeyEvent(CARD32 key, Bool down) { @@ -12920,7 +13141,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + + if (appData.fileActive) { + if (!dyn || time(NULL) < last_filexfer + delay_filexfer) { -+ //fprintf(stderr, "skip SendPointerEvent: %d - %d\n", last_filexfer, time(NULL)); ++#if 0 ++ fprintf(stderr, "skip SendPointerEvent: %d - %d\n", last_filexfer, time(NULL)); ++#endif + return True; + } + } @@ -12937,7 +13160,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie } -@@ -942,281 +2237,1024 @@ +@@ -942,281 +2282,1025 @@ Bool SendClientCutText(char *str, int len) { @@ -12951,7 +13174,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + + if (appData.fileActive) { + if (!dyn || time(NULL) < last_filexfer + delay_filexfer) { -+ // ultravnc java viewer lets this one through. ++ /* ultravnc java viewer lets this one through. */ + return True; + } + } @@ -12969,7 +13192,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie - return (WriteExact(rfbsock, (char *)&cct, sz_rfbClientCutTextMsg) && - WriteExact(rfbsock, str, len)); + cct.type = rfbClientCutText; -+ cct.length = Swap32IfLE(len); ++ cct.length = Swap32IfLE((unsigned int) len); + currentMsg = rfbClientCutText; + return (WriteExact(rfbsock, (char *)&cct, sz_rfbClientCutTextMsg) && + WriteExact(rfbsock, str, len)); @@ -13086,7 +13309,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + chat.pad1 = 0; + chat.pad2 = 0; + chat.length = (unsigned int) strlen(str); -+ if (db) fprintf(stderr, "SendTextChat: %d '%s'\n", chat.length, str); ++ if (db) fprintf(stderr, "SendTextChat: %d '%s'\n", (int) chat.length, str); + chat.length = Swap32IfLE(chat.length); + if (!WriteExact(rfbsock, (char *)&chat, sz_rfbTextChatMsg)) { + return False; @@ -13110,8 +13333,10 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie +Bool +SendTextChatOpen(void) +{ -+ raiseme(0); + rfbTextChatMsg chat; + +- msg.fu.nRects = Swap16IfLE(msg.fu.nRects); ++ raiseme(0); + chat.type = rfbTextChat; + chat.pad1 = 0; + chat.pad2 = 0; @@ -13119,7 +13344,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + return WriteExact(rfbsock, (char *)&chat, sz_rfbTextChatMsg); +} -- msg.fu.nRects = Swap16IfLE(msg.fu.nRects); +- for (i = 0; i < msg.fu.nRects; i++) { +- if (!ReadFromRFBServer((char *)&rect, sz_rfbFramebufferUpdateRectHeader)) +- return False; +Bool +SendTextChatClose(void) +{ @@ -13132,9 +13359,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + return WriteExact(rfbsock, (char *)&chat, sz_rfbTextChatMsg); +} -- for (i = 0; i < msg.fu.nRects; i++) { -- if (!ReadFromRFBServer((char *)&rect, sz_rfbFramebufferUpdateRectHeader)) -- return False; +- rect.encoding = Swap32IfLE(rect.encoding); +- if (rect.encoding == rfbEncodingLastRect) +- break; +Bool +SendTextChatFinished(void) +{ @@ -13189,35 +13416,35 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + unsigned int len; + + int rfbDirContentRequest = 1; -+ int rfbDirPacket = 2; // Full directory name or full file name. ++ 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 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 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 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 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 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 rfbRErrorUnknownCmd = 1; /* Unknown FileTransfer command. */ +#define rfbRErrorCmd 0xFFFFFFFF + + static int db = -1; @@ -13227,13 +13454,10 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + if (filexfer_sock < 0) { + return True; + } -+ // instead, we read and discard the ft msg data. ++ /* instead, we read and discard the ft msg data. */ +#endif - -- rect.encoding = Swap32IfLE(rect.encoding); -- if (rect.encoding == rfbEncodingLastRect) -- break; -+//fprintf(stderr, "In HandleFileXfer\n"); ++ ++/*fprintf(stderr, "In HandleFileXfer\n"); */ - rect.r.x = Swap16IfLE(rect.r.x); - rect.r.y = Swap16IfLE(rect.r.y); @@ -13259,12 +13483,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie - if (!HandleCursorPos(rect.r.x, rect.r.y)) { - return False; + last_filexfer = time(NULL); -+ //fprintf(stderr, "last_filexfer-1: %d\n", last_filexfer); ++ /*fprintf(stderr, "last_filexfer-1: %d\n", last_filexfer); */ + -+ // load first byte to send to Java be the FT msg number: ++ /* load first byte to send to Java be the FT msg number: */ + hdr[0] = rfbFileTransfer; + -+ // this is to avoid XtAppProcessEvent() calls induce by our ReadFromRFBServer calls below: ++ /* this is to avoid XtAppProcessEvent() calls induce by our ReadFromRFBServer calls below: */ + skip_XtUpdateAll = 1; + if (!ReadFromRFBServer(&hdr[1], 11)) { + skip_XtUpdateAll = 0; @@ -13340,7 +13564,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + int timeH4 = (unsigned char) fxfer[11]; + if (dattr != 0) { + if (timeH1 == 0 && timeH2 == 0 && timeH3 == 0 && timeH4 == 0) { -+ if (timeL1 != 0 || timeL2 != 0 && timeL3 != 0 && timeL4 != 0) { ++ if ((timeL1 != 0 || timeL2 != 0) && timeL3 != 0 && timeL4 != 0) { + if (!guess_x11vnc) fprintf(stderr, "guessed x11vnc server\n"); + guess_x11vnc = 1; + } @@ -13358,14 +13582,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + + len = (hdr[4] << 24) | (hdr[5] << 16) | (hdr[6] << 8) | hdr[7]; + if (db) fprintf(stderr, "Got rfbFileTransfer: len2 %u\n", len); - -- /* 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); ++ +#if 0 + if (hdr[1] == rfbFileHeader && len != rfbRErrorCmd) +#else -+ // the extra 4 bytes get send on rfbRErrorCmd as well. ++ /* the extra 4 bytes get send on rfbRErrorCmd as well. */ + if (hdr[1] == rfbFileHeader) { +#endif + int is_err = 0; @@ -13395,14 +13616,17 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + } + } -- switch (rect.encoding) { +- /* 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); + read_no_more: -+ + +- switch (rect.encoding) { + if (filexfer_sock < 0) { + int stop = 0; + static time_t last_stop = 0; +#if 0 -+ // this isn't working ++ /* this isn't working */ + if (hdr[1] == rfbFilePacket || hdr[1] == rfbFileHeader) { + fprintf(stderr, "filexfer_sock closed, trying to abort receive\n"); + stop = 1; @@ -13429,7 +13653,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie - linesToRead = BUFFER_SIZE / bytesPerLine; + if (db) fprintf(stderr, "CFX: B\n"); + CheckFileXfer(); -+//fprintf(stderr, "Out HandleFileXfer\n"); ++/*fprintf(stderr, "Out HandleFileXfer\n"); */ + return True; +} @@ -13471,7 +13695,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + } + } + -+//fprintf(stderr, "msg.type: %d\n", msg.type); ++/*fprintf(stderr, "msg.type: %d\n", msg.type); */ - case rfbEncodingCopyRect: - { @@ -13575,29 +13799,13 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie break; - } + } - -- 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; ++ + case rfbFramebufferUpdate: + { + rfbFramebufferUpdateRectHeader rect; + int linesToRead; + int bytesPerLine; + int i; -+ int usecs; + + int area_copyrect = 0; + int area_tight = 0; @@ -13610,6 +13818,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + int cnt_pseudo = 0; + int cnt_image = 0; + ++ int skip_incFBU = 0; ++ + if (db) fprintf(stderr, "FBU-0: %.6f\n", dnow()); + if (rdb < 0) { + if (getenv("SSVNC_DEBUG_RECTS")) { @@ -13617,9 +13827,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + } else { + rdb = 0; + } - } -- break; -- } ++ } + if (delay_sync < 0) { + if (getenv("SSVNC_DELAY_SYNC")) { + delay_sync = atoi(getenv("SSVNC_DELAY_SYNC")); @@ -13629,22 +13837,21 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + } + } + -+ int skip_incFBU = 0; + sent_FBU = -1; -- case rfbEncodingZlib: +- case rfbEncodingHextile: - { - switch (myFormat.bitsPerPixel) { - case 8: -- if (!HandleZlib8(rect.r.x,rect.r.y,rect.r.w,rect.r.h)) +- if (!HandleHextile8(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)) +- if (!HandleHextile16(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)) +- if (!HandleHextile32(rect.r.x,rect.r.y,rect.r.w,rect.r.h)) - return False; - break; + if (appData.pipelineUpdates) { @@ -13659,39 +13866,46 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + XSendEvent(dpy, XtWindow(desktop), False, 0, &ev); } - break; -- } +- } -- case rfbEncodingTight: +- case rfbEncodingZlib: - { - switch (myFormat.bitsPerPixel) { - case 8: -- if (!HandleTight8(rect.r.x,rect.r.y,rect.r.w,rect.r.h)) +- if (!HandleZlib8(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)) +- if (!HandleZlib16(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)) +- if (!HandleZlib32(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; -- } +- } -- default: -- fprintf(stderr,"Unknown rect encoding %d\n", -- (int)rect.encoding); -- return False; -- } +- 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; + msg.fu.nRects = Swap16IfLE(msg.fu.nRects); - -- /* Now we may discard "soft cursor locks". */ -- SoftCursorUnlockScreen(); -- } ++ + if (rdb) fprintf(stderr, "Begin rect loop %d\n", msg.fu.nRects); + + if (delay_sync) { @@ -13728,8 +13942,15 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + } \ + try_delay_sync = 0; \ + skip_maybe_sync = 0; \ -+ } -+ + } +- break; +- } + +- default: +- fprintf(stderr,"Unknown rect encoding %d\n", +- (int)rect.encoding); +- return False; +- } + for (i = 0; i < msg.fu.nRects; i++) { + if (!ReadFromRFBServer((char *)&rect, sz_rfbFramebufferUpdateRectHeader)) { + return False; @@ -13745,7 +13966,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + rect.r.w = Swap16IfLE(rect.r.w); + rect.r.h = Swap16IfLE(rect.r.h); + -+ if (rdb > 1) fprintf(stderr, "nRects: %d i=%d enc: %d %dx%d+%d+%d\n", msg.fu.nRects, i, rect.encoding, rect.r.w, rect.r.h, rect.r.x, rect.r.y); ++ if (rdb > 1) fprintf(stderr, "nRects: %d i=%d enc: %d %dx%d+%d+%d\n", msg.fu.nRects, i, (int) rect.encoding, rect.r.w, rect.r.h, rect.r.x, rect.r.y); + + if (rect.encoding == rfbEncodingXCursor || rect.encoding == rfbEncodingRichCursor) { + cnt_pseudo++; @@ -13786,7 +14007,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + fprintf(stderr,"New Size: %dx%d at (%d, %d)\n", rect.r.w, rect.r.h, rect.r.x, rect.r.y); + si.framebufferWidth = rect.r.w; + si.framebufferHeight = rect.r.h; -+ //fprintf(stderr, "si: %d %d\n", si.framebufferWidth, si.framebufferHeight); ++ /*fprintf(stderr, "si: %d %d\n", si.framebufferWidth, si.framebufferHeight); */ + ReDoDesktop(); + continue; + } @@ -13804,12 +14025,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + case rfbEncodingRRE: + case rfbEncodingCoRRE: + case rfbEncodingHextile: -+ //case rfbEncodingUltra: -+// case rfbEncodingZlib: -+ //case rfbEncodingXOR_Zlib: -+ //case rfbEncodingXORMultiColor_Zlib: -+ //case rfbEncodingXORMonoColor_Zlib: -+ //case rfbEncodingSolidColor: ++ /*case rfbEncodingUltra: */ ++/* case rfbEncodingZlib: */ ++ /*case rfbEncodingXOR_Zlib: */ ++ /*case rfbEncodingXORMultiColor_Zlib: */ ++ /*case rfbEncodingXORMonoColor_Zlib: */ ++ /*case rfbEncodingSolidColor: */ + case rfbEncodingTight: + case rfbEncodingZlibHex: + case rfbEncodingZRLE: @@ -13826,14 +14047,14 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + (rect.r.y + rect.r.h > si.framebufferHeight)) { + if (!appData.chatOnly) { + fprintf(stderr,"Rect too large: %dx%d at (%d, %d) encoding=%d\n", -+ rect.r.w, rect.r.h, rect.r.x, rect.r.y, rect.encoding); ++ rect.r.w, rect.r.h, rect.r.x, rect.r.y, (int) rect.encoding); + return False; + } + } + + if (rect.r.h * rect.r.w == 0) { + fprintf(stderr,"*** Warning *** Zero size rect: %dx%d+%d+%d encoding=%d\n", -+ rect.r.w, rect.r.h, rect.r.x, rect.r.y, rect.encoding); ++ rect.r.w, rect.r.h, rect.r.x, rect.r.y, (int) rect.encoding); + if (0) continue; + } + @@ -14133,7 +14354,10 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + fprintf(stderr,"Unknown rect encoding %d\n", (int)rect.encoding); + return False; + } -+ + +- /* Now we may discard "soft cursor locks". */ +- SoftCursorUnlockScreen(); +- } + /* Now we may discard "soft cursor locks". */ + if (db) fprintf(stderr, "FBU-SUL1 %.6f\n", dnow()); + @@ -14184,7 +14408,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 +3262,168 @@ +@@ -1224,59 +3308,168 @@ mainly to avoid copyrect using invalid screen contents - not sure if we'd need it otherwise. */ @@ -14218,12 +14442,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); @@ -14377,7 +14601,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + appData.fileActive = False; + SendFramebufferUpdateRequest(0, 0, 1, 1, False); + } else { -+//fprintf(stderr, "CFX: A\n"); ++/*fprintf(stderr, "CFX: A\n"); */ + CheckFileXfer(); + } + } @@ -14386,7 +14610,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie } -@@ -1296,26 +3443,93 @@ +@@ -1296,26 +3489,93 @@ #define CONCAT2(a,b) a##b #define CONCAT2E(a,b) CONCAT2(a,b) @@ -14420,7 +14644,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie #include "corre.c" #include "hextile.c" #include "zlib.c" -+// ++ +#ifdef TURBOVNC +#undef FillRectangle +#define FillRectangle turbovnc_FillRectangle @@ -14429,7 +14653,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie +#else #include "tight.c" +#endif -+// ++ +#include "zrle.c" #undef BPP + @@ -14438,7 +14662,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie #include "corre.c" #include "hextile.c" #include "zlib.c" -+// ++ +#ifdef TURBOVNC +#undef FillRectangle +#define FillRectangle turbovnc_FillRectangle @@ -14447,7 +14671,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie +#else #include "tight.c" +#endif -+// ++ +#include "zrle.c" +#define REALBPP 15 +#include "zrle.c" @@ -14458,7 +14682,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie #include "corre.c" #include "hextile.c" #include "zlib.c" -+// ++ +#ifdef TURBOVNC +#undef FillRectangle +#define FillRectangle turbovnc_FillRectangle @@ -14467,7 +14691,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie +#else #include "tight.c" +#endif -+// ++ +#include "zrle.c" +#define REALBPP 24 +#include "zrle.c" @@ -14480,7 +14704,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie #undef BPP /* -@@ -1325,23 +3539,27 @@ +@@ -1325,23 +3585,27 @@ static void ReadConnFailedReason(void) { @@ -14502,7 +14726,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie + reasonLen = Swap32IfLE(reasonLen); + if ((reason = malloc(reasonLen)) != NULL && + ReadFromRFBServer(reason, reasonLen)) { -+ int len = reasonLen < sizeof(msgbuf) - 10 ? (int) reasonLen : sizeof(msgbuf) - 10; ++ int len = (int) reasonLen < sizeof(msgbuf) - 10 ? (int) reasonLen : sizeof(msgbuf) - 10; + sprintf(msgbuf,"VNC connection failed: %.*s\n", len, reason); + wmsg(msgbuf, 1); + free(reason); @@ -14522,7 +14746,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie } /* -@@ -1358,9 +3576,9 @@ +@@ -1358,9 +3622,9 @@ " %s significant bit in each byte is leftmost on the screen.\n", (format->bigEndian ? "Most" : "Least")); } else { @@ -14534,7 +14758,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rfbproto.c vnc_unixsrc/vncvie (format->bigEndian ? "Most" : "Least")); } if (format->trueColour) { -@@ -1462,4 +3680,3 @@ +@@ -1462,4 +3726,3 @@ cinfo->src = &jpegSrcManager; } @@ -14607,7 +14831,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/rre.c vnc_unixsrc/vncviewer/r +#undef FillRectangle diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/selection.c vnc_unixsrc/vncviewer/selection.c --- vnc_unixsrc.orig/vncviewer/selection.c 2004-03-03 04:11:52.000000000 -0500 -+++ vnc_unixsrc/vncviewer/selection.c 2009-11-24 13:34:03.000000000 -0500 ++++ vnc_unixsrc/vncviewer/selection.c 2010-02-25 23:28:48.000000000 -0500 @@ -43,13 +43,16 @@ unsigned long* length, int* format); static void LoseSelection(Widget w, Atom *selection); @@ -14664,7 +14888,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/selection.c vnc_unixsrc/vncvi } -@@ -93,13 +102,15 @@ +@@ -93,13 +102,16 @@ Atom* selection, Atom* type, XtPointer value, unsigned long* length, int* format) { @@ -14684,10 +14908,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/selection.c vnc_unixsrc/vncvi + if (value) { + XtFree(value); + } ++ if (w || clientData || selection || type || value || length || format) {} } -@@ -121,26 +132,29 @@ +@@ -121,26 +133,30 @@ void SelectionToVNC(Widget w, XEvent *event, String *params, Cardinal *num_params) { @@ -14733,10 +14958,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/selection.c vnc_unixsrc/vncvi + } else { + XtGetSelectionValue(w, sendsel, XInternAtom(dpy, "TIMESTAMP", False), GetSelectionTimeCallback, NULL, TimeFromEvent(event)); + } ++ if (w || event || params || num_params) {} } -@@ -158,10 +172,12 @@ +@@ -158,10 +174,13 @@ int len = *length; char *str = (char *)value; @@ -14750,10 +14976,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/selection.c vnc_unixsrc/vncvi + } else if (!getenv("VNCVIEWER_NO_CUTBUFFER")) { + SendCutBuffer(); + } ++ if (w || clientData || selection || type || value || length || format) {} } -@@ -180,26 +196,23 @@ +@@ -180,26 +199,24 @@ Atom* type, XtPointer value, unsigned long* length, int* format) { @@ -14793,10 +15020,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/selection.c vnc_unixsrc/vncvi + if (value) { + XtFree(value); + } ++ if (w || clientData || selection || type || value || length || format) {} } -@@ -209,16 +222,17 @@ +@@ -209,16 +226,17 @@ */ static void @@ -14822,7 +15050,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/selection.c vnc_unixsrc/vncvi } -@@ -230,10 +244,11 @@ +@@ -230,10 +248,12 @@ static void CutBufferChange(Widget w, XtPointer ptr, XEvent *ev, Boolean *cont) { @@ -14834,10 +15062,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/selection.c vnc_unixsrc/vncvi - cutBufferTime = ev->xproperty.time; + cutBufferTime = ev->xproperty.time; ++ if (w || ptr || cont) {} } -@@ -249,36 +264,68 @@ +@@ -249,36 +269,69 @@ void SelectionFromVNC(Widget w, XEvent *event, String *params, Cardinal *num_params) { @@ -14933,10 +15162,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/selection.c vnc_unixsrc/vncvi + ClipboardSelectionOwner = True; + if (dbg_sel) fprintf(stderr, "Own CLIPBOARD\n"); + } ++ if (w || event || params || num_params) {} } -@@ -293,37 +340,36 @@ +@@ -293,37 +346,36 @@ XtPointer* value, unsigned long* length, int* format) { @@ -15002,7 +15232,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/selection.c vnc_unixsrc/vncvi } -@@ -332,7 +378,12 @@ +@@ -332,7 +384,13 @@ */ static void @@ -15017,11 +15247,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/selection.c vnc_unixsrc/vncvi + if (dbg_sel) fprintf(stderr, "lost CLIPBOARD\n"); + ClipboardSelectionOwner = False; + } ++ if (w) {} } diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/shm.c vnc_unixsrc/vncviewer/shm.c --- vnc_unixsrc.orig/vncviewer/shm.c 2000-06-11 08:00:53.000000000 -0400 -+++ vnc_unixsrc/vncviewer/shm.c 2009-11-28 02:25:03.000000000 -0500 -@@ -30,71 +30,108 @@ ++++ vnc_unixsrc/vncviewer/shm.c 2010-02-25 23:40:58.000000000 -0500 +@@ -30,71 +30,113 @@ static Bool caughtShmError = False; static Bool needShmCleanup = False; @@ -15036,6 +15267,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/shm.c vnc_unixsrc/vncviewer/s - } +static int ShmCreationXErrorHandler(Display *dpy, XErrorEvent *error) { + caughtShmError = True; ++ if (dpy || error) {} + return 0; } @@ -15149,7 +15381,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/shm.c vnc_unixsrc/vncviewer/s + + if (shminfo.shmid == -1) { + XDestroyImage(image); -+ //fprintf(stderr, "CreateShmImage: destroyed 'image' (1)\n"); ++ if (0) fprintf(stderr, "CreateShmImage: destroyed 'image' (1)\n"); + return NULL; + } + @@ -15157,7 +15389,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/shm.c vnc_unixsrc/vncviewer/s + + if (shminfo.shmaddr == (char *)-1) { + XDestroyImage(image); -+ //fprintf(stderr, "CreateShmImage: destroyed 'image' (2)\n"); ++#if 0 ++ fprintf(stderr, "CreateShmImage: destroyed 'image' (2)\n"); ++#endif + shmctl(shminfo.shmid, IPC_RMID, 0); + return NULL; + } @@ -15171,7 +15405,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/shm.c vnc_unixsrc/vncviewer/s + + if (caughtShmError) { + XDestroyImage(image); -+ //fprintf(stderr, "CreateShmImage: destroyed 'image' (3)\n"); ++#if 0 ++ fprintf(stderr, "CreateShmImage: destroyed 'image' (3)\n"); ++#endif + shmdt(shminfo.shmaddr); + shmctl(shminfo.shmid, IPC_RMID, 0); + return NULL; @@ -15203,8 +15439,14 @@ 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 2009-11-27 13:55:46.000000000 -0500 -@@ -27,11 +27,17 @@ ++++ vnc_unixsrc/vncviewer/sockets.c 2010-02-25 23:38:35.000000000 -0500 +@@ -22,17 +22,25 @@ + */ + + #include <unistd.h> ++#include <time.h> + #include <sys/socket.h> + #include <errno.h> #include <netinet/in.h> #include <netinet/tcp.h> #include <arpa/inet.h> @@ -15220,9 +15462,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview +#endif + void PrintInHex(char *buf, int len); ++extern void printChat(char *, Bool); Bool errorMessageOnReadFailure = True; -@@ -56,31 +62,376 @@ + +@@ -56,31 +64,396 @@ */ static Bool rfbsockReady = False; @@ -15238,11 +15482,14 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview - rfbsockReady = True; - XtRemoveInput(*id); + rfbsockReady = True; -+// XtRemoveInput(*id); ++#if 0 ++ XtRemoveInput(*id); ++#endif + XtRemoveInput(rfbsockId); + if (do_xfrsockId) { + XtRemoveInput(xfrsockId); + } ++ if (clientData || fd || id) {} } static void @@ -15260,6 +15507,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview + if (do_rfbsockId) { + XtRemoveInput(rfbsockId); + } ++ if (clientData || fd || id) {} +} + + @@ -15310,7 +15558,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview + filexfer_listen = -1; + return; + } -+//fprintf(stderr, "In CheckFileXfer\n"); ++if (0) fprintf(stderr, "In CheckFileXfer\n"); + + if (filexfer_listen >=0) { + n = filexfer_listen; @@ -15348,6 +15596,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview + unsigned char hdr[12]; + unsigned int len; + if (db) fprintf(stderr, "try read filexfer...\n"); ++ if (hdr || len || i) {} +#if 1 + rn = read(n, fxfer, 1*8192); +if (db) { @@ -15367,7 +15616,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview + close(n); + filexfer_sock = -1; + last_filexfer = time(NULL); -+ //fprintf(stderr, "last_filexfer-2a: %d\n", last_filexfer); ++#if 0 ++ fprintf(stderr, "last_filexfer-2a: %d\n", last_filexfer); ++#endif + appData.fileActive = False; + SendFramebufferUpdateRequest(0, 0, 1, 1, False); + return; @@ -15376,7 +15627,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview + if (db) fprintf(stderr, "\n"); + bytes += rn; + last_filexfer = time(NULL); -+ //fprintf(stderr, "last_filexfer-2b: %d\n", last_filexfer); ++#if 0 ++ fprintf(stderr, "last_filexfer-2b: %d\n", last_filexfer); ++#endif + + if (0) { + /* WE TRY TO FIX THIS IN THE JAVA NOW */ @@ -15395,7 +15648,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview + igot = 1; + } +#else -+ // not working, not always 7 msg type. ++ /* not working, not always 7 msg type. */ + rn = read(n, hdr, 12); + if (db) fprintf(stderr, "filexfer read %d.\n", rn); + if (rn == 0) { @@ -15440,8 +15693,10 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview + if (ok) { + grace++; + bytes0 = bytes; -+ //fprintf(stderr, "grace: %d\n", grace); -+ // forgot that this is about... ++#if 0 ++ fprintf(stderr, "grace: %d\n", grace); ++ /* forgot that this is about... */ ++#endif + usleep(10 * 1000); + continue; + } @@ -15451,9 +15706,13 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview + } + if (igot) { + last_filexfer = time(NULL); -+ //fprintf(stderr, "last_filexfer-2c: %d\n", last_filexfer); ++#if 0 ++ fprintf(stderr, "last_filexfer-2c: %d\n", last_filexfer); ++#endif + } -+//fprintf(stderr, "Out CheckFileXfer\n"); ++#if 0 ++fprintf(stderr, "Out CheckFileXfer\n"); ++#endif + return; +} + @@ -15492,7 +15751,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview + if (buf[0] != '\0') { + SendTextChat(buf); + } -+ if (igot >= 0) printChat("Send: "); ++ if (igot >= 0) printChat("Send: ", False); +} + +static time_t time_mark; @@ -15503,7 +15762,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview + +void ProcessXtEvents() +{ -+ int y, db = 0; ++ int db = 0; + static int dyn = -1; + static int chat_was_active = 0; + int check_chat = 0; @@ -15523,7 +15782,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview + } + } + -+ //if (0) fprintf(stderr, "ProcessXtEvents: %d %.4f\n", skip_XtUpdateAll, dnow() - start_time); ++#if 0 ++ if (0) fprintf(stderr, "ProcessXtEvents: %d %.4f\n", skip_XtUpdateAll, dnow() - start_time); ++#endif + + if (skip_XtUpdateAll) { + return; @@ -15536,7 +15797,6 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview + static double last_check = 0.0; + double now = dnow(); + if (now > last_check + 0.75) { -+ //fprintf(stderr, "cwa\n"); + check_chat = 1; + last_check = now; + } @@ -15599,28 +15859,36 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview Bool ReadFromRFBServer(char *out, unsigned int n) { -+// double start = dnow(), dn = n; ++#if 0 ++ double start = dnow(), dn = n; ++#endif if (n <= buffered) { memcpy(out, bufoutptr, n); bufoutptr += n; buffered -= n; -+//fprintf(stderr, "R0: %06d\n", (int) dn); ++#if 0 ++fprintf(stderr, "R0: %06d\n", (int) dn); ++#endif return True; } -@@ -119,6 +470,7 @@ +@@ -119,6 +492,9 @@ memcpy(out, bufoutptr, n); bufoutptr += n; buffered -= n; -+//fprintf(stderr, "R1: %06d %06d %10.2f KB/sec\n", (int) dn, buffered+n, 1e-3 * (buffered+n)/(dnow() - start)); ++#if 0 ++fprintf(stderr, "R1: %06d %06d %10.2f KB/sec\n", (int) dn, buffered+n, 1e-3 * (buffered+n)/(dnow() - start)); ++#endif return True; } else { -@@ -146,11 +498,14 @@ +@@ -146,11 +522,16 @@ n -= i; } -+//fprintf(stderr, "R2: %06d %06d %10.2f KB/sec\n", (int) dn, (int) dn, 1e-3 * (dn)/(dnow() - start)); ++#if 0 ++fprintf(stderr, "R2: %06d %06d %10.2f KB/sec\n", (int) dn, (int) dn, 1e-3 * (dn)/(dnow() - start)); ++#endif return True; } } @@ -15631,7 +15899,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview /* * Write an exact number of bytes, and don't return until you've sent them. */ -@@ -158,37 +513,81 @@ +@@ -158,37 +539,81 @@ Bool WriteExact(int sock, char *buf, int n) { @@ -15742,7 +16010,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview } -@@ -203,6 +602,8 @@ +@@ -203,6 +628,8 @@ struct sockaddr_in addr; int one = 1; @@ -15751,7 +16019,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = host; -@@ -232,7 +633,22 @@ +@@ -232,7 +659,22 @@ return sock; } @@ -15774,7 +16042,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview /* * FindFreeTcpPort tries to find unused TCP port in the range -@@ -245,6 +661,8 @@ +@@ -245,6 +687,8 @@ int sock, port; struct sockaddr_in addr; @@ -15783,7 +16051,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview addr.sin_family = AF_INET; addr.sin_addr.s_addr = INADDR_ANY; -@@ -272,6 +690,8 @@ +@@ -272,6 +716,8 @@ * ListenAtTcpPort starts listening at the given TCP port. */ @@ -15792,7 +16060,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview int ListenAtTcpPort(int port) { -@@ -279,10 +699,16 @@ +@@ -279,10 +725,16 @@ struct sockaddr_in addr; int one = 1; @@ -15809,7 +16077,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview sock = socket(AF_INET, SOCK_STREAM, 0); if (sock < 0) { fprintf(stderr,programName); -@@ -305,7 +731,7 @@ +@@ -305,7 +757,7 @@ return -1; } @@ -15818,7 +16086,16 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/sockets.c vnc_unixsrc/vncview fprintf(stderr,programName); perror(": ListenAtTcpPort: listen"); close(sock); -@@ -392,6 +818,42 @@ +@@ -379,7 +831,7 @@ + + *addr = inet_addr(str); + +- if (*addr != -1) ++ if (*addr != (unsigned int) -1) + return True; + + hp = gethostbyname(str); +@@ -392,6 +844,42 @@ return False; } @@ -15913,8 +16190,16 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/tmake vnc_unixsrc/vncviewer/t +ldd vncviewer diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/tunnel.c vnc_unixsrc/vncviewer/tunnel.c --- vnc_unixsrc.orig/vncviewer/tunnel.c 2003-07-31 04:03:49.000000000 -0400 -+++ vnc_unixsrc/vncviewer/tunnel.c 2007-05-08 21:28:01.000000000 -0400 -@@ -132,6 +132,7 @@ ++++ vnc_unixsrc/vncviewer/tunnel.c 2010-02-25 23:39:24.000000000 -0500 +@@ -100,7 +100,6 @@ + int *pargc, char **argv, int tunnelArgIndex) + { + char *pdisplay; +- int port; + + if (tunnelArgIndex >= *pargc - 1) + usage(); +@@ -132,6 +131,7 @@ { char *colonPos; int len, portOffset; @@ -15922,8 +16207,12 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/tunnel.c vnc_unixsrc/vncviewe if (tunnelArgIndex >= *pargc - 2) usage(); -@@ -153,7 +154,14 @@ - if (!len || strspn(colonPos, "-0123456789") != len) { +@@ -150,10 +150,17 @@ + len--; + portOffset = 0; + } +- if (!len || strspn(colonPos, "-0123456789") != len) { ++ if (!len || (int) strspn(colonPos, "-0123456789") != len) { usage(); } +#if 0 @@ -17616,20 +17905,22 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer._man vnc_unixsrc/vn +Karl J. Runge <runge@karlrunge.com> 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 2009-11-24 19:41:33.000000000 -0500 -@@ -22,6 +22,7 @@ ++++ vnc_unixsrc/vncviewer/vncviewer.c 2010-03-06 14:43:29.000000000 -0500 +@@ -22,6 +22,8 @@ */ #include "vncviewer.h" ++#include <ctype.h> +#include <X11/Xaw/Toggle.h> char *programName; XtAppContext appContext; -@@ -29,11 +30,258 @@ +@@ -29,11 +31,258 @@ Widget toplevel; +extern void raiseme(int force); ++extern void CreateChat(void); + +void set_sbwidth(int sbw) { + char *q, *p, t[5]; @@ -17668,9 +17959,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi +} + +void min_title(void) { -+ char *q, *p; -+ int i, k, N = 4; -+ int db = 0; ++ char *q; ++ int k; + + k = 0; + while (fallback_resources[k] != NULL) { @@ -17886,7 +18176,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 +293,1667 @@ +@@ -45,89 +294,1744 @@ listenForIncomingConnections() returns, setting the listenSpecified flag. */ @@ -18073,7 +18363,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + tmp[i] = '\0'; + } + for (i=0; i<250; i++) { -+ if (i >= strlen(appData.repeaterUltra)) { ++ if (i >= (int) strlen(appData.repeaterUltra)) { + break; + } + tmp[i] = appData.repeaterUltra[i]; @@ -18187,7 +18477,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + +int do_format_change = 0; +int do_cursor_change = 0; -+int do_fb_update = 0.0; ++double do_fb_update = 0.0; +static void schedule_format_change(void) { + do_format_change = 1; + do_cursor_change = 0; @@ -18240,6 +18530,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + fprintf(stderr, "8bpp: on (%d colors)\n", appDataNew.useBGR233); + } + schedule_format_change(); ++ if (w || ev || params || num_params) {} +} + + @@ -18260,6 +18551,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + fprintf(stderr, "16bpp: on\n"); + } + schedule_format_change(); ++ if (w || ev || params || num_params) {} +} + +void @@ -18287,6 +18579,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } + } + schedule_format_change(); ++ if (w || ev || params || num_params) {} +} + +void @@ -18300,6 +18593,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + fprintf(stderr, "ToggleXGrab, current=%d\n", appData.grabAll); + /* always ungrab to be sure, fullscreen will handle the rest */ + XUngrabServer(dpy); ++ if (w || ev || params || num_params) {} +} + +void @@ -18310,6 +18604,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + appData.escapeActive = True; + } ++ if (w || ev || params || num_params) {} +} + +/* @@ -18332,6 +18627,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + appDataNew.useBGR565 = False; + schedule_format_change(); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -18346,6 +18642,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + appDataNew.useBGR565 = False; + schedule_format_change(); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -18360,6 +18657,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + appDataNew.useBGR565 = False; + schedule_format_change(); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -18375,6 +18673,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + fprintf(stderr, "greyscale: on\n"); + } + schedule_format_change(); ++ if (w || ev || params || num_params) {} +} + +/* @@ -18393,6 +18692,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + fprintf(stderr, "JPEG: on\n"); + } + schedule_format_change(); ++ if (w || ev || params || num_params) {} +} + +/* @@ -18450,6 +18750,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + first = 0; + } + schedule_format_change(); ++ if (w || ev || params || num_params) {} +} + +void @@ -18480,6 +18781,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } + } + schedule_format_change(); ++ if (w || ev || params || num_params) {} +} + +void @@ -18526,6 +18828,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + first = 0; + } + schedule_format_change(); ++ if (w || ev || params || num_params) {} +} + +void scale_check_zrle(void) { @@ -18538,7 +18841,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + return; + } + if (!usingZRLE && !usingHextile) { -+ Widget w; ++ Widget w = 0; + fprintf(stderr, "\nSwitching to faster ZRLE encoding in client-side scaling mode.\n"); + fprintf(stderr, "Switch back to Tight via the Popup menu if you prefer it.\n\n"); + ToggleTightZRLE(w, NULL, NULL, NULL); @@ -18560,6 +18863,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + fprintf(stderr, "viewonly: on\n"); + } + Xcursors(1); ++ if (w || ev || params || num_params) {} +} + +void @@ -18579,6 +18883,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + do_cursor_change = -1; + } ++ if (w || ev || params || num_params) {} +} + +void @@ -18591,6 +18896,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + appData.useCursorAlpha = True; + fprintf(stderr, "useCursorAlpha: on\n"); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -18606,6 +18912,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } + schedule_format_change(); + do_cursor_change = 1; ++ if (w || ev || params || num_params) {} +} + +void @@ -18618,6 +18925,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + appData.useBell = True; + fprintf(stderr, "useBell: on\n"); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -18632,6 +18940,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + fprintf(stderr, "useRawLocal: on\n"); + } + schedule_format_change(); ++ if (w || ev || params || num_params) {} +} + +void @@ -18646,6 +18955,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + fprintf(stderr, "serverInput: on\n"); + SendServerInput(False); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -18659,6 +18969,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + fprintf(stderr, "pipeline-update: on\n"); + } + /* XXX request one to be sure? */ ++ if (w || ev || params || num_params) {} +} + +void @@ -18671,6 +18982,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + appData.sendClipboard = True; + fprintf(stderr, "Send CLIPBOARD Selection: on (do not send PRIMARY)\n"); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -18683,6 +18995,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + appData.sendAlways = True; + fprintf(stderr, "Send Selection Always: on\n"); + } ++ if (w || ev || params || num_params) {} +} + + @@ -18708,11 +19021,17 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + XDefineCursor(dpy, desktopWin, bogoCursor); + } + } ++ if (w || ev || params || num_params) {} +} + +void raiseme(int force); +void AppendChatInput(char *); + ++extern void ShowChat(Widget w, XEvent *event, String *params, Cardinal *num_params); ++extern void ShowFile(Widget w, XEvent *event, String *params, Cardinal *num_params); ++extern Bool SendTextChatFinished(void); ++ ++ +void printChat(char *str, Bool raise) { + if (appData.termChat) { + if (raise) { @@ -18721,7 +19040,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + fprintf(stderr, str); + } else { + if (raise) { -+ ShowChat(); ++ ShowChat(0, 0, 0, 0); + } + AppendChatInput(str); + } @@ -18737,7 +19056,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + HideChat(0, NULL, NULL, NULL); + appData.chatActive= False; + } else { -+ ShowChat(); ++ ShowChat(0, 0, 0, 0); + SendTextChatOpen(); + if (appData.termChat) { + printChat("\n*SentOpen*\n\nSend: ", True); @@ -18746,6 +19065,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } + appData.chatActive = True; + } ++ if (w || ev || params || num_params) {} +} + +extern int filexfer_sock; @@ -18760,8 +19080,10 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi +{ + static double last_start = 0.0; + if (appData.fileActive) { -+ //HideFile(w, ev, params, num_params); -+ //appData.fileActive = False; ++#if 0 ++ HideFile(w, ev, params, num_params); ++ appData.fileActive = False; ++#endif +#ifndef KILLJAVA + if (filexfer_sock >= 0) { + close(filexfer_sock); @@ -18788,9 +19110,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + appData.fileActive = True; + last_start = dnow(); + } ++ if (w || ev || params || num_params) {} +} + +static int fooHandler(Display *dpy, XErrorEvent *error) { ++ if (dpy || error) {} + return 0; +} + @@ -18844,6 +19168,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + n = atoi(s); + set_server_scale(n); + } ++ if (w || ev || params || num_params) {} +} + +void set_server_quality(int n) { @@ -18878,6 +19203,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + n = atoi(s); + set_server_quality(n); + } ++ if (w || ev || params || num_params) {} +} + +void set_server_compress(int n) { @@ -18912,9 +19238,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + n = atoi(s); + set_server_compress(n); + } ++ if (w || ev || params || num_params) {} +} + +extern void rescale_image(void); ++extern void get_scale_values(double *fx, double *fy); + +void +SetScale(Widget w, XEvent *ev, String *params, Cardinal *num_params) @@ -18922,8 +19250,10 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + char *s; + s = DoScaleDialog(); + if (s[0] != '\0') { ++#if 0 + int w = si.framebufferWidth; + int h = si.framebufferHeight; ++#endif + double fx, fy; + int fs = 0; + if (appData.scale != NULL && !strcmp(s, appData.scale)) { @@ -18956,6 +19286,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + FullScreenOn(); + } + } ++ if (w || ev || params || num_params) {} +} + +void @@ -18967,6 +19298,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + if (s[0] != '\0') { + appData.escapeKeys = strdup(s); + } ++ if (w || ev || params || num_params) {} +} + +void set_ycrop(int n) { @@ -19001,6 +19333,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + n = atoi(s); + set_ycrop(n); + } ++ if (w || ev || params || num_params) {} +} + +void set_scbar(int n) { @@ -19035,6 +19368,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + n = atoi(s); + set_scbar(n); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19044,6 +19378,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + int n = atoi(params[0]); + set_server_scale(n); + } ++ if (w || ev || params || num_params) {} +} + +void UpdateQual(void) { @@ -19158,6 +19493,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + LosslessRefresh(); + } + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19167,6 +19503,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + int n = atoi(params[0]); + set_server_quality(n); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19176,6 +19513,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + int n = atoi(params[0]); + set_server_compress(n); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19225,6 +19563,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19235,6 +19574,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, True, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19248,6 +19588,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + XtVaSetValues(w, XtNstate, False, NULL); + } + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19261,6 +19602,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + XtVaSetValues(w, XtNstate, False, NULL); + } + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19274,6 +19616,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + XtVaSetValues(w, XtNstate, False, NULL); + } + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19290,6 +19633,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19306,6 +19650,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19322,6 +19667,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + XtVaSetValues(b16, XtNstate, False, NULL); + } + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19332,6 +19678,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19342,6 +19689,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19358,6 +19706,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19374,6 +19723,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19390,6 +19740,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19400,9 +19751,10 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} +} + -+static init_state(void) { ++static void init_state(void) { + static int first = 1; + if (first && appData.encodingsString) { + char *t, *z, *y, *h; @@ -19447,6 +19799,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19458,6 +19811,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19469,6 +19823,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19479,6 +19834,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19489,6 +19845,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19499,6 +19856,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19509,6 +19867,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, True, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19519,6 +19878,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19529,6 +19889,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19539,6 +19900,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, True, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19549,6 +19911,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, True, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19559,6 +19922,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, True, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19569,6 +19933,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19579,6 +19944,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} +} + +void @@ -19589,10 +19955,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.c vnc_unixsrc/vncvi + } else { + XtVaSetValues(w, XtNstate, False, NULL); + } ++ if (w || ev || params || num_params) {} } 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 2009-11-28 00:45:15.000000000 -0500 ++++ vnc_unixsrc/vncviewer/vncviewer.h 2010-02-25 21:53:14.000000000 -0500 @@ -28,6 +28,7 @@ #include <string.h> #include <sys/time.h> @@ -19616,7 +19983,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi #define FLASH_PORT_OFFSET 5400 #define LISTEN_PORT_OFFSET 5500 -@@ -64,60 +71,126 @@ +@@ -64,60 +71,130 @@ #define DEFAULT_VIA_CMD \ (DEFAULT_SSH_CMD " -f -L %L:%H:%R %G sleep 20") @@ -19653,9 +20020,11 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi - - int rawDelay; - int copyRectDelay; ++#if 0 +static const char *subsampLevel2str[TVNC_SAMPOPT] = { + "1X", "4X", "2X", "Gray" +}; ++#endif +#ifdef TURBOVNC +#define rfbTightNoZlib 0x0A +#define rfbTurboVncVendor "TRBO" @@ -19666,13 +20035,16 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi +#define rfbJpegSubsamp2X 0xFFFFFD02 +#define rfbJpegSubsampGray 0xFFFFFD03 +#endif ++ ++/* for debugging width, height, etc */ ++#if 0 ++#define XtVaSetValues printf("%s:%d\n", __FILE__, __LINE__); XtVaSetValues ++#endif - Bool debug; -+/* for debugging width, height, etc */ -+//#define XtVaSetValues printf("%s:%d\n", __FILE__, __LINE__); XtVaSetValues - int popupButtonCount; - +- - int bumpScrollTime; - int bumpScrollPixels; +/* argsresources.c */ @@ -19783,7 +20155,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi extern int listenPort, flashPort; extern XrmOptionDescRec cmdLineOptions[]; -@@ -130,10 +203,11 @@ +@@ -130,10 +207,11 @@ /* colour.c */ extern unsigned long BGR233ToPixel[]; @@ -19796,7 +20168,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi extern void SetVisualAndCmap(); -@@ -155,15 +229,60 @@ +@@ -155,15 +233,60 @@ extern GC srcGC, dstGC; extern Dimension dpyWidth, dpyHeight; @@ -19857,7 +20229,7 @@ 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(); -@@ -171,6 +290,10 @@ +@@ -171,6 +294,10 @@ Cardinal *num_params); extern char *DoPasswordDialog(); @@ -19868,7 +20240,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi /* fullscreen.c */ extern void ToggleFullScreen(Widget w, XEvent *event, String *params, -@@ -181,6 +304,13 @@ +@@ -181,6 +308,13 @@ extern void FullScreenOn(); extern void FullScreenOff(); @@ -19882,7 +20254,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi /* listen.c */ extern void listenForIncomingConnections(); -@@ -196,6 +326,8 @@ +@@ -196,6 +330,8 @@ Cardinal *num_params); extern void Quit(Widget w, XEvent *event, String *params, Cardinal *num_params); @@ -19891,7 +20263,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi extern void Cleanup(); /* popup.c */ -@@ -207,6 +339,29 @@ +@@ -207,6 +343,29 @@ Cardinal *num_params); extern void CreatePopup(); @@ -19921,7 +20293,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi /* rfbproto.c */ extern int rfbsock; -@@ -229,8 +384,19 @@ +@@ -229,8 +388,19 @@ extern Bool SendClientCutText(char *str, int len); extern Bool HandleRFBServerMessage(); @@ -19941,7 +20313,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi /* selection.c */ extern void InitialiseSelection(); -@@ -241,8 +407,10 @@ +@@ -241,8 +411,10 @@ /* shm.c */ @@ -19953,7 +20325,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi /* sockets.c */ -@@ -253,10 +421,15 @@ +@@ -253,10 +425,15 @@ extern int FindFreeTcpPort(void); extern int ListenAtTcpPort(int port); extern int ConnectToTcpAddr(unsigned int host, int port); @@ -19969,7 +20341,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.h vnc_unixsrc/vncvi extern Bool SameMachine(int sock); /* tunnel.c */ -@@ -271,3 +444,82 @@ +@@ -271,3 +448,82 @@ extern XtAppContext appContext; extern Display* dpy; extern Widget toplevel; @@ -20600,7 +20972,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/vncviewer.man vnc_unixsrc/vnc +Karl J. Runge <runge@karlrunge.com> diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/zrle.c vnc_unixsrc/vncviewer/zrle.c --- vnc_unixsrc.orig/vncviewer/zrle.c 2007-02-04 18:59:50.000000000 -0500 -+++ vnc_unixsrc/vncviewer/zrle.c 2009-11-19 23:34:28.000000000 -0500 ++++ vnc_unixsrc/vncviewer/zrle.c 2010-02-25 23:24:28.000000000 -0500 @@ -0,0 +1,620 @@ +/* + * Copyright (C) 2005 Johannes E. Schindelin. All Rights Reserved. @@ -21129,8 +21501,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/zrle.c vnc_unixsrc/vncviewer/ + } + + zywrle_level &= 0x7F; -+ // Reverse copy: screen to buf/ptmp: -+ // make this CopyDataFromScreen() or something. ++ /* Reverse copy: screen to buf/ptmp: */ ++ /* make this CopyDataFromScreen() or something. */ + if (!appData.useBGR565) { + scrWidthInBytes = si.framebufferWidth * myFormat.bitsPerPixel / 8; + if (scrWidthInBytes != im->bytes_per_line) scrWidthInBytes = im->bytes_per_line; @@ -22868,7 +23240,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/vncviewer/zywrletemplate.c vnc_unixsrc/ +#undef ZYWRLE_SAVE_PIXEL diff -Naur -X ./exclude vnc_unixsrc.orig/include/rfbproto.h vnc_unixsrc/include/rfbproto.h --- vnc_unixsrc.orig/include/rfbproto.h 2004-05-27 03:02:02.000000000 -0400 -+++ vnc_unixsrc/include/rfbproto.h 2008-12-07 09:35:32.000000000 -0500 ++++ vnc_unixsrc/include/rfbproto.h 2010-02-25 21:54:58.000000000 -0500 @@ -205,7 +205,22 @@ #define rfbSecTypeInvalid 0 #define rfbSecTypeNone 1 @@ -22896,7 +23268,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/include/rfbproto.h vnc_unixsrc/include/ #define rfbBell 2 #define rfbServerCutText 3 -+#define rfbResizeFrameBuffer 4 // Modif sf@2002 ++#define rfbResizeFrameBuffer 4 /* Modif sf@2002 */ + +/* http://sourceforge.net/projects/vncsessmgr */ +#define rfbRestartConnection 82 @@ -22923,19 +23295,21 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/include/rfbproto.h vnc_unixsrc/include/ #define rfbFileListRequest 130 #define rfbFileDownloadRequest 131 #define rfbFileUploadRequest 132 -@@ -435,6 +467,11 @@ +@@ -435,6 +467,13 @@ #define rfbEncodingTight 7 #define rfbEncodingZlibHex 8 +#define rfbEncodingZRLE 16 -+// nyama/2006/08/02:new YUV-Wavlet lossy codec based on ZRLE (ZYWRLE) ++/* ++nyama/2006/08/02:new YUV-Wavlet lossy codec based on ZRLE (ZYWRLE) ++ */ +#define rfbEncodingZYWRLE 17 + + /* signatures for basic encoding types */ #define sig_rfbEncodingRaw "RAW_____" #define sig_rfbEncodingCopyRect "COPYRECT" -@@ -955,6 +992,51 @@ +@@ -955,6 +994,51 @@ #define sz_rfbFileDownloadFailedMsg 4 /*----------------------------------------------------------------------------- @@ -22955,9 +23329,9 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/include/rfbproto.h vnc_unixsrc/include/ + +typedef struct _rfbTextChatMsg { + CARD8 type; /* always rfbTextChat */ -+ CARD8 pad1; // Could be used later as an additionnal param -+ CARD16 pad2; // Could be used later as text offset, for instance -+ CARD32 length; // Specific values for Open, close, finished (-1, -2, -3) ++ CARD8 pad1; /* Could be used later as an additionnal param */ ++ CARD16 pad2; /* Could be used later as text offset, for instance */ ++ CARD32 length; /* Specific values for Open, close, finished (-1, -2, -3) */ + /* followed by char text[length] */ +} rfbTextChatMsg; + @@ -22976,8 +23350,8 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/include/rfbproto.h vnc_unixsrc/include/ +typedef struct _rfbResizeFrameBufferMsg { + CARD8 type; /* always rfbResizeFrameBuffer */ + CARD8 pad1; -+ CARD16 framebufferWidth; // FrameBuffer width -+ CARD16 framebufferHeight; // FrameBuffer height ++ CARD16 framebufferWidth; /* FrameBuffer width */ ++ CARD16 framebufferHeight; /* FrameBuffer height */ +} rfbResizeFrameBufferMsg; + +#define sz_rfbResizeFrameBufferMsg 6 @@ -22987,7 +23361,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/include/rfbproto.h vnc_unixsrc/include/ * Union of all server->client messages. */ -@@ -968,6 +1050,8 @@ +@@ -968,6 +1052,8 @@ rfbFileDownloadDataMsg fdd; rfbFileUploadCancelMsg fuc; rfbFileDownloadFailedMsg fdf; @@ -22996,7 +23370,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/include/rfbproto.h vnc_unixsrc/include/ } rfbServerToClientMsg; -@@ -1221,6 +1305,41 @@ +@@ -1221,6 +1307,41 @@ #define sz_rfbFileCreateDirRequestMsg 4 @@ -23038,7 +23412,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/include/rfbproto.h vnc_unixsrc/include/ /*----------------------------------------------------------------------------- * Union of all client->server messages. */ -@@ -1241,4 +1360,9 @@ +@@ -1241,4 +1362,9 @@ rfbFileDownloadCancelMsg fdc; rfbFileUploadFailedMsg fuf; rfbFileCreateDirRequestMsg fcdr; @@ -23063,10 +23437,33 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/include/vncauth.h vnc_unixsrc/include/v extern void vncEncryptBytes(unsigned char *bytes, char *passwd); + +extern void vncEncryptPasswd_MSLOGON(unsigned char *encryptedPasswd, char *passwd); +diff -Naur -X ./exclude vnc_unixsrc.orig/libvncauth/d3des.c vnc_unixsrc/libvncauth/d3des.c +--- vnc_unixsrc.orig/libvncauth/d3des.c 2000-06-11 08:00:53.000000000 -0400 ++++ vnc_unixsrc/libvncauth/d3des.c 2010-02-25 21:49:02.000000000 -0500 +@@ -34,12 +34,15 @@ + static void cookey(unsigned long *); + + static unsigned long KnL[32] = { 0L }; ++/* no londer used: */ ++#if 0 + static unsigned long KnR[32] = { 0L }; + static unsigned long Kn3[32] = { 0L }; + static unsigned char Df_Key[24] = { + 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef, + 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10, + 0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67 }; ++#endif + + static unsigned short bytebit[8] = { + 01, 02, 04, 010, 020, 040, 0100, 0200 }; diff -Naur -X ./exclude vnc_unixsrc.orig/libvncauth/vncauth.c vnc_unixsrc/libvncauth/vncauth.c --- vnc_unixsrc.orig/libvncauth/vncauth.c 2003-03-01 11:48:06.000000000 -0500 -+++ vnc_unixsrc/libvncauth/vncauth.c 2009-04-12 22:28:08.000000000 -0400 -@@ -30,6 +30,7 @@ ++++ vnc_unixsrc/libvncauth/vncauth.c 2010-02-25 21:47:25.000000000 -0500 +@@ -27,9 +27,11 @@ + #include <sys/types.h> + #include <sys/stat.h> + #include <unistd.h> ++#include <time.h> #include <vncauth.h> #include <d3des.h> @@ -23074,7 +23471,25 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/libvncauth/vncauth.c vnc_unixsrc/libvnc /* * Make sure we call srandom() only once. -@@ -195,6 +196,44 @@ +@@ -45,6 +47,8 @@ + + static unsigned char s_fixedkey[8] = {23,82,107,6,35,78,88,7}; + ++int vncEncryptAndStorePasswd2(char *passwd, char *passwdViewOnly, char *fname); ++int vncDecryptPasswdFromFile2(char *fname, char *passwdFullControl, char *passwdViewOnly); + + /* + * Encrypt a password and store it in a file. Returns 0 if successful, +@@ -73,7 +77,7 @@ + vncEncryptAndStorePasswd2(char *passwd, char *passwdViewOnly, char *fname) + { + FILE *fp; +- int i, bytesToWrite, bytesWrote; ++ int bytesToWrite, bytesWrote; + unsigned char encryptedPasswd[16] = { + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0 +@@ -195,6 +199,44 @@ return (i < 16) ? 1 : 2; } @@ -23119,7 +23534,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/libvncauth/vncauth.c vnc_unixsrc/libvnc /* * Generate CHALLENGESIZE random bytes for use in challenge-response -@@ -207,11 +246,13 @@ +@@ -207,11 +249,13 @@ int i; unsigned int seed; @@ -23138,7 +23553,7 @@ diff -Naur -X ./exclude vnc_unixsrc.orig/libvncauth/vncauth.c vnc_unixsrc/libvnc for (i = 0; i < CHALLENGESIZE; i++) { bytes[i] = (unsigned char)(random() & 255); -@@ -245,3 +286,48 @@ +@@ -245,3 +289,48 @@ des(bytes+i, bytes+i); } } |