RFR: 8360647: [XWayland] [OL10] NumPad keys are not triggered

Alexander Zvegintsev azvegint at openjdk.org
Thu Jul 10 01:06:40 UTC 2025


On Mon, 7 Jul 2025 19:21:57 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:

> When we try to pass `XK_KP_0` to [`NotifyKeyboardKeysym`](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.RemoteDesktop.html#org-freedesktop-portal-remotedesktop-notifykeyboardkeysym) in Remote Desktop API, it presses/releases `SHIFT` + `XK_KP_Insert`.
> 
> To get the same result as XTest api when using `NotifyKeyboardKeysym` we should use `XK_KP_Insert` instead of `XK_KP_0` regardless of NumLock state. Similarly for other Numpad keys.

> The test _expects_ to receive Insert (not 0) even if numlock is on ? Why is that ?
> It isn't really mentioned but this about Robot, isn't it ? What happens if a user types directly ?

The test doesn't care which button is pressed. It stores the keyCode-keyChar pair in a map received from the keyPressed event.
Later, it checks whether the keyChar in the subsequent keyReleased event for the same keyCode matches the keyChar in the keyPressed event for that keyCode. It just checks for consistency.

https://github.com/openjdk/jdk/blob/518536c607cb383e810ee0f50f8af44e121f4ab3/test/jdk/java/awt/event/KeyEvent/KeyCharTest/KeyCharTest.java#L45-L55

Before the fix, it was receiving:
* Numlock on: KEY_PRESSED with `keyChar=Undefined keyChar` and KEY_RELEASED with `keyChar='0'`  / NumPad-0 keyCode
* Numlock off: Undefined keyChar was received in both cases; the test didn't fail.  / Insert keyCode

After the fix, everything is consistent, and the same key events are reported as if they were pressed by a user.

> Can you please put an evaluation in the bug report.

Sure.

> Also is this a regression of JDK-8351907 ? Looks that way since it is reported as working in JDK 25 b23.

Yes, it is.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/26170#issuecomment-3054737704


More information about the client-libs-dev mailing list