Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!spool.mu.edu!snorkelwacker.mit.edu!bloom-beacon!dont-send-mail-to-path-lines From: mouse@lightning.mcrcim.mcgill.EDU (der Mouse) Newsgroups: comp.windows.x Subject: Re: HELP needed with BadMatch error Message-ID: <9103261112.AA05054@lightning.McRCIM.McGill.EDU> Date: 26 Mar 91 11:12:15 GMT Sender: tytso@athena.mit.edu (Theodore Y. Ts'o) Organization: The Internet Lines: 37 > The following program gives the following protocol error and I can't > work out why. Enlightenment would be greatly appreciated. A > sensible mechanism for fixing it would also be appreciated. > X Error: BadMatch, invalid parameter attributes > Request Major code 72 () Major request 72 is PutImage, as one would expect. > mask = XCreateImage(display, DefaultVisualOfScreen(screen), > 1, XYBitmap, 0, 0, > ((cols>>3)+1)<<3, rows, 8, 0); > mask->data = malloc((mask->bytes_per_line+100) * (rows+100)); [...load mask's data...] > maskp = XCreatePixmap(display, RootWindowOfScreen(screen), cols, rows, 1); > XPutImage(display, maskp, DefaultGCOfScreen(screen), mask, 0, 0, 0, 0, > cols, rows); > Note that both the Image and the Pixmap have depth 1. Are you by any chance on a non-1-bit server? Because if so, the default GC of the screen will not be of depth 1, so a BadMatch is to be expected. If that's not the problem, something weird is going on. With four changes, it builds fine here, and runs fine on a monochrome server and dies as you describe on a color server. (The four changes: delete the #include of , delete the extern from the declaration of pm_progname, add an extern declaration for malloc, and add calls to XCloseDisplay and exit at the end of main.) der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu