[Freeciv-Dev] Re: (PR#3424) New flush code
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Sun, Mar 02, 2003 at 11:49:05PM -0800, Jason Short wrote:
>
> [rfalke - Fri Feb 28 10:56:30 2003]:
>
> > > One problem is that the SDL event code I used is unreliable.
> > Apparently
> > > SDL can drop events, particularly before the main loop is entered.
> > > After one dropped event the code cannot recover. A good partial
> > > solution would be to move the is_flush_queued=FALSE line into
> > > flush_dirty for SDL and possibly other GUIs.
> >
> > Are you sure the SDL drops events? Can you prove it? Normally it is
> > wrong usage.
>
> Rafal told me that SDL can drop events with no warning.
>
> This doesn't appear to be the case, but after doing some research I
> think SDL_PushEvent used to be broken. It claims to return 0 on
> success, -1 on failure - but everyone says it actually returns the
> number of events enqueued (0 or 1) on success, and -1 on error.
> Apparently this is not the case anymore (at least for my version of SDL).
> According to what I read SDL uses a queue of 127 events, so if this
> queue overflows events will be dropped.
Yes the source says so. This IMHO important fact isn't mentioned in
the docu. Nice.
> I believe this new code handles that correctly, assuming that -1 is
> returned when an event is dropped (I haven't actually seen or tested
> this). Rafal also said it failed to update the canvas when map options
> are toggled, but that's simply because update_map_canvas_visible is not
> called in that case.
>
> I've also updated the patch for current CVS. It may now be in a final form.
> +static void queue_flush(void)
> +{
> + if (!is_flush_queued) {
> + if (SDL_PushEvent(&flush_user_event) == 0) {
> + is_flush_queued = TRUE;
> + }
> + /* Else nothing... */
Here have lost a flush call. Bad.
Some comments in gui-sdl refer to GTK. This is odd.
Also I would like some more formal description of this. What is
flushed to which destination? Also you speak about screen. This is
IMHO wrong. It should be (visible) map canvas.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"I do feel kind of sorry for Microsoft. Their attornies and marketing
force must have tons of ulcers trying to figure out how to beat (not
just co-exist with) a product that has no clearly defined (read
suable) human owner, and that changes on an hourly basis like the
sea changes the layout of the sand on a beach. Severely tough to
fight something like that."
-- David D.W. Downey at linux-kernel
|
|