I want to get the top most window that is at position x and y. In Winapi I do this with WindowFromPoint seen here: https://msdn.microsoft.com/en-us/library/ms633558
XQueryTree gives list of window in the stacking order. You would need to query dimensions for every window in the list and stop when your point is within rectangle