Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!caen!uflorida!bikini!thoth From: thoth@reef.cis.ufl.edu (Gilligan) Newsgroups: comp.windows.x Subject: String to Pixmap converter + Bug report Message-ID: Date: 5 Jan 91 01:58:23 GMT Sender: news@uflorida.cis.ufl.EDU Distribution: comp Organization: Zik Zak Lines: 96 As part of the XPM effort I have been developing a String to Pixmap converter that is similar to the String to Bitmap converter. In fact they are so similar I just copied and modified all the relevant bitmap files to handle pixmaps instead. This worked fine until I tried to use the code. The converter was getting replaced by the String to Bitmap converter somewhere in the program and NOT in my code. I abandoned the effort after a week of struggle and didn't return to it until just recently. I went into the source code for the Athena widgets on the hunch that one of their widgets was mangling the converters. I found the offender. Scrollbar. Someone on bad drugs decided that the Scrollbar wanted a String to Pixmap converter and decided to use the standard XmuCvtStringToBitmap. Fine, the Scrollbar has code to handle when the depth of its particular pixmap does not match the window, but NONE of the rest of the toolkit does (possible overstatement). Almost anything with scrollbars is a candidate for a BadMatch error. See the bug report for a good example. Bitmaps are NOT suitable replacements for Pixmaps in most cases and the code in Scrollbar.c is quite erroneous in thinking it will serve. It also ticks me off when my converters get overridden by obviously incorrect ones:) Here's a copy of the bug report I'm sending. X Window System Bug Report xbugs@expo.lcs.mit.edu VERSION: R4 CLIENT MACHINE and OPERATING SYSTEM: Sun 4/490 running SunOS 4.1.0, and probably just about any other machine with Athena Widgets. DISPLAY TYPE: HP apollo 9000 series 400 and Sun 3/80 color displays, probably anything with a depth!=1. WINDOW MANAGER: not relevant AREA: Xaw, Scrollbar.c SYNOPSIS: Scrollbar registers a WHOLLY inappropriate converter. DESCRIPTION: The Scrollbar widget registers XmuCvtStringToBitmap as a converter for String to Pixmap. This converter returns a depth 1 pixmap that is unsuitable for use as the omnipresent backgroundPixmap or anything else that is XtRPixmap since most of the toolkit code assumes the depths of the Pixmaps and windows match. A much more suitable choice would be XmuCvtStringToPixmap (written by me using the XPM2 library. Can I get it into R5?). REPEAT BY: xmh -xrm "*backgroundPixmap: egypt.bg" where egypt.bg is a standard X bitmap in your bitmapFilePath SAMPLE FIX: This is only a start. There is much code in the Scrollbar widget that this makes obsolete, but the code shouldn't have been there in the first place. *** /cis/src/x11r4/mit/lib/Xaw/Scrollbar.c Fri Dec 15 11:37:21 1989 --- Scrollbar.c Mon Dec 31 21:44:20 1990 *************** *** 171,178 **** XawInitializeWidgetSet(); XtAddConverter( XtRString, XtROrientation, XmuCvtStringToOrientation, NULL, (Cardinal)0 ); - XtAddConverter( XtRString, XtRPixmap, XmuCvtStringToBitmap, - screenConvertArg, XtNumber(screenConvertArg)); } /* --- 171,176 ---- If you want a copy of the converter (alpha 0.1 release) and a sample program you have to send me an ORIGINAL (either you drew it, or I haven't seen it yet) xpm2 format image that is a tesselation suitable for a background. No two-color images accepted :) Grey-scales are OK. Company logos are neat. -- "Until it's on my desk, it's vaporware" (`it' is the NeXT) "Those who would trade freedom for security soon will have neither" B. Franklin I deal with Reality as you _don't_ understand it.