zmilla93 / SlimTrade

A trade UI overlay for Path of Exile
MIT License
123 stars 13 forks source link

SlimTrade blocks certain character inputs #4

Closed Jimmehcake closed 3 years ago

Jimmehcake commented 4 years ago

When SlimTrade is active I can't seem to type the following characters: `~'"^ (basically any character that allows you to modify a letter) This is both inside and outside the game.

Also a suggestion: I'd really like to be able to change/edit/remove/location swap the default buttons.

Keep up the good work!

zmilla93 commented 4 years ago

Noted the suggestion for the buttons. Don't expect it immediately, but I do intent to make several large changes to the button customization in a future patch.

Blocking Character Input This sounds like an issue with the new hotkey system, but I don't encounter it myself. Parts of this code are platform specific, so any additional information would be great, like operation system and if your using any non standard keyboard.

Since I can't reproduce this, if you or anyone else want to do a bit of debugging, you can run SlimTrade from the command line. This will print out any errors if they do occur, although none might be occuring. One way to do this is by opening the folder containing SlimTrade, shift + right click anywhere in the folder, select "Open PowerShell window here", then run the command "java -jar slimtrade.jar". I'll look into adding a crash report system to simplify this process in the future.

This is a fairly major bug, so I'll continue to look for a potential cause. Information from anyone else encountering this issue is appreciated.

zmilla93 commented 4 years ago

Another potential cause is conflicts with other macro programs. If you do run any, try closing them and see if the issue still persists.

Jimmehcake commented 4 years ago

I'm running Windows 10 x64 Pro, using a standard ANSI layout keyboard. I have it set to the English (US) keyboard layout in Windows.

I ran SlimTrade in PowerShell but did not get any error messages.

Disabling my other macro applications did not solve the issue.

Other things I've tried that did not solve the issue:

I did notice that when I change my keyboard layout to one that prints the characters directly instead of waiting for the next input that they work just fine. `~'"^

zmilla93 commented 4 years ago

That last bit sounds promising. What layout causes the issue, and what did you switch to that fixed it?

Jimmehcake commented 4 years ago

I have two languages set to switch between: Dutch and Japanese. The Dutch one uses the standard US QWERTY layout but it (and I'm assuming most other non-English countries) functions slightly differently to be able to create international characters, see: https://support.microsoft.com/en-us/help/306560/how-to-use-the-united-states-international-keyboard-layout-in-windows

When I switch to Japanese and enter the English typing mode it doesn't do international characters and prints out the character right away when you press the button for it.

So the problem is most likely with any layout that accommodates international character support.

zmilla93 commented 4 years ago

Can you clarify which language works and which language has the isssue?

Also when you did the test of running from the command line, make sure to press the keys that cause issues and see if errors show up when they are pressed, not just at launch. You may have realized this, but I didn't make it clear.

Here's a version of the program with the keyboard listener disabled. This obviously breaks all features that use hotkeys, but it will confirm that is the problematic part of the code before I continue debugging. Please let me know if that version affects the issue.

Jimmehcake commented 4 years ago

Sure, so when my keyboard is set to Dutch is when I have this issue. I assume this would be the case for all languages that make use of international character support. When I set it to Japanese and use the English layout it works normally (but it doesn't support the international characters).

I did indeed press the keys while running it in the command line, it didn't show anything no matter what I pressed.

I downloaded your version without the keyboard listener but the issue still persists.

zmilla93 commented 4 years ago

Do the blocked keys use a modifier key? If they do, is it a physical modifier key where it takes two key presses, or is it a single keypress and the modifier is simulated by support?

I noticed that some of the libraries I was were quite outdated. I've updated the prerelease I linked earlier with these new libraries. Give that a try, as I'm really hoping that was the cause of the issue.

If the issue still persists, run that version from the command line and it will also print out key information when you press a key. Copy and paste some examples of working and not working international keys so I can try to compare what is happening.

Jimmehcake commented 4 years ago

Some of the keys use a modifier, some don't. ~^" do (holding shift) ` ' don't

The way they normally function is: I press "`", nothing is printed, then if I press "e" afterwards, "è" is printed. Or if I press "`" again instead of "e", "``" is printed. ñèêéë

I redownloaded it but it still doesn't work properly. Interestingly enough, the application catches the keypresses and registers them the same way in either language. Dutch (not functioning as intended): https://i.imgur.com/YlkMfZr.png Japanese/English (functioning as intended*): https://i.imgur.com/EyZNKuq.png

* I noticed that after switching language, the application registered every press as if I were holding CTRL while I wasn't, this continued until I actually pressed CTRL. This doesn't seem to be a related issue but you can see it in the second screenshot. It also doesn't seem to register when I actually press my left CTRL or Shift buttons until I press something else and it shows as a modifier, but when I press my right Shift it will spam the console with an unknown command: https://i.imgur.com/3yT4Saz.png

zmilla93 commented 4 years ago

The CTRL issue is strange. I've been messing around with the international keyboard myself and haven't experienced that when switching languages. Regardless, I don't think it is related.

Modifier keys like CTRL and shift not showing up is intentional, although I should have added a message showing these were ignored (prevents you from settings them as hotkeys alone). I've updated the testing jar with this change if it is needed for more testing in the future.

The right shift issue is an issue with the library I'm using, but I'll add my own exception handling for unsupported keys.

Thanks for all the information so far. I'll make a new testing jar in the coming days to completely strip out a few of the 3rd party libraries to see if the issue is related to that, or my own code.

zmilla93 commented 4 years ago

Version 0.2.5 contains a handful of small fixes for the keyboard listener. It should resolve the CTRL issue you mentioned, but I'm doubtful it will have fixed the main issue. Nonetheless, can you confirm the issue still persists in this version?

Assuming the issue is still there, please try this experimental version and let me know if it exists there. It completely removes a few 3rd party libraries so a bunch of features will not work at all, but it will confirm where in the code the bug lies.

Jimmehcake commented 4 years ago

The issue still persists, I'm not sure if the CTRL issue has been fixed since the console doesn't show which keys I press with this version. I'm not sure how to use the experimental version because the jar file isn't present.

zmilla93 commented 4 years ago

Sorry about that, link was pointing to the wrong test version. Fixed now!

Jimmehcake commented 4 years ago

The issue does not exist in the experimental version.

zmilla93 commented 4 years ago

I'm a bit stumped on this at the moment. The libraries that cause this issue (JNA + JNativeHook) are extremely widely used, including in MercuryTrade, though I haven't been able to find any other reports about this for other programs. They are also critical for interacting with POE, so it isn't really an option to disable them.

I'm going to take one more good look at my own code, add some debugging info, and if I still can't figure it out then I'll open a new issue containing all the technical information so that other programmers might be able to take a look.

Jimmehcake commented 4 years ago

That's strange since I don't have this issue with MercuryTrade at all. I hope you manage to find the issue!

zmilla93 commented 3 years ago

This should finally be resolved in v0.3.0. The issue was apparently newer versions of JNativeHook, so that library has been downgraded to the previous version.