diff options
author | fvogel <fvogelnew1@free.fr> | 2019-12-14 20:05:54 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2019-12-14 20:05:54 (GMT) |
commit | da273a3121cac74628721669428f7df9efe373a7 (patch) | |
tree | 7fc31ed9cf8b1d4e72a0e902888b12dcf1080d2d /library/ttk | |
parent | 0c3533436365a18e275516bcf295e3bb0afd8149 (diff) | |
parent | 5b8024c00ad7e34076fe6cfa5facb94dfebb6bcb (diff) | |
download | tk-da273a3121cac74628721669428f7df9efe373a7.zip tk-da273a3121cac74628721669428f7df9efe373a7.tar.gz tk-da273a3121cac74628721669428f7df9efe373a7.tar.bz2 |
Fix [b3b56ae8dc]: ttk widgets overwrite user-set -cursor option
Diffstat (limited to 'library/ttk')
-rw-r--r-- | library/ttk/combobox.tcl | 4 | ||||
-rw-r--r-- | library/ttk/cursors.tcl | 26 | ||||
-rw-r--r-- | library/ttk/panedwindow.tcl | 13 | ||||
-rw-r--r-- | library/ttk/spinbox.tcl | 4 | ||||
-rw-r--r-- | library/ttk/treeview.tcl | 6 |
5 files changed, 46 insertions, 7 deletions
diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl index 1355a04..2770142 100644 --- a/library/ttk/combobox.tcl +++ b/library/ttk/combobox.tcl @@ -149,12 +149,14 @@ proc ttk::combobox::Drag {w x} { # Set cursor. # proc ttk::combobox::Motion {w x y} { + variable State + ttk::saveCursor $w State(userConfCursor) [ttk::cursor text] if { [$w identify $x $y] eq "textarea" && [$w instate {!readonly !disabled}] } { ttk::setCursor $w text } else { - ttk::setCursor $w "" + ttk::setCursor $w $State(userConfCursor) } } diff --git a/library/ttk/cursors.tcl b/library/ttk/cursors.tcl index 75f7791..f1f9fa1 100644 --- a/library/ttk/cursors.tcl +++ b/library/ttk/cursors.tcl @@ -140,8 +140,30 @@ proc ttk::cursor {name} { proc ttk::setCursor {w name} { variable Cursors - if {[$w cget -cursor] ne $Cursors($name)} { - $w configure -cursor $Cursors($name) + if {[info exists Cursors($name)]} { + set cursorname $Cursors($name) + } else { + set cursorname $name + } + if {[$w cget -cursor] ne $cursorname} { + $w configure -cursor $cursorname + } +} + +## ttk::saveCursor $w $saveVar $excludeList -- +# Set variable $saveVar to the -cursor value from widget $w, +# if either: +# a. $saveVar does not yet exist +# b. the currently user-specified cursor for $w is not in +# $excludeList + +proc ttk::saveCursor {w saveVar excludeList} { + upvar $saveVar sv + if {![info exists sv]} { + set sv [$w cget -cursor] + } + if {[$w cget -cursor] ni $excludeList} { + set sv [$w cget -cursor] } } diff --git a/library/ttk/panedwindow.tcl b/library/ttk/panedwindow.tcl index a2e073b..ba47003 100644 --- a/library/ttk/panedwindow.tcl +++ b/library/ttk/panedwindow.tcl @@ -62,13 +62,22 @@ proc ttk::panedwindow::Release {w x y} { # proc ttk::panedwindow::ResetCursor {w} { variable State + + ttk::saveCursor $w State(userConfCursor) \ + [list [ttk::cursor hresize] [ttk::cursor vresize]] + if {!$State(pressed)} { - ttk::setCursor $w {} + ttk::setCursor $w $State(userConfCursor) } } proc ttk::panedwindow::SetCursor {w x y} { - set cursor "" + variable State + + ttk::saveCursor $w State(userConfCursor) \ + [list [ttk::cursor hresize] [ttk::cursor vresize]] + + set cursor $State(userConfCursor) if {[llength [$w identify $x $y]]} { # Assume we're over a sash. switch -- [$w cget -orient] { diff --git a/library/ttk/spinbox.tcl b/library/ttk/spinbox.tcl index 90a1572..9728755 100644 --- a/library/ttk/spinbox.tcl +++ b/library/ttk/spinbox.tcl @@ -29,12 +29,14 @@ ttk::bindMouseWheel TSpinbox [list ttk::spinbox::MouseWheel %W] # Sets cursor. # proc ttk::spinbox::Motion {w x y} { + variable State + ttk::saveCursor $w State(userConfCursor) [ttk::cursor text] if { [$w identify $x $y] eq "textarea" && [$w instate {!readonly !disabled}] } { ttk::setCursor $w text } else { - ttk::setCursor $w "" + ttk::setCursor $w $State(userConfCursor) } } diff --git a/library/ttk/treeview.tcl b/library/ttk/treeview.tcl index df188b7..81ba27e 100644 --- a/library/ttk/treeview.tcl +++ b/library/ttk/treeview.tcl @@ -102,7 +102,11 @@ proc ttk::treeview::Keynav {w dir} { # Sets cursor, active element ... # proc ttk::treeview::Motion {w x y} { - set cursor {} + variable State + + ttk::saveCursor $w State(userConfCursor) [ttk::cursor hresize] + + set cursor $State(userConfCursor) set activeHeading {} switch -- [$w identify region $x $y] { |