diff options
author | hobbs <hobbs@noemail.net> | 1999-12-03 07:15:02 (GMT) |
---|---|---|
committer | hobbs <hobbs@noemail.net> | 1999-12-03 07:15:02 (GMT) |
commit | 4fd36b379f0edfe0652c884bb60133c28e422cb6 (patch) | |
tree | 0bd124d246eb5ce5e085d5fa5f951576e4beee63 /library/tk.tcl | |
parent | acd453d66f7084dfba4a7a29935b3b2392f67109 (diff) | |
download | tk-4fd36b379f0edfe0652c884bb60133c28e422cb6.zip tk-4fd36b379f0edfe0652c884bb60133c28e422cb6.tar.gz tk-4fd36b379f0edfe0652c884bb60133c28e422cb6.tar.bz2 |
* library/msgbox.tcl: added color icons for tk_messageBox on Unix
and Mac when tk_strictMotif isn't set. (Hipp)
* library/tk.tcl: added window bounds checking to ::tk::PlaceWindow
FossilOrigin-Name: 428a104b0f24457e94efe4fe717535a30aaf0e86
Diffstat (limited to 'library/tk.tcl')
-rw-r--r-- | library/tk.tcl | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/library/tk.tcl b/library/tk.tcl index e64a98f..dc793e8 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -3,7 +3,7 @@ # Initialization script normally executed in the interpreter for each # Tk-based application. Arranges class bindings for widgets. # -# RCS: @(#) $Id: tk.tcl,v 1.14 1999/11/30 00:02:12 hobbs Exp $ +# RCS: @(#) $Id: tk.tcl,v 1.15 1999/12/03 07:15:02 hobbs Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. @@ -45,19 +45,20 @@ namespace eval ::tk { # Results: # Returns nothing # -proc ::tk::PlaceWindow {w {placement ""} {anchor ""}} { +proc ::tk::PlaceWindow {w {place ""} {anchor ""}} { wm withdraw $w update idletasks - if {[string match p* $placement]} { + set checkBounds 1 + if {[string equal -len [string length $place] $place "pointer"]} { ## place at POINTER (centered if $anchor == center) - if {[string match "c*" $anchor]} { + if {[string equal -len [string length $anchor] $anchor "center"]} { set x [expr {[winfo pointerx $w]-[winfo reqwidth $w]/2}] set y [expr {[winfo pointery $w]-[winfo reqheight $w]/2}] } else { set x [winfo pointerx $w] set y [winfo pointery $w] } - } elseif {[string match w* $placement] && \ + } elseif {[string equal -len [string length $place] $place "widget"] && \ [winfo exists $anchor] && [winfo ismapped $anchor]} { ## center about WIDGET $anchor, widget must be mapped set x [expr {[winfo rootx $anchor] + \ @@ -67,6 +68,19 @@ proc ::tk::PlaceWindow {w {placement ""} {anchor ""}} { } else { set x [expr {([winfo screenwidth $w]-[winfo reqwidth $w])/2}] set y [expr {([winfo screenheight $w]-[winfo reqheight $w])/2}] + 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 {$y < 0} { + set y 0 + } elseif {$y > ([winfo screenheight $w]-[winfo reqheight $w])} { + set y [expr {[winfo screenheight $w]-[winfo reqheight $w]}] + } } wm geometry $w +$x+$y wm deiconify $w |