danishjuzdan / jnativehook

Automatically exported from code.google.com/p/jnativehook
0 stars 0 forks source link

Left and Right ALT mismatch #45

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run JNativeHook.jar
2. Press AltGr+2 on spanish layout

What is the expected output? What do you see instead?
The output shout be '@' but a '2' is displayed.

What version of the product are you using? On what operating system?
Version 1.1.4 on Windows

Please provide any additional information below.

AltGr is the RIGHT ALT in spanish keyboard, it allows to type characters like @ 
# { }. It might be a mismatch between the LEFT and the RIGHT ALT, because 
pressing LEFT ALT+2 a '@' is displayed, but the correct output should be 
nothing (could be special action, but not a character). This issue is a 
duplicated of #39 that is marked as related to #32 wich is resolved, but #39 is 
not.

Original issue reported on code.google.com by edu...@gmail.com on 14 May 2013 at 1:27

GoogleCodeExporter commented 9 years ago
Thanks for the report.  I am not sure it makes a difference, but which Spanish 
(Country) keyboard layout are you using with Windows?

Original comment by a...@1stleg.com on 14 May 2013 at 2:34

GoogleCodeExporter commented 9 years ago
Is Spanish (ES). 

Ok, I think I find something interesting, look at this:

http://en.wikipedia.org/wiki/AltGr_key#Control_.2B_Alt_as_a_substitute

It might be posible that del AltGr+2 is handled as Alt+Ctrl+2 and the code 
don't handle it, and with left alt it does correctly. If you don't distinguish 
between left and right, but the right has a doblue mod key I think the code 
ignores it.

Original comment by edu...@gmail.com on 14 May 2013 at 2:48

GoogleCodeExporter commented 9 years ago
I can confirm that the problem is the previous I mentioned. 

Changing de following piece of code form /src/native/windows/WinUnicodeHelper.c:
https://gist.github.com/hzeroo/43020e5a722ed20f9470/revisions

The program makes no diference between left and right alt. But de ideal 
behavoir is that only right alt (wich is sended as alt+ctrl) prints the '@'. 
There is a good idea too to check that de modifiers are alt and control, and 
perform the print only if these and only these two are pressed.

Original comment by edu...@gmail.com on 14 May 2013 at 4:05

GoogleCodeExporter commented 9 years ago
Ok, I believe I have a complete patch for this issue.  I have attached a 
patched Jar for Windows 64-bit ONLY (Does not work on Windows 32-bit) and a 
patch file for the source code.  The patch is applied "upstream" to libuiohook 
(https://github.com/kwhat/libuiohook).   Do to the complexity of the code in 
question and the lack of documentation from Microsoft regarding the features 
used, I would like to do more testing before committing the changes to the 
primary codebase.

Original comment by a...@1stleg.com on 16 Apr 2014 at 11:08

Attachments:

GoogleCodeExporter commented 9 years ago
After doing some testing I am confident that the patch doesn't introduce any 
new issues so I am going to mark this issue resolved as of 1.2.0-Beta2.

Original comment by a...@1stleg.com on 17 Apr 2014 at 6:12