The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#  Copyright (c) 1990-1993 The Regents of the University of California.
#  Copyright (c) 1994-1996 Sun Microsystems, Inc.
#  See the file "license.terms" for information on usage and redistribution
#  of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
#

=head1 NAME

Tk_CoordsToWindow - Find window containing a point

=for category C Programming

=head1 SYNOPSIS

B<#include E<lt>tk.hE<gt>>

Tk_Window
B<Tk_CoordsToWindow>(I<rootX, rootY, tkwin>)

=head1 ARGUMENTS

=over 4

=item int rootX (in)

X-coordinate (in root window coordinates).

=item int rootY (in)

Y-coordinate (in root window coordinates).

=item Tk_Window tkwin (in)

Token for window that identifies application.

=back

=head1 DESCRIPTION

B<Tk_CoordsToWindow> locates the window that contains a given point.
The point is specified in root coordinates with I<rootX> and
I<rootY> (if a virtual-root window manager is in use then
I<rootX> and I<rootY> are in the coordinate system of the
virtual root window).
The return value from the procedure is a token for the window that
contains the given point.
If the point is not in any window, or if the containing window
is not in the same application as I<tkwin>, then NULL is
returned.

The containing window is decided using the same rules that determine
which window contains the mouse cursor:  if a parent and a child both
contain the point then the child gets preference, and if two siblings
both contain the point then the highest one in the stacking order
(i.e. the one that's visible on the screen) gets preference.

=head1 KEYWORDS

containing, coordinates, root window