glwt_events: Fixed uninitialized window on error.
OSX: fix GL context initialization, clean up

Moved context-view association to after the context has been created.

Fixed incorrect behavior in context version attributes caused by a typo
in an #ifdef.
OSX: window close event and glwtQuit fix

Handle windowShouldClose instead of windowWillClose event to get
behavior that is more like other platforms.

Don't terminate the app on glwtQuit.

NSApplocation terminate terminates the entire process, not only the runloop
of the NSApplication object. Using stop instead of terminate only stops the
runloop so we use that instead.

Clean up and refactor window init and cleanup.
OSX: Fix glwtEventHandle(wait=0)

Make glwtEventHandle behave nicely when nextEventMatchingMask returns
nil.

Remove application.[mh] and move keyboard event workaround to
glwtEventHandle instead of subclassing NSApplication. Move
modifier_flags to struct glwt_window_osx.