Added window rotation detection