| Ticket UUID: | 1954833 | |||
| Title: | Busy canvas grinds after cursor change | |||
| Type: | Bug | Version: | 8.4, 8.5, 8.6.18, 9.0.5, 9.1b1 | |
| Submitter: | jaspert | Created on: | 2008-04-30 13:58:05 | |
| Subsystem: | 04. Canvas Basics | Assigned To: | aku | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2026-10-22 15:05:13 | |
| Resolution: | Fixed | Closed By: | nemethi | |
| Closed on: | 2026-10-22 15:05:13 | |||
| Description: |
If you have a canvas with a large number of items (around 100000) and you change its cursor style, either for the canvas widget itself or some other widget above it in the hierarchy, then the cursor appearance changes immediately but the wish process is busy for about a second afterwards. I have checked this for Tk 8.4 and 8.5 under Linux, Windows and MacOS.
This code snippet illustrates the problem -- click once and the cursor changes immediately, but click twice and the second change is delayed.
======
pack [canvas .c -width 1000 -height 1000 -bg \#ffaaff]
for {set y 0} {$y < 1000} {incr y 3} {
for {set x 0} {$x < 1000} {incr x 3} {
.c create line $x $y [expr $x+5] [expr $y+5]
}
}
proc SwapCursor {} {
if {[string equal watch [.c cget -cursor]]} {
.c config -cursor arrow
} else {
.c config -cursor watch
}
}
bind .c <Button-1> SwapCursor
======
| |||
| User Comments: |
nemethi (claiming to be Csaba Nemethi) added on 2026-10-22 15:05:13:
Serhiy, many thanks! Merged into main, core-9-0-branch, and core-8-6-branch by commits [c2585f66], [75ca4582], and [9e1fb585]. serhiy.storchaka added on 2026-09-22 13:32:46: The cause is that every configure of the canvas widget redrew all its items, whatever option was changed. Measured with the script from the report (111556 items) in 9.1: on Windows 11 "configure -cursor" costs 1030 ms, exactly the second of the report, and "configure -takefocus" 1015 ms, as much as "configure -background" (1026 ms), which has to redraw; on Linux with an X server about 47 ms for each. 8.6.18 and 9.0.5 behave the same. Fixed in [9ad5b07cf2] (branch canvas-configure-redraw): the items are redrawn only if an option which can affect their appearance was given. With the same script "configure -cursor" now costs 5 ms on Windows and 3 ms on Linux, "configure -takefocus" 2 ms and 4 ms, while "configure -background" is unchanged. The remaining cost is the scan of all items for the FORCE_REDRAW flag which is done on every redisplay. | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki