Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ucbvax!bloom-beacon!dont-send-mail-to-path-lines From: mouse@lightning.mcrcim.mcgill.EDU (der Mouse) Newsgroups: comp.windows.x Subject: Re: XCreatePixmapFromBitmapData (was: white and black ..) Message-ID: <9106091743.AA01216@lightning.McRCIM.McGill.EDU> Date: 9 Jun 91 17:43:07 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 55 > one more problem about black and white, this time not in the server > but with XCreatePixmapFromBitmapData. > A few days ago someone posted the following small program to this > group (it was something about twm and free-ing), and as it is so > small, I will misuse it to demonstrate my problem: > On Sun4, X11R4 (MIT), SunOS4.1.1, awm, I get > black: 1; white: 0 > and the icon is a black smiley on white. > On my NCD X-Terminal (program running on the same Sun as above), I get > black: 0; white: 1 > and the icon is a white smiley on black. > Of course the servers are free to code black/white by any number they > like, so I don't mind black: 1 vs. black: 0, but where is the moment > in the program when I use hard coded 0/1 as black/white for the icon > pixmap and especially: how do I do it right? Your basic problem is that you don't quite know how icon pixmaps work. First of all, they aren't, as the name implies, truly icon pixmaps; they're really icon bitmaps. The ICCCM says, in 4.1.2.4 (discussing the WM_HINTS property), The icon_pixmap field may specify a pixmap to be used as an icon. This pixmap should be: o One of the sizes specified in the WM_ICON_SIZE property on the root, if it exists (see Section 4.1.3.2). o 1-bit deep. The window manager will select, through the defaults database, suitable background (for the 0 bits) and foreground (for the 1 bits) colors. These defaults can, of course, specify different colors for the icons of different clients. So, if you change the following icon_pix = XCreatePixmapFromBitmapData(disp,RootWindow(disp,scrn), icon_bits,icon_width,icon_height,BlackPixel(disp,scrn), WhitePixel(disp,scrn),DefaultDepth(disp,scrn)); so that it reads icon_pix = XCreatePixmapFromBitmapData(disp,RootWindow(disp,scrn), icon_bits,icon_width,icon_height,0L,1L,1); you should get more consistent results. (The depth change is necessary to make the code work on non-1-bit displays.) der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu