Subject: * library/dialog.tcl (::tk_dialog): add tkwait visibility before grab. [Bug 1216775]

From: hobbs <hobbs>
Date: Wed, 5 Oct 2005 04:14:19 +0000

---
 ChangeLog          |  3 +++
 library/dialog.tcl | 25 +++++++++++++------------
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8f9d3f4..ff3ed58 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2005-10-04  Jeff Hobbs  <[email-masked]>
 
+	* library/dialog.tcl (::tk_dialog): add tkwait visibility before
+	grab. [Bug 1216775]
+
 	* win/tkWinDialog.c (ChooseDirectoryValidateProc): reset stored
 	path to "" if it doesn't exist and -mustexist is true. [Bug 1309218]
 
diff --git a/library/dialog.tcl b/library/dialog.tcl
index 2a66619..3d64b4d 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.14.2.1 2003/10/22 15:22:07 dkf Exp $
+# RCS: @(#) $Id: dialog.tcl,v 1.14.2.2 2005/10/05 04:14:19 hobbs Exp $
 #
 # Copyright (c) 1992-1993 The Regents of the University of California.
 # Copyright (c) 1994-1997 Sun Microsystems, Inc.
@@ -63,7 +63,7 @@ proc ::tk_dialog {w title text bitmap default args} {
     #
     if {[winfo viewable [winfo toplevel [winfo parent $w]]] } {
 	wm transient $w [winfo toplevel [winfo parent $w]]
-    }    
+    }
 
     if {[string equal $tcl_platform(platform) "macintosh"]
 	    || [string equal [tk windowingsystem] "aqua"]} {
@@ -93,10 +93,9 @@ proc ::tk_dialog {w title text bitmap default args} {
 
     label $w.msg -justify left -text $text
     pack $w.msg -in $w.top -side right -expand 1 -fill both -padx 3m -pady 3m
-    if {[string compare $bitmap ""]} {
-	if {([string equal $tcl_platform(platform) "macintosh"]
-	     || [string equal [tk windowingsystem] "aqua"]) &&\
-		[string equal $bitmap "error"]} {
+    if {$bitmap ne ""} {
+	if {($tcl_platform(platform) eq "macintosh"
+	     || [tk windowingsystem] eq "aqua") && ($bitmap eq "error")} {
 	    set bitmap "stop"
 	}
 	label $w.bitmap -bitmap $bitmap
@@ -165,14 +164,16 @@ proc ::tk_dialog {w title text bitmap default args} {
 	set y 0
     }
     wm maxsize $w [winfo screenwidth $w] [winfo screenheight $w]
-    wm geom $w +$x+$y
+    wm geometry $w +$x+$y
     wm deiconify $w
 
+    tkwait visibility $w
+
     # 7. Set a grab and claim the focus too.
 
     set oldFocus [focus]
     set oldGrab [grab current $w]
-    if {[string compare $oldGrab ""]} {
+    if {$oldGrab ne ""} {
 	set grabStatus [grab status $oldGrab]
     }
     grab $w
@@ -198,11 +199,11 @@ proc ::tk_dialog {w title text bitmap default args} {
 	bind $w <Destroy> {}
 	destroy $w
     }
-    if {[string compare $oldGrab ""]} {
-      if {[string compare $grabStatus "global"]} {
+    if {$oldGrab ne ""} {
+	if {$grabStatus ne "global"} {
 	    grab $oldGrab
-      } else {
-          grab -global $oldGrab
+	} else {
+	    grab -global $oldGrab
 	}
     }
     return $Priv(button)
-- 
cgit v0.12