Open LiamKinghouser opened 2 years ago
I honestly have no idea... I can tell you that the reason you're getting the modifier key and not a normal key is because CGEventTapCreate()
returns a kCGEventFlagsChanged
event for modifier key presses and this library creates a key down/up event for the change. The same exact event tap created with CGEventTapCreate()
that produced that modifier event should also produce kCGEventKeyDown
& kCGEventKeyUp
events for non-modifier key presses. You can look at the code here.
OS X or Minecraft are doing something wired that is causing the event tap to not work as expected. You could try enabling the debug logs and see if anything interesting comes out, but it is highly unlikely that there is anything I can do about it from the perspective of this library.
Thanks for the quick response.
I have tried literally everything with the debug logs. I saw a post at one point that recommended setting them all to off to try and see if that would fix the issue, and it did not. When on, no warnings or errors appear. Looks like I do need to update my OS so I'll see if that fixes it.
Set the logs to finest level:
Logger logger = Logger.getLogger(GlobalScreen.class.getPackage().getName());
logger.setLevel(Level.ALL);
logger.setUseParentHandlers(false);
You should see mouse events and key press / release events. Just curious if the key up/down event handler is even being called.
When enabling the logs, nothing is logged, but the key presses are still detected.
This issue is only present inside Minecraft
So basically when pressing shift and a num key, the num key is not detected and only the shift key is registered inside Minecraft. This issue only occurs once, and then right after that, it works properly. Then, a bit later, the issue will arise again. I'm wondering if this has to do with some kind of event priority going to jnativehook before Minecraft, but it's just a guess as I've no idea how this project works. Can provide additional info if needed.