Move SDL-centric code into ui/window.c