diff options
author | csaba <csaba> | 2024-06-22 14:54:41 (GMT) |
---|---|---|
committer | csaba <csaba> | 2024-06-22 14:54:41 (GMT) |
commit | d5d68cc968cfeb0349723c6d43a0613753b476e9 (patch) | |
tree | b48c7d794bdf3709f349a13a97376aee227cc512 /library | |
parent | 4c08a968ab2da317b7d0e865ac7288845e8020a7 (diff) | |
download | tk-d5d68cc968cfeb0349723c6d43a0613753b476e9.zip tk-d5d68cc968cfeb0349723c6d43a0613753b476e9.tar.gz tk-d5d68cc968cfeb0349723c6d43a0613753b476e9.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 6874226..5fc32f0 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 81920ed..9b66116 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 335971b..5dc14b8 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 9e7c234..39fbbb1 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 8.6- +package require Tk 8.7- package require msgcat destroy {*}[winfo children .] diff --git a/library/tk.tcl b/library/tk.tcl index bcbf8ce..7916ccb 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 -- |