0

I am using a java library called JNativehook to receive typing event on Lubuntu and Windows, My problem is when I type a character on Lubuntu with an Arabic keyboard layout I receive the English neighbor of the key, But when I used the library on Windows I was receiving the correct key, Why is this happening ? and how can I fix it ? Here is my code :

public void nativeKeyTyped(NativeKeyEvent e)
{
    System.out.println("char: " + e.getKeyChar());
}

I download 2.1 from here https://oss.sonatype.org/content/repositories/snapshots/com/1stleg/jnativehook/2.1.SNAPSHOT/ , But the problem get even worse, when I type one Arabic character I receive weird characters and a lot of events and this just a small part of the output

INFO: hook_event_proc [314]: Key 0 typed. (罟)

Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. (ý
Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. (罟)

Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. ()

Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. ()

Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. (
Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. (
Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. (
Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. (
Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. (ý½
Oct 19, 2016 4:43:27 PM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: hook_event_proc [314]: Key 0 typed. (罟)
Char: 
sam01
  • 1
  • 1

1 Answers1

1

The issue is with how these are translated on Linux, I have changed the backing library which has resoleved the issue in 2.1.

Alex Barker
  • 4,316
  • 4
  • 28
  • 47
  • The version I am using is 2.3 – sam01 Oct 19 '16 at 07:23
  • You are using 2.0.3, 2.1.0 will be the fix version ;) – Alex Barker Oct 19 '16 at 16:39
  • But the last binary release is 2.0.3 https://github.com/kwhat/jnativehook/releases , Should I compile the source ? – sam01 Oct 19 '16 at 19:03
  • Yes, there is no official 2.1 build yet. You will need to compile from src or use the last nightly. Note that the current master is broken as I try and figure out GlobalScreen refactor. https://oss.sonatype.org/content/repositories/snapshots/com/1stleg/jnativehook/2.1.SNAPSHOT/ – Alex Barker Oct 20 '16 at 18:09
  • Make sure your console supports the wide chars. It should support wchar_t but that my not be sufficient. Check java output, not console. – Alex Barker Oct 20 '16 at 19:02
  • The problem not just about wired character I received a lot of event for typing one key and sometimes the JVM crash afterword – sam01 Oct 20 '16 at 19:50
  • Please open a bug on github for the project. I suspect the width of wchar_t is not sufficient. Please include the err_###.log that is automatically produced on crash. – Alex Barker Oct 20 '16 at 20:15