Basically trying to separate stuff from window.hh
... with a few leftover bugs and a few missing features. Still, it works nicely.