Avoid exiting on X11 errors in general

There are many race conditions that can cause X11 errors, so it's not worth it
to abort on them.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
Optimize event processing logic

Use XPending() to make sure we process all events in the buffer before we
repaint.  One paint per event could easily be too aggressive.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>