Better handling of mouse leaving window frame