summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2003-10-22 15:22:06 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2003-10-22 15:22:06 (GMT)
commit2b5dcb0f64726e8ebf0793892d2a89ac5bcf4f5e (patch)
tree2947e0c9891eb4bfa5895fbb1e57b18c51c54304
parent36942822bfe420c414a9d44a6cfd15358ab5475b (diff)
downloadtk-2b5dcb0f64726e8ebf0793892d2a89ac5bcf4f5e.zip
tk-2b5dcb0f64726e8ebf0793892d2a89ac5bcf4f5e.tar.gz
tk-2b5dcb0f64726e8ebf0793892d2a89ac5bcf4f5e.tar.bz2
Constrain tk_dialg to be sensibly sized and placed. [Bug 827535]
-rw-r--r--ChangeLog5
-rw-r--r--library/dialog.tcl12
2 files changed, 16 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index bcf143b..67c1c12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-10-22 Donal K. Fellows <fellowsd@cs.man.ac.uk>
+
+ * library/dialog.tcl (tk_dialog): Constrain the dialog to be
+ fairly sensibly sized and placed. [Bug 827535]
+
2003-10-12 Jeff Hobbs <jeffh@ActiveState.com>
* generic/tkInt.h: move TkGetOptionSpec to stubs intDecls
diff --git a/library/dialog.tcl b/library/dialog.tcl
index 2eb425f..2a66619 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 2002/08/31 06:12:28 das Exp $
+# RCS: @(#) $Id: dialog.tcl,v 1.14.2.1 2003/10/22 15:22:07 dkf Exp $
#
# Copyright (c) 1992-1993 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
@@ -155,6 +155,16 @@ proc ::tk_dialog {w title text bitmap default args} {
- [winfo vrootx [winfo parent $w]]}]
set y [expr {[winfo screenheight $w]/2 - [winfo reqheight $w]/2 \
- [winfo vrooty [winfo parent $w]]}]
+ # Make sure that the window is on the screen and set the maximum
+ # size of the window is the size of the screen. That'll let things
+ # fail fairly gracefully when very large messages are used. [Bug 827535]
+ if {$x < 0} {
+ set x 0
+ }
+ if {$y < 0} {
+ set y 0
+ }
+ wm maxsize $w [winfo screenwidth $w] [winfo screenheight $w]
wm geom $w +$x+$y
wm deiconify $w