Enqueue out-of-band events

Provides an out-of-band event queue that gets broadcast as part of the main loop.

This is a generalisation of the keyboard event queue. Keyboard events are now implemented in terms of this interface.

This can be used for handling e.g. window focus events.