How to check if window is on top?