Closed GoogleCodeExporter closed 9 years ago
Original comment by a...@1stleg.com
on 23 Dec 2012 at 5:04
It looks like this bug is also effecting Portuguese.
Original comment by a...@1stleg.com
on 30 Jan 2013 at 7:25
Issue 39 has been merged into this issue.
Original comment by a...@1stleg.com
on 11 Mar 2013 at 11:35
I did some digging around on this issue and it appears to be caused by
GetKeyboardLayoutName() only returns the layout for the running application,
not the window in focus. So if you have multiple languages setup, it will only
use the one that Java was started with (probably your default language).
A couple of things will need to be address to get this working properly.
First, GetKeyboardLayoutName() needs to be replaced with something that can get
the keyboard layout of the input focus window. Second, the keyboard layout
needs to be updated each time the focus changes or each time a key is typed.
Original comment by a...@1stleg.com
on 11 Mar 2013 at 11:52
Ahh excellent! Glad to see you found the cause :)
By 'the keyboard layout needs to be updated each time the focus changes or each
time a key is typed', you mean that each time a key is typed the language will
revert back to default (English in my case) and it will need to be updated
programmatic back to the language I chose to type with? (for instance Hebrew).
Original comment by alonmin...@gmail.com
on 12 Mar 2013 at 7:59
So the code in question is located here:
https://code.google.com/p/jnativehook/source/browse/branches/1.1/src/native/wind
ows/WinUnicodeHelper.c
Something like HKL locale_id =
GetKeyboardLayout(GetWindowThreadProcessId(GetActiveWindow(), NULL)); would
need to be placed in ConvertVirtualKeyToWChar() to check and see if the active
window or its language has changed. The only thing I haven't figured out yet
is how to convert that HKL to a string that represents the same name returned
by GetKeyboardLayoutName().
Original comment by a...@1stleg.com
on 12 Mar 2013 at 4:42
I believe I have solved the problem. I still need to re-factor some of the
code, should have a build attached here tonight.
Original comment by a...@1stleg.com
on 12 Mar 2013 at 9:41
I have committed revision 698 that should contain a fix.
Original comment by a...@1stleg.com
on 14 Mar 2013 at 7:39
Code still doesn't work right, something got borked between r623 and r627 for
WinUnicodeHelper.c
Original comment by a...@1stleg.com
on 14 Mar 2013 at 6:12
Alright, as of revision 700 this issue should be resolved. If you are capable
of compiling from src, please test asap. I will attach a 1.1.4 preview jar
tonight for those who cant build from src.
Original comment by a...@1stleg.com
on 14 Mar 2013 at 6:47
Test attached JAR. This will probably be the 1.1.4 final jar if it works
properly.
Original comment by a...@1stleg.com
on 14 Mar 2013 at 11:49
Attachments:
Is appears to be working for all of my tests. I have made a few more fixes to
a couple of bugs I found in r701 and r702. I will tag 1.4 tonight.
Original comment by a...@1stleg.com
on 16 Mar 2013 at 6:41
Hi there!
I am sorry I sort of dissapeared here. Unfortunatly
I was in the hospital with a really high fever forthe last 7 days and couldnt
even sit infront the computer... Nasty stuff.
But im getting better so the minute i get back home in the next day or two,
Ill test your latest JAR on my system.
At any rate, I really appreciate your time and effort in this.
Thank you!
Ill update my results here.
Original comment by alonmin...@gmail.com
on 18 Mar 2013 at 8:36
Hi, Don't worry about it. I am glad you are feeling better. Please test the
latest 1.1.4 release when you get a chance. I tested for a couple of days and
everything seems to be working well for the languages I tried.
Original comment by a...@1stleg.com
on 18 Mar 2013 at 4:44
Alright. I tried afew things.
When I try the code you posted here:
http://code.google.com/p/jnativehook/source/browse/trunk/src/java/org/jnativehook/example/NativeHookDemo.java
when I use a Hebrew keyboard, it does show the correct letter when typed.
Works perfectlly.
But when I write my own code and try to implement it, it shows ? instead of the
letter I typed.
Obviously its something I'm doing wrong. I just can't pin point what it is.
Does it matter where I use GlobalScreen.registerNativeHook(); ?
Currently I use it in my main method coupled with
GlobalScreen.getInstance().addNativeKeyListener(window);
I attached my file for you to see. I guess this is more of a usage question
because the code in your example does the job.... I just still cant get it to
work right in my own simple code... :)
Original comment by alonmin...@gmail.com
on 21 Mar 2013 at 5:45
Attachments:
It looks like you are doing everything correctly. My guess is that the console
System.out.println() is writing to does not support Unicode. You can confirm
by checking System.out.println( (int) e.getKeyChar() ); If it's not 63, it
isn't ascii '?'. Try using the chcp command to check your active code page.
You may want to try issuing a chcp 65001 to activate UTF-8 but I have no idea
if that will actually fix the output. The Windows shell is really terrible.
Try using something like win-bash ;)
Original comment by a...@1stleg.com
on 21 Mar 2013 at 6:33
Ahh! you are correct. I tried JOptionPane for instance. Works perfectly now.
Thank you so much for this. Brilliant stuff! :)
Original comment by alonmin...@gmail.com
on 22 Mar 2013 at 9:51
Original issue reported on code.google.com by
alonmin...@gmail.com
on 23 Dec 2012 at 4:06