trouble with gtk idle function callback



Brief summary: when my GTK (1.2.9) idle callback function is installed,
the callback doesn't happen until after at least one event happens (for
instance, if I move the mouse within the window. 

I'm working on an Alto simulator with a GTK interface, as well as a text
(stdin/stdout) interface.  Because the simulation is CPU intensive, when
enabled it runs during GTK idle callbacks.  When the user tells the
simulator to start, gtk_idle_add is called, and when the user wants to
stop it, or a breakpoint is hit, gtk_idle_remove is called.

Since the program started out with the text interface only, currently
that interface is used to start and stop the simulation.  The text
interface uses GNU readline in callback mode, using a callback installed
with gdk_input_add.

When the program is started, I get the window and the command line prompt.
If I give my simulator the "step" or "go" command, the idle callback is
installed (in the context of the input callback).  However, the idle
function doesn't get called, even though everything is idle, until there
is another event.  Moving the mouse within the window will cause this.

Any idea what might cause this, or how to fix it?  If all else fails, is
there a way I can post an event that does nothing, but will allow the
idle callback to happen?

I'm developing and testing on mostly stock Red Hat 7.1, with gtk+-1.2.9-4,
gcc-2.96-81, glibc-2.2.2-10, readline-4.1-9.

If anyone cares to try my program (which is at far too early a stage to
do anything useful), it can be checked out of CVS from SourceForge:

	https://sourceforge.net/projects/altogether/

(Don't mind the "This project has no CVS history" statement on the CVS
page.  I'm not sure why they say that, but the code most definitely IS
in CVS.)

If you try to run it, I recommend a command line "./altogether -d",
which tells it not to start the simulation.  You'll get a "> " prompt
from the debugger.  The commands are "s" to single-step the simulation,
"g" for go, "t" for go with trace output, control-c to stop, and the
ever-important "help" and "quit".

Thanks!
Eric Smith




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