Window focus fixes

Closes #15.