Skip to content

Indecisive keycodes, keychar, rawcode #44

@M1ndo

Description

@M1ndo

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions