JackieXie168 / logkeys

Automatically exported from code.google.com/p/logkeys
Other
0 stars 0 forks source link

Invalid layout determine (dvorak) #85

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Logkeys fills an array char_keys not true in the case of dvorak layout.
Error contained in the lines

if (i> = sizeof (char_or_func)) break; / / only ever map keycodes up to 128 
(currently N_KEYS_DEFINED are used)
if (! is_char_key (i)) continue; / / only map character keys of keyboard
...
index = to_char_keys_index (- i);

In the case of dvorak layout have the following dumpkeys output

...
keycode 13 = 0x005d
        shift keycode 13 = 0x007d
        altgr keycode 13 = 0x0403
keycode 14 = 0x007f
...

In addition, for keycode 13 we obtain i = 13. When reading the shift i = 14 and 
for him, we check is_char_key, which returns the (false)
Thus we have two extra times increment i (for line shift and altgr) and because 
of this layout is determined not true.

I suggest the following patch which is determined by the layout right.

--- A / src / logkeys.cc
    b / src / logkeys.cc
@ @ -188,7 188,7 @ @ void determine_system_keymap ()
       index = line.find ("U", index);
     }

- If (i> = sizeof (char_or_func)) break; / / only ever map keycodes up to 128 
(currently N_KEYS_DEFINED are used)
     if ((line [0] == 'k') && (i> = sizeof (char_or_func))) break; / / only ever map keycodes up to 128 (currently N_KEYS_DEFINED are used)
     if (! is_char_key (i)) continue; / / only map character keys of keyboard

     assert (line.size ()> 0);
@ @ -217,7 217,7 @ @ void determine_system_keymap ()
     }

     / / Else if line starts with 'shift i'
- Index = to_char_keys_index (- i);
     index = to_char_keys_index (i);
     ss << & line [21]; / / 1st keysym starts at index 21 (skip "\ tshift \ tkeycode XXX =" or "\ taltgr \ tkeycode XXX =")
     ss >> std :: hex >> utf8code;
     if (line [21] == '' && (utf8code & 0xB00)) utf8code ^ = 0xB00; / / see line 0XB00CLUELESS

Sorry for my english

Mihail Kirichenko, Moscow

Original issue reported on code.google.com by kirime...@gmail.com on 24 Mar 2012 at 10:47

GoogleCodeExporter commented 9 years ago
Patch in attach

Original comment by kirime...@gmail.com on 24 Mar 2012 at 10:49

Attachments: