summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatthoyts@users.sourceforge.net <patthoyts>2010-03-06 01:11:06 (GMT)
committerpatthoyts@users.sourceforge.net <patthoyts>2010-03-06 01:11:06 (GMT)
commit5a00979b032b4c964d6b85c3a23762ec44a86484 (patch)
tree2d70b1de67a8a5752443a30295b59b935a406066
parentc59737e42b3ac998496d98fded7bb51614cc44ff (diff)
downloadtk-5a00979b032b4c964d6b85c3a23762ec44a86484.zip
tk-5a00979b032b4c964d6b85c3a23762ec44a86484.tar.gz
tk-5a00979b032b4c964d6b85c3a23762ec44a86484.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.
-rw-r--r--ChangeLog6
-rw-r--r--library/menu.tcl19
2 files changed, 19 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 76b47bc..13b8191 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-03-06 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/menu.tcl: [Bug 2949774]: When using the non-ClickToFocus
+ menu mode cascade menus should popdown once the pointer moves to
+ another entry to be compatible with current X desktop usage.
+
2010-03-04 Jan Nijtmans <nijtmans@users.sf.net>
* unix/configure.in: Don't use -fvisibility=hidden
diff --git a/library/menu.tcl b/library/menu.tcl
index 751d556..e9d1c27 100644
--- a/library/menu.tcl
+++ b/library/menu.tcl
@@ -4,7 +4,7 @@
# It also implements keyboard traversal of menus and implements a few
# other utility procedures related to menus.
#
-# RCS: @(#) $Id: menu.tcl,v 1.33 2010/01/09 00:43:46 patthoyts Exp $
+# RCS: @(#) $Id: menu.tcl,v 1.34 2010/03/06 01:11:07 patthoyts Exp $
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
@@ -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]]
+ }
}
}
}