Skip site navigation (1)Skip section navigation (2)
Date:              Mon, 20 Feb 95 14:32:03 EWT
From:      Peter Williams <PWILLIAM%ESOC.BITNET@vm.gmd.de>
To:        <OI-USERS@freefall.cdrom.com>
Subject:        Creating Application Windows in an OI_add_timeout callback
Message-ID:  <199502201335.FAA22148@freefall.cdrom.com>

next in thread | raw e-mail | index | archive | help
Hello OI users,

We are currently experiencing some strange behaviour when creating application
windows for a OI_add_timeout callback. Maybe someone out there has come across
the same problem and/or knows a solution.

I have extracted out two small text cases which exhibit the problem. They
appear at the end of this note.

What I am expecting to happen in the first test case is for an application
window to be created and displayed every 5 seconds.

On a Sparc Station IPX this is pretty much what happens, but as more and more
windows are created, the rate at which windows are created increases, ie the
timeout is being ignored.

Things get pretty manic on a Sparc Station 20, my screen is rapidly filled
with windows as though the callback is being called with no timeout whatsoever.

If rather than creating a new window in the callback, I add a new static text
item, everything works as expected. This is shown in the second test case.

(OI 4.0 under Solaris 2.3)

--- TEST CASE ONE ---

/*
  This application creates and displays an empty application window
  once the application has been idle for 5 seconds.
  This process of adding application windows should continue
  ad infinitum approximatly every 5 seconds.
*/

#include <OI/appwin.H>

void timeoutCB(void *argp)
{
    OI_app_window * wind = oi_create_app_window( "wind",1,1,"wind");
    wind->set_associated_object(wind->root(),OI_def_loc,OI_def_loc,OI_active);
}

void main( int argc, char **argv )
{
    OI_init( &argc, argv, "OI Timeout Test" );
    OI_add_timeout(5000,timeoutCB);
    OI_begin_interaction();
    OI_fini();
}

--- TEST CASE TWO ---

/*
  This application creates and displays an empty application window.
  Once the application has been idle for 5 seconds, a static text item
  is created and added to the window. This process of adding text continues
  ad infinitum approximatly every 5 seconds.
*/

#include <OI/appwin.H>
#include <OI/stattxt.H>

OI_app_window   *wind;

void timeoutCB(void *argp)
{
    static int index = 0;
    OI_static_text *text = oi_create_static_text("text","fred");

    text->layout_associated_object(wind,1,index++,OI_active);
}

void main( int argc, char **argv )
{
    OI_init( &argc, argv, "OI Timeout Test" );

    wind = oi_create_app_window( "wind",1,1,"wind");
    wind->set_associated_object(wind->root(),OI_def_loc,OI_def_loc, OI_active);
    wind->set_layout(OI_layout_row_aligned);

    OI_add_timeout(5000,timeoutCB);
    OI_begin_interaction();
    OI_fini();
}

End of Message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199502201335.FAA22148>