Giter Site home page Giter Site logo

Comments (10)

kwhat avatar kwhat commented on June 9, 2024 1

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.

kwhat avatar kwhat commented on June 9, 2024

I presume this is on Windows?

from libuiohook.

fleischverpackung avatar fleischverpackung commented on June 9, 2024

Yes, Windows.

from libuiohook.

kwhat avatar kwhat commented on June 9, 2024

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.

fleischverpackung avatar fleischverpackung commented on June 9, 2024

from libuiohook.

fleischverpackung avatar fleischverpackung commented on June 9, 2024

from libuiohook.

TolikPylypchuk avatar TolikPylypchuk commented on June 9, 2024

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.

fleischverpackung avatar fleischverpackung commented on June 9, 2024

Hi! Thanks a lot for addressing this issue. Should I post again when I can test? Could take some time.

from libuiohook.

TolikPylypchuk avatar TolikPylypchuk commented on June 9, 2024

Sure, any bit of feedback is appreciated!

The fix is available in version 5.0.0 of SharpHook BTW.

from libuiohook.

TolikPylypchuk avatar TolikPylypchuk commented on June 9, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.