diff options
author | he <he@pkgsrc.org> | 2001-08-01 20:56:30 +0000 |
---|---|---|
committer | he <he@pkgsrc.org> | 2001-08-01 20:56:30 +0000 |
commit | 2efc95c931557fb9e4e0bfa2e47535e60901ef4a (patch) | |
tree | c06483c377868214514d548dbfd8be89c25bf1f0 | |
parent | a8bdd3bdfd6ffe795f5ace8e747f8c03bf531df6 (diff) | |
download | pkgsrc-2efc95c931557fb9e4e0bfa2e47535e60901ef4a.tar.gz |
Add a patch to modernize the X11 visual detection and color
allocation, so that this program gives color also on TrueColor
displays. The use of color plane masks is however removed.
-rw-r--r-- | graphics/xplot/distinfo | 3 | ||||
-rw-r--r-- | graphics/xplot/patches/patch-ae | 68 |
2 files changed, 70 insertions, 1 deletions
diff --git a/graphics/xplot/distinfo b/graphics/xplot/distinfo index 35d12ef5ba9..25094569bc4 100644 --- a/graphics/xplot/distinfo +++ b/graphics/xplot/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.2 2001/04/21 09:54:30 wiz Exp $ +$NetBSD: distinfo,v 1.3 2001/08/01 20:56:30 he Exp $ SHA1 (xplot-0.90.tar.gz) = 8d20e356eb767cecf428edb1140934bc423cd33c Size (xplot-0.90.tar.gz) = 217521 bytes @@ -6,3 +6,4 @@ SHA1 (patch-aa) = 12ae7dc50504201034f47e70798f41aa8dc769f6 SHA1 (patch-ab) = 94fb5f8b5483fcc5922b619bcf0b08a682bd12c1 SHA1 (patch-ac) = 671b63a8db7c41df4e9f14147988d81ff921aca7 SHA1 (patch-ad) = fd19823030badf91734fde92b45fcaecc06cf0f8 +SHA1 (patch-ae) = 782339f6118df2c64a852921e30c620b584c08b8 diff --git a/graphics/xplot/patches/patch-ae b/graphics/xplot/patches/patch-ae new file mode 100644 index 00000000000..683c3498bb0 --- /dev/null +++ b/graphics/xplot/patches/patch-ae @@ -0,0 +1,68 @@ +$NetBSD: patch-ae,v 1.1 2001/08/01 20:56:30 he Exp $ + +--- xplot.c.orig Wed Jul 2 22:26:09 1997 ++++ xplot.c +@@ -842,38 +842,39 @@ + /* Allocate some color cells */ + + if (d_i[d].virgin ) { ++ int default_depth; ++ int default_screen; ++ int default_cmap; ++ XVisualInfo visual_info; ++ + d_i[d].virgin = 0; + + d_i[d].xplot_nagle_atom = XInternAtom(pl->dpy, "XPLOT_NAGLE", False); + +- d_i[d].clr_map = DefaultColormap(pl->dpy, DefaultScreen(pl->dpy)); ++ default_screen = ScreenNumberOfScreen(pl->screen); ++ default_depth = DefaultDepth(pl->dpy, default_screen); ++ default_cmap = DefaultColormap(pl->dpy, default_screen); + +- if ( option_mono || ++ i = DirectColor; ++ while (!XMatchVisualInfo(pl->dpy, default_screen, default_depth, ++ i--, &visual_info)) ++ ; + +- ! XAllocColorCells(pl->dpy, +- d_i[d].clr_map, 0, +- &d_i[d].line_plane_mask, 1, +- d_i[d].pixel, NColors) ) +- { +- /* probably only one bit plane, or all the color cells are taken */ +-#if 1 +- if (! option_mono) +- fputs("XAllocColorCells failed, will only have one plot color\n", +- stderr); +-#endif +- for ( i = 0; i < NColors; i++) { +- d_i[d].Colors[i] = WhitePixelOfScreen(pl->screen); +- } +- } else { +- for (i = 0; i < NColors; i++) { +- XParseColor(pl->dpy, d_i[d].clr_map, ColorNames[i], &d_i[d].clr); +- d_i[d].clr.pixel = d_i[d].pixel[i]; +- XStoreColor (pl->dpy, d_i[d].clr_map, &d_i[d].clr); +- d_i[d].clr.pixel |= d_i[d].line_plane_mask; +- XStoreColor (pl->dpy, d_i[d].clr_map, &d_i[d].clr); +- d_i[d].Colors[i] = d_i[d].clr.pixel; ++ if (i < StaticColor || option_mono) { ++ mono: ++ for ( i = 0; i < NColors; i++) { ++ d_i[d].Colors[i] = WhitePixelOfScreen(pl->screen); ++ } ++ } else { ++ for (i = 0; i < NColors; i++) { ++ XParseColor(pl->dpy, default_cmap, ColorNames[i], &d_i[d].clr); ++ if (!XAllocColor(pl->dpy, default_cmap, &d_i[d].clr)) { ++ fprintf(stderr, "XAllocColor failed, reverting to monochrome\n"); ++ goto mono; + } ++ d_i[d].Colors[i] = d_i[d].clr.pixel; + } ++ } + } + + for (i = 0; i < NColors; i++) { |