XForms: Drawing to a pixmap

Scott F. Thompson, Ph.D. (sthompson@alanpenn.com)
Wed, 17 Nov 1999 09:57:25 -0500 (EST)

# To subscribers of the xforms list from "Scott F. Thompson, Ph.D." <sthompson@alanpenn.com> :

I am porting my xforms application to an SGI box, and I'm getting the
following runtime error:

X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 70 (X_PolyFillRectangle)
Serial number of failed request: 346
Current serial number in output stream: 346

This is caused by trying to draw to a pixmap that I've created (for double
buffering purposes). A few facts:

- The code works fine on Linux (Red Hat 6.0).
- It bombs on 2 different SGI machines (Indigo2 Impact R10k, Irix 6.2).
- Without creating/writing to pixmaps, my xforms app ports fine.
- I've written a small X program and can create/write to pixmaps
without any problems on the same SGI machines. It's when I try to
do it from within an xforms app that causes problems.

The above error was produced by the following simple function, which just
creates a pixmap and tries to fill it.

initCanvas (FL_OBJECT *obj) {

int size = 512;
GC gc = fl_state[fl_get_vclass()].gc[0];
Display *disp = fl_get_display();
int screen = DefaultScreen(disp);
int default_depth = DefaultDepth (disp, screen);
Window win = FL_ObjWin(obj);

if (win) {
printf("Creating pixmap %dx%d (WINDOW=%ld).", size, size, win);
if (! (pixmap = XCreatePixmap (disp, win, size, size, default_depth))) {
printf("ERROR: Cannot create pixmap, exiting.\n");
exit(1);
}
printf(" Created (%ld).\n", pixmap);
}

/* Clear the pixmap. Barfs on SGI's! */
if (pixmap) {
fl_color(FL_COL1);
XFillRectangle (disp, pixmap, gc, 0, 0, size, size);
}
}

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuhs.mil or see
http://bob.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/