Re: Peeking into the event queue?

On Mon, Aug 14, 2000 at 03:21:10PM -0300, Ian Britten wrote:
> The reason I'm looking for it is that I'm inside a loop, doing a bunch of
> work, and I need to periodically check to see if the user has hit a key to
> cancel the operation.
> The relevant code is a callback that is initiated by an idle event.  Thus,
> it is blocked, with no events being processed, eliminating any possibility
> of setting up signal handlers, etc.

Call this periodically from inside of your loop, and you won't hangg
the GUI for the duration of your computation:

  while (gtk_events_pending())

Have your cancel keypress callback just set a flag, and then check for
that flag after the above while() loop.


GNU/Linux: Free your mind and your OS will follow.

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