The find window algorithm is used to find the lowest level window
enclosing a given point on the desktop. The pseudo-code algorithm of
(FindWindow) functions is listed in
Appendix . This function is typically used by the
desktop component in order to find the target window in the event
propagation module. The find window algorithm starts from the root of
the current window hierarchy. It first checks if the point lies
outside the coordinates of the root window, in that case an error is
returned. If not, at each level either the x or y coordinate of
the point is compared depending on the type of the window at that
level, and appropriate index of the child window (W) is
determined to enclose the point in that dimension. This process
continues in a loop until W is null, a packed node, has no
children, or an H-Node with the point on the border region, and then
W is returned as the lowest level enclosing window.