Slight refactoring of input, fix picdocument, FFI-API for pic_jpeg

This are three separate things (I probably should have sent three PRs...)

A slight refactoring of the fake_event input device handling (pull out of general implementation, put solely into Kindle device code).

A fix for picdocument so it doesn't crash anymore.

And finally an update of base that would depend on the FFI-API for pic_jpeg that I submitted for base