Implemented refresh on window refocus.

Refocus detection isn't terribly efficient, but it's a lot neater than
trying to do it in C++/WinAPI. The code is also a bit of a mess, I need
to tidy up the JS object / UI interaction.