diff options
author | culler <culler> | 2020-11-10 13:59:25 (GMT) |
---|---|---|
committer | culler <culler> | 2020-11-10 13:59:25 (GMT) |
commit | d94200fdcf927707b43670e7751208ea902b382e (patch) | |
tree | c8f724ce055955eef67c4b799866138c5389715d /library/text.tcl | |
parent | a49d6e52a72b1f086503ae32cb28b0da62e5fa99 (diff) | |
parent | 6133a711414cfb8fcc3a8b52ecf25b59a09e5800 (diff) | |
download | tk-d94200fdcf927707b43670e7751208ea902b382e.zip tk-d94200fdcf927707b43670e7751208ea902b382e.tar.gz tk-d94200fdcf927707b43670e7751208ea902b382e.tar.bz2 |
Merge main
Diffstat (limited to 'library/text.tcl')
-rw-r--r-- | library/text.tcl | 129 |
1 files changed, 22 insertions, 107 deletions
diff --git a/library/text.tcl b/library/text.tcl index 1c84b40..5db9453 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -3,9 +3,9 @@ # This file defines the default bindings for Tk text widgets and provides # procedures that help in implementing the bindings. # -# Copyright (c) 1992-1994 The Regents of the University of California. -# Copyright (c) 1994-1997 Sun Microsystems, Inc. -# Copyright (c) 1998 by Scriptics Corporation. +# Copyright © 1992-1994 The Regents of the University of California. +# Copyright © 1994-1997 Sun Microsystems, Inc. +# Copyright © 1998 by Scriptics Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -306,9 +306,7 @@ bind Text <Meta-Key> {# nothing} bind Text <Control-Key> {# nothing} bind Text <Escape> {# nothing} bind Text <KP_Enter> {# nothing} -if {[tk windowingsystem] eq "aqua"} { - bind Text <Command-Key> {# nothing} -} +bind Text <Command-Key> {# nothing} # Additional emacs-like bindings: @@ -429,107 +427,29 @@ bind Text <Control-h> { %W see insert } } -if {[tk windowingsystem] ne "aqua"} { - bind Text <Button-2> { - if {!$tk_strictMotif} { - tk::TextScanMark %W %x %y - } - } - bind Text <B2-Motion> { - if {!$tk_strictMotif} { - tk::TextScanDrag %W %x %y - } - } -} else { - bind Text <Button-3> { - if {!$tk_strictMotif} { - tk::TextScanMark %W %x %y - } +bind Text <Button-2> { + if {!$tk_strictMotif} { + tk::TextScanMark %W %x %y } - bind Text <B3-Motion> { - if {!$tk_strictMotif} { - tk::TextScanDrag %W %x %y - } +} +bind Text <B2-Motion> { + if {!$tk_strictMotif} { + tk::TextScanDrag %W %x %y } } set ::tk::Priv(prevPos) {} -# The MouseWheel will typically only fire on Windows and MacOS X. -# However, someone could use the "event generate" command to produce one -# on other platforms. We must be careful not to round -ve values of %D -# down to zero. - -if {[tk windowingsystem] eq "aqua"} { - bind Text <MouseWheel> { - %W yview scroll [expr {-15 * (%D)}] pixels - } - bind Text <Option-MouseWheel> { - %W yview scroll [expr {-150 * (%D)}] pixels - } - bind Text <Shift-MouseWheel> { - %W xview scroll [expr {-15 * (%D)}] pixels - } - bind Text <Shift-Option-MouseWheel> { - %W xview scroll [expr {-150 * (%D)}] pixels - } -} else { - # 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> { - if {%D >= 0} { - %W yview scroll [expr {-%D/3}] pixels - } else { - %W yview scroll [expr {(2-%D)/3}] pixels - } - } - bind Text <Shift-MouseWheel> { - if {%D >= 0} { - %W xview scroll [expr {-%D/3}] pixels - } else { - %W xview scroll [expr {(2-%D)/3}] pixels - } - } +bind Text <MouseWheel> { + tk::MouseWheel %W y %D -3.0 pixels } - -if {[tk windowingsystem] eq "x11"} { - # 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://linuxreviews.org/howtos/xfree/mouse/ - bind Text <Button-4> { - if {!$tk_strictMotif} { - %W yview scroll -50 pixels - } - } - bind Text <Button-5> { - if {!$tk_strictMotif} { - %W yview scroll 50 pixels - } - } - bind Text <Shift-Button-4> { - if {!$tk_strictMotif} { - %W xview scroll -50 pixels - } - } - bind Text <Shift-Button-5> { - if {!$tk_strictMotif} { - %W xview scroll 50 pixels - } - } - bind Text <Button-6> { - if {!$tk_strictMotif} { - %W xview scroll -50 pixels - } - } - bind Text <Button-7> { - if {!$tk_strictMotif} { - %W xview scroll 50 pixels - } - } +bind Text <Option-MouseWheel> { + tk::MouseWheel %W y %D -0.3 pixels +} +bind Text <Shift-MouseWheel> { + tk::MouseWheel %W x %D -3.0 pixels +} +bind Text <Shift-Option-MouseWheel> { + tk::MouseWheel %W x %D -0.3 pixels } # ::tk::TextClosestGap -- @@ -581,12 +501,7 @@ proc ::tk::TextButton1 {w x y} { } else { $w mark gravity $anchorname left } - # Allow focus in any case on Windows, because that will let the - # selection be displayed even for state disabled text widgets. - if {[tk windowingsystem] eq "win32" \ - || [$w cget -state] eq "normal"} { - focus $w - } + focus $w if {[$w cget -autoseparators]} { $w edit separator } |