events will go to the bottommost window which has registered interest. client A owns window A. client B owns window B, which is a subwindow of window A. client A listens for keypress/keyrelease on window A. keypress on window B -> event delivered to client A, window A. client B listens for keypress/keyrelease on window A. keypress on window B -> event delivered to clients A & B, window A. client B listens for keypress/keyrelease on window B. keypress on window B -> event delivered to client B, window B. note client A never receives any event in the last one here, because window B now has interest registered on it. it doesn't matter that it's a different client.