-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reset the keyboard status after ToUnicodeEx #1583
base: master
Are you sure you want to change the base?
Conversation
After getting a dead key from `ToUnicodeEx`, add an additional `VK_SPACE` to the keyboard state so we reset the dead key flag and subsequent calls with modifiers, like shift, return the right result (-1) instead of 1. This happened because without reseting the dead key status the new one was attempted to be composed with the old one, which failed and the end result was a single unicode codepoint not marked as a dead key. This opens the door to potentially use the returned unicode from the second call to `ToUnicodeEx` as the key character instead of maintaining the getDeadKey function. This should, hopefully, address issues like debauchee#1267 or debauchee#727 debauchee#1143 or debauchee#795 I have submitted the same patch to Synergy.
Hey, what's the process for getting my PR reviewed? |
Hello @pedronavf, I'm very interested in this fix, though it handles only Windows hosts (I guess?). Would it be possible to extend this to XWindowsKeyState.cpp at least (Linux), and possibly tell me if that could directly fix composite keys? I'm a developer, but it's too much time I don't write C/C++ code. If you wish to explain the key detection flow, I might able to help you experimenting via logging. |
Hi @elegos, what problem are you having? My synergy server runs on Linux and I had problem with the composite keys when I switch to a Windows client. I have a Spanish layout keyboard and I have no problems with composite keys at all on Linux. Is your case the opposite, in which your server is Windows and your client Linux? |
Hello @pedronavf so this is a client fix? With the current version of Barrier (not modified), when I try, for example, to compose SHIFT+', SPACE it writes only a space instead of the quote symbol " (using US international layout), or any vocal instead of space for accented vocals (i.e. ë). Other combinations work fine, for example `+e = è (any vocal). Other example might be the fractions, for example ⅚ (made via AltGR+5+6) doesn't work on the Windows client... AltGr+5 doesn't write the Euro symbol (though CTRL+ALT+5 does). |
can we generate the executable directly from this PR? |
@entomoio I've compiled and succesfully installed the modified version of barrier, applying the patch on the master branch, in a virtual machine. I haven't tested the functionaly yet, but you can download the installer from here (obviously at your own risk): To build it I had to:
|
Lovely, @elegos, thank you very much! It was possible to avoid the dead key quote not being sent by setting the keyboard on client machine to use EN-US keyboard, and since I am using an US keyboard on server machine, setting it to PT-US.international. *one more thing: I had to Reload the server every time the keyboard changed (on client or server), so it would use the new config. |
Sorry @elegos, I missed the notifications for this thread. To answer your question: yes, it's a client only patch. The correct keys were being sent to Windows but they were being mishandled there. What's your setup? Linux server and Windows client both with the layout set to US? |
Hello @pedronavf, Yes exactly, they're both set to US international. Will try my own build with your patch as soon as I'll power my job's laptop up :) |
I can try that combination also @elegos. I'll take a look. Note that I'm using Synergy and not Barrier. |
@pedronavf Ok, here I am, I'm writing from the Windows client machine, using US international on both devices (with dead keys on Linux). Unfortunately pressing [SHIFT} + ', [SPACE] won't write me the quote symbol :( Is there anything I can do to debug the keys being received by barrier client, to investigate whether it's a server or a client issue? (maybe continue on another thread?) |
I changed my Linux machine to use the "English (US) English (intl, with AltGr dead keys)". On Linux I can use all keys with shift and in dead key mode. For the ' key I get (I'm typing this on my Windows client machine)
My keyboard does have an AltGr key. I don't know if that helps. Also, in my configuration I have for my windows machine: meta = altgr I don't know if that helps. Keep in mind that I'm not using barrier but synergy, which has new code for handling keyboard layouts. You might want to give it a try. |
Yes, with the layout English (USA) international with AltGr dead keys it seems to work fine on my guest, too. I might switch to this layout (from English (USA) international with dead keys), though I'd like to know if there was a way to let the 2nd layout work, too. |
Oh, I didn't see that layout. I'll try that one and will report back. |
@elegos, does the "English internation with AltGr dead keys" work without my patch? I'm curious. |
I see what you mean. This is what Linux shows for the US Intl with dead keys keyboard layout: In this layout, the dead keys are used without modifiers, and you can access The issue here is that I installed on my Windows machine the United States-International layout and I could type |
Ah, awesome! Will try that. Strange thing though is that when I switch to direct Windows input, the SHIFT+", space press works just fine. I didn't know the layout I'm using is the alt. one, as it fits the (roughly same) layout of the US int. layout on Windows, too. |
After getting a dead key from
ToUnicodeEx
, add an additionalVK_SPACE
to the keyboard state so we reset the dead key flag and subsequent calls with modifiers, like shift, return the right result (-1) instead of 1.This happened because without reseting the dead key status the new one was attempted to be composed with the old one, which failed and the end result was a single unicode codepoint not marked as a dead key.
This opens the door to potentially use the returned unicode from the second call to
ToUnicodeEx
as the key character instead of maintaining the getDeadKey function.This should, hopefully, address issues like #1267 or #727 #1143 or #795
I have submitted the same patch to Synergy.
Contributor Checklist:
doc/newsfragments
directory IF it is auser-visible change (and make sure to read the
README.md
in that directory)