Avoid slow redraw lagging behind a large key event queue
Avoid slow redraw lagging behind a large key event queue

This commit fixes a problem that happened when redraw is slower than
keyboard repeat speed (seen on fullscreen on 4k screen with core-i7
integrated GPU). A large queue of next-page commands could build up, making
the viewer unresponsive while the queue is emptied page-by-page.

The fix is to only do the navigation key processing (do_app()) in the key
event callback, and delay the redraw in run_main_loop() to after all events
in the queue have been processed. This way, all queued next-page events can
be handled with a single redraw.

knielsen/mupdf,knielsen/mupdf,knielsen/mupdf,knielsen/mupdf,knielsen/mupdf,knielsen/mupdf