[Bug][?] Don't see F1-F10 keys in Linux, F11, F12 wrong.

Ned Konz ned at bike-nomad.com
Mon Jul 21 16:07:34 UTC 2003


On Monday 21 July 2003 03:52 am, Daniel Vainsencher wrote:

> I do Sensor kbdTest, press F1-F10, nothing happens at all. 

Yes, the VM doesn't pass function keys up to Squeak.

> When I
> press an F key above 10, i get " 0 0" printed. Is this a VM
> feature? it doesn't appear to my window manager or X itself
> (changed window manager, Eterms do print something when F1 is
> pressed).
>
> I anybody else seeing this? Ideas?

Yes, I see it too.

I suspect this is a side-effect of how we're translating key strings 
in the VM.

If you compile with DEBUG_EVENTS defined you'll see the translation.

What we're doing is calling XLookupString().
Then if it doesn't come up with a character code, we're trying to 
translate the symbolic keyname.

Now in this case, XLookupString() results in no bytes. Output below 
from xev (1):

KeyPress event, serial 27, synthetic NO, window 0x3400001,
    root 0x7c, subw 0x0, time 2167463, (280,699), root:(286,719),
    state 0x0, keycode 76 (keysym 0xffc7, F10), same_screen YES,
    XLookupString gives 0 bytes:  ""

KeyPress event, serial 27, synthetic NO, window 0x3400001,
    root 0x7c, subw 0x0, time 2170356, (280,699), root:(286,719),
    state 0x0, keycode 95 (keysym 0xffc8, F11), same_screen YES,
    XLookupString gives 0 bytes:  ""

But... there's special logic in there for Sun keyboards.

And the Sun keyboards use the same keysyms as F11 and F12...

#define XK_F11			0xFFC8
#define XK_L1			0xFFC8
#define XK_F12			0xFFC9
#define XK_L2			0xFFC9
#define XK_F13			0xFFCA
#define XK_L3			0xFFCA

And the special logic says (in translateCode()):

# define ALT (8<<8)
  switch (symbolic)
    {
    case XK_L1:		return ALT+'.';	/* stop */
    case XK_L2:		return ALT+'j';	/* again */

So in the case of (for instance) F11, translateCode() returns 
0x0800+0x2e, or 0x82e.

Then the return value of translateCode() is used as a lookup in a 
table with 256 entries...

  if (nConv == 0 && (charCode= translateCode(symbolic)) < 0)
    return -1;	/* unknown key */
  if ((charCode == 127) && mapDelBs)
    charCode= 8;
  if (charCode >= 128)
    charCode= X_to_Squeak[charCode];
  return charCode;

So we get whatever is 0x72e bytes past the end of the table.

Which is apparently 0.

This is probably a bug.
-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE



More information about the Squeak-dev mailing list