diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 6b1e88e4b..673624b43 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -2627,16 +2627,15 @@ protected void handleKeyEvent(KeyEvent event) { keyEvent = event; key = event.getKey(); keyCode = event.getKeyCode(); - + Long hash = ((long) keyCode << Character.SIZE); switch (event.getAction()) { case KeyEvent.PRESS -> { - Long hash = ((long) keyCode << Character.SIZE) | key; if (!pressedKeys.contains(hash)) pressedKeys.add(hash); keyPressed = true; keyPressed(keyEvent); } case KeyEvent.RELEASE -> { - pressedKeys.remove(((long) keyCode << Character.SIZE) | key); + pressedKeys.remove(hash); keyPressed = !pressedKeys.isEmpty(); keyReleased(keyEvent); }