Better handling of window/fullscreen transition