Wayland: Keyboard input improvements (#7989)

Release Notes:

- N/A

---

Right now the Wayland backend is using `xkb::State::key_get_utf8` as the
`key`, when it should be used as the `ime_key`. It also manages
pressing/releasing modifiers manually when this should be managed by the
display server.

This allows modifier combinations to work in more cases, making it an
alternative to https://github.com/zed-industries/zed/pull/7975, which
interprets what is now only used as the `ime_key` value as a `key`
value.
This commit is contained in:
Tadeo Kondrak 2024-02-18 22:25:42 -07:00 committed by GitHub
parent bd137b01ad
commit 2b56c43f2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 41 additions and 81 deletions

View file

@ -71,8 +71,8 @@ impl WaylandWindowInner {
bounds: Bounds<i32>,
) -> Self {
let raw = RawWindow {
window: wl_surf.id().as_ptr() as *mut _,
display: conn.backend().display_ptr() as *mut _,
window: wl_surf.id().as_ptr().cast::<c_void>(),
display: conn.backend().display_ptr().cast::<c_void>(),
};
let gpu = Arc::new(
unsafe {
@ -204,7 +204,9 @@ impl WaylandWindowState {
if let PlatformInput::KeyDown(event) = input {
let mut inner = self.inner.lock();
if let Some(ref mut input_handler) = inner.input_handler {
input_handler.replace_text_in_range(None, &event.keystroke.key);
if let Some(ime_key) = &event.keystroke.ime_key {
input_handler.replace_text_in_range(None, ime_key);
}
}
}
}