diff options
author | rsc <devnull@localhost> | 2004-03-25 23:03:57 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-03-25 23:03:57 +0000 |
commit | 8ad517944e46710ab832350c0dc3fc4e9239f7e2 (patch) | |
tree | 7b99a1833e1b303719c2aac75e3f7e82482b42ab /src/libdraw | |
parent | cb27443abf3d6af6ab52377c71c843e619928433 (diff) | |
download | plan9port-8ad517944e46710ab832350c0dc3fc4e9239f7e2.tar.gz plan9port-8ad517944e46710ab832350c0dc3fc4e9239f7e2.tar.bz2 plan9port-8ad517944e46710ab832350c0dc3fc4e9239f7e2.zip |
Today's changes.
More changes.
Diffstat (limited to 'src/libdraw')
-rw-r--r-- | src/libdraw/openfont.c | 4 | ||||
-rw-r--r-- | src/libdraw/x11-init.c | 23 | ||||
-rw-r--r-- | src/libdraw/x11-itrans.c | 3 |
3 files changed, 23 insertions, 7 deletions
diff --git a/src/libdraw/openfont.c b/src/libdraw/openfont.c index a359327b..05370eac 100644 --- a/src/libdraw/openfont.c +++ b/src/libdraw/openfont.c @@ -18,8 +18,10 @@ openfont(Display *d, char *name) nambuf = smprint("#9/font/%s", name+14); if(nambuf == nil) return 0; + nambuf = unsharp(nambuf); + if(nambuf == nil) + return 0; if((fd = open(nambuf, OREAD)) < 0){ -fprint(2, "failed at %s\n", nambuf); free(nambuf); return 0; } diff --git a/src/libdraw/x11-init.c b/src/libdraw/x11-init.c index 1283f430..c959eee4 100644 --- a/src/libdraw/x11-init.c +++ b/src/libdraw/x11-init.c @@ -185,26 +185,22 @@ xattach(char *label) /* * Figure out underlying screen format. */ - _x.depth = DefaultDepth(_x.display, xrootid); if(XMatchVisualInfo(_x.display, xrootid, 16, TrueColor, &xvi) || XMatchVisualInfo(_x.display, xrootid, 16, DirectColor, &xvi)){ _x.vis = xvi.visual; _x.depth = 16; - _x.usetable = 1; } else if(XMatchVisualInfo(_x.display, xrootid, 15, TrueColor, &xvi) || XMatchVisualInfo(_x.display, xrootid, 15, DirectColor, &xvi)){ _x.vis = xvi.visual; _x.depth = 15; - _x.usetable = 1; } else if(XMatchVisualInfo(_x.display, xrootid, 24, TrueColor, &xvi) || XMatchVisualInfo(_x.display, xrootid, 24, DirectColor, &xvi)){ _x.vis = xvi.visual; _x.depth = 24; - _x.usetable = 1; } else if(XMatchVisualInfo(_x.display, xrootid, 8, PseudoColor, &xvi) @@ -218,6 +214,7 @@ xattach(char *label) _x.depth = 8; } else{ + _x.depth = DefaultDepth(_x.display, xrootid); if(_x.depth != 8){ werrstr("can't understand depth %d screen", _x.depth); goto err0; @@ -225,6 +222,9 @@ xattach(char *label) _x.vis = DefaultVisual(_x.display, xrootid); } + if(DefaultDepth(_x.display, xrootid) == _x.depth) + _x.usetable = 1; + /* * _x.depth is only the number of significant pixel bits, * not the total number of pixel bits. We need to walk the @@ -298,7 +298,7 @@ xattach(char *label) Dx(r), /* width */ Dy(r), /* height */ 0, /* border width */ - DefaultDepthOfScreen(xscreen), /* depth */ + _x.depth, /* depth */ InputOutput, /* class */ _x.vis, /* visual */ /* valuemask */ @@ -563,6 +563,18 @@ setupcmap(XWindow w) if(_x.depth >= 24) { /* + * This is needed for SunOS. Ask Axel Belinfante. + */ + if(_x.usetable == 0){ + _x.cmap = XCreateColormap(_x.display, w, _x.vis, AllocAll); + XStoreColors(_x.display, _x.cmap, _x.map, 256); + for(i = 0; i < 256; i++){ + _x.tox11[i] = i; + _x.toplan9[i] = i; + } + } + + /* * The pixel value returned from XGetPixel needs to * be converted to RGB so we can call rgb2cmap() * to translate between 24 bit X and our color. Unfortunately, @@ -573,7 +585,6 @@ setupcmap(XWindow w) * some displays say MSB even though they run on LSB. * Besides, this is more anal. */ - c = _x.map[19]; /* known to have different R, G, B values */ if(!XAllocColor(_x.display, _x.cmap, &c)){ werrstr("XAllocColor: %r"); diff --git a/src/libdraw/x11-itrans.c b/src/libdraw/x11-itrans.c index 8e72b011..509b55cf 100644 --- a/src/libdraw/x11-itrans.c +++ b/src/libdraw/x11-itrans.c @@ -11,6 +11,9 @@ #include <keyboard.h> #include "x11-memdraw.h" +#undef time + + static int __xtoplan9kbd(XEvent *e) { |