dvdhrm / kmscon

Linux KMS/DRM based virtual Console Emulator
http://www.freedesktop.org/wiki/Software/kmscon
Other
429 stars 78 forks source link

Numpad buttons don't work #106

Open beojan opened 10 years ago

beojan commented 10 years ago

In kmscon, the numbers (with numlock on), +, -, *, /, ., and enter keys in the numpad area do not work.

dvdhrm commented 10 years ago

What do you mean by "do not work"?

beojan commented 10 years ago

The number keys, and +, -, /, and * keys produce no output, and the enter key does not execute the command (in the shell).

dvdhrm commented 10 years ago

Can you run "make check" which will produce "./test_input". Then run that as root from a command-line and show its output if you press the given keys. And please describe exactly which output happens for which key-presses.

beojan commented 10 years ago

Strangely, different applications get different keys. ZSH gets nothing as I said above. /bin/login gets the correct keys, as does test_input. VIM, gets letters (p, q, r, s, t, u, v, w, x, and y).

dvdhrm commented 10 years ago

Can you please provide the output of ./test_input with a description what was reported on which key-presses?

beojan commented 10 years ago

sym KP_End sym KP_Down sym KP_Next sym KP_Left sym KP_Begin sym KP_Right sym KP_Home sym KP_Up sym KP_Prior sym KP_Multiply unicode sym KP_Subtract unicode - sym KP_Add unicode + ym KP_Enter unicode sym Num_Lock sym KP_1 unicode 1 sym KP_2 unicode 2 sym KP_3 unicode 3 sym KP_4 unicode 4 sym KP_5 unicode 5 sym KP_6 unicode 6 sym KP_7 unicode 7 sym KP_8 unicode 8 sym KP_9 unicode 9 sym KP_Divide unicode / sym KP_Multiply unicode sym KP_Subtract unicode - sym KP_Add unicode + ym KP_Enter unicode sym KP_0 unicode 0 sym KP_Decimal unicode .

This output is correct. The bug appears to be in how kmscon reports these keypresses to applications.

On 23 February 2014 15:11, David Herrmann notifications@github.com wrote:

Can you please provide the output of ./test_input with a description what was reported on which key-presses?

Reply to this email directly or view it on GitHubhttps://github.com/dvdhrm/kmscon/issues/106#issuecomment-35833608 .

dvdhrm commented 10 years ago

Yepp, that depends on whether an applications sets the keypad-application-mode or not. This is done in libtsm src/tsm_vte.c in tsm_vte_handle_keyboard(). I'm not sure why that doesn't work as this is afaik the way to report these keys. Sadly, there's no real documentation so I'm not really sure what to do.

The kmscon repository contains a "test_key" program (built by make check). Can you run this in xterm (or your favorite terminal) and tell me what it reports for keypad keys? I have not numpad/keypad so I cannot really test. Sorry..

beojan commented 10 years ago

Perhaps related, if I start VIM from kmscon, pressing any key puts it into Replace mode.

apcel commented 8 years ago

Something like that also reproduces in any curses "gui": num-keys work as arrow keys, "/" and "*" are swapped What info should I attach? Numpad works, as I can see, everywhere except curses. Should I open another issue?

waveform80 commented 3 years ago

I realize this is probably way too late, but just in case anyone else runs across this like I did and spends several days wondering about it: I'm reasonably convinced this isn't a problem in kmscon, or libtsm, but is a problem in zsh (as mentioned by the OP in the comment above).

More specifically it's an issue in a probable extension (like oh-my-zsh or countless others) that use the smkx/rmkx sequences to place the terminal in application mode. Firing up a bash, dash, or a "raw" zsh (with "zsh +d -f") on my system resulted in the keypad working just fine, but it displayed the exact behaviour noted above (right down to the precise same test_input output) under my "usual" zsh environment.

There's a lot more discussion and workarounds to be found, e.g.:

https://superuser.com/questions/742171/zsh-z-shell-numpad-numlock-doesnt-work http://www.f30.me/2012/10/oh-my-zsh-key-bindings-on-ubuntu-12-10/ https://github.com/ohmyzsh/ohmyzsh/issues/2654 https://github.com/ohmyzsh/ohmyzsh/pull/5113

Some of those may appear Mac OS specific, but it's all the same underlying issue with smkx/rmkx. There's several workarounds to pick from the links above; disable the config setting application mode for zle (zsh's line editor), use bindkey to override the output, or something much more complex (like the PR in the last link). Ultimately though, I think this could be closed as "not a problem in kmscon" (or libtsm for that matter).