x11vnc: fix failure of -8to24 on default depth 24 due to

nonstandard indexed color support changes.  Fix small window
for failure after XSendEvent selection call; add env var.
X11VNC_SENDEVENT_SYNC=1 to take even more care.
pull/1/head
runge 16 years ago
parent 91174efbb8
commit 198382dcf3

@ -79,7 +79,9 @@ static void set_root_cmap(void) {
RAWFB_RET_VOID RAWFB_RET_VOID
if (depth > 8) { if (depth > 16) {
ncolor = NCOLOR;
} else if (depth > 8) {
ncolor = 1 << depth; ncolor = 1 << depth;
} else { } else {
ncolor = NCOLOR; ncolor = NCOLOR;
@ -255,7 +257,7 @@ static void set_poll_fb(void) {
return; /* this saves a bit of RAM */ return; /* this saves a bit of RAM */
} }
pfb(4, &poll24_fb, &poll24_fb_w, &poll24_fb_h); pfb(4, &poll24_fb, &poll24_fb_w, &poll24_fb_h);
if (depth > 8) { if (depth > 8 && depth <= 16) {
pfb(2, &poll8_fb, &poll8_fb_w, &poll8_fb_h); /* 2X for rare 16bpp colormap case */ pfb(2, &poll8_fb, &poll8_fb_w, &poll8_fb_h); /* 2X for rare 16bpp colormap case */
} else { } else {
pfb(1, &poll8_fb, &poll8_fb_w, &poll8_fb_h); pfb(1, &poll8_fb, &poll8_fb_w, &poll8_fb_h);
@ -333,7 +335,7 @@ if (db24 > 2) fprintf(stderr, " check_for_multivis: %.4f\n", now - last_call);
if (stack_old) { if (stack_old) {
free(stack_old); free(stack_old);
} }
stack_old = (Window *) malloc(n*sizeof(Window)); stack_old = (Window *) calloc(n*sizeof(Window), 1);
stack_old_len = n; stack_old_len = n;
} }
@ -1340,7 +1342,10 @@ static int get_cmap(int j, Colormap cmap) {
RAWFB_RET(0) RAWFB_RET(0)
if (depth > 8) { if (depth > 16) {
/* 24 */
ncolor = NCOLOR;
} else if (depth > 8) {
ncolor = 1 << depth; ncolor = 1 << depth;
} else { } else {
ncolor = NCOLOR; ncolor = NCOLOR;
@ -1362,9 +1367,10 @@ static int get_cmap(int j, Colormap cmap) {
} else { } else {
ncells = NCOLOR; ncells = NCOLOR;
} }
if (db24 > 1) fprintf(stderr, "get_cmap: %d 0x%x\n", j, (unsigned int) cmap);
if (ncells > ncolor) { if (depth > 16) {
;
} else if (ncells > ncolor) {
ncells = ncolor; ncells = ncolor;
} else if (ncells == 8 && depth != 3) { } else if (ncells == 8 && depth != 3) {
/* XXX. see set_colormap() */ /* XXX. see set_colormap() */
@ -1376,6 +1382,7 @@ if (db24 > 1) fprintf(stderr, "get_cmap: %d 0x%x\n", j, (unsigned int) cmap);
color[j][i].pixel = i; color[j][i].pixel = i;
color[j][i].pad = 0; color[j][i].pad = 0;
} }
if (db24 > 1) fprintf(stderr, "get_cmap: %d 0x%x ncolor=%d ncells=%d\n", j, (unsigned int) cmap, ncolor, ncells);
/* try to query the colormap, trap errors */ /* try to query the colormap, trap errors */
X_LOCK; X_LOCK;

@ -1,3 +1,9 @@
2009-01-10 Karl Runge <runge@karlrunge.com>
* x11vnc: fix failure of -8to24 on default depth 24 due to
nonstandard indexed color support changes. Fix small window
for failure after XSendEvent selection call; add env var.
X11VNC_SENDEVENT_SYNC=1 to take even more care.
2009-01-03 Karl Runge <runge@karlrunge.com> 2009-01-03 Karl Runge <runge@karlrunge.com>
* x11vnc: add -rmflag option, -rawfb vt support, bpp < 8 support * x11vnc: add -rmflag option, -rawfb vt support, bpp < 8 support
for rawfb, find /dev/video better. Fix reverse SSL connection for rawfb, find /dev/video better. Fix reverse SSL connection

@ -1,5 +1,5 @@
x11vnc README file Date: Sat Jan 3 23:43:28 EST 2009 x11vnc README file Date: Wed Jan 7 21:16:30 EST 2009
The following information is taken from these URLs: The following information is taken from these URLs:
@ -12266,7 +12266,7 @@ x11vnc: a VNC server for real X displays
Here are all of x11vnc command line options: Here are all of x11vnc command line options:
% x11vnc -opts (see below for -help long descriptions) % x11vnc -opts (see below for -help long descriptions)
x11vnc: allow VNC connections to real X11 displays. 0.9.7 lastmod: 2009-01-03 x11vnc: allow VNC connections to real X11 displays. 0.9.7 lastmod: 2009-01-07
x11vnc options: x11vnc options:
-display disp -auth file -N -display disp -auth file -N
@ -12390,7 +12390,7 @@ libvncserver-tight-extension options:
% x11vnc -help % x11vnc -help
x11vnc: allow VNC connections to real X11 displays. 0.9.7 lastmod: 2009-01-03 x11vnc: allow VNC connections to real X11 displays. 0.9.7 lastmod: 2009-01-07
(type "x11vnc -opts" to just list the options.) (type "x11vnc -opts" to just list the options.)

@ -194,7 +194,9 @@ void set_colormap(int reset) {
} }
if (init) { if (init) {
if (depth > 8) { if (depth > 16) {
ncolor = NCOLOR;
} else if (depth > 8) {
ncolor = 1 << depth; ncolor = 1 << depth;
} else { } else {
ncolor = NCOLOR; ncolor = NCOLOR;

@ -63,6 +63,7 @@ void selection_request(XEvent *ev, char *type) {
unsigned int length; unsigned int length;
unsigned char *data; unsigned char *data;
static Atom xa_targets = None; static Atom xa_targets = None;
static int sync_it = -1;
# ifndef XA_LENGTH # ifndef XA_LENGTH
unsigned long XA_LENGTH; unsigned long XA_LENGTH;
# endif # endif
@ -72,6 +73,14 @@ void selection_request(XEvent *ev, char *type) {
XA_LENGTH = XInternAtom(dpy, "LENGTH", True); XA_LENGTH = XInternAtom(dpy, "LENGTH", True);
# endif # endif
if (sync_it < 0) {
if (getenv("X11VNC_SENDEVENT_SYNC")) {
sync_it = 1;
} else {
sync_it = 0;
}
}
req_event = &(ev->xselectionrequest); req_event = &(ev->xselectionrequest);
notify_event.type = SelectionNotify; notify_event.type = SelectionNotify;
notify_event.display = req_event->display; notify_event.display = req_event->display;
@ -170,10 +179,16 @@ void selection_request(XEvent *ev, char *type) {
rfbLog("selection_request: ignored XError while sending " rfbLog("selection_request: ignored XError while sending "
"%s selection to 0x%x.\n", type, req_event->requestor); "%s selection to 0x%x.\n", type, req_event->requestor);
} }
XFlush_wr(dpy);
if (sync_it) {
usleep(5 * 1000);
XSync(dpy, False);
}
XSetErrorHandler(old_handler); XSetErrorHandler(old_handler);
trapped_xerror = 0; trapped_xerror = 0;
XFlush_wr(dpy);
#endif /* NO_X11 */ #endif /* NO_X11 */
} }

@ -2,7 +2,7 @@
.TH X11VNC "1" "January 2009" "x11vnc " "User Commands" .TH X11VNC "1" "January 2009" "x11vnc " "User Commands"
.SH NAME .SH NAME
x11vnc - allow VNC connections to real X11 displays x11vnc - allow VNC connections to real X11 displays
version: 0.9.7, lastmod: 2009-01-03 version: 0.9.7, lastmod: 2009-01-07
.SH SYNOPSIS .SH SYNOPSIS
.B x11vnc .B x11vnc
[OPTION]... [OPTION]...

@ -15,7 +15,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0; int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */ /* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.9.7 lastmod: 2009-01-03"; char lastmod[] = "0.9.7 lastmod: 2009-01-07";
/* X display info */ /* X display info */

@ -135,8 +135,8 @@ static void xrecord_grabserver(int start) {
XSetErrorHandler(old_handler); XSetErrorHandler(old_handler);
return; return;
} }
XSetErrorHandler(old_handler);
XFlush_wr(gdpy_data); XFlush_wr(gdpy_data);
XSetErrorHandler(old_handler);
#else #else
if (!rc || !old_handler) {} if (!rc || !old_handler) {}
#endif #endif

Loading…
Cancel
Save