Cleaned up the const_cast mess a little.

--HG--
extra : rebase_source : d3ca36c9e2438c114afe339d1cbf704d318b6185
Fixed using the event queue lock before the mutex was created.

This has the benefit of ending the otherwise-bogus complaints that
 SDL_GetError() reports "Passed a NULL mutex" if you call it instead of
 checking if SDL_CreateWindow() actually succeeded.  :)

--HG--
extra : rebase_source : 49ed52691094eab9dd4012bb97f32fbcc678551e