Re: Making things flash...

Steve Lamont (spl@szechuan.ucsd.edu)
Wed, 18 Dec 96 08:40:52 PST

To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> >> I want to have a flashing red spot or two on the screen. But I don't
> >> specifically want to redraw everything every time. So I thought of changing
> >> the color pointed to by FL_FREE_COL1 every now & then, using a timer.
> >
> >The problem is likely that your changes are not flushed to the
> >server. To force a flush, execute
> >
> > XFlush( fl_get_display() );
>
> Nope, sorry, doesn't work :-(

Quite right. Sorry -- I should have tested before I made a
recommendation.

> I might have a fair number of little red dots on a couple of screens and I
> would like to make them flash without having to go through a list using
> fl_show_object. That's why I thought that, if I could change the palette, it
> would be better.
>
> Has anybody ever done something like this? I.e. remapping the X palette on
> the fly?

About the only way I can see without doing a lot of really ugly
hackery to get around XForms's color management is to do

fl_mapcolor( FL_FREE_COL1, red, green, blue );
fl_redraw_object( object );

If you collect your flashing dinguses into an XForms Group object, you
can just do the fl_redraw_object() for the group and they should
change color. Of course, if you've got zillions of them, you may need
to go to double buffering.

You can't directly manipulate a lot of the XForms colors because
XForms does its best to share the colormap with other applications and
this means that XForms will most likely try to share the real
FL_FREE_COL1 (or any other) colormap cell, thus trying to manipulate
that cell will most likely result in a BadAccess violation from X.

spl