Import Tk 8.6.12

This commit is contained in:
Steve Dower
2021-11-08 17:28:57 +00:00
parent 070b8750b0
commit c6710de848
290 changed files with 5626 additions and 3660 deletions

View File

@@ -83,9 +83,8 @@ if {[tk windowingsystem] eq "aqua"} {
set mw [winfo reqwidth $menu]
set bw [winfo width $mb]
set dF [expr {[winfo width $mb] - [winfo reqwidth $menu] - $menuPad}]
set entry ""
set entry [::tk::MenuFindName $menu [$mb cget -text]]
if {$entry eq ""} {
if {$entry < 0} {
set entry 0
}
set x [winfo rootx $mb]
@@ -124,25 +123,24 @@ if {[tk windowingsystem] eq "aqua"} {
incr mh 6
incr mw 16
}
set entry {}
set entry [::tk::MenuFindName $menu [$mb cget -text]]
if {$entry eq {}} {
if {$entry < 0} {
set entry 0
}
set x [winfo rootx $mb]
set y [winfo rooty $mb]
switch [$mb cget -direction] {
above {
set entry {}
set entry ""
incr y -$mh
# if we go offscreen to the top, show as 'below'
if {$y < [winfo vrooty $mb]} {
set y [expr {[winfo vrooty $mb] + [winfo rooty $mb]\
+ [winfo reqheight $mb]}]
+ [winfo reqheight $mb]}]
}
}
below {
set entry {}
set entry ""
incr y $bh
# if we go offscreen to the bottom, show as 'above'
if {($y + $mh) > ([winfo vrooty $mb] + [winfo vrootheight $mb])} {
@@ -196,7 +194,7 @@ proc ttk::menubutton::Pulldown {mb} {
$mb state pressed
$mb configure -cursor [$menu cget -cursor]
foreach {x y entry} [PostPosition $mb $menu] { break }
if {$entry ne {}} {
if {$entry >= 0} {
$menu post $x $y $entry
} else {
$menu post $x $y
@@ -228,7 +226,7 @@ proc ttk::menubutton::TransferGrab {mb} {
#
proc ttk::menubutton::FindMenuEntry {menu s} {
set last [$menu index last]
if {$last eq "none" || $last eq ""} {
if {$last eq "none" || $last < 0} {
return ""
}
for {set i 0} {$i <= $last} {incr i} {