implemented blocking, interruptable wait for XEvents in XWindow