Re: XForms: window focus

Steve Lamont (spl@szechuan.ucsd.edu)
Fri, 27 Mar 98 05:44:51 PST

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

> In order to prevent each animation competing for CPU cycles, I would
> like to attach a seperate on_idle callback to different windows on the
> basis of which window has the current input focus.
>
> Can anyone suggest an elegant way of achieving this?

I'm not sure it's going to be elegant, since, as you know already,
idle callbacks are invoked on an application wide basis.

You could register and unregister idle callbacks by creating a raw
callback (fl_register_raw_callback()) for each of the Forms by
selecting FL_ALL_EVENT and testing for the FocusIn and FocusOut event
types. Alternatively you an use fl_addto_selected_xevent() to do
something similar.

What I've done when I've needed to managed multiple callbacks is to
create an idle callback manager which allows me to do things like
commutate through a list of background tasks which may be dynamically
registered and unregistered on the fly. XForms calls the idle
callback manager through the standard mechanism and then the manager
sorts out what work needs to be done.

spl

_________________________________________________
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/