I'm seeing this problem on Solaris 10, but it may apply to other X11
systems with Input Methods enabled.
Immediately after starting a wish application, if the first
keyboard input is an Alt sequence (e.g. to open a menu) then that
key binding doesn't work.
The following wish script demonstrates the problem:
bind . <Alt-KeyPress> {puts "Alt-KeyPress %K"}
focus -force .
Start wish with the above script. Type Alt+f. The binding is
not fired. Enter Alt+f again and the binding works. Similarily
if another key is entered before the first Alt sequence, then it
works.
The problem is in TkpGetKeySym in unix/tkUnixKey.c. Use of input
methods short-cuts the code to find a keysym, and prevents
TkpInitKeymapInfo being called on the first event.
TkpInitKeymapInfo must be called to setup dispPtr->altModMask for
the bindings to be matched correctly.
A minor reorganisation of the code to ensure TkpInitKeymapInfo is
called fixes the problem, as attached.
tkUnixKey.c, tk8.5.13 fix
I've got it in a branch (bug-3599312) off the main 8.5 branch, but I can't test it because of subtle differences in how OSX supports X11.
I've tested the fix on unix (solaris), but can't help with OSX
Don't worry about OSX; that's just different (this system passes the Alt key over as a Mode_switch keysym with both the keyboards I've tried it with) and wasn't apparently suffering from the problem in the first place.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Read-Only Bugs"
this fix works fine for unix like TK on OSX.
thanx
Applied to 8.5 branch and trunk; thanks for the help with testing!