diff options
Diffstat (limited to 'library/menu.tcl')
-rw-r--r-- | library/menu.tcl | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/library/menu.tcl b/library/menu.tcl index bf5c955..e415ce0 100644 --- a/library/menu.tcl +++ b/library/menu.tcl @@ -408,6 +408,8 @@ proc ::tk::MenuUnpost menu { after cancel [array get Priv menuActivatedTimer] unset -nocomplain Priv(menuActivated) + after cancel [array get Priv menuDeactivatedTimer] + unset -nocomplain Priv(menuDeactivated) catch { if {$mb ne ""} { @@ -563,13 +565,18 @@ proc ::tk::MenuMotion {menu x y state} { set index [$menu index @$x,$y] if {[info exists Priv(menuActivated)] \ && $index ne "none" \ - && $index ne $activeindex \ - && [$menu type $index] eq "cascade"} { + && $index ne $activeindex} { set mode [option get $menu clickToFocus ClickToFocus] if {$mode eq "" || ([string is boolean $mode] && !$mode)} { - set delay [expr {[$menu cget -type] eq "menubar"? 0 : 50}] - set Priv(menuActivatedTimer) \ - [after $delay [list $menu postcascade active]] + set delay [expr {[$menu cget -type] eq "menubar" ? 0 : 50}] + if {[$menu type $activeindex] eq "cascade"} { + set Priv(menuDeactivatedTimer) \ + [after $delay [list $menu postcascade none]] + } + if {[$menu type $index] eq "cascade"} { + set Priv(menuActivatedTimer) \ + [after $delay [list $menu postcascade active]] + } } } } |