kwhat / jnativehook

Global keyboard and mouse listeners for Java.
Other
1.75k stars 348 forks source link

Explain keypad number conversions in jni_ConvertToJavaLocation(...) #445

Open spxl opened 1 year ago

spxl commented 1 year ago

// FIXME Should this fall though? comments are highly suspicious. It seems that there should not be a fall-through in these places.

Please describe the logic of the subtractions made for numpad keys 1 to 9

eg *nativeKeyCode -= ((VC_KP_1 - VC_1) - (VC_KP_4 - VC_4) ); // 0x4D - 0x46

Why are these not all just like the code for keypad 0?

https://github.com/kwhat/jnativehook/blob/dd4a524a6e6035acc5180230789992c44ac156b4/src/main/jni/jni_Converter.c#L142-L166