linux: Fix wrong keys are reported when using German layout (#31193)

Part of #31174

Because the keyboard layout parameter wasn’t set correctly, characters
don’t show up properly when using the German layout at launch.

To reproduce:
Switch to the German layout, launch Zed, and press the `7` key. it
should output `7`, but instead it outputs `è`.


Release Notes:

- N/A
This commit is contained in:
张小白 2025-05-22 22:47:23 +08:00 committed by GitHub
parent d61e1e24a7
commit ee4e43f1b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -840,6 +840,14 @@ impl X11Client {
state.xkb_device_id,
)
};
let depressed_layout = xkb_state.serialize_layout(xkbc::STATE_LAYOUT_DEPRESSED);
let latched_layout = xkb_state.serialize_layout(xkbc::STATE_LAYOUT_LATCHED);
let locked_layout = xkb_state.serialize_layout(xkbc::ffi::XKB_STATE_LAYOUT_LOCKED);
state.previous_xkb_state = XKBStateNotiy {
depressed_layout,
latched_layout,
locked_layout,
};
state.xkb = xkb_state;
}
Event::XkbStateNotify(event) => {