diff options
author | ericm <ericm> | 2000-04-18 02:18:32 (GMT) |
---|---|---|
committer | ericm <ericm> | 2000-04-18 02:18:32 (GMT) |
commit | 3b8d97bbddc028359dd7f579f7f4e2fdaf887752 (patch) | |
tree | 1a5b1bcdfcedcc57a982da47be2f49a3aba66103 /generic | |
parent | 642a893448534c32d814fa625c78d6ab695cad1b (diff) | |
download | tk-3b8d97bbddc028359dd7f579f7f4e2fdaf887752.zip tk-3b8d97bbddc028359dd7f579f7f4e2fdaf887752.tar.gz tk-3b8d97bbddc028359dd7f579f7f4e2fdaf887752.tar.bz2 |
* win/tkWinDialog.c: Added checks for visibility of parent window
before creating MessageBox and ChooseColor dialogs; this prevents
the application from locking when the parent is withdrawn and the
message box is created. In these cases, the window will be
created without a parent.
* unix/mkLinks: Added WinViewable.3.
* tests/msgbox.test: Added tests for patch from [Bug: 4997].
* library/msgbox.tcl:
* library/dialog.tcl: Applied patch from [Bug: 4997]; detaches
dialog window from parent if parent is not viewable.
* library/bgerror.tcl: Removed workaround from [Bug: 4370]; this
is superceeded by patches to dialog.tcl.
* generic/tkCmds.c: Changed WinfoObjCmd to use Tk_IsViewable
function to determine visibility of windows instead of inlining
the code.
* generic/tkStubInit.c:
* generic/tkDecls.h:
* generic/tk.decls: Added Tk_IsViewable declaration.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tk.decls | 5 | ||||
-rw-r--r-- | generic/tkCmds.c | 16 | ||||
-rw-r--r-- | generic/tkDecls.h | 9 | ||||
-rw-r--r-- | generic/tkStubInit.c | 3 | ||||
-rw-r--r-- | generic/tkUtil.c | 36 |
5 files changed, 51 insertions, 18 deletions
diff --git a/generic/tk.decls b/generic/tk.decls index fe8b72e..9c1d115 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: tk.decls,v 1.7 2000/02/09 02:13:50 hobbs Exp $ +# RCS: @(#) $Id: tk.decls,v 1.8 2000/04/18 02:18:32 ericm Exp $ library tk @@ -1120,6 +1120,9 @@ declare 236 generic { declare 237 generic { double Tk_PostscriptY (double y, Tk_PostscriptInfo psInfo) } +declare 238 generic { + int Tk_IsViewable (Tk_Window tkwin) +} # Define the platform specific public Tk interface. These functions are # only available on the designated platform. diff --git a/generic/tkCmds.c b/generic/tkCmds.c index 34d383c..60b1515 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -10,7 +10,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.11 2000/02/01 11:41:10 hobbs Exp $ + * RCS: @(#) $Id: tkCmds.c,v 1.12 2000/04/18 02:18:32 ericm Exp $ */ #include "tkPort.h" @@ -1179,19 +1179,7 @@ Tk_WinfoObjCmd(clientData, interp, objc, objv) break; } case WIN_VIEWABLE: { - int viewable; - - viewable = 0; - for ( ; ; winPtr = winPtr->parentPtr) { - if ((winPtr == NULL) || !(winPtr->flags & TK_MAPPED)) { - break; - } - if (winPtr->flags & TK_TOP_LEVEL) { - viewable = 1; - break; - } - } - Tcl_SetBooleanObj(resultPtr, viewable); + Tcl_SetBooleanObj(resultPtr, Tk_IsViewable(tkwin)); break; } case WIN_VISUAL: { diff --git a/generic/tkDecls.h b/generic/tkDecls.h index 0a0820d..1ad995c 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkDecls.h,v 1.8 2000/02/08 11:31:32 hobbs Exp $ + * RCS: @(#) $Id: tkDecls.h,v 1.9 2000/04/18 02:18:32 ericm Exp $ */ #ifndef _TKDECLS @@ -815,6 +815,8 @@ EXTERN int Tk_PostscriptStipple _ANSI_ARGS_(( /* 237 */ EXTERN double Tk_PostscriptY _ANSI_ARGS_((double y, Tk_PostscriptInfo psInfo)); +/* 238 */ +EXTERN int Tk_IsViewable _ANSI_ARGS_((Tk_Window tkwin)); typedef struct TkStubHooks { struct TkPlatStubs *tkPlatStubs; @@ -1065,6 +1067,7 @@ typedef struct TkStubs { void (*tk_PostscriptPath) _ANSI_ARGS_((Tcl_Interp * interp, Tk_PostscriptInfo psInfo, double * coordPtr, int numPoints)); /* 235 */ int (*tk_PostscriptStipple) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, Pixmap bitmap)); /* 236 */ double (*tk_PostscriptY) _ANSI_ARGS_((double y, Tk_PostscriptInfo psInfo)); /* 237 */ + int (*tk_IsViewable) _ANSI_ARGS_((Tk_Window tkwin)); /* 238 */ } TkStubs; #ifdef __cplusplus @@ -2027,6 +2030,10 @@ extern TkStubs *tkStubsPtr; #define Tk_PostscriptY \ (tkStubsPtr->tk_PostscriptY) /* 237 */ #endif +#ifndef Tk_IsViewable +#define Tk_IsViewable \ + (tkStubsPtr->tk_IsViewable) /* 238 */ +#endif #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */ diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index f242892..7dee693 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkStubInit.c,v 1.19 2000/04/10 22:43:12 ericm Exp $ + * RCS: @(#) $Id: tkStubInit.c,v 1.20 2000/04/18 02:18:33 ericm Exp $ */ #include "tkInt.h" @@ -948,6 +948,7 @@ TkStubs tkStubs = { Tk_PostscriptPath, /* 235 */ Tk_PostscriptStipple, /* 236 */ Tk_PostscriptY, /* 237 */ + Tk_IsViewable, /* 238 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tkUtil.c b/generic/tkUtil.c index 0ba1f96..b677e03 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.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: tkUtil.c,v 1.7 1999/12/14 06:52:34 hobbs Exp $ + * RCS: @(#) $Id: tkUtil.c,v 1.8 2000/04/18 02:18:33 ericm Exp $ */ #include "tkInt.h" @@ -951,3 +951,37 @@ TkFindStateNumObj(interp, optionPtr, mapPtr, keyPtr) } return mPtr->numKey; } + +/* + *---------------------------------------------------------------------- + * + * Tk_IsViewable -- + * + * Given a Tk_Window pointer, determine if that window is viewable. + * + * Results: + * 1 if the window is viewable, 0 otherwise. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Tk_IsViewable(tkwin) + Tk_Window tkwin; /* Pointer to the window to examine */ +{ + TkWindow *winPtr = (TkWindow *)tkwin; + int viewable = 0; + for ( ; ; winPtr = winPtr->parentPtr) { + if ((winPtr == NULL) || !(winPtr->flags & TK_MAPPED)) { + break; + } + if (winPtr->flags & TK_TOP_LEVEL) { + viewable = 1; + break; + } + } + return viewable; +} |