Properly restore window state after exiting full screen mode, fixes #347