getting mouse coordinates in a KeyPress event

Hello

I have a program that doesn't work anymore with tcl/tk 8.5 or 8.6 on Linux.

This program uses the mouse coordinates in a script bound to <KeyPress>, and it used to work at least in tk 4.1 What happens now is that %x,%y,%X or %Y are replaced by fixed values, not depending on the mouse position, but only on the window position on the screen.

Here is a minimal script to illustrate the problem :

canvas .c
pack .c
focus .c
bind .c <KeyPress> {puts "X=%X Y=%Y x=%x y=%y"}

KPV: as a work-around, why not use winfo pointerxy?

package require Tk
canvas .c
pack .c
focus .c
bind .c <KeyPress> {puts [winfo pointerxy %W]}