diff options
author | vincentdarley <vincentdarley> | 2004-09-24 14:03:53 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley> | 2004-09-24 14:03:53 (GMT) |
commit | 00f74438c9deed2111133ed89d2fedab3ff1990d (patch) | |
tree | 069b4e62db5ef0c19eb61ef7427faa10ad7e6f53 | |
parent | 7eb9084b9e65b063d1fea59837f705050fa2847e (diff) | |
download | tk-00f74438c9deed2111133ed89d2fedab3ff1990d.zip tk-00f74438c9deed2111133ed89d2fedab3ff1990d.tar.gz tk-00f74438c9deed2111133ed89d2fedab3ff1990d.tar.bz2 |
fix to mousewheel scrolling
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | library/text.tcl | 15 |
2 files changed, 17 insertions, 2 deletions
@@ -1,3 +1,7 @@ +2004-09-24 Vince Darley <vincentdarley@users.sourceforge.net> + + * library/text.tcl: corrected mousewheel scrolling [Bug 960190] + 2004-09-24 Pat Thoyts <patthoyts@users.sourceforge.net> * win/tkWinX.c: Added declaration for advapi32 now that this file diff --git a/library/text.tcl b/library/text.tcl index fc40aeb..3d3a219 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -3,7 +3,7 @@ # This file defines the default bindings for Tk text widgets and provides # procedures that help in implementing the bindings. # -# RCS: @(#) $Id: text.tcl,v 1.33 2004/09/10 12:13:42 vincentdarley Exp $ +# RCS: @(#) $Id: text.tcl,v 1.34 2004/09/24 14:04:03 vincentdarley Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. @@ -452,8 +452,19 @@ set ::tk::Priv(prevPos) {} # on other platforms. We must be careful not to round -ve values of %D # down to zero. +# We must make sure that positive and negative movements are rounded +# equally to integers, avoiding the problem that +# (int)1/3 = 0, +# but +# (int)-1/3 = -1 +# The following code ensure equal +/- behaviour. bind Text <MouseWheel> { - %W yview scroll [expr {-%D}] pixels + puts stderr %D + if {%D >= 0} { + %W yview scroll [expr {-%D/3}] pixels + } else { + %W yview scroll [expr {(2-%D)/3}] pixels + } } if {[string equal [tk windowingsystem] "aqua"]} { bind Text <Option-MouseWheel> { |