diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-05-03 08:00:32 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-05-03 08:00:32 (GMT) |
commit | b9aa9a5d2da795de9a7bad7448cc5af7c2c8dd86 (patch) | |
tree | c0830a6a3eb0bed28895c61139b30b1d0943848b | |
parent | 9685eae702c2d72291bb0b47e5ec481b9afa3a80 (diff) | |
parent | acdaf387562f63cecd2e448c4790aa5e02bd89a9 (diff) | |
download | tk-b9aa9a5d2da795de9a7bad7448cc5af7c2c8dd86.zip tk-b9aa9a5d2da795de9a7bad7448cc5af7c2c8dd86.tar.gz tk-b9aa9a5d2da795de9a7bad7448cc5af7c2c8dd86.tar.bz2 |
Use non-busy wait in stead of busy "after 100". Testcase still passes! Great!
-rw-r--r-- | library/button.tcl | 23 | ||||
-rw-r--r-- | tests/button.test | 1 |
2 files changed, 17 insertions, 7 deletions
diff --git a/library/button.tcl b/library/button.tcl index 16624e7..80d8bf9 100644 --- a/library/button.tcl +++ b/library/button.tcl @@ -601,12 +601,23 @@ proc ::tk::ButtonInvoke w { set oldRelief [$w cget -relief] set oldState [$w cget -state] $w configure -state active -relief sunken - update idletasks - after 100 - if {[winfo exists $w]} { - $w configure -state $oldState -relief $oldRelief - uplevel #0 [list $w invoke] - } + after 100 [list ::tk::ButtonInvokeEnd $w $oldState $oldRelief] + } +} + +# ::tk::ButtonInvokeEnd -- +# The procedure below is called after a button is invoked through +# the keyboard. It simulate a release of the button via the mouse. +# +# Arguments: +# w - The name of the widget. +# oldState - Old state to be set back. +# oldRelief - Old relief to be set back. + +proc ::tk::ButtonInvokeEnd {w oldState oldRelief} { + if {[winfo exists $w]} { + $w configure -state $oldState -relief $oldRelief + uplevel #0 [list $w invoke] } } diff --git a/tests/button.test b/tests/button.test index 05f463c..708fc30 100644 --- a/tests/button.test +++ b/tests/button.test @@ -3912,7 +3912,6 @@ test button-14.1 {bug fix: [011706ec42] tk::ButtonInvoke unsafe wrt widget destr proc destroy_button {} { if {[winfo exists .top.b]} { destroy .top.b - puts destroyed } } toplevel .top |