LaurentGomila/SFML — pull request #301 by ryanfields (2012-10-09 00:39:03+00:00)
Title: Improves fullscreen support on OS X by adding proper display mode … switching.

The existing fullscreen implementation simply opens a window to the size
of the desktop (while creating a context of the requested mode size).
This change tests the requested fullscreen mode for validity and, if the
mode is a valid hardware mode, switches the main display to the
requested mode. The original mode is retained so that when the window
is deallocated, the desktop can be restored to the user's normal display
mode.

This could be further improved by offering the option to fullscreen onto
another display, but that requires multi-display support higher up in
SFML as a prerequisite.

**RELOCATION OF RESPONSIBILITY**
This change introduces a `DisplayImpl` object that takes on responsibility of managing a specific display. Video mode lists are acquired via a `DisplayImpl` instance instead of from a static method in `VideoModeImpl`. This affords the `DisplayImpl` the chance to map native mode references to SFML video mode objects, making it simple to perform a proper mode switch on OS X.

**IMPORTANT**
The one caveat to this change is that Xcode 4 requires a setting change in the sfml-window target in order to avoid a link error. Changing the "Symbols Hidden by Default" build setting to "Yes" resolves the link error. I'm having trouble determining whether Cmake is able to set this during project creation. If not, then I might have to do some extra wrapping around `DisplayImpl` to keep it's usage of `std::vector` from clashing with usage elsewhere. (I haven't quite figured out why it's doing that in the first place...)

This is the solution I referenced in LaurentGomila/SFML#300