summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-20 12:27:15 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-04-20 12:27:15 (GMT)
commit48618f68cf19963ba025756c77672298c47b804c (patch)
tree67282c401e49141494e4c57d279601278e19b21c /library
parent29090f7e122f08f970ad2970f6fedb5fd681192c (diff)
parent72dea207ae279d05cfa07445b767e0efb4bb6702 (diff)
downloadtk-48618f68cf19963ba025756c77672298c47b804c.zip
tk-48618f68cf19963ba025756c77672298c47b804c.tar.gz
tk-48618f68cf19963ba025756c77672298c47b804c.tar.bz2
Use vroot size in stead of screen size for clipping window coordinates in ::tk::PlaceWindow.
Use ::tk::PlaceWindow in dialog.tcl, in stead of dumplicating the code there.
Diffstat (limited to 'library')
-rw-r--r--library/bgerror.tcl4
-rw-r--r--library/choosedir.tcl2
-rw-r--r--library/clrpick.tcl2
-rw-r--r--library/dialog.tcl22
-rw-r--r--library/msgbox.tcl2
-rw-r--r--library/tk.tcl17
-rw-r--r--library/tkfbox.tcl6
7 files changed, 20 insertions, 35 deletions
diff --git a/library/bgerror.tcl b/library/bgerror.tcl
index 65e7209..3b21d4c 100644
--- a/library/bgerror.tcl
+++ b/library/bgerror.tcl
@@ -220,7 +220,9 @@ proc ::tk::dialog::error::bgerror err {
bind $dlg.function <Return> [namespace code {ReturnInDetails %W}]
$dlg.function configure -command [namespace code Details]
- # 6. Place the window (centered in the display) and deiconify it.
+ # 6. Withdraw the window, then update all the geometry information
+ # so we know how big it wants to be, then center the window in the
+ # display (Motif style) and de-iconify it.
::tk::PlaceWindow $dlg
diff --git a/library/choosedir.tcl b/library/choosedir.tcl
index 8c87b9e..62e3165 100644
--- a/library/choosedir.tcl
+++ b/library/choosedir.tcl
@@ -89,7 +89,7 @@ proc ::tk::dialog::file::chooseDir:: {args} {
# Withdraw the window, then update all the geometry information
# so we know how big it wants to be, then center the window in the
- # display and de-iconify it.
+ # display (Motif style) and de-iconify it.
::tk::PlaceWindow $w widget $data(-parent)
wm title $w $data(-title)
diff --git a/library/clrpick.tcl b/library/clrpick.tcl
index 712c45d..092915c 100644
--- a/library/clrpick.tcl
+++ b/library/clrpick.tcl
@@ -89,7 +89,7 @@ proc ::tk::dialog::color:: {args} {
# 5. Withdraw the window, then update all the geometry information
# so we know how big it wants to be, then center the window in the
- # display and de-iconify it.
+ # display (Motif style) and de-iconify it.
::tk::PlaceWindow $w widget $data(-parent)
wm title $w $data(-title)
diff --git a/library/dialog.tcl b/library/dialog.tcl
index 1ae5b8a..adea259 100644
--- a/library/dialog.tcl
+++ b/library/dialog.tcl
@@ -146,27 +146,9 @@ proc ::tk_dialog {w title text bitmap default args} {
# 6. Withdraw the window, then update all the geometry information
# so we know how big it wants to be, then center the window in the
- # display and de-iconify it.
-
- wm withdraw $w
- update idletasks
- set x [expr {[winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 \
- - [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 geometry $w +$x+$y
- wm deiconify $w
+ # display (Motif style) and de-iconify it.
+ ::tk::PlaceWindow $w
tkwait visibility $w
# 7. Set a grab and claim the focus too.
diff --git a/library/msgbox.tcl b/library/msgbox.tcl
index 087567e..60a2a19 100644
--- a/library/msgbox.tcl
+++ b/library/msgbox.tcl
@@ -395,7 +395,7 @@ proc ::tk::MessageBox {args} {
# 7. Withdraw the window, then update all the geometry information
# so we know how big it wants to be, then center the window in the
- # display and de-iconify it.
+ # display (Motif style) and de-iconify it.
::tk::PlaceWindow $w widget $data(-parent)
diff --git a/library/tk.tcl b/library/tk.tcl
index 5e6f4a6..b259240 100644
--- a/library/tk.tcl
+++ b/library/tk.tcl
@@ -116,15 +116,15 @@ proc ::tk::PlaceWindow {w {place ""} {anchor ""}} {
set checkBounds 0
}
if {$checkBounds} {
- if {$x < 0} {
- set x 0
- } elseif {$x > ([winfo screenwidth $w]-[winfo reqwidth $w])} {
- set x [expr {[winfo screenwidth $w]-[winfo reqwidth $w]}]
+ if {$x < [winfo vrootx $w]} {
+ set x [winfo vrootx $w]
+ } elseif {$x > ([winfo vrootx $w]+[winfo vrootwidth $w]-[winfo reqwidth $w])} {
+ set x [expr {[winfo vrootx $w]+[winfo vrootwidth $w]-[winfo reqwidth $w]}]
}
- if {$y < 0} {
- set y 0
- } elseif {$y > ([winfo screenheight $w]-[winfo reqheight $w])} {
- set y [expr {[winfo screenheight $w]-[winfo reqheight $w]}]
+ if {$y < [winfo vrooty $w]} {
+ set y [winfo vrooty $w]
+ } elseif {$y > ([winfo vrooty $w]+[winfo vrootheight $w]-[winfo reqheight $w])} {
+ set y [expr {[winfo vrooty $w]+[winfo vrootheight $w]-[winfo reqheight $w]}]
}
if {[tk windowingsystem] eq "aqua"} {
# Avoid the native menu bar which sits on top of everything.
@@ -133,6 +133,7 @@ proc ::tk::PlaceWindow {w {place ""} {anchor ""}} {
}
}
}
+ wm maxsize $w [winfo vrootwidth $w] [winfo vrootheight $w]
wm geometry $w +$x+$y
wm deiconify $w
}
diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl
index 6354300..ff79df8 100644
--- a/library/tkfbox.tcl
+++ b/library/tkfbox.tcl
@@ -196,9 +196,9 @@ proc ::tk::dialog::file:: {type args} {
}
UpdateWhenIdle $w
- # Withdraw the window, then update all the geometry information so we know
- # how big it wants to be, then center the window in the display and
- # de-iconify it.
+ # Withdraw the window, then update all the geometry information
+ # so we know how big it wants to be, then center the window in the
+ # display (Motif style) and de-iconify it.
::tk::PlaceWindow $w widget $data(-parent)
wm title $w $data(-title)