Added support for screen flipping in portrait mode.