summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2019-12-14 20:06:30 (GMT)
committerfvogel <fvogelnew1@free.fr>2019-12-14 20:06:30 (GMT)
commitb5f82eb05e0aa9998385cef1a3135e5a9044c86c (patch)
treec58632dec02b230440da7eb8ca89868ecf5af901 /library
parentefae1b799e7c55c25fcda6f682415a8fd6e2a25f (diff)
parentda273a3121cac74628721669428f7df9efe373a7 (diff)
downloadtk-b5f82eb05e0aa9998385cef1a3135e5a9044c86c.zip
tk-b5f82eb05e0aa9998385cef1a3135e5a9044c86c.tar.gz
tk-b5f82eb05e0aa9998385cef1a3135e5a9044c86c.tar.bz2
Fix [b3b56ae8dc]: ttk widgets overwrite user-set -cursor option
Diffstat (limited to 'library')
-rw-r--r--library/ttk/combobox.tcl4
-rw-r--r--library/ttk/cursors.tcl26
-rw-r--r--library/ttk/panedwindow.tcl13
-rw-r--r--library/ttk/spinbox.tcl4
-rw-r--r--library/ttk/treeview.tcl6
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 852f01c..9125acb 100644
--- a/library/ttk/cursors.tcl
+++ b/library/ttk/cursors.tcl
@@ -137,8 +137,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 8cd3e75..99210af 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] {