kernc / kernc/logkeys

Invalid layout determine (dvorak)

Open
#85 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
C++
Stars
834
Forks
254
PR merge metrics
No merged PRs in 30d

Description

```
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

Contributor guide

No contributing guide indexed for this repository

Research direction

Read determine_system_keymap in src/logkeys.cc and compare its parsing with the provided Dvorak dumpkeys output. Reproduce the keymap case and verify that character-key indexing and layout detection handle shifted and AltGr lines correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.