Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!bcm!etaylor From: etaylor@wilkins.iaims.bcm.tmc.edu (Eric Taylor) Newsgroups: comp.windows.x Subject: Re: X Protocol Error? Keywords: BackgroundPixmap, XChangeWindowAttributes Message-ID: <3203@gazette.bcm.tmc.edu> Date: 14 Dec 90 18:50:18 GMT References: <1050@sppy00.UUCP> Sender: usenet@bcm.tmc.edu Reply-To: etaylor@wilkins.iaims.bcm.tmc.edu (Eric Taylor) Organization: Baylor College of Medicine, Houston, Tx Lines: 73 Nntp-Posting-Host: wilkins.iaims.bcm.tmc.edu In article <1050@sppy00.UUCP>, jxf@sppy00.UUCP (Jonathan Fausey) writes: |> |> I have encountered an Xlib programming problem that I am unable to resolve. |> Namely, the code below compiles on a Sparcstation 1 (R3), a NeXT (R3), a Mac |> IIx (A/UX & R4), a DG AViiON (R3), and a Sun 3/50 (R3), runs (as a client on |> any of these machines) under the X servers on the NeXT, Mac, and Sun 3/50, but |> generates an X protocol error on the others' X servers as well as on a PC X |> server. The X protocol error I get is: |> |> X Protocol error: BadMatch, invalid parameter attributes |> Major opcode of failed request: 1 (X_CreateWindow) |> XSetErrorHandle Minor opcode of failed request: 1 |> Resource id in failed request: 0x8006c |> Serial number of failed request: 82 |> Current serial number in output stream: 85 |> |> Here's (portions of) the code: |> |> Display *wndw_disp; |> int wndw_screen; |> Visual *visual; |> XSetWindowAttributes WinAttr; |> unsigned long WinAttrMask = CWBackPixmap; |> Window win; |> Window wndw_hndl; |> Pixmap pix; |> . |> . |> . |> if (!(wndw_disp = XOpenDisplay(""))) |> { |> printf("Can't connect to X server %s\n", XDisplayName("")); |> exit(-1); |> } |> |> wndw_screen = DefaultScreen(wndw_disp); |> wndw_hndl = XCreateSimpleWindow(wndw_disp, |> DefaultRootWindow(wndw_disp), |> wndw_hint.x, wndw_hint.y, wndw_hint.width, |> wndw_hint.height, |> border_w, wndw_foregrnd, wndw_backgrnd); |> XSetStandardProperties(wndw_disp, *wndw_hndl, test_str, cur_title_str, |> None, argv, argc, &wndw_hint); |> . |> . |> . |> pix = XCreateBitmapFromData(wndw_disp, wndw_hndl, |> RawBitmapData, NumBitsPerBitmapLine, |> NumLinesInBitmap); |> WinAttr.background_pixmap = pix; |> win = XCreateWindow(wndw_disp, DefaultRootWindow(wndw_disp), |> ulx, uly, width, height, 4, 1, InputOutput, |> DefaultVisual(wndw_disp,wndw_screen), WinAttrMask, |> &WinAttr); |> |> I get a similar X protocol error message when I use XCreateSimpleWindow and |> XSetBackgroundPixmap instead of XCreateWindow etc. Can some kind soul help? One glaring error is that you are assuming 1 bit deep display. You specify depth 1 for your window depth. Use DefaultDepth(wndw_disp,wndw_screen) instead. Another error: You are using XCreateBitmapFromData. You should be using XCreatePixmapFromBitmapData. As a rule, bitmaps are not suitable as background pixmaps. (There are situations where you want them, but this is not one) -- Eric Taylor Baylor College of Medicine etaylor@wilkins.bcm.tmc.edu (713) 798-3776