Implement Surface.get_flags().

This includes the code required to get the flags from a window.