diff -r -c -N tk8.4.5.dist/doc/winfo.n tk8.4.5.winfo/doc/winfo.n
*** tk8.4.5.dist/doc/winfo.n	2001-12-03 22:07:43.000000000 -0500
--- tk8.4.5.winfo/doc/winfo.n	2003-12-17 12:16:50.000000000 -0500
***************
*** 260,266 ****
  is an integer release number provided by the server.
  .TP
  \fBwinfo toplevel \fIwindow\fR
! Returns the path name of the top-level window containing \fIwindow\fR.
  .TP
  \fBwinfo viewable \fIwindow\fR
  Returns 1 if \fIwindow\fR and all of its ancestors up through the
--- 260,268 ----
  is an integer release number provided by the server.
  .TP
  \fBwinfo toplevel \fIwindow\fR
! Returns the path name of the top-of-hierarchy window containing \fIwindow\fR.
! In standard Tk this will always be a toplevel widget, but extensions may
! create other kinds of top-of-hierarchy widgets.
  .TP
  \fBwinfo viewable \fIwindow\fR
  Returns 1 if \fIwindow\fR and all of its ancestors up through the
diff -r -c -N tk8.4.5.dist/generic/tkCmds.c tk8.4.5.winfo/generic/tkCmds.c
*** tk8.4.5.dist/generic/tkCmds.c	2002-09-02 15:16:23.000000000 -0400
--- tk8.4.5.winfo/generic/tkCmds.c	2003-12-17 12:38:18.000000000 -0500
***************
*** 32,38 ****
   * Forward declarations for procedures defined later in this file:
   */
  
! static TkWindow *	GetToplevel _ANSI_ARGS_((Tk_Window tkwin));
  static char *		WaitVariableProc _ANSI_ARGS_((ClientData clientData,
  			    Tcl_Interp *interp, CONST char *name1,
  			    CONST char *name2, int flags));
--- 32,38 ----
   * Forward declarations for procedures defined later in this file:
   */
  
! static TkWindow *	GetTopHierarchy _ANSI_ARGS_((Tk_Window tkwin));
  static char *		WaitVariableProc _ANSI_ARGS_((ClientData clientData,
  			    Tcl_Interp *interp, CONST char *name1,
  			    CONST char *name2, int flags));
***************
*** 1283,1289 ****
  	    useY = 1;
  
  	    pointerxy:
! 	    winPtr = GetToplevel(tkwin);
  	    if (winPtr == NULL) {
  		x = -1;
  		y = -1;
--- 1283,1289 ----
  	    useY = 1;
  
  	    pointerxy:
! 	    winPtr = GetTopHierarchy(tkwin);
  	    if (winPtr == NULL) {
  		x = -1;
  		y = -1;
***************
*** 1361,1367 ****
  	    break;
  	}
  	case WIN_TOPLEVEL: {
! 	    winPtr = GetToplevel(tkwin);
  	    if (winPtr != NULL) {
  		Tcl_SetStringObj(resultPtr, winPtr->pathName, -1);
  	    }
--- 1361,1367 ----
  	    break;
  	}
  	case WIN_TOPLEVEL: {
! 	    winPtr = GetTopHierarchy(tkwin);
  	    if (winPtr != NULL) {
  		Tcl_SetStringObj(resultPtr, winPtr->pathName, -1);
  	    }
***************
*** 2019,2032 ****
  /*
   *----------------------------------------------------------------------
   *
!  * GetToplevel --
   *
!  *	Retrieves the toplevel window which is the nearest ancestor of
!  *	of the specified window.
   *
   * Results:
!  *	Returns the toplevel window or NULL if the window has no
!  *	ancestor which is a toplevel.
   *
   * Side effects:
   *	None.
--- 2019,2033 ----
  /*
   *----------------------------------------------------------------------
   *
!  * GetTopHierarchy --
   *
!  *	Retrieves the top-of-hierarchy window which is the nearest
!  *	ancestor of the specified window.
   *
   * Results:
!  *	Returns the top-of-hierarchy window, or NULL if the window
!  *	has no ancestor which is at the top of a physical window
!  *	hierarchy.
   *
   * Side effects:
   *	None.
***************
*** 2035,2050 ****
   */
  
  static TkWindow *
! GetToplevel(tkwin)
!     Tk_Window tkwin;		/* Window for which the toplevel should be
! 				 * deterined. */
  {
       TkWindow *winPtr = (TkWindow *) tkwin;
  
!      while (!(winPtr->flags & TK_TOP_LEVEL)) {
  	 winPtr = winPtr->parentPtr;
  	 if (winPtr == NULL) {
! 	     return NULL;
  	 }
       }
       return winPtr;
--- 2036,2051 ----
   */
  
  static TkWindow *
! GetTopHierarchy(tkwin)
!     Tk_Window tkwin;		/* Window for which the top-of-hierarchy
! 				 * ancestor should be deterined. */
  {
       TkWindow *winPtr = (TkWindow *) tkwin;
  
!      while (!(winPtr->flags & TK_TOP_HIERARCHY)) {
  	 winPtr = winPtr->parentPtr;
  	 if (winPtr == NULL) {
! 	     return NULL; /* This should never happen! */
  	 }
       }
       return winPtr;
