Re: XForms: Problems with two windows and timer

Steve Lamont (
Sat, 15 Nov 97 08:23:35 PST

To subscribers of the xforms list from (Steve Lamont) :

> Hello all,
> excuse my lousy english, ...

Your English is fine, however your text layout was less than readable
(I had to extensively edit it in order to even read it). I don't want
to start another browser war but please, folks, remember that some of
us primitive stone axe hackers don't run and don't wish to run MIMEish
mailer, so be careful with long lines and special (non-ASCII)
characters. A line of 72 characters or fewer is generally the best
since most displays support 80 characters reliably and when you insert
the standard email quote ('>') for replies, lines much longer than
that will begin to wrap around and become unreadable.

> ... I'm using a timer
> (setitimer(ITIMER_REAL,...) ) for doing periodic interaction on a
> first form (window). When showing a secound window (with
> fl_show_form()) XForms sometimes draws some object on the first
> form, where it doesm't belong to. Dose anybody have a solution for
> this?

How are you catching the timer? With a signal handler? What are you
doing in the signal handler? If you're doing anything *other* than
setting a flag to tell yourself you've caught a signal you're probably
confusing XForms and, eventually, X itself.

(Everybody repeat after me:) XForms and Xlib, upon which XForms is
based, are *not* reentrant. Since a signal may occur at any time
while XForms or Xlib might be doing anything, if you make any XForms
or Xlib calls, you are likely to screw up the internal bookkeeping and
cause anomalous behavior or probably eventually core dumps.

There are a couple of ways to do what you want.

First, if you don't otherwise use the idle callback mechanism in
XForms, you can register an idle callback and set the callback delta
to perform your periodic function (since only one idle callback can
exist at any instant, this solution may not be the right one for you
if you have other tasks to be performed in the background.)

Second, you can use the timeout capability built into more recent
versions of XForms. This allows you to set one or more timers to do
various periodic functions (note: these timers are one-shots and have
to be rearmed in the callback to get periodic behavior).

Finally, if you wish, you can use the setitimer() mechanism you are
currently using but register a signal callback with XForms rather than
handling it directly yourself.

Refer to the manual sections on fl_set_idle_callback(),
fl_add_timeout(), and fl_add_signal_callback() for details.

[Note to TC and/or FAQ maintainer. If this isn't in the FAQ or
stressed in the manual, it probably should be]


To unsubscribe, send the message "unsubscribe" to or see
Xforms Home Page:
List Archive: