Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indecisive keycodes, keychar, rawcode #44

Open
1 of 3 tasks
M1ndo opened this issue Oct 9, 2023 · 1 comment
Open
1 of 3 tasks

Indecisive keycodes, keychar, rawcode #44

M1ndo opened this issue Oct 9, 2023 · 1 comment

Comments

@M1ndo
Copy link

M1ndo commented Oct 9, 2023

I've came across a really annoying bug. is that some keys like ctrl, alt, tab, shift, home, end ,delete, caps_lock keys, functions keys are not recognized and display the wrong keycode, keychar, rawcode.

  • Gohook version (or commit ref):
  • Go version: 1.21.1
  • Gcc version: 13.2.1
  • Operating system and bit: Arch Linux (64bit)
  • Resolution: 1920x1080
  • Can you reproduce the bug at Examples:
    • Yes (provide example code)
    • No
    • Not relevant
  • Provide example code: same as at Examples

In the following screenshot you can see, we're not able to obtain the correct keychar/rawcode for ctrl, alt, win key (as an example) are display unrecognized rawcode
image
You can also notice that Keycode is 0 in KeyDown event.
In Another example we can see the difference clearly. that the rawcode is totally undefined.
image
I've searched around the code and couldn't exactly find where these codes are coming from.
One other issue i've spotted is that some keys might have the correct keychar but wrong Rawcode like escape, backspace, enter on keydown event but on up event is not even correct.
image
Here's a list of undefined keys and their respective rawcode.
Ctrl Left :: 65507 // Ctrl Right :: 65508
Windows/Meta Key :: 65515
Alt key :: 65513 // Alt Key Right 65514
Left shift :: 65505 // Right shift :: 65506
Caps Lock :: 65509 // Num Lock :: 65407
F1 :: 65470 // F2 :: 65471
F3 :: 65472 // F4 :: 65473
F5 :: 65474 // F6 :: 65475
F7 :: 65476 // F8 :: 65477
F9 :: 65478 // F10 :: 65479
F11 :: 65480 // F12 :: 65481
Delete :: 65535 // Insert :: 65379
End :: 65367 // Home :: 65360
Page Down :: 65366 // Page Up :: 65365

This issue on windows doesn't exist (sort of)
All these keys i've tried worked except CTRL (L 162 / R 163) , ALT (L 164 / R 165) , SHIFT (L 160 / R 161)

@M1ndo
Copy link
Author

M1ndo commented Oct 11, 2023

I have created a workaround this issue for both Windows/Linux here maybe it be useful for you to fix it.
Just to elaborate little bit, using my workaround works pretty well and translating keycodes works exactly it supposed to be.
I'm not sure about darwin or existing of this issue in the, so its probably a good idea to investigate it .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant