Re: gtk_timeout_change()?
- From: Havoc Pennington <hp redhat com>
- To: "David J. Topper" <topper virginia edu>
- Cc: gtk-list gnome org
- Subject: Re: gtk_timeout_change()?
- Date: 28 Oct 2001 23:52:44 -0500
"David J. Topper" <topper virginia edu> writes:
> Is there something like this? I tried but don't see it. It would come
> in a lot more handy than having to remove the timeout, then set it
> again. A good example is a timer linked to a slider. The timer doesn't
> get updated until the slider motion stops.
There isn't a way to change it, other than add/remove. The add/remove
should work fine though, it's only a couple more lines of code to
type.
> Imagine an app that simply had a flashing circle on the screen,
> controlled by gtk_timeout. It's better to be able to continuously
> control timer rates but can't seem to do it.
The usual way to do smooth animation is to drop frames as
required. i.e. at each timeout, call g_get_current_time(), compute
elapsed time since the animation started, compute what frame _should_
be showing, and then show that frame. This works better than relying
on exact timeout values.
Note that timeout functions self-remove if you return FALSE, so in
each timeout you can re-add a new timeout for the corrected time to
the next frame, and then return FALSE to drop the previous timeout.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]