summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-09-04 02:05:52 (GMT)
committerhobbs <hobbs>2002-09-04 02:05:52 (GMT)
commit45e3631faf0960201c791c0b5ae29662c97b0fe2 (patch)
treeec49cb43644703a7d3f93728a719c315aca6588a
parentf1f341ddda6f49a2e7b4a9ac30de8bd8cbc6e3a4 (diff)
downloadtk-45e3631faf0960201c791c0b5ae29662c97b0fe2.zip
tk-45e3631faf0960201c791c0b5ae29662c97b0fe2.tar.gz
tk-45e3631faf0960201c791c0b5ae29662c97b0fe2.tar.bz2
* library/button.tcl: further restrict buttons to not resetting
the "original" relief if it has changed in the interim. This prevents code that simulated overrelief buttons from not working in 8.4. [Bug #604270]
-rw-r--r--ChangeLog7
-rw-r--r--library/button.tcl84
2 files changed, 62 insertions, 29 deletions
diff --git a/ChangeLog b/ChangeLog
index c23f3e4..ea58c41 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2002-09-03 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/button.tcl: further restrict buttons to not resetting
+ the "original" relief if it has changed in the interim. This
+ prevents code that simulated overrelief buttons from not working
+ in 8.4. [Bug #604270]
+
2002-09-03 Daniel Steffen <das@users.sourceforge.net>
* macosx/Wish.pbproj/project.pbxproj: Bumped version number to
diff --git a/library/button.tcl b/library/button.tcl
index 928e2b1..f6cea6a 100644
--- a/library/button.tcl
+++ b/library/button.tcl
@@ -4,7 +4,7 @@
# checkbutton, and radiobutton widgets and provides procedures
# that help in implementing those bindings.
#
-# RCS: @(#) $Id: button.tcl,v 1.16 2002/09/02 22:00:53 hobbs Exp $
+# RCS: @(#) $Id: button.tcl,v 1.17 2002/09/04 02:05:52 hobbs Exp $
#
# Copyright (c) 1992-1994 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
@@ -152,8 +152,10 @@ proc ::tk::ButtonEnter w {
set Priv($w,relief) [$w cget -relief]
if {$Priv(buttonWindow) eq $w} {
$w configure -relief sunken -state active
- } elseif {[$w cget -overrelief] ne ""} {
- $w configure -relief [$w cget -overrelief]
+ set Priv($w,prelief) sunken
+ } elseif {[set over [$w cget -overrelief]] ne ""} {
+ $w configure -relief $over
+ set Priv($w,prelief) $over
}
}
set Priv(window) $w
@@ -173,12 +175,15 @@ proc ::tk::ButtonLeave w {
$w configure -state normal
}
- # Restore the original button relief if it was changed.
- # That is signaled by the existence of Priv($w,relief).
+ # Restore the original button relief if it was changed by Tk.
+ # That is signaled by the existence of Priv($w,prelief).
if {[info exists Priv($w,relief)]} {
- $w configure -relief $Priv($w,relief)
- unset Priv($w,relief)
+ if {[info exists Priv($w,prelief)] && \
+ $Priv($w,prelief) eq [$w cget -relief]} {
+ $w configure -relief $Priv($w,relief)
+ }
+ unset -nocomplain Priv($w,relief) Priv($w,prelief)
}
set Priv(window) ""
@@ -207,6 +212,7 @@ proc ::tk::ButtonDown w {
if {[$w cget -state] ne "disabled"} {
set Priv(buttonWindow) $w
$w configure -relief sunken -state active
+ set Priv($w,prelief) sunken
# If this button has a repeatdelay set up, get it going with an after
after cancel $Priv(afterId)
@@ -234,8 +240,11 @@ proc ::tk::ButtonUp w {
# Restore the button's relief if it was cached.
if {[info exists Priv($w,relief)]} {
- $w configure -relief $Priv($w,relief)
- unset Priv($w,relief)
+ if {[info exists Priv($w,prelief)] && \
+ $Priv($w,prelief) eq [$w cget -relief]} {
+ $w configure -relief $Priv($w,relief)
+ }
+ unset -nocomplain Priv($w,relief) Priv($w,prelief)
}
# Clean up the after event from the auto-repeater
@@ -268,9 +277,10 @@ proc ::tk::CheckRadioEnter w {
if {$Priv(buttonWindow) eq $w} {
$w configure -state active
}
- if {[$w cget -overrelief] ne ""} {
- set Priv($w,relief) [$w cget -relief]
- $w configure -relief [$w cget -overrelief]
+ if {[set over [$w cget -overrelief]] ne ""} {
+ set Priv($w,relief) [$w cget -relief]
+ set Priv($w,prelief) $over
+ $w configure -relief $over
}
}
set Priv(window) $w
@@ -325,8 +335,10 @@ proc ::tk::ButtonEnter {w} {
set Priv($w,relief) [$w cget -relief]
if {$Priv(buttonWindow) eq $w} {
$w configure -relief sunken
- } elseif {[$w cget -overrelief] ne ""} {
- $w configure -relief [$w cget -overrelief]
+ set Priv($w,prelief) sunken
+ } elseif {[set over [$w cget -overrelief]] ne ""} {
+ $w configure -relief $over
+ set Priv($w,prelief) $over
}
}
set Priv(window) $w
@@ -346,12 +358,15 @@ proc ::tk::ButtonLeave w {
$w configure -state normal
}
- # Restore the original button relief if it was changed.
- # That is signaled by the existence of Priv($w,relief).
+ # Restore the original button relief if it was changed by Tk.
+ # That is signaled by the existence of Priv($w,prelief).
if {[info exists Priv($w,relief)]} {
- $w configure -relief $Priv($w,relief)
- unset Priv($w,relief)
+ if {[info exists Priv($w,prelief)] && \
+ $Priv($w,prelief) eq [$w cget -relief]} {
+ $w configure -relief $Priv($w,relief)
+ }
+ unset -nocomplain Priv($w,relief) Priv($w,prelief)
}
set Priv(window) ""
@@ -380,6 +395,7 @@ proc ::tk::ButtonDown w {
if {[$w cget -state] ne "disabled"} {
set Priv(buttonWindow) $w
$w configure -relief sunken
+ set Priv($w,prelief) sunken
# If this button has a repeatdelay set up, get it going with an after
after cancel $Priv(afterId)
@@ -407,8 +423,11 @@ proc ::tk::ButtonUp w {
# Restore the button's relief if it was cached.
if {[info exists Priv($w,relief)]} {
- $w configure -relief $Priv($w,relief)
- unset Priv($w,relief)
+ if {[info exists Priv($w,prelief)] && \
+ $Priv($w,prelief) eq [$w cget -relief]} {
+ $w configure -relief $Priv($w,relief)
+ }
+ unset -nocomplain Priv($w,relief) Priv($w,prelief)
}
# Clean up the after event from the auto-repeater
@@ -449,9 +468,10 @@ proc ::tk::ButtonEnter {w} {
if {$Priv(buttonWindow) eq $w} {
$w configure -state active
- } elseif {[$w cget -overrelief] ne ""} {
- set Priv($w,relief) [$w cget -relief]
- $w configure -relief [$w cget -overrelief]
+ } elseif {[set over [$w cget -overrelief]] ne ""} {
+ set Priv($w,relief) [$w cget -relief]
+ set Priv($w,prelief) $over
+ $w configure -relief $over
}
}
set Priv(window) $w
@@ -473,12 +493,15 @@ proc ::tk::ButtonLeave w {
$w configure -state normal
}
- # Restore the original button relief if it was changed.
- # That is signaled by the existence of Priv($w,relief).
+ # Restore the original button relief if it was changed by Tk.
+ # That is signaled by the existence of Priv($w,prelief).
if {[info exists Priv($w,relief)]} {
- $w configure -relief $Priv($w,relief)
- unset Priv($w,relief)
+ if {[info exists Priv($w,prelief)] && \
+ $Priv($w,prelief) eq [$w cget -relief]} {
+ $w configure -relief $Priv($w,relief)
+ }
+ unset -nocomplain Priv($w,relief) Priv($w,prelief)
}
set Priv(window) ""
@@ -528,8 +551,11 @@ proc ::tk::ButtonUp w {
# Restore the button's relief if it was cached.
if {[info exists Priv($w,relief)]} {
- $w configure -relief $Priv($w,relief)
- unset Priv($w,relief)
+ if {[info exists Priv($w,prelief)] && \
+ $Priv($w,prelief) eq [$w cget -relief]} {
+ $w configure -relief $Priv($w,relief)
+ }
+ unset -nocomplain Priv($w,relief) Priv($w,prelief)
}
# Clean up the after event from the auto-repeater