Skip to content

backends/native: Translate keycodes with xkb_key_state_get_one_sym()

There's two aspects from its documentation (https://xkbcommon.org/doc/current/group__state.html#gae56031a8c1d48e7802da32f5f39f5738) affecting us here:

  1. "This function is similar to xkb_state_key_get_syms(), but intended for users which cannot or do not want to handle the case where multiple keysyms are returned (in which case this function is preferred)."

    We are indeed in that field, and have been for a long time.

  2. "This function performs Capitalization Keysym Transformations."

    This is unlike the xkb_key_get_syms() function that we use, and convenient here for parity with X11 since it behaves exactly that way.

Fixes cases where the keysym for some keys is not properly capitalized when caps lock is toggled, due to the output of capslock+key being different from shift+key. An example of this is 'é' in french(azerty) layout (bound to the '2' key). Even though shift+2 outputs '2', capslock+é should output 'É'.

Closes: #3058 (closed)

Merge request reports

Loading