fixed busy-waiting in XWindow.cpp