diff options
author | fredb <fredb@pkgsrc.org> | 2000-08-17 18:38:00 +0000 |
---|---|---|
committer | fredb <fredb@pkgsrc.org> | 2000-08-17 18:38:00 +0000 |
commit | 06549ff5eeb7ae883355079ffeabb16f1cbbab6d (patch) | |
tree | 4961eaf41a482fa930d8a83e036b44bd7c4e084c /x11 | |
parent | 3d1aa8e3f56e840147a9225dfda5dee090043270 (diff) | |
download | pkgsrc-06549ff5eeb7ae883355079ffeabb16f1cbbab6d.tar.gz |
Make this work with 16-bit displays. Patch provided by Johan Danielsson
<joda@netbsd.org>, in response to PR pkg/10852.
Diffstat (limited to 'x11')
-rw-r--r-- | x11/xworld/files/patch-sum | 3 | ||||
-rw-r--r-- | x11/xworld/patches/patch-ad | 118 |
2 files changed, 120 insertions, 1 deletions
diff --git a/x11/xworld/files/patch-sum b/x11/xworld/files/patch-sum index afcf4f56958..93ffde2bd91 100644 --- a/x11/xworld/files/patch-sum +++ b/x11/xworld/files/patch-sum @@ -1,5 +1,6 @@ -$NetBSD: patch-sum,v 1.4 2000/08/17 15:26:32 fredb Exp $ +$NetBSD: patch-sum,v 1.5 2000/08/17 18:38:00 fredb Exp $ MD5 (patch-aa) = 77c1d0c6752a84a93f7fb566c6ba3a6e MD5 (patch-ab) = 7a372dfcb44f68a52e65eed100883f7d MD5 (patch-ac) = 5d1eab63a888564e347b8687a2ff6876 +MD5 (patch-ad) = 3b92140a80b821e161cae0372140bab5 diff --git a/x11/xworld/patches/patch-ad b/x11/xworld/patches/patch-ad new file mode 100644 index 00000000000..2e1dbfea7ce --- /dev/null +++ b/x11/xworld/patches/patch-ad @@ -0,0 +1,118 @@ +$NetBSD: patch-ad,v 1.1 2000/08/17 18:38:00 fredb Exp $ + +From joda@pdc.kth.se Thu Aug 17 12:18:46 2000 +Date: 17 Aug 2000 19:02:53 +0200 +From: Johan Danielsson <joda@pdc.kth.se> +To: fb@enteract.com +Cc: gnats-bugs@gnats.netbsd.org +Subject: Re: pkg/10852: "xworld" fails to start + +Frederick Bruckman <fb@enteract.com> writes: + +> XIO: fatal IO error 14 (Bad address) on X server "1ton:0.0" +> after 32 requests (29 known processed) with 0 events remaining. + +This is because it only works as-is on 8-bit displays. Try this patch: + +--- work/xworld-2.0/xworld.c Thu Aug 17 19:00:48 2000 ++++ xworld.c Thu Aug 17 19:00:32 2000 +@@ -92,6 +92,26 @@ + exit(1); + } + ++ ++static char * ++alloc_image(XImage *image) ++{ ++ char *Map; ++ int ix, iy, j; ++ Map = (char *)malloc(image->height * image->bytes_per_line); ++ if (Map == NULL) { ++ fprintf(stderr, "xworld: not enough memory\n"); ++ exit(1); ++ } ++ image->data = Map; ++ ++ for(j = 0, ix = 0; ix < image->width; ix++) ++ for (iy = 0; iy < image->height; iy++) ++ XPutPixel(image, ix, iy, j++ % NCOLORS); ++ ++ return Map; ++} ++ + int + main(int argc, char **argv) + { +@@ -314,22 +334,7 @@ + /* + * generate startup image + */ +- Map = (char *)malloc(size*size*sizeof(char)); +- if (Map == NULL) { +- fprintf(stderr, "xworld: not enough memory\n"); +- exit(1); +- } +- +- j = 0; +- for (iy = 0; iy < size; iy++) { +- i = iy % (NCOLORS + 1); +- for (ix = 0; ix < size; ix++) { +- *(Map + j++) = xcolor[i].pixel; +- if (i++ >= NCOLORS) i = 0; +- } +- } +- +- image->data = Map; ++ Map = alloc_image(image); + + gc = XCreateGC(display, win, 0, 0); + +@@ -416,21 +421,21 @@ + * Map elevations to colors + */ + if (i != SOK) { +- *(Map + j) = xcolor[BLACK].pixel; ++ XPutPixel(image, ix, iy, xcolor[BLACK].pixel); + continue; + } + if (Value > level[NLEVELS - 1]) { +- *(Map + j) = xcolor[HIGH].pixel; ++ XPutPixel(image, ix, iy, xcolor[HIGH].pixel); + continue; + } + for (i = 0; i <= NLEVELS - 1; i++) { + if (Value <= level[i]) { +- *(Map + j) = xcolor[i].pixel; ++ XPutPixel(image, ix, iy, xcolor[i].pixel); + break; + } + } + } else +- *(Map + j) = xcolor[BLACK].pixel; ++ XPutPixel(image, ix, iy, xcolor[BLACK].pixel); + } + } + XPutImage(display, win, gc, image, 0, 0, 0, 0, size, size); +@@ -462,21 +467,8 @@ + fprintf(stderr, "xworld: can't create XImage\n"); + exit(1); + } +- Map = (char *)malloc(size*size*sizeof(char)); +- if (Map == NULL) { +- fprintf(stderr, "xworld: not enough memory\n"); +- exit(1); +- } +- image->data = Map; ++ Map = alloc_image(image); + +- j = 0; +- for (iy = 0; iy < size; iy++) { +- i = iy % (NCOLORS + 1); +- for (ix = 0; ix < size; ix++) { +- *(Map + j++) = xcolor[i].pixel; +- if (i++ >= NCOLORS) i = 0; +- } +- } + XPutImage(display, win, gc, image, 0, 0, 0, 0, + size, size); + break; |