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 /library | |
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 'library')
-rw-r--r-- | library/bgerror.tcl | 17 | ||||
-rw-r--r-- | library/dialog.tcl | 17 | ||||
-rw-r--r-- | library/msgbox.tcl | 15 |
3 files changed, 25 insertions, 24 deletions
diff --git a/library/bgerror.tcl b/library/bgerror.tcl index f9dc8d8..398e140 100644 --- a/library/bgerror.tcl +++ b/library/bgerror.tcl @@ -4,7 +4,7 @@ # posts a dialog box with the error message and gives the user a chance # to see a more detailed stack trace. # -# RCS: @(#) $Id: bgerror.tcl,v 1.7 2000/04/11 18:19:06 ericm Exp $ +# RCS: @(#) $Id: bgerror.tcl,v 1.8 2000/04/18 02:18:33 ericm Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. @@ -40,21 +40,6 @@ proc bgerror err { set ret [catch {tkerror $err} msg]; if {$ret != 1} {return -code $ret $msg} - # Normally, the bgerror dialog is made transient with respect to "." (due - # to the implementation of tk_dialog). On some systems (like Windows), - # when a window is withdraw or iconified, it's transient windows go with - # it. Unfortunately, there is also a grab on the dialog (again because of - # the implementation of tk_dialog). So if "." is withdrawn or iconified - # and the user gets a bgerror, the app will hang, for no apparent reason. - # - # One (somewhat hacky) way to address this is to un-transient the dialog - # if "." is withdrawn or iconified. - after idle { - if { ![winfo viewable .bgerrorDialog] } { - wm transient .bgerrorDialog {} - } - } - # Ok the application's tkerror either failed or was not found # we use the default dialog then : if {$tcl_platform(platform) == "macintosh"} { diff --git a/library/dialog.tcl b/library/dialog.tcl index 499526e..b3c9dbd 100644 --- a/library/dialog.tcl +++ b/library/dialog.tcl @@ -3,7 +3,7 @@ # This file defines the procedure tk_dialog, which creates a dialog # box containing a bitmap, a message, and one or more buttons. # -# RCS: @(#) $Id: dialog.tcl,v 1.7 2000/01/12 11:45:14 hobbs Exp $ +# RCS: @(#) $Id: dialog.tcl,v 1.8 2000/04/18 02:18:33 ericm Exp $ # # Copyright (c) 1992-1993 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. @@ -53,12 +53,17 @@ proc tk_dialog {w title text bitmap default args} { wm iconname $w Dialog wm protocol $w WM_DELETE_WINDOW { } - # The following command means that the dialog won't be posted if - # [winfo parent $w] is iconified, but it's really needed; otherwise - # the dialog can become obscured by other windows in the application, - # even though its grab keeps the rest of the application from being used. + # Dialog boxes should be transient with respect to their parent, + # so that they will always stay on top of their parent window. However, + # some window managers will create the window as withdrawn if the parent + # window is withdrawn or iconified. Combined with the grab we put on the + # window, this can hang the entire application. Therefore we only make + # the dialog transient if the parent is viewable. + # + if { [winfo viewable [winfo toplevel [winfo parent $w]]] } { + wm transient $w [winfo toplevel [winfo parent $w]] + } - wm transient $w [winfo toplevel [winfo parent $w]] if {[string equal $tcl_platform(platform) "macintosh"]} { unsupported1 style $w dBoxProc } diff --git a/library/msgbox.tcl b/library/msgbox.tcl index 09928ee..f3df745 100644 --- a/library/msgbox.tcl +++ b/library/msgbox.tcl @@ -3,7 +3,7 @@ # Implements messageboxes for platforms that do not have native # messagebox support. # -# RCS: @(#) $Id: msgbox.tcl,v 1.8 1999/12/03 07:15:02 hobbs Exp $ +# RCS: @(#) $Id: msgbox.tcl,v 1.9 2000/04/18 02:18:33 ericm Exp $ # # Copyright (c) 1994-1997 Sun Microsystems, Inc. # @@ -244,7 +244,18 @@ proc tkMessageBox {args} { wm title $w $data(-title) wm iconname $w Dialog wm protocol $w WM_DELETE_WINDOW { } - wm transient $w $data(-parent) + + # Message boxes should be transient with respect to their parent so that + # they always stay on top of the parent window. But some window managers + # will simply create the child window as withdrawn if the parent is not + # viewable (because it is withdrawn or iconified). This is not good for + # "grab"bed windows. So only make the message box transient if the parent + # is viewable. + # + if { [winfo viewable [winfo toplevel $data(-parent)]] } { + wm transient $w $data(-parent) + } + if {[string equal $tcl_platform(platform) "macintosh"]} { unsupported1 style $w dBoxProc } |