[Xastir] interrupting a map redraw?

Curt Mills, WE7U archer at eskimo.com
Fri Jul 4 11:27:14 EDT 2003


On Thu, 3 Jul 2003 wes at johnston.net wrote:

> Is there any way to abort a map draw if a user hits the PG UP, PG DN or arrow
> keys while the redraw is happening?  It sure would speed up moving around the
> map.

Sometime later today some new mods will be available via the
anonymous CVS server.  It doesn't work quite like one would expect
yet, but it's certainly better than it was.  We now just set some
variables in the keyboard/mouse callback routines called da_input and
da_resize, then actually do the map drawing/screen update in our main
loop instead of the callback (before that we did all the map drawing
for events in the callback).  With this little tweak it allows us to
interrupt map drawing and restart it on certain keyboard/mouse
events.

You can see this new operation easily if you have a lot of maps
selected and then keep resizing the window.  Before:  Xastir would
draw each and every resize in sequence.  Now, it'll get interrupted
between maps or even during loading of one map, exit, and restart
with the last resize that it has recognized so far.

I ran through all the map_*.c code and added checks for
"interrupt_drawing_now" all over the place.  If we get an interrupt,
we clean up and return from the map drawing (freeing up processor
time for the next draw).

I have some more local mods that I haven't committed yet which
involve waiting a second or two after certain keyboard/mouse
operations before starting the redraw.  This allows multiple events
to get recognized by X11 before we start our redraw, which can get
rid of that uninterruptible first redraw.  If we can instead find an
X11 call that will process all of the keyboard/mouse operations in
the queue, we can just do that one call and then start my redraw
instead of waiting XX seconds.

What happens in the new CVS code is that you may run all the way
through the _first_ redraw before X11 recognizes that there are more
keyboard/mouse events waiting in the queue.  After that first redraw
completes without being interrupted, lots of events in the queue get
processed, and then the next set of redraws are all interrupted,
letting the _last_ one actually run to completion.  Not a perfect
solution, but certainly better/faster than it was.  Like I said, I'm
looking for a "process every input in the queue" command, which I
might be able to call between each map or even every time just before
I check for "interrupt_drawing_now".

Some of the mods were committed rather early this morning, so I guess
I'll revise my estimate and say that they'll be available on the anon
CVS server sometime saturday.

Curt, WE7U.				archer at eskimo.com
http://www.eskimo.com/~archer
  Lotto:  A tax on people who are bad at math. - unknown
Windows:  Microsoft's tax on computer illiterates. - WE7U.
The world DOES revolve around me:  I picked the coordinate system!"



More information about the Xastir mailing list