edrosten/libcvd — pull request #2 by charleskorn (2013-04-03 06:14:36+00:00)
Title: GLWindow fixes for Windows

This fixes three Windows-specific issues for `GLWindow`:
* Fixes issue where window caption wasn't actually set when passed to the `GLWindow` constructor on Windows.
* Fixes the issue where the window doesn’t respond properly to being closed (eg. by clicking the X button in the top-right hand corner of the window) – it assumed it would receive the `WM_DESTROY` message in the `handle_events` function, but this will never happen – `WM_DESTROY` (and `WM_CLOSE`) will always go to `WndProc`, and so you could end up with either an endless loop, or a crash when the destructor is finally called and it tries to destroy a window that's already been destroyed.
* Fixes a similar issue responding to the `WM_PAINT` message - it was assuming it will receive the message in `handle_events`, but it will always go to `WndProc`.

The last two fixes appear to have solved the problem, but haven't received extensive testing, and may have some threading-related problems (if `handle_events` is called on a different thread to `WndProc`).

(Side note: Visual Studio has reformatted the file, so I'd recommending turning off whitespace comparison.)