summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2011-04-30 22:28:14 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2011-04-30 22:28:14 (GMT)
commit4f503e1d1c1ba2e564bf26b58a23c3caf2c411ea (patch)
treea8b3fc6ac966cd424dd39726fd2df2b642e47e98
parent241ce388b466cd9ccd0c7ab90aa1a5c3e2fb3f09 (diff)
downloadtk-4f503e1d1c1ba2e564bf26b58a23c3caf2c411ea.zip
tk-4f503e1d1c1ba2e564bf26b58a23c3caf2c411ea.tar.gz
tk-4f503e1d1c1ba2e564bf26b58a23c3caf2c411ea.tar.bz2
[Bug 2949774]: cascade menus should popdown ofter loosing the pointer.
When the pointer moves to another entry from a cascade entry the sub-menu should popdown. This is how other menus on X11 work today. This effect will not be used if the user has configured ClickToFocus to maintain the previous Tk menu effects. (backported from trunk) Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
-rw-r--r--library/menu.tcl17
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]]
+ }
}
}
}