Menu

#3050 First Alt key event is lost - Fix

obsolete: 8.5.13
closed-fixed
5
2013-02-28
2013-01-03
No

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.

Discussion

  • Colin McDonald

    Colin McDonald - 2013-01-03

    tkUnixKey.c, tk8.5.13 fix

     
  • Jan Nijtmans

    Jan Nijtmans - 2013-01-03
    • assigned_to: cc_benny --> wordtech
     
  • Kevin Walzer

    Kevin Walzer - 2013-01-03
    • assigned_to: wordtech --> dkf
     
  • Donal K. Fellows

    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.

     
  • Colin McDonald

    Colin McDonald - 2013-01-07

    I've tested the fix on unix (solaris), but can't help with OSX

     
  • Donal K. Fellows

    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.

     
  • Donal K. Fellows

    Applied to 8.5 branch and trunk; thanks for the help with testing!

     
  • Donal K. Fellows

    • status: open --> closed-fixed