Re: XForms: Queued X event handling

From: Steve Lamont (
Date: Tue Apr 11 2000 - 21:20:32 EDT

  • Next message: Lothar Esser: "XForms: fl_set_object_position"

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

    > I'm using a standard timer with which resets itself at the end of its
    > own call-back, therefore re-triggering itself (a 'heartbeat').

    By timer, I assume you mean the Timer object.

    > This works beautifully, except when there is a lot of other stuff
    > happening grabbing CPU time, then the timer starts piling up
    > call-backs, which all get serviced in a rush when there is a gap in
    > the processing time.
    > I can't seem to lengthen the timer easily when I know this will
    > happen, and I'm not certain how best to use the X-event queue
    > manipulation stuff.

    You probably don't want to muck with the X Event queue.

    You might check to see if the timeout (fl_add_timeout()) does a better

    A possible alternative is to use the gettimeofday() to check whether
    the callback really needs to do anything:

            void your_callback( FL_OBJECT *obj, long data )


                static double last_tick = 0;
                struct timeval tv;
                double this_tick;

                gettimeofday( &tv, NULL );
                this_tick = tv.tv_sec + ( tv.tv_usec * 1.0e-6 );

                if ( this_tick - last_tick > MINIMUM_INTERVAL ) {

                    do_the_real_callback_action( obj, data );
                    last_tick = this_tick;



    It's a hack.

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

    This archive was generated by hypermail 2b29 : Tue Apr 11 2000 - 21:24:29 EDT