From 3b3c9c1c3c7745de0f2de35cd4a3a1f4fc109c78 Mon Sep 17 00:00:00 2001 From: patthoyts Date: Wed, 13 Aug 2003 10:59:33 +0000 Subject: * library/scale.tcl: Fix for bug #787065 for Button-2 press. * tests/scale.test: Added test for this bug. --- ChangeLog | 5 +++++ library/scale.tcl | 3 ++- tests/scale.test | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index bfa27c8..a9f58f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-08-13 Pat Thoyts + + * library/scale.tcl: Fix for bug #787065 for Button-2 press. + * tests/scale.test: Added test for this bug. + 2003-08-12 Daniel Steffen * macosx/tkMacOSXMenu.c: fixed C99'ism that breaks gcc 2.95. diff --git a/library/scale.tcl b/library/scale.tcl index 894358e..cdae3c9 100644 --- a/library/scale.tcl +++ b/library/scale.tcl @@ -3,7 +3,7 @@ # This file defines the default bindings for Tk scale widgets and provides # procedures that help in implementing the bindings. # -# RCS: @(#) $Id: scale.tcl,v 1.9.2.1 2003/07/19 01:15:32 patthoyts Exp $ +# RCS: @(#) $Id: scale.tcl,v 1.9.2.2 2003/08/13 10:59:33 patthoyts Exp $ # # Copyright (c) 1994 The Regents of the University of California. # Copyright (c) 1994-1995 Sun Microsystems, Inc. @@ -276,6 +276,7 @@ proc ::tk::ScaleButton2Down {w x y} { $w set [$w get $x $y] set Priv(dragging) 1 set Priv(initValue) [$w get] + set Priv($w,relief) [$w cget -sliderrelief] set coords "$x $y" set Priv(deltaX) 0 set Priv(deltaY) 0 diff --git a/tests/scale.test b/tests/scale.test index fb9ba5d..396ed76 100644 --- a/tests/scale.test +++ b/tests/scale.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: scale.test,v 1.12 2002/07/13 20:28:35 dgp Exp $ +# RCS: @(#) $Id: scale.test,v 1.12.2.1 2003/08/13 10:59:33 patthoyts Exp $ package require tcltest 2.1 namespace import -force tcltest::configure @@ -817,6 +817,56 @@ test scale-18.1 {DestroyScale, -cursor option [Bug: 3897]} { destroy .s } {} +test scale-18.2 {Scale button 1 events [Bug 787065]} \ + -setup { + catch {destroy .s} + set y 5 + scale .s -from 0 -to 10 -variable y -orient horizontal -length 150 + pack .s + tkwait visibility .s + set ::error {} + proc bgerror {args} {set ::error $args} + } \ + -body { + list [catch { + event generate .s <1> -x 0 -y 0 + event generate .s -x 0 -y 0 + update + set ::error + } msg] $msg + } \ + -cleanup { + unset ::error + rename bgerror {} + catch {destroy .s} + } \ + -result {0 {}} + +test scale-18.3 {Scale button 2 events [Bug 787065]} \ + -setup { + catch {destroy .s} + set y 5 + scale .s -from 0 -to 10 -variable y -orient horizontal -length 150 + pack .s + tkwait visibility .s + set ::error {} + proc bgerror {args} {set ::error $args} + } \ + -body { + list [catch { + event generate .s <2> -x 0 -y 0 + event generate .s -x 0 -y 0 + update + set ::error + } msg] $msg + } \ + -cleanup { + unset ::error + rename bgerror {} + catch {destroy .s} + } \ + -result {0 {}} + catch {destroy .s} option clear -- cgit v0.12