Comments (10)
I don't believe ToUnicodeEx will work in a number of situations. I seem to remember starting there a long, long time ago and then moving to the code outlined here. The code was modified from using #define KBD_LONG_POINTER __ptr64 to doing a bunch of hacky things in memory to pad the pointer at runtime. I wrote all this code on a flight from Sydney to Los Angeles about 10 years ago and there are probably several bugs in it but that code makes my face melt and I've avoided revisiting it. There is probably a bug report either against this project or JNativeHook that talks about why this solution was added. You can find one of the changes here. It looks like the change was made in 2.2 and back ported. I will have to go dig though the history and see if I can figure it out at some point.
I am still dealing with a bunch of feature dev for 1.3 and Wayland support needs to happen next so I am probably not going to have the time nor desired to look at this for a while. If ToUnicodeEx works for you, please continue to use it and do let me know how to goes.
from libuiohook.
I presume this is on Windows?
from libuiohook.
Yes, Windows.
from libuiohook.
Windows 10? 11?
32 or 64 bit program?
32 or 64 bit Windows?
This problem comes from the this incredibly ugly bit of code. For whatever reason, this method was unable to determine that the key/modifier combination should have produced an '@'.
This method does some fancy stuff like find the language dll in the registry, loads it up and asks it for a char. If the registry doesn't have the correct dll location you should get an error message and would have likely broken much more than '@'. If you read a little further up, this code was adapted from some code written by Marc-André Moreau. One of the things that was changed was removing the need for _ptr64
in a truly insane and probably buggy dynamic implementation. If there is a fix to your problem this is likely it. IF I can duplicate the issue, I'll take a look and see if this was caused by the _ptr64
stuff as I really only ever use MSVC on Windows these days.
from libuiohook.
from libuiohook.
from libuiohook.
In my fork I've managed to improve getting the characters for the key typed events on Windows by removing the obscure code which gets the characters and using ToUnicodeEx
instead. I'm not 100% sure that it works correctly, but I've tested it on my machine with various keyboard layouts, and it seemed to work.
Here's the commit with the relevant changes: fb88601
from libuiohook.
Hi! Thanks a lot for addressing this issue. Should I post again when I can test? Could take some time.
from libuiohook.
Sure, any bit of feedback is appreciated!
The fix is available in version 5.0.0 of SharpHook BTW.
from libuiohook.
I've just looked at the change in JNativeHook which you've linked, and I saw this comment:
/* FIXME ToUnicode needs to be replaced because it doesn't work well with dead keys */
if (ToUnicode(kbhook->vkCode, kbhook->scanCode, keymap, keytxt, sizeof(keytxt) / sizeof(WCHAR), 0) == 1) {
// ...
}
I used ToUnicodeEx
and it actually worked correctly with dead keys - it did produce characters like à and â. I don't know if there were other issues with this approach, but at least one aspect which didn't work now works.
from libuiohook.
Related Issues (20)
- Change USE_OBJC flag to USE_APPKIT
- Rotation value is always zero for mouse wheel events generated by a trackpad on Windows HOT 6
- Unable to post kVK_ANSI_A on MacOS
- Review use of LLKHF_EXTENDED?
- External keyboard modifier keys (Mac) HOT 3
- [Feature Request] Allow event "consumption" on Linux via evdev HOT 14
- [Feature Request] Gamepad support? HOT 1
- [Feature request] gamepads support?
- Can't type special characters with right alt HOT 3
- replace key ouput with other value HOT 11
- Caps lock can't be suppressed on Mac OS Monterey HOT 1
- Posting Keys Does Not Work in Games on Windows
- hook_create_screen_info doesn't work correctly on Windows when there are multiple screens HOT 1
- Darwin Segfualt on CGEventTapCreate failure
- [Feature Request] Add support for Mac Catalyst HOT 8
- Address issues with Windows hook restarts HOT 2
- coordinates multiplied by two for the mouse on windows HOT 9
- error in the readme HOT 1
- Add keychar support to press and release HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libuiohook.