summaryrefslogtreecommitdiffstats
path: root/x11vnc/8to24.c
diff options
context:
space:
mode:
authorrunge <runge>2009-01-10 23:03:24 +0000
committerrunge <runge>2009-01-10 23:03:24 +0000
commit198382dcf3c9b86919b7b69b9cedff7a162ba9cf (patch)
treea06b4a4d410e28439da2b63b4848bc142f918292 /x11vnc/8to24.c
parent91174efbb8e2fb09520477af6593f99b865777b0 (diff)
downloadlibtdevnc-198382dc.tar.gz
libtdevnc-198382dc.zip
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.
Diffstat (limited to 'x11vnc/8to24.c')
-rw-r--r--x11vnc/8to24.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/x11vnc/8to24.c b/x11vnc/8to24.c
index a8ba59a..f69fb9a 100644
--- a/x11vnc/8to24.c
+++ b/x11vnc/8to24.c
@@ -79,7 +79,9 @@ static void set_root_cmap(void) {
RAWFB_RET_VOID
- if (depth > 8) {
+ if (depth > 16) {
+ ncolor = NCOLOR;
+ } else if (depth > 8) {
ncolor = 1 << depth;
} else {
ncolor = NCOLOR;
@@ -255,7 +257,7 @@ static void set_poll_fb(void) {
return; /* this saves a bit of RAM */
}
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 */
} else {
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) {
free(stack_old);
}
- stack_old = (Window *) malloc(n*sizeof(Window));
+ stack_old = (Window *) calloc(n*sizeof(Window), 1);
stack_old_len = n;
}
@@ -1340,7 +1342,10 @@ static int get_cmap(int j, Colormap cmap) {
RAWFB_RET(0)
- if (depth > 8) {
+ if (depth > 16) {
+ /* 24 */
+ ncolor = NCOLOR;
+ } else if (depth > 8) {
ncolor = 1 << depth;
} else {
ncolor = NCOLOR;
@@ -1362,9 +1367,10 @@ static int get_cmap(int j, Colormap cmap) {
} else {
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;
} else if (ncells == 8 && depth != 3) {
/* 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].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 */
X_LOCK;