Commit 833f0602 authored by runge's avatar runge

x11vnc -ncache on by default for beta test. fix -nofb & -rawfb modes.

parent e4a397ed
......@@ -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
......
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.)
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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
......
......@@ -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);
}
......
......@@ -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
......
This diff is collapsed.
......@@ -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;
......
......@@ -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;
......
......@@ -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]...
......
......@@ -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 */
......
......@@ -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 */
......
......@@ -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
......
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment