processing4 icon indicating copy to clipboard operation
processing4 copied to clipboard

Fix hash of keyEvent being added to pressedKeys.

Open harry1064 opened this issue 2 years ago • 4 comments

When we press a letter, lets say d is key is char value d and hash calculated using keyCodea and key is added to pressed keys. But when without release d, if we press SHIFT key, hash of shift key also being added to pressedKeys. Now, when we release d, it is actually now D hence key value change and when we try to remove new hash, it doesnot exist in pressedKeys and the old hash of d still stays in pressedKeys which was the cause of keyPressed returning true.

fixes #779

harry1064 avatar Sep 23 '23 10:09 harry1064

Hi @benfry Hope you are doing well. I saw in your commit that you have included this pull request in todo.txt. Does it mean you're going to have a look at it when you have time?

harry1064 avatar Sep 29 '23 17:09 harry1064

Yes, went to pull it in but realized that I needed to do additional testing… This is a really messy issue because of the way that different key combinations are posted as events (and there are differences to this between Java2D, OpenGL, and JavaFX as well) so it just needs more thorough work to make sure this is doing what we need. I suspect that this change doesn't fix the problem broadly enough, and want to make sure we have it right before altering something so fundamental.

benfry avatar Sep 30 '23 14:09 benfry

Yes, that make sense.. I was also curious why | key was done in first place. Testing it more thoroughly make sense.

harry1064 avatar Sep 30 '23 15:09 harry1064

Yeah, it's because with any keystroke there may be a combination of key and keyCode, and those vary as different modifiers are applied. It's especially important in this scenario where we're trying to just detect what keys and modifiers are doing.

benfry avatar Sep 30 '23 15:09 benfry