Fixed some __BEOS__ vs __HAIKU__ preprocessor tests (thanks, Axel!).

Fixes Bugzilla #1773.
Don't set the same GL context twice on Mac OS X (thanks, Alex!).

Fixes Bugzilla #1939.
Patched to compile on pre-C99 compilers.