Open hendriks73 opened 7 years ago
I need the debug log output. I have answered several issues about this, but no one has posted that output yet.
My best guess is it is a signed vs unsigned bug.
Thanks for the quick comment.
My understanding is that I should turn debug logging on and that this cannot be done via a simple configuration (i.e. without re-building).
Any chance you could make a debug build available somehow? Would make this much easier...
See: https://github.com/kwhat/jnativehook/wiki/ConsoleOutput for java
Ah! Thanks. The other thread mentioned re-compiling...
Does the following excerpt help?
2017-05-19 21:32:38,024 [ 28865] [DEBUG][JNativeHook Hook Thread] org.jnativehook: keycode_to_scancode [331]: Using normal lookup for vk_code: 78
2017-05-19 21:32:38,024 [ 28865] [INFO ][JNativeHook Hook Thread] org.jnativehook: process_key_released [286]: Key 0X31 released. (0X4E)
2017-05-19 21:32:38,024 [ 28865] [DEBUG][JNativeHook Hook Thread] org.jnativehook: dispatch_event [64]: Dispatching event type 5.
2017-05-19 21:32:38,200 [ 29041] [DEBUG][JNativeHook Hook Thread] org.jnativehook: keycode_to_scancode [331]: Using normal lookup for vk_code: 77
2017-05-19 21:32:38,200 [ 29041] [INFO ][JNativeHook Hook Thread] org.jnativehook: process_key_pressed [227]: Key 0X32 pressed. (0X4D)
2017-05-19 21:32:38,200 [ 29041] [DEBUG][JNativeHook Hook Thread] org.jnativehook: dispatch_event [64]: Dispatching event type 4.
2017-05-19 21:32:38,200 [ 29041] [DEBUG][JNativeHook Hook Thread] org.jnativehook: keycode_to_unicode [682]: Refreshing locale cache.
2017-05-19 21:32:38,200 [ 29041] [INFO ][JNativeHook Hook Thread] org.jnativehook: refresh_locale_list [470]: GetKeyboardLayoutList(0, NULL) found 1 layouts.
2017-05-19 21:32:38,200 [ 29041] [INFO ][JNativeHook Hook Thread] org.jnativehook: refresh_locale_list [487]: Received 1 locales.
2017-05-19 21:32:38,200 [ 29041] [DEBUG][JNativeHook Hook Thread] org.jnativehook: get_keyboard_layout_file [433]: Found keyboard layout "A0000409".
2017-05-19 21:32:38,200 [ 29041] [DEBUG][JNativeHook Hook Thread] org.jnativehook: get_keyboard_layout_file [453]: RegOpenKeyEx failed to open key: "SYSTEM\CurrentCon"!
2017-05-19 21:32:38,200 [ 29041] [ERROR][JNativeHook Hook Thread] org.jnativehook: refresh_locale_list [628]: Could not find keyboard map for locale 0XFFFFFFFFF0D30409!
There we go, "SYSTEM\CurrentCon" is not correct! For some reason that string is truncated.... https://github.com/kwhat/libuiohook/blob/1681e2d6d5385f2c98a9c58412bede50c6dcbe67/src/windows/input_helper.c#L435
See line 435/436:
const char *kbdKeyBase = "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\%s";
char *kbdKeyPath = (char *) malloc(sizeof(kbdKeyBase) + KL_NAMELENGTH)
I'm no C expert, but it looks to me like you are using the size of the char
pointer (sizeof(kbdKeyBase)
) and not the size of the array it points to.
That aside, you might want to change line 447:
logger(LOG_LEVEL_DEBUG, "%s [%u]: RegOpenKeyEx failed to open key: \"%s\"!\n",
__FUNCTION__, __LINE__, kbdKey);
to
logger(LOG_LEVEL_DEBUG, "%s [%u]: RegQueryValueEx failed to query value for key: \"%s\"!\n",
__FUNCTION__, __LINE__, kbdKey);
Regarding that sizeof()
comment above. The same issue occurs again in
snprintf(kbdKeyPath, sizeof(kbdKeyBase) ...
Also see http://stackoverflow.com/a/17298238/942774
Instead of sizeof
, perhaps strlen
does what you want.
I will see I if I can fix up this weekend.
Awesome. Thanks!
I have pushed patch f1445ba to master 1.1 and 1.0 upstream. git submodule update should get this project compiling. I have not tested this patch so if you could compile, let me know.
This should be working now. Please let me know / reopen if it still causes a problem with the next release.
Will do. Any idea, when you'll release 2.1.1?
I try and carve out some time this week/weekend to address a few more bugs and then release. I'll try to get it out in +/- a week.
Sorry to bother you again.
Is 2.1.1 still about to be released? Or did real life get in the way? 😉
A little bit of real life and gentoo updates. I am having issues with clang 4 ;(
Well, let me just say—I'm really looking forward to it!
How about a release preview for testing? 😸
I finally got llvm working... I think there is a macro bug in v4.0.0 so I needed to build with -U__STDC_HOSTED__
. Build is in the snapshot repo: https://oss.sonatype.org/content/repositories/snapshots/com/1stleg/jnativehook/2.1.SNAPSHOT/
To use this, you'll need to add
<repository>
<id>oss-sonatype</id>
<name>oss-sonatype</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
to the <repositories>
section of your pom.xml
.
And change the dependency to:
<dependency>
<groupId>com.1stleg</groupId>
<artifactId>jnativehook</artifactId>
<version>2.1.SNAPSHOT</version>
</dependency>
Actually... I have tried a bunch of different ways, but mvn
was not able to download your snapshot. Settings as above. Maven version 3.0.5.
It resolves to
Downloading: https://oss.sonatype.org/content/repositories/snapshots/com/1stleg/jnativehook/2.1.20170625.182326-27/jnativehook-2.1.20170625.182326-27.jar
and that fails with 404
, because the file isn't there.
Maybe this has to do with the version format. I always use X.Y.Z-SNAPSHOT
as the snapshot version format. So for jnativehook that would be 2.1.1-SNAPSHOT
. But that's just a wild guess.
I'm getting a
org.jnativehook: refresh_locale_list [628]: Could not find keyboard map for locale 0XFFFFFFFFF0D30409!
on Windows 7 under macOS Parallels using the snapshot.
@dyorgio Did you have a chance to test this? Any luck?
And with debug on I see:
2017-06-26 22:26:55,782 [126675] [INFO ][JNativeHook Hook Thread] org.jnativehook: win_hook_event_proc [634]: Restarting Windows input hook on window event: 0X800C.
2017-06-26 22:26:55,844 [126737] [INFO ][JNativeHook Hook Thread] org.jnativehook: process_key_pressed [227]: Key 0X45 pressed. (0X90)
2017-06-26 22:26:55,844 [126737] [INFO ][JNativeHook Hook Thread] org.jnativehook: refresh_locale_list [470]: GetKeyboardLayoutList(0, NULL) found 1 layouts.
2017-06-26 22:26:55,844 [126737] [INFO ][JNativeHook Hook Thread] org.jnativehook: refresh_locale_list [487]: Received 1 locales.
2017-06-26 22:26:55,844 [126737] [ERROR][JNativeHook Hook Thread] org.jnativehook: refresh_locale_list [628]: Could not find keyboard map for locale 0XFFFFFFFFF0D30409!
2017-06-26 22:26:55,845 [126738] [INFO ][JNativeHook Hook Thread] org.jnativehook: process_key_released [286]: Key 0X45 released. (0X90)
Well, it looks like I missed something, let me take a look tonight and recompile.
Please let me know, when there is a new snapshot to try. Thanks!
new nightly to test for this bug. There should at least be some better console output.
The snapshot does not contain the NativeKeyAdapter
class...
java.lang.ClassNotFoundException: org.jnativehook.keyboard.NativeKeyAdapter
Has the class been removed on purpose?
@hendriks73 it is version 2.0 which does not have adapter support. I am still sorting out the xcb issue with 2.1 so that build will follow when I figure out if it is fixable.
Alright. I've never used 2.0. I'll wait with testing for a 2.1 version then.
Ok this should address a number of issues that people have been having including this one. Please test and let me know if this issue can be closed.
Using the 2.1.1-rc I'm getting
java.lang.NullPointerException
at org.jnativehook.GlobalScreen.registerNativeHook(GlobalScreen.java:402)
Not sure how that's possible, but that's what I'm seeing on Windows.
That's what I have been hearing, it looks like I botched the != null check here. I'll make a new build tonight.
We're back to
2017-08-02 09:58:43,871 [115362] [ERROR][JNativeHook Hook Thread] org.jnativehook: refresh_locale_list [628]: Could not find keyboard map for locale 0XFFFFFFFFF0D30409!
Debug output:
2017-08-02 10:21:43,376 [224064] [INFO ][JNativeHook Hook Thread] org.jnativehook: refresh_locale_list [470]: GetKeyboardLayoutList(0, NULL) found 1 layouts.
2017-08-02 10:21:43,376 [224064] [INFO ][JNativeHook Hook Thread] org.jnativehook: refresh_locale_list [487]: Received 1 locales.
2017-08-02 10:21:43,377 [224065] [ERROR][JNativeHook Hook Thread] org.jnativehook: refresh_locale_list [628]: Could not find keyboard map for locale 0XFFFFFFFFF0D30409!
2017-08-02 10:21:43,377 [224065] [INFO ][JNativeHook Hook Thread] org.jnativehook: process_key_pressed [227]: Key 0XF pressed. (0X9)
Even am facing the same issue :(
I still can't duplicate this bug with english, polish or german languages but I played around with the cause of this issue and created a new build using strlen. Please test the following file and make sure to set the log level output to debug: https://oss.sonatype.org/content/repositories/snapshots/com/1stleg/jnativehook/2.1.SNAPSHOT/jnativehook-2.1.20170819.180800-42.jar
Still does not work...
2017-08-20 14:23:00,187 [ 69011] [INFO ][JNativeHook Hook Thread] org.jnativehook: win_hook_event_proc [634]: Restarting Windows input hook on window event: 0X800C.
2017-08-20 14:23:32,121 [100945] [INFO ][JNativeHook Hook Thread] org.jnativehook: process_key_pressed [227]: Key 0X45 pressed. (0X90)
2017-08-20 14:23:32,123 [100947] [INFO ][JNativeHook Hook Thread] org.jnativehook: refresh_locale_list [470]: GetKeyboardLayoutList(0, NULL) found 1 layouts.
2017-08-20 14:23:32,123 [100947] [INFO ][JNativeHook Hook Thread] org.jnativehook: refresh_locale_list [487]: Received 1 locales.
2017-08-20 14:23:32,123 [100947] [ERROR][JNativeHook Hook Thread] org.jnativehook: refresh_locale_list [628]: Could not find keyboard map for locale 0XFFFFFFFFF0D30409!
2017-08-20 14:23:32,124 [100948] [INFO ][JNativeHook Hook Thread] org.jnativehook: process_key_released [286]: Key 0X45 released. (0X90)
Does this help?
Hey @kwhat, just a high level idea:
When could not find keyboard fallback to default keyboard (or first).
Maybe parametrize this behavior.
@dyorgio probably but that doesn't address this issue... I still have no idea why this is happening or how to duplicate it. What language are you having trouble with?
Brazilian Portuguese (pt-br). In fact, multiple layouts cause problems too, like accents stop to work. I have asking to my users to delete extra-layouts from windows Control Panel.
I would like to enfatize accents stop to work. problem. In Brazil a lot of words have accents. In any moment you SET layout during libhook key code detection? Maybe the trick is refactor it to stop to SET and only QUERY by keycode-table.
Hi @kwhat, can you generate a new jar with libhook using flag KLF_REORDER on ActivateKeyboardLayout call? I really have problems to build the native lib in my Mac. Maybe you need to save oldLayout (ActivateKeyboardLayout return) to restore, instead use hlk_default.
Hi @kwhat, docker file will be a very good addition! I stopped to use this lib 2 years ago, my software is enterprise and accents problems are not accepted by customers. Currently I use a custom solution based in Jinput to process keyboard events globally, works fine. Maybe some day I put it as opensource :).
Same, happening for me on 2.1.0. I only have a NativeMouseListener
added, but I guess from the comments above this is happening in some native code that registers something about the keyboard with a UK layout.
I'm on Zulu13 JDK on Windows 10.
Jan 09, 2020 8:54:16 PM org.jnativehook.GlobalScreen$NativeHookThread enable
SEVERE: refresh_locale_list [628]: Could not find keyboard map for locale 0X0000000008090409!
Good luck with Docker.
I'm trying to use jnativehook under Windows 7, running in Parallels with OS X 10.10.5 as host.
I keep on getting the error message:
What does it mean and how can I fix this? Also, is this caused by Parallels or will this also happen on a regular Windows installation? Thanks.