[comp.windows.open-look] Xview window repaint parameters

sdorsey@eng.umd.edu (Bill Dorsey) (06/07/91)

I'm trying to create an array of Xview canvases on the screen to hold
different signals for a signal processing application.  My code looks
like this:

Frame sig_frame[MAX_WINDOWS];
Canvas sig_canvas[MAX_WINDOWS];
void sig_repaint();

for (i=0; i<MAX_WINDOWS; i++) {
	sprintf(s, "Signal %d", i+1);
	sig_frame[i] = xv_create(base_frame, FRAME,
	    FRAME_LABEL, s,
	    FRAME_SHOW_LABEL, TRUE,
	    NULL);
	sig_canvas[i] = xv_create(sig_frame[i], CANVAS,
	    CANVAS_REPAINT_PROC, sig_repaint,
	    CANVAS_X_PAINT_WINDOW, TRUE,
	    NULL);
	H_scrollbar = (Scrollbar) xv_create(sig_canvas[i], SCROLLBAR,
	    SCROLLBAR_DIRECTION, SCROLLBAR_HORIZONTAL, NULL);
	xv_set(sig_frame[i], WIN_FIT_WIDTH, 0, WIN_FIT_HEIGHT, 0, NULL);
}

and my repaint function starts out like this:

void sig_repaint(canvas, paint_win, dpy, xwin, xrects)
Canvas		canvas;
Xv_Window	paint_win;
Display		dpy;
Window		xwin;
Xv_xrectlist	*xrects;
{
...

Now, when I realize one of my canvases with the command:

	xv_set(sig_frame[x], XV_SHOW, TRUE, NULL);

My sig_repaint function gets called with xwin equal to the X window
associated with the canvas sig_canvas[MAX_WINDOWS-1] instead of the
one I would expect -- the one associated with sig_canvas[x].  I have
been able to work around this by getting the canvas paint window
associated with sig_canvas[x] with the canvas_paint_window() macro
and then getting the X window id associated with the paint window
with the xv_get(sig_pw, XV_XID) call.  However, this doesn't seem
like the way things should work to me.  Am I doing something horribly
wrong?  Am I just plain stupid?  Is this a bug?

I'd appreciate any information that could shed some light on this
problem.  If you post a reply, please cc a copy to my email address
as I don't read this newsgroup regularly (maybe I should).  Thanks.

- Bill Dorsey   (sdorsey@eng.umd.edu)