Re: XForms: FL_ObjWin() returns bogus Window XID in double buffer mode.

Dr. T.C. Zhao (zhao@bragg.phys.uwm.edu)
Tue, 8 Jul 1997 23:01:30 -0500

To subscribers of the xforms list from "Dr. T.C. Zhao" <zhao@bragg.phys.uwm.edu> :

list from spl@szechuan.ucsd.edu (Steve Lamont) :

>I've just encountered what appears to be a bug in the FL_ObjWin()
>macro. If it is called in double buffer mode it returns the XID of
>the Pixmap used as the back buffer rather than the actual Window XID.

>This causes the program to die if this XID is used in any Xlib calls
>requiring a Window XID or if used in the fl_set_cursor() function
>(among others).

This is where not having true double buffering
really hurts. Prior to issuing FL_DRAW event, the form->window
is switched to that of the backingstore pixmap XID (so
the drawing routine doesn't have to know anything about
double buffering and can draw as usual) and then
switched back again when FL_DRAW finishes. But, as you found out,
the form->window is not usable as a regular window while handling
FL_DRAW event. In typical GUI interaction, FL_DRAW is brief and
is unlikely to cause problems, but I can see the need to get
hold of the true window ID in order to change the cursor
or whatever while drawing for specific applications.

There is really no clean way to get the real window id
while at the same time hiding the fact that pixmap ID
is substituted for the real window id. Another function/macro
will have to be added that can be used while handling FL_DRAW
event (but this window is not for drawing!). What a mess.

For the time being, the following should work:

Window get_real_object_window(FL_OBJECT *ob)
{
FL_pixmap *objp = ob->flpixmap;
FL_pixmap *formp = ob->form->flpixmap;

return (objp && objp->win) ? objp->win :
((formp && formp->win) ? formp->win : FL_ObjWin(ob);
}

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