diff options
author | csaba <csaba> | 2024-06-22 15:10:55 (GMT) |
---|---|---|
committer | csaba <csaba> | 2024-06-22 15:10:55 (GMT) |
commit | 7c3e2ff815e23cc6ac1ce9891ca659e709776ea4 (patch) | |
tree | 82b9528e7478b80a60eaa8ebd4c730e70c74e772 /library | |
parent | 86129d02d64e51b5ccdc92e3f9317842a6eadf0a (diff) | |
parent | d5d68cc968cfeb0349723c6d43a0613753b476e9 (diff) | |
download | tk-7c3e2ff815e23cc6ac1ce9891ca659e709776ea4.zip tk-7c3e2ff815e23cc6ac1ce9891ca659e709776ea4.tar.gz tk-7c3e2ff815e23cc6ac1ce9891ca659e709776ea4.tar.bz2 |
Some more cleanup, mainly in the Widget Demo.
Diffstat (limited to 'library')
-rw-r--r-- | library/demos/ctext.tcl | 6 | ||||
-rw-r--r-- | library/demos/floor.tcl | 9 | ||||
-rw-r--r-- | library/demos/items.tcl | 15 | ||||
-rw-r--r-- | library/demos/widget | 2 | ||||
-rw-r--r-- | library/tk.tcl | 10 |
5 files changed, 12 insertions, 30 deletions
diff --git a/library/demos/ctext.tcl b/library/demos/ctext.tcl index db78a20..57fbb13 100644 --- a/library/demos/ctext.tcl +++ b/library/demos/ctext.tcl @@ -50,11 +50,7 @@ $c bind text <Return> "textInsert $c \\n" $c bind text <Control-h> "textBs $c" $c bind text <BackSpace> "textBs $c" $c bind text <Delete> "textDel $c" -if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide tk] 8.7-]} { - $c bind text <Button-3> "textPaste $c @%x,%y" -} else { - $c bind text <Button-2> "textPaste $c @%x,%y" -} +$c bind text <Button-2> "textPaste $c @%x,%y" # Next, create some items that allow the text's anchor position # to be edited. diff --git a/library/demos/floor.tcl b/library/demos/floor.tcl index 3cec5de..4bf3ce4 100644 --- a/library/demos/floor.tcl +++ b/library/demos/floor.tcl @@ -1372,13 +1372,8 @@ $c bind floor2 <Button-1> "floorDisplay $c 2" $c bind floor3 <Button-1> "floorDisplay $c 3" $c bind room <Enter> "newRoom $c" $c bind room <Leave> {set currentRoom ""} -if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide tk] 8.7-]} { - bind $c <Button-3> "$c scan mark %x %y" - bind $c <B3-Motion> "$c scan dragto %x %y" -} else { - bind $c <Button-2> "$c scan mark %x %y" - bind $c <B2-Motion> "$c scan dragto %x %y" -} +bind $c <Button-2> "$c scan mark %x %y" +bind $c <B2-Motion> "$c scan dragto %x %y" bind $c <Destroy> "unset currentRoom" set currentRoom "" trace add variable currentRoom write "roomChanged $c" diff --git a/library/demos/items.tcl b/library/demos/items.tcl index 56080fd..7b45cf5 100644 --- a/library/demos/items.tcl +++ b/library/demos/items.tcl @@ -185,17 +185,10 @@ $c create text 28.5c 17.4c -text Scale: -anchor s $c bind item <Enter> "itemEnter $c" $c bind item <Leave> "itemLeave $c" -if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide tk] 8.7-]} { - bind $c <Button-2> "itemMark $c %x %y" - bind $c <B2-Motion> "itemStroke $c %x %y" - bind $c <Button-3> "$c scan mark %x %y" - bind $c <B3-Motion> "$c scan dragto %x %y" -} else { - bind $c <Button-2> "$c scan mark %x %y" - bind $c <B2-Motion> "$c scan dragto %x %y" - bind $c <Button-3> "itemMark $c %x %y" - bind $c <B3-Motion> "itemStroke $c %x %y" -} +bind $c <Button-2> "$c scan mark %x %y" +bind $c <B2-Motion> "$c scan dragto %x %y" +bind $c <Button-3> "itemMark $c %x %y" +bind $c <B3-Motion> "itemStroke $c %x %y" bind $c <<NextChar>> "itemsUnderArea $c" bind $c <Button-1> "itemStartDrag $c %x %y" bind $c <B1-Motion> "itemDrag $c %x %y" diff --git a/library/demos/widget b/library/demos/widget index 62ed3d6..d2dff1c 100644 --- a/library/demos/widget +++ b/library/demos/widget @@ -10,7 +10,7 @@ exec wish "$0" ${1+"$@"} # separate ".tcl" files is this directory, which are sourced by this script as # needed. -package require tk +package require tk 8.7- package require msgcat destroy {*}[winfo children .] diff --git a/library/tk.tcl b/library/tk.tcl index 32f8b31..7741fd0 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -562,14 +562,12 @@ proc ::tk::PreciseScrollDeltas {dxdy} { ## yview moveto. proc ::tk::ScrollByPixels {w deltaX deltaY} { + set fracX [lindex [$w xview] 0] + set fracY [lindex [$w yview] 0] set width [expr {1.0 * [winfo width $w]}] set height [expr {1.0 * [winfo height $w]}] - set X [lindex [$w xview] 0] - set Y [lindex [$w yview] 0] - set x [expr {$X - $deltaX / $width}] - set y [expr {$Y - $deltaY / $height}] - $w xview moveto $x - $w yview moveto $y + $w xview moveto [expr {$fracX - $deltaX / $width}] + $w yview moveto [expr {$fracY - $deltaY / $height}] } # ::tk::TabToWindow -- |