Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!ezx!larry From: larry@sunrise.com (Larry Rogers) Newsgroups: comp.windows.x.motif Subject: Re: Loading pixmap in drawn button on color display? Message-ID: <1990Aug27.132311.11381@sunrise.com> Date: 27 Aug 90 13:23:11 GMT References: <1990Aug27.005946.5857@elroy.jpl.nasa.gov> Organization: Sunrise Software Systems, Inc. Lines: 41 In article <1990Aug27.005946.5857@elroy.jpl.nasa.gov> pjs@aristotle.jpl.nasa.gov writes: >I have an application which fills a drawnbutton with a pixmap >read from a file picked by the user so they can preview it. >(The bitmaps are from /usr/include/X11/bitmaps and I convert them >to pixmaps with XReadBitmapFile). Worked fine on our monochrome >displays. I just went to a color workstation that I have occasional >access to, and got the error > >X Error of failed request: BadMatch (invalid parameter attributes) > Major opcode of failed request: 55 (X_CreateGC) > Minor opcode of failed request: 0 > Resource id in failed request: 0x800025 > Serial number of failed request: 57 > Current serial number in output stream: 122 > >After a while of scratching my head, it dawned on me that the >problem was in the drawnbutton, and was because the color w/s >ihas an 8-bit deep display. I recall reading something about >this here lately. Anyway, I tried setting the depth resource to >1 in the argument list in the widget creation call, but that didn't >help. How can I write something which works on mono and color >displays? More to the point, why can't the drawnbutton figure >it out for itself??? > You have to generate an image and then generate a pixmap from the image. An easier solution under Motif is to use XmGetPixmap. It automatically generates a pixmap of the correct depth for the display. It's also pretty quick becauuse it caches the pixmaps it creates. >-- >This is news. This is your | Peter Scott, NASA/JPL/Caltech >brain on news. Any questions? | (pjs@aristotle.jpl.nasa.gov) -- == Larry Rogers == Sunrise Software Systems, Inc. ==