Handle emulated events on 'window' (Fixes #535)