diff --git a/x11vnc/8to24.c b/x11vnc/8to24.c index a25cbf4..ff5a581 100644 --- a/x11vnc/8to24.c +++ b/x11vnc/8to24.c @@ -66,6 +66,7 @@ static unsigned int root_rgb[NCOLOR]; static void set_root_cmap(void) { #if NO_X11 + RAWFB_RET_VOID return; #else static time_t last_set = 0; @@ -245,6 +246,7 @@ double MV_start; void check_for_multivis(void) { #if NO_X11 + RAWFB_RET_VOID return; #else XWindowAttributes attr; @@ -758,11 +760,12 @@ if (db24 > 1) fprintf(stderr, " ------------ 0x%lx i=%d\n", windows_8bp } static XImage *p_xi(XImage *xi, Visual *visual, int win_depth, int *w) { + RAWFB_RET(NULL) + #if NO_X11 if (!xi || !visual || !win_depth || !w) {} return NULL; #else - RAWFB_RET(NULL) if (xi == NULL || *w < dpy_x) { char *d; if (xi) { @@ -783,6 +786,7 @@ static XImage *p_xi(XImage *xi, Visual *visual, int win_depth, int *w) { static int poll_line(int x1, int x2, int y1, int n, sraRegionPtr mod) { #if NO_X11 + RAWFB_RET(1) if (!x1 || !x2 || !y1 || !n || !mod) {} return 1; #else @@ -1295,6 +1299,7 @@ int histo[256]; static int get_cmap(int j, Colormap cmap) { #if NO_X11 + RAWFB_RET(0) if (!j || !cmap) {} return 0; #else @@ -1460,6 +1465,7 @@ static XImage *cmap_xi(XImage *xi, Window win, int win_depth) { static void transform_rect(sraRect rect, Window win, int win_depth, int cm) { #if NO_X11 + RAWFB_RET_VOID if (!rect.x1 || !win || !win_depth || !cm) {} return; #else diff --git a/x11vnc/README b/x11vnc/README index 6ae1a57..80eb701 100644 --- a/x11vnc/README +++ b/x11vnc/README @@ -1,5 +1,5 @@ -x11vnc README file Date: Thu Dec 28 15:22:02 EST 2006 +x11vnc README file Date: Fri Dec 29 01:37:39 EST 2006 The following information is taken from these URLs: @@ -9262,7 +9262,7 @@ x11vnc: a VNC server for real X displays Here are all of x11vnc command line options: % x11vnc -opts (see below for -help long descriptions) -x11vnc: allow VNC connections to real X11 displays. 0.8.4 lastmod: 2006-12-28 +x11vnc: allow VNC connections to real X11 displays. 0.8.4 lastmod: 2006-12-29 x11vnc options: -display disp -auth file -id windowid @@ -9369,7 +9369,7 @@ libvncserver-tight-extension options: % x11vnc -help -x11vnc: allow VNC connections to real X11 displays. 0.8.4 lastmod: 2006-12-28 +x11vnc: allow VNC connections to real X11 displays. 0.8.4 lastmod: 2006-12-29 (type "x11vnc -opts" to just list the options.) diff --git a/x11vnc/cursor.c b/x11vnc/cursor.c index da7e93c..10de753 100644 --- a/x11vnc/cursor.c +++ b/x11vnc/cursor.c @@ -1875,7 +1875,6 @@ int check_x11_pointer(void) { if (unixpw_in_progress) return 0; - #ifdef MACOSX if (macosx_console) { ret = macosx_get_cursor_pos(&root_x, &root_y); @@ -1883,6 +1882,7 @@ int check_x11_pointer(void) { RAWFB_RET(0) } #else + RAWFB_RET(0) # if NO_X11 diff --git a/x11vnc/options.c b/x11vnc/options.c index a1d597c..f25582f 100644 --- a/x11vnc/options.c +++ b/x11vnc/options.c @@ -194,10 +194,14 @@ char *wireframe_copyrect_default = "never"; int wireframe_in_progress = 0; int wireframe_local = 1; -int ncache = 0; +#ifndef NCACHE +#define NCACHE -10 +#endif +int ncache = NCACHE; int ncache0 = 0; int ncache_copyrect = 0; int macosx_ncache_macmenu = 0; +int ncache_beta_tester = 0; #ifdef MACOSX int ncache_pad = 24; #else diff --git a/x11vnc/options.h b/x11vnc/options.h index 6cd9f70..856df15 100644 --- a/x11vnc/options.h +++ b/x11vnc/options.h @@ -161,6 +161,7 @@ extern int ncache0; extern int ncache_copyrect; extern int ncache_pad; extern int macosx_ncache_macmenu; +extern int ncache_beta_tester; extern char *scroll_copyrect_str; extern char *scroll_copyrect; diff --git a/x11vnc/pointer.c b/x11vnc/pointer.c index 617da83..803e793 100644 --- a/x11vnc/pointer.c +++ b/x11vnc/pointer.c @@ -414,12 +414,13 @@ void do_button_mask_change(int mask, int button) { */ static void update_x11_pointer_mask(int mask) { #if NO_X11 + last_event = last_input = last_pointer_input = time(NULL); + RAWFB_RET_VOID if (!mask) {} return; #else int snapped = 0, xr_mouse = 1, i; - last_event = last_input = last_pointer_input = time(NULL); RAWFB_RET_VOID diff --git a/x11vnc/screen.c b/x11vnc/screen.c index 51705dc..dc0a604 100644 --- a/x11vnc/screen.c +++ b/x11vnc/screen.c @@ -425,6 +425,7 @@ static void set_visual(char *str) { void set_nofb_params(int restore) { static int first = 1; static int save[100]; + static char *scroll = NULL; int i = 0; if (first) { @@ -444,6 +445,9 @@ void set_nofb_params(int restore) { save[i++] = show_cursor; save[i++] = cursor_shape_updates; save[i++] = cursor_pos_updates; + save[i++] = ncache; + + scroll = scroll_copyrect; } if (restore) { i = 0; @@ -462,6 +466,9 @@ void set_nofb_params(int restore) { show_cursor = save[i++]; cursor_shape_updates = save[i++]; cursor_pos_updates = save[i++]; + ncache = save[i++]; + + scroll_copyrect = scroll; if (cursor_shape_updates) { restore_cursor_shape_updates(screen); @@ -496,9 +503,13 @@ void set_nofb_params(int restore) { cursor_pos_updates = 0; } + ncache = 0; + + scroll_copyrect = "never"; + if (! quiet) { rfbLog("disabling: xfixes, xdamage, solid, overlay, shm,\n"); - rfbLog(" wireframe, scrollcopyrect,\n"); + rfbLog(" wireframe, scrollcopyrect, ncache,\n"); rfbLog(" noonetile, nap, cursor, %scursorshape\n", got_cursorpos ? "" : "cursorpos, " ); rfbLog(" in -nofb mode.\n"); @@ -654,16 +665,22 @@ void set_raw_fb_params(int restore) { */ static void nofb_hook(rfbClientPtr cl) { XImage *fb; + XImage raw; rfbLog("framebuffer requested in -nofb mode by client %s\n", cl->host); /* ignore xrandr */ if (raw_fb && ! dpy) { - XImage raw; fb = &raw; fb->data = (char *)malloc(32); } else { - fb = XGetImage_wr(dpy, window, 0, 0, dpy_x, dpy_y, AllPlanes, ZPixmap); + int use_real_ximage = 0; + if (use_real_ximage) { + fb = XGetImage_wr(dpy, window, 0, 0, dpy_x, dpy_y, AllPlanes, ZPixmap); + } else { + fb = &raw; + fb->data = (char *) calloc(dpy_x*dpy_y*bpp/8, 1); + } } main_fb = fb->data; rfb_fb = main_fb; @@ -1468,6 +1485,9 @@ static int wait_until_mapped(Window win) { */ XImage *initialize_xdisplay_fb(void) { #if NO_X11 + if (raw_fb_str) { + return initialize_raw_fb(0); + } return NULL; #else XImage *fb; @@ -2038,7 +2058,7 @@ void initialize_screen(int *argc, char **argv, XImage *fb) { } #ifndef NO_NCACHE - if (ncache > 0) { + if (ncache > 0 && !nofb) { #ifdef MACOSX if (! raw_fb_str || macosx_console) { #else @@ -2552,18 +2572,18 @@ void announce(int lport, int ssl, char *iface) { if (lport >= 5900) { snprintf(vnc_desktop_name, sz, "%s:%d", host, lport - 5900); - fprintf(stderr, "%s %s\n", tvdt, + fprintf(stderr, "\n%s %s\n", tvdt, vnc_desktop_name); } else { snprintf(vnc_desktop_name, sz, "%s:%d", host, lport); - fprintf(stderr, "%s %s\n", tvdt, + fprintf(stderr, "\n%s %s\n", tvdt, vnc_desktop_name); } } else if (lport >= 5900) { snprintf(vnc_desktop_name, sz, "%s:%d", host, lport - 5900); - fprintf(stderr, "%s %s\n", tvdt, vnc_desktop_name); + fprintf(stderr, "\n%s %s\n", tvdt, vnc_desktop_name); if (lport >= 6000) { rfbLog("possible aliases: %s:%d, " "%s::%d\n", host, lport, @@ -2572,7 +2592,7 @@ void announce(int lport, int ssl, char *iface) { } else { snprintf(vnc_desktop_name, sz, "%s:%d", host, lport); - fprintf(stderr, "%s %s\n", tvdt, vnc_desktop_name); + fprintf(stderr, "\n%s %s\n", tvdt, vnc_desktop_name); rfbLog("possible alias: %s::%d\n", host, lport); } diff --git a/x11vnc/selection.c b/x11vnc/selection.c index 0630aea..7428ead 100644 --- a/x11vnc/selection.c +++ b/x11vnc/selection.c @@ -62,14 +62,14 @@ void selection_request(XEvent *ev, char *type) { char *str; unsigned int length; unsigned char *data; -#ifndef XA_LENGTH +# ifndef XA_LENGTH unsigned long XA_LENGTH; -#endif +# endif RAWFB_RET_VOID -#ifndef XA_LENGTH +# ifndef XA_LENGTH XA_LENGTH = XInternAtom(dpy, "LENGTH", True); -#endif +# endif req_event = &(ev->xselectionrequest); notify_event.type = SelectionNotify; @@ -257,6 +257,7 @@ void cutbuffer_send(void) { * Also: XFIXES has XFixesSelectSelectionInput(). */ #define CHKSZ 32 + void selection_send(XEvent *ev) { #if NO_X11 RAWFB_RET_VOID diff --git a/x11vnc/userinput.c b/x11vnc/userinput.c index 612c1dd..4099ca5 100644 --- a/x11vnc/userinput.c +++ b/x11vnc/userinput.c @@ -3546,28 +3546,28 @@ static Window NPP_nwin = None; void clear_win_events(void) { #if !NO_X11 - if (dpy && NPP_nwin != None) { - XEvent ev; - XErrorHandler old_handler; - old_handler = XSetErrorHandler(trap_xerror); - trapped_xerror = 0; - while (XCheckTypedWindowEvent(dpy, NPP_nwin, ConfigureNotify, &ev)) { - fprintf(stderr, "."); - if (trapped_xerror) { - break; - } - trapped_xerror = 0; + if (dpy && NPP_nwin != None) { + XEvent ev; + XErrorHandler old_handler; + old_handler = XSetErrorHandler(trap_xerror); + trapped_xerror = 0; + while (XCheckTypedWindowEvent(dpy, NPP_nwin, ConfigureNotify, &ev)) { + fprintf(stderr, "."); + if (trapped_xerror) { + break; } - while (XCheckTypedWindowEvent(dpy, NPP_nwin, VisibilityNotify, &ev)) { - fprintf(stderr, "+"); - if (trapped_xerror) { - break; - } - trapped_xerror = 0; + trapped_xerror = 0; + } + while (XCheckTypedWindowEvent(dpy, NPP_nwin, VisibilityNotify, &ev)) { + fprintf(stderr, "+"); + if (trapped_xerror) { + break; } - XSetErrorHandler(old_handler); - fprintf(stderr, " 0x%x\n", (unsigned int) NPP_nwin); + trapped_xerror = 0; } + XSetErrorHandler(old_handler); + fprintf(stderr, " 0x%x\n", (unsigned int) NPP_nwin); + } #endif } @@ -5515,7 +5515,12 @@ void snapshot_cache_list(int free_only, double allowed_age) { RAWFB_RET_VOID #endif + #if NO_X11 && !defined(MACOSX) + num = rc = i = 0; /* compiler warnings */ + ui = 0; + r = w = None; + list = NULL; return; #else @@ -6357,6 +6362,15 @@ fprintf(stderr, "free_rect: bad index: %d\n", idx); fac1 = 0.18; fac2 = 0.35; } + if (macosx_console && !macosx_ncache_macmenu) { + if (cram) { + fac1 *= 1.5; + fac2 *= 1.5; + } else { + fac1 *= 2.5; + fac2 *= 2.5; + } + } if (w * h > fac1 * (dpy_x * dpy_y)) { big1 = 1; } @@ -6559,7 +6573,7 @@ int valid_wr(int idx, Window win, XWindowAttributes *attr) { return valid_window(win, attr, 1); } -int bs_save(int idx, int *nbatch) { +int bs_save(int idx, int *nbatch, int verb) { Window win = cache_list[idx].win; XWindowAttributes attr; int x1, y1, w1, h1; @@ -6573,7 +6587,7 @@ int bs_save(int idx, int *nbatch) { w1 = cache_list[idx].width; h1 = cache_list[idx].height; -fprintf(stderr, "backingstore save: 0x%x %3d \n", (unsigned int) win, idx); +if (verb) fprintf(stderr, "backingstore save: 0x%x %3d \n", (unsigned int) win, idx); X_LOCK; if (! valid_wr(idx, win, &attr)) { @@ -6630,12 +6644,12 @@ fprintf(stderr, "BS_save: FAIL FOR: %d\n", idx); sraRgnOffset(r, dx, dy); dtA = dnowx(); -fprintf(stderr, "BS_save: %.4f %d dx=%d dy=%d\n", dtA, idx, dx, dy); +if (verb) fprintf(stderr, "BS_save: %.4f %d dx=%d dy=%d\n", dtA, idx, dx, dy); if (w2 > 0 && h2 > 0) { cache_cr(r, dx, dy, save_delay0, save_delay1, nbatch); } dtB = dnowx(); -fprintf(stderr, "BS_save: %.4f %.2f %d done. %dx%d+%d+%d %dx%d+%d+%d %.2f %.2f\n", dtB, dtB-dtA, idx, w1, h1, x1, y1, w2, h2, x2, y2, cache_list[idx].bs_time - x11vnc_start, dnowx()); +if (verb) fprintf(stderr, "BS_save: %.4f %.2f %d done. %dx%d+%d+%d %dx%d+%d+%d %.2f %.2f\n", dtB, dtB-dtA, idx, w1, h1, x1, y1, w2, h2, x2, y2, cache_list[idx].bs_time - x11vnc_start, dnowx()); sraRgnDestroy(r0); sraRgnDestroy(r); @@ -6646,7 +6660,7 @@ fprintf(stderr, "BS_save: %.4f %.2f %d done. %dx%d+%d+%d %dx%d+%d+%d %.2f %.2f return 1; } -int su_save(int idx, int *nbatch) { +int su_save(int idx, int *nbatch, int verb) { Window win = cache_list[idx].win; XWindowAttributes attr; int x1, y1, w1, h1; @@ -6655,7 +6669,7 @@ int su_save(int idx, int *nbatch) { int dx, dy, rc = 1; sraRegionPtr r, r0; -fprintf(stderr, "save-unders save: 0x%x %3d \n", (unsigned int) win, idx); +if (verb) fprintf(stderr, "save-unders save: 0x%x %3d \n", (unsigned int) win, idx); x1 = cache_list[idx].x; y1 = cache_list[idx].y; @@ -6716,12 +6730,12 @@ fprintf(stderr, "SU_save: FAIL FOR: %d\n", idx); sraRgnOffset(r, dx, dy); dtA = dnowx(); -fprintf(stderr, "SU_save: %.4f %d dx=%d dy=%d\n", dtA, idx, dx, dy); +if (verb) fprintf(stderr, "SU_save: %.4f %d dx=%d dy=%d\n", dtA, idx, dx, dy); if (w2 > 0 && h2 > 0) { cache_cr(r, dx, dy, save_delay0, save_delay1, nbatch); } dtB = dnowx(); -fprintf(stderr, "SU_save: %.4f %.2f %d done. %dx%d+%d+%d %dx%d+%d+%d %.2f %.2f\n", dtB, dtB-dtA, idx, w1, h1, x1, y1, w2, h2, x2, y2, cache_list[idx].su_time - x11vnc_start, dnowx()); +if (verb) fprintf(stderr, "SU_save: %.4f %.2f %d done. %dx%d+%d+%d %dx%d+%d+%d %.2f %.2f\n", dtB, dtB-dtA, idx, w1, h1, x1, y1, w2, h2, x2, y2, cache_list[idx].su_time - x11vnc_start, dnowx()); sraRgnDestroy(r0); sraRgnDestroy(r); @@ -6732,7 +6746,7 @@ fprintf(stderr, "SU_save: %.4f %.2f %d done. %dx%d+%d+%d %dx%d+%d+%d %.2f %.2f return 1; } -int bs_restore(int idx, int *nbatch, int nopad) { +int bs_restore(int idx, int *nbatch, int nopad, int verb) { Window win = cache_list[idx].win; XWindowAttributes attr; int x1, y1, w1, h1; @@ -6741,7 +6755,7 @@ int bs_restore(int idx, int *nbatch, int nopad) { int dx, dy; sraRegionPtr r, r0; -fprintf(stderr, "backingstore restore: 0x%x %3d \n", (unsigned int) win, idx); +if (verb) fprintf(stderr, "backingstore restore: 0x%x %3d \n", (unsigned int) win, idx); x1 = cache_list[idx].x; y1 = cache_list[idx].y; @@ -6807,12 +6821,12 @@ fprintf(stderr, "BS_restore: not a valid X window: 0x%x\n", (unsigned int) win); sraRgnAnd(r, r0); dtA = dnowx(); -fprintf(stderr, "BS_rest: %.4f %d dx=%d dy=%d\n", dtA, idx, dx, dy); +if (verb) fprintf(stderr, "BS_rest: %.4f %d dx=%d dy=%d\n", dtA, idx, dx, dy); if (w2 > 0 && h2 > 0) { cache_cr(r, dx, dy, restore_delay0, restore_delay1, nbatch); } dtB = dnowx(); -fprintf(stderr, "BS_rest: %.4f %.2f %d done. %dx%d+%d+%d %dx%d+%d+%d %.2f %.2f\n", dtB, dtB-dtA, idx, w1, h1, x1, y1, w2, h2, x2, y2, cache_list[idx].bs_time - x11vnc_start, dnowx()); +if (verb) fprintf(stderr, "BS_rest: %.4f %.2f %d done. %dx%d+%d+%d %dx%d+%d+%d %.2f %.2f\n", dtB, dtB-dtA, idx, w1, h1, x1, y1, w2, h2, x2, y2, cache_list[idx].bs_time - x11vnc_start, dnowx()); sraRgnDestroy(r0); sraRgnDestroy(r); @@ -6822,7 +6836,7 @@ fprintf(stderr, "BS_rest: %.4f %.2f %d done. %dx%d+%d+%d %dx%d+%d+%d %.2f %.2f return 1; } -int su_restore(int idx, int *nbatch, int nopad) { +int su_restore(int idx, int *nbatch, int nopad, int verb) { Window win = cache_list[idx].win; XWindowAttributes attr; int x1, y1, w1, h1; @@ -6832,7 +6846,7 @@ int su_restore(int idx, int *nbatch, int nopad) { sraRegionPtr r, r0; int invalid = 0; -fprintf(stderr, "save-unders restore: 0x%x %3d \n", (unsigned int) win, idx); +if (verb) fprintf(stderr, "save-unders restore: 0x%x %3d \n", (unsigned int) win, idx); x1 = cache_list[idx].x; y1 = cache_list[idx].y; @@ -6903,12 +6917,12 @@ fprintf(stderr, "SU_rest: su_x/bs_x/su_time: %d %d %.3f\n", x, cache_list[idx].b sraRgnAnd(r, r0); dtA = dnowx(); -fprintf(stderr, "SU_rest: %.4f %d dx=%d dy=%d\n", dtA, idx, dx, dy); +if (verb) fprintf(stderr, "SU_rest: %.4f %d dx=%d dy=%d\n", dtA, idx, dx, dy); if (w2 > 0 && h2 > 0) { cache_cr(r, dx, dy, restore_delay0, restore_delay1, nbatch); } dtB = dnowx(); -fprintf(stderr, "SU_rest: %.4f %.2f %d done. %dx%d+%d+%d %dx%d+%d+%d %.2f %.2f\n", dtB, dtB-dtA, idx, w1, h1, x1, y1, w2, h2, x2, y2, cache_list[idx].su_time - x11vnc_start, dnowx()); +if (verb) fprintf(stderr, "SU_rest: %.4f %.2f %d done. %dx%d+%d+%d %dx%d+%d+%d %.2f %.2f\n", dtB, dtB-dtA, idx, w1, h1, x1, y1, w2, h2, x2, y2, cache_list[idx].su_time - x11vnc_start, dnowx()); sraRgnDestroy(r0); sraRgnDestroy(r); @@ -7042,7 +7056,7 @@ Window sched_bs[NSCHED]; double sched_tm[NSCHED]; double last_sched_bs = 0.0; -#define SCHED(w) \ +#define SCHED(w, v) \ { \ int k, save = -1, empty = 1; \ for (k=0; k < NSCHED; k++) { \ @@ -7059,7 +7073,7 @@ double last_sched_bs = 0.0; sched_bs[save] = w; \ if (empty) { \ sched_tm[save] = dnow(); \ - fprintf(stderr, "SCHED: %d %f\n", save, dnowx()); \ + if (v) fprintf(stderr, "SCHED: %d %f\n", save, dnowx()); \ } \ } \ } @@ -7174,7 +7188,7 @@ int check_ncache(int reset, int mode) { if (ncache0) { if (reset) { ; - } else if (! client_count || !ncache) { + } else if (! client_count || !ncache || nofb) { static double last_purge = 0.0; double delay = client_count ? 0.5 : 2.0; if (now > last_purge + delay) { @@ -7209,6 +7223,9 @@ if (c) fprintf(stderr, "check_ncache purged %d events\n", c); if (subwin) { return -1; } + if (nofb) { + return -1; + } if (reset) { rfbLog("check_ncache: resetting cache\n"); @@ -7352,7 +7369,7 @@ fprintf(stderr, "Created window never mapped: freeing(%d) 0x%x\n", k, (unsigned int idx = lookup_win_index(topmapped); if (idx >= 0) { if (! macosx_console) { - bs_save(idx, NULL); + bs_save(idx, NULL, 1); } } } @@ -7387,8 +7404,8 @@ fprintf(stderr, "Created window never mapped: freeing(%d) 0x%x\n", k, (unsigned } else if (aw * ah < 64 * 64) { ; } else { -fprintf(stderr, "*NEW BS_save: 0x%x %d %d %d\n", (unsigned int) win, aw, ah, cache_list[idx].map_state); - bs_save(idx, bat); +fprintf(stderr, "*SNAP BS_save: 0x%x %d %d %d\n", (unsigned int) win, aw, ah, cache_list[idx].map_state); + bs_save(idx, bat, 0); } } } @@ -7409,7 +7426,7 @@ fprintf(stderr, "*NEW BS_save: 0x%x %d %d %d\n", (unsigned int) win, aw, ah, cac if (cache_list[i].vis_state == VisibilityUnobscured) { if (cache_list[i].valid) { if (cache_list[i].win != None) { - SCHED(cache_list[i].win) + SCHED(cache_list[i].win, 0) } } } @@ -7554,10 +7571,10 @@ fprintf(stderr, "\n"); rfbLog("IN check_ncache() %d events.\n", n); if (create_tot <= 6 && create_cnt++ < 3) { if (w*h > 64 * 64) { X_UNLOCK; - su_save(idx, nbatch); + su_save(idx, nbatch, 1); X_LOCK; if (cache_list[idx].valid) { - SCHED(win2) + SCHED(win2, 1) } create_cnt++; } @@ -7655,7 +7672,7 @@ fprintf(stderr, "----%02d: VisibilityNotify 0x%x %3d state: %s U/P %d/%d\n", i } if (ok) { X_UNLOCK; - bs_restore(idx, nbatch, 1); + bs_restore(idx, nbatch, 1, 1); X_LOCK; cache_list[idx].time = dnow(); cache_list[idx].vis_cnt++; @@ -7665,7 +7682,7 @@ fprintf(stderr, "----%02d: VisibilityNotify 0x%x %3d state: %s U/P %d/%d\n", i Ev_rects[nrects].x2 = cache_list[idx].width; Ev_rects[nrects].y2 = cache_list[idx].height; nrects++; - SCHED(win) + SCHED(win, 1) } } cache_list[idx].vis_state = state; @@ -7680,14 +7697,14 @@ fprintf(stderr, "----%02d: MapNotify 0x%x %3d\n", i, (unsigned int) win, if (cache_list[idx].map_state == IsUnmapped || macosx_console) { X_UNLOCK; - su_save(idx, nbatch); - bs_restore(idx, nbatch, 0); + su_save(idx, nbatch, 1); + bs_restore(idx, nbatch, 0, 1); if (macosx_console) { #ifdef MACOSX macosxCGS_follow_animation_win(win, -1, 1); if (valid_window(win, &attr, 1)) { STORE(idx, win, attr); - SCHED(win); + SCHED(win, 1); } /* XXX Y */ if (cache_list[idx].vis_state == -1) { @@ -7723,8 +7740,8 @@ fprintf(stderr, "----%02d: UnmapNotify 0x%x %3d\n", i, (unsigned int) win, if (cache_list[idx].map_state == IsViewable || macosx_console) { X_UNLOCK; - bs_save(idx, nbatch); - su_restore(idx, nbatch, 0); + bs_save(idx, nbatch, 1); + su_restore(idx, nbatch, 0, 1); X_LOCK; pixels += cache_list[idx].width * cache_list[idx].height; cache_list[idx].time = dnow(); diff --git a/x11vnc/util.c b/x11vnc/util.c index 7b030d7..5ba621c 100644 --- a/x11vnc/util.c +++ b/x11vnc/util.c @@ -548,8 +548,8 @@ char *choose_title(char *display) { } strncat(title, display, MAXN - strlen(title)); if (subwin && dpy && valid_window(subwin, NULL, 0)) { - char *name = NULL; #if !NO_X11 + char *name = NULL; if (XFetchName(dpy, subwin, &name)) { if (name) { strncat(title, " ", MAXN - strlen(title)); @@ -557,8 +557,6 @@ char *choose_title(char *display) { free(name); } } -#else - if (!name) {} #endif /* NO_X11 */ } return title; diff --git a/x11vnc/win_utils.c b/x11vnc/win_utils.c index 2e5449e..aea8473 100644 --- a/x11vnc/win_utils.c +++ b/x11vnc/win_utils.c @@ -85,11 +85,13 @@ int valid_window(Window win, XWindowAttributes *attr_ret, int bequiet) { if (win == None) { return 0; } + #ifdef MACOSX if (macosx_console) { return macosx_valid_window(win, attr_ret); } #endif + RAWFB_RET(0) #if NO_X11 @@ -205,7 +207,7 @@ void snapshot_stack_list(int free_only, double allowed_age) { #endif #if NO_X11 && !defined(MACOSX) - num = rc = i = j = 0; + num = rc = i = j = 0; /* compiler warnings */ ui = 0; r = w = None; list = NULL; @@ -332,7 +334,7 @@ if (0) fprintf(stderr, "update_stack_list[%d]: %.4f %.4f\n", stack_list_num, no Window query_pointer(Window start) { int rx, ry; #if !NO_X11 - Window r, c; + Window r, c; /* compiler warnings */ int wx, wy; unsigned int mask; #endif @@ -344,6 +346,7 @@ Window query_pointer(Window start) { #endif RAWFB_RET(None) + #if NO_X11 if (!start) { rx = ry = 0; } return None; diff --git a/x11vnc/x11vnc.1 b/x11vnc/x11vnc.1 index d82c9fa..389fb12 100644 --- a/x11vnc/x11vnc.1 +++ b/x11vnc/x11vnc.1 @@ -2,7 +2,7 @@ .TH X11VNC "1" "December 2006" "x11vnc " "User Commands" .SH NAME x11vnc - allow VNC connections to real X11 displays - version: 0.8.4, lastmod: 2006-12-28 + version: 0.8.4, lastmod: 2006-12-29 .SH SYNOPSIS .B x11vnc [OPTION]... diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c index f8b10f9..73adb8f 100644 --- a/x11vnc/x11vnc.c +++ b/x11vnc/x11vnc.c @@ -1443,6 +1443,50 @@ static void store_homedir_passwd(char *file) { exit(0); } +void ncache_beta_tester_message(void) { + +char msg[] = +"\n" +"***************************************************************************\n" +"\n" +"Hello! Exciting News!!\n" +"\n" +"You have been selected at random to beta test the x11vnc '-ncache' VNC\n" +"client-side pixel caching feature!\n" +"\n" +"This scheme stores pixel data offscreen on the VNC viewer side for faster\n" +"retrieval. It should work with any VNC viewer.\n" +"\n" +"This method requires much testing and so we hope you will try it out and\n" +"perhaps even report back your observations. However, if you do not want\n" +"to test or use the feature, run x11vnc like this:\n" +"\n" +" x11vnc -ncache 0 ...\n" +"\n" +"The feature needs additional testing because we want to have x11vnc\n" +"performance enhancements on by default. Otherwise, only a relative few\n" +"would notice and use the -ncache option (e.g. the wireframe and scroll\n" +"detection features are on by default). A couple things to note:\n" +"\n" +" 1) It uses a large amount of RAM (on both viewer and server)\n" +"\n" +" 2) You can actually see the cached pixel data if you scroll down\n" +" to it in your viewer; adjust your viewer's size to hide it.\n" +"\n" +"More info: http://www.karlrunge.com/x11vnc/#faq-client-caching\n" +; + + if (raw_fb_str && !macosx_console) { + return; + } + if (nofb) { + return; + } + + fprintf(stderr, "%s", msg); + +} + #define SHOW_NO_PASSWORD_WARNING \ (!got_passwd && !got_rfbauth && (!got_passwdfile || !passwd_list) \ && !query_cmd && !remote_cmd && !unixpw && !got_gui_pw \ @@ -2920,6 +2964,11 @@ int main(int argc, char* argv[]) { } } + if (ncache < 0) { + ncache_beta_tester = 1; + ncache = -ncache; + } + if (raw_fb_str) { set_raw_fb_params(0); } @@ -3349,6 +3398,7 @@ int main(int argc, char* argv[]) { rfbLog(" client sides. This mode works with any VNC viewer,\n"); rfbLog(" however in most you can actually see the cached pixel\n"); rfbLog(" data by scrolling down, so you need to re-adjust its size.\n"); + rfbLog(" See http://www.karlrunge.com/x11vnc/#faq-client-caching.\n"); rfbLog(" If this mode yields undesired behavior (poor response,\n"); rfbLog(" painting errors, etc) it may be disabled via: '-ncache 0'\n"); rfbLog(" You can press 3 Alt_L's (Left \"Alt\" key) in a row to \n"); @@ -3562,6 +3612,10 @@ int main(int argc, char* argv[]) { } set_vnc_desktop_name(); + if (ncache_beta_tester) { + ncache_beta_tester_message(); + } + #if LIBVNCSERVER_HAVE_FORK && LIBVNCSERVER_HAVE_SETSID if (bg) { /* fork into the background now */ diff --git a/x11vnc/x11vnc_defs.c b/x11vnc/x11vnc_defs.c index 9227b55..170be87 100644 --- a/x11vnc/x11vnc_defs.c +++ b/x11vnc/x11vnc_defs.c @@ -15,7 +15,7 @@ int xtrap_base_event_type = 0; int xdamage_base_event_type = 0; /* date +'lastmod: %Y-%m-%d' */ -char lastmod[] = "0.8.4 lastmod: 2006-12-28"; +char lastmod[] = "0.8.4 lastmod: 2006-12-29"; /* X display info */ diff --git a/x11vnc/xevents.c b/x11vnc/xevents.c index 1e24b39..5f22e9b 100644 --- a/x11vnc/xevents.c +++ b/x11vnc/xevents.c @@ -181,7 +181,9 @@ static void get_prop(char *str, int len, Atom prop) { if (prop == None) { return; } + RAWFB_RET_VOID + #if NO_X11 return; #else diff --git a/x11vnc/xwrappers.c b/x11vnc/xwrappers.c index 4c6982b..a7ecba0 100644 --- a/x11vnc/xwrappers.c +++ b/x11vnc/xwrappers.c @@ -318,7 +318,8 @@ XImage *XCreateImage_wr(Display *disp, Visual *visual, unsigned int depth, #if NO_X11 nox11_exit(1); - if (!disp || !visual || !depth || !format || !offset || !data || !width || !height || !width || !bitmap_pad || !bytes_per_line) {} + if (!disp || !visual || !depth || !format || !offset || !data || !width + || !height || !width || !bitmap_pad || !bytes_per_line) {} return NULL; #else if (overlay) { @@ -632,16 +633,16 @@ void XTRAP_FakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down, /* unused vars warning: */ if (key || down || delay) {} -#if LIBVNCSERVER_HAVE_LIBXTRAP +# if LIBVNCSERVER_HAVE_LIBXTRAP XESimulateXEventRequest(trap_ctx, down ? KeyPress : KeyRelease, key, 0, 0, 0); if (debug_keyboard) { upup_downdown_warning(key, down); } keycode_state[(int) key] = down ? 1 : 0; -#else +# else DEBUG_SKIPPED_INPUT(debug_keyboard, "keyboard: no-XTRAP-build"); -#endif +# endif #endif /* NO_X11 */ } @@ -1112,7 +1113,8 @@ Bool XQueryPointer_wr(Display *display, Window w, Window *root_return, Window *child_return, int *root_x_return, int *root_y_return, int *win_x_return, int *win_y_return, unsigned int *mask_return) { #if NO_X11 - if (!display || !w || !root_return || !child_return || !root_x_return || !root_y_return || !win_x_return || !win_y_return || !mask_return) {} + if (!display || !w || !root_return || !child_return || !root_x_return + || !root_y_return || !win_x_return || !win_y_return || !mask_return) {} return False; #else Bool rc; @@ -1163,7 +1165,8 @@ Status XQueryTree_wr(Display *display, Window w, Window *root_return, } #endif #if NO_X11 - if (!display || !w || !root_return || !parent_return || !children_return || !nchildren_return) {} + if (!display || !w || !root_return || !parent_return + || !children_return || !nchildren_return) {} return (Status) 0; #else if (! display) {