Search code examples
ccairoxlibscreensaverxorg

Xscreensaver code giving BadMatch error


I've been able to hack an Xscreensaver to where I'm getting my desired look (big thanks to luser droog for his aid). I added in some Cairo code because it was difficult to implement what I wanted with Xlib alone. Since this is just a hack for me I don't intend on distributing it.

Anyway, when I preview Fuzzyflakes in a window it looks fine, yet when I preview it fullscreen (like any good screensaver) it gives me this error:

X error in fuzzyflakes:
X Error of failed request: BadMatch (invalid parameter attribute)
  Major Optcode of failed request: 139 (RENDER)
  Minor optcode of failed request: 4 (RenderCreatePicture)
  Serial number of failed request: 528
  Current serial number in output stream: 1654

Here's some further information. I'm using Linux Mint 14, 64-bit edition. I'm using the nVidia proprietary drivers, version 304.88. I had to hack the Makefile generated by the xscreensaver configure script. I changed line 800 of the Makefile to this:

fuzzyflakes:    fuzzyflakes.o   $(HACK_OBJS) 
    $(CC_HACK) `pkg-config --cflags cairo` -g -o $@ [email protected]    $(HACK_OBJS) $(HACK_LIBS) -lcairo -lm

For the full source code you can look here.


Solution

  • From a quick look, it seems like you are feeding cairo with invalid information:

    
    flake->Fluff.gradient_image_background =
                   cairo_xlib_surface_create(flake->dpy,
                   flake->DB.b, DefaultVisual(flake->dpy, 0),
                   flake->XGWA.width, flake->XGWA.height);
    

    This claims that the drawable DB.p uses the display's first screen's default visual. However, the actual window seems to be an argument to fuzzyflakes_init() and thus could be using another visual.

    From another quick look, please try replacing DefaultVisual(flake->dpy, 0) with flake->XGWA.visual.