From 590d429c5fcd570547336bc7ab06310f35f35c0f Mon Sep 17 00:00:00 2001 From: hobbs Date: Thu, 10 Feb 2000 08:52:50 +0000 Subject: * library/listbox.tcl: * library/text.tcl: added support for <4> and <5> for mousewheel style scrolling on Unix for mice that map to these buttons. --- library/listbox.tcl | 19 ++++++++++++++++++- library/text.tcl | 19 ++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/library/listbox.tcl b/library/listbox.tcl index 5c95474..cd5d6c8 100644 --- a/library/listbox.tcl +++ b/library/listbox.tcl @@ -3,7 +3,7 @@ # This file defines the default bindings for Tk listbox widgets # and provides procedures that help in implementing those bindings. # -# RCS: @(#) $Id: listbox.tcl,v 1.9 2000/01/06 02:22:24 hobbs Exp $ +# RCS: @(#) $Id: listbox.tcl,v 1.10 2000/02/10 08:52:50 hobbs Exp $ # # Copyright (c) 1994 The Regents of the University of California. # Copyright (c) 1994-1995 Sun Microsystems, Inc. @@ -183,6 +183,23 @@ bind Listbox { %W yview scroll [expr {- (%D / 120) * 4}] units } +if {[string equal "unix" $tcl_platform(platform)]} { + # Support for mousewheels on Linux/Unix commonly comes through mapping + # the wheel to the extended buttons. If you have a mousewheel, find + # Linux configuration info at: + # http://www.inria.fr/koala/colas/mouse-wheel-scroll/ + bind Listbox <4> { + if {!$tk_strictMotif} { + %W yview scroll -5 units + } + } + bind Listbox <5> { + if {!$tk_strictMotif} { + %W yview scroll 5 units + } + } +} + # tkListboxBeginSelect -- # # This procedure is typically invoked on button-1 presses. It begins diff --git a/library/text.tcl b/library/text.tcl index 557fffa..dd660f8 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.9 2000/01/21 03:54:57 hobbs Exp $ +# RCS: @(#) $Id: text.tcl,v 1.10 2000/02/10 08:52:50 hobbs Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. @@ -456,6 +456,23 @@ bind Text { %W yview scroll [expr {- (%D / 120) * 4}] units } +if {[string equal "unix" $tcl_platform(platform)]} { + # Support for mousewheels on Linux/Unix commonly comes through mapping + # the wheel to the extended buttons. If you have a mousewheel, find + # Linux configuration info at: + # http://www.inria.fr/koala/colas/mouse-wheel-scroll/ + bind Text <4> { + if {!$tk_strictMotif} { + %W yview scroll -5 units + } + } + bind Text <5> { + if {!$tk_strictMotif} { + %W yview scroll 5 units + } + } +} + # tkTextClosestGap -- # Given x and y coordinates, this procedure finds the closest boundary # between characters to the given coordinates and returns the index -- cgit v0.12