diff options
author | dkf <dkf@noemail.net> | 2004-06-30 22:17:55 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2004-06-30 22:17:55 (GMT) |
commit | f36c73a25d2db2b04bf5eac901e4c5743c60872f (patch) | |
tree | 9a4439d8a49e23ad3bd9fffd6f7da1e25e1bcbef /generic/tkCmds.c | |
parent | 76c41cfb5c711767328c52c9c9419d70acd98898 (diff) | |
download | tk-f36c73a25d2db2b04bf5eac901e4c5743c60872f.zip tk-f36c73a25d2db2b04bf5eac901e4c5743c60872f.tar.gz tk-f36c73a25d2db2b04bf5eac901e4c5743c60872f.tar.bz2 |
TIP#153 implementation from Neil McKay, with thanks!
FossilOrigin-Name: ec27edf8c79175a1a201953845426abb4a9edea3
Diffstat (limited to 'generic/tkCmds.c')
-rw-r--r-- | generic/tkCmds.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/generic/tkCmds.c b/generic/tkCmds.c index f664b8c..dfd9af1 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCmds.c,v 1.33 2004/06/29 23:21:43 hobbs Exp $ + * RCS: @(#) $Id: tkCmds.c,v 1.34 2004/06/30 22:18:01 dkf Exp $ */ #include "tkPort.h" @@ -30,7 +30,7 @@ * Forward declarations for procedures defined later in this file: */ -static TkWindow * GetToplevel _ANSI_ARGS_((Tk_Window tkwin)); +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,7 +1283,7 @@ Tk_WinfoObjCmd(clientData, interp, objc, objv) useY = 1; pointerxy: - winPtr = GetToplevel(tkwin); + winPtr = GetTopHierarchy(tkwin); if (winPtr == NULL) { x = -1; y = -1; @@ -1361,7 +1361,7 @@ Tk_WinfoObjCmd(clientData, interp, objc, objv) break; } case WIN_TOPLEVEL: { - winPtr = GetToplevel(tkwin); + winPtr = GetTopHierarchy(tkwin); if (winPtr != NULL) { Tcl_SetStringObj(resultPtr, winPtr->pathName, -1); } @@ -2019,14 +2019,15 @@ TkDeadAppCmd(clientData, interp, argc, argv) /* *---------------------------------------------------------------------- * - * GetToplevel -- + * GetTopHierarchy -- * - * Retrieves the toplevel window which is the nearest ancestor of - * of the specified window. + * Retrieves the top-of-hierarchy window which is the nearest + * ancestor of the specified window. * * Results: - * Returns the toplevel window or NULL if the window has no - * ancestor which is a toplevel. + * 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,17 +2036,17 @@ TkDeadAppCmd(clientData, interp, argc, argv) */ static TkWindow * -GetToplevel(tkwin) - Tk_Window tkwin; /* Window for which the toplevel should be - * deterined. */ +GetTopHierarchy(tkwin) + Tk_Window tkwin; /* Window for which the top-of-hierarchy + * ancestor should be deterined. */ { - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; - while (!(winPtr->flags & TK_TOP_LEVEL)) { - winPtr = winPtr->parentPtr; - if (winPtr == NULL) { - return NULL; - } - } - return winPtr; + while (!(winPtr->flags & TK_TOP_HIERARCHY)) { + winPtr = winPtr->parentPtr; + if (winPtr == NULL) { + return NULL; /* This should never happen! */ + } + } + return winPtr; } |