[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XForms] Can Xforms be used to run an animation?

From: Jens Thoms Toerring
Subject: Re: [XForms] Can Xforms be used to run an animation?
Date: Fri, 3 Jul 2015 16:05:47 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hi Peter,

On Thu, Jul 02, 2015 at 07:12:55PM -0700, Peter Rowat wrote:
> Is there a function that will repeatedly call a draw routine forever, at a
> particular rate so the animation speed can be changed? Something like the
> XView function “notify_set_itimer_func” I used long ago.

> I’ve looked at the manual section, 21.1 Timer Object and I’m not sure.

A timer would be one way to go - in the callback function you
do your drawing and restart the timer. Another possibility
would be an idle callback. But all depends on how regular your
redraws have to be done. Idle calbacks are called when there's
time to spare - so they are're not too reliable. Timers are
more precise since they have a much higher priority.

But neither will work when you use up all the CPU time and
never call a function like do_forms() which invokes the
event loop. So, if you expect something that does work in
parallel to doing lots of computations than this won't do
too well - XForms (as I think, most GUI libraries) requires
that you regularly give the event loop a chance to run. But
if you don't do that the whole GUI becomes unresponsive and,
of course, also timer callbacks aren't getting invoked. A
way around that would be to use a "worker| thread for your
computations and passing results back to the main thread,
mostly running the event loop. Then, in a callback you can
display whatever new results you received from the "worker"
thread. Mind though that XForms is not thread-safe in the
sense that you could call XForms functions from such a se-
cond thread - they can only be invoked from the thread that
initialized XForms (via fl_initialize()), having two threads
call them uncoordinatedly is a sure recipe for disaster;-)

I hope this explains your options. Don't hesitate to ask if
my attempt at an explanation is unintelligble or you need
more information.
                            Best regards, Jens
  \   Jens Thoms Toerring  ________      address@hidden
   \_______________________________      http://toerring.de

reply via email to

[Prev in Thread] Current Thread [Next in Thread]