[XForms] FL_NoColor?

jason cipriani jac4 at mindless.com
Fri Jun 25 14:28:07 EDT 2004


So I've been having this problem in applications that use GLCanvases where the canvases flicker a lot in response to Expose events because the forms library is calling XClearWindow() to draw the fdesign-set background color on the canvas. Sometimes, the GLCanvas image disappears entirely (when the X server decides to process XClearWindow() -after- I swap GL buffers).

I looked into this and noticed FL_NoColor in the library code. When a canvas's col1 is set to FL_NoColor, the forms library doesn't call XClearWindow() to clear the background color. It shouldn't do this for GLCanvases anyway: why clear the canvas with an X call when the application is going to be redrawing the entire canvas with GL calls anyway?

Apparently, canvases are initially created with col1 set to FL_NoColor. But then, the fdesign-generated code calls fl_set_object_color() and overrides this.

Unfortunately, FL_NoColor (=0x7fffffff) is defined in the libraries private header files but does -not- appear in forms.h. So the only way to programmatically give a canvas on an fdesign-generated form no background color is:

fl_set_object_color(my_canvas, 0x7fffffff, FL_BLACK);

Works but I like named constants better than actual values. So, with that in mind:

1) Why is FL_NoColor not in forms.h?
2) Can you stick it in there in the next release?
3) Am I unleashing a dangerous beast by explicitly calling fl_object_color() with 0x7fffffff?

There is no way to prevent the XClearWindow() call simply by clever use of preemptive callbacks because if you return FL_PREEMPT on an FL_DRAW event, init_canvas() never gets called and X complains about bad drawables. And if you don't return FL_PREEMPT, then that kind of defeats the purpose here. Setting col1 to 0x7fffffff seems to be the cleanest way of getting rid of the flicker.

Thanks,
Jason
-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm




More information about the Xforms mailing list