Check that the window has the focus for some events