Skip to content

Commit 8c38fb7

Browse files
authored
fix(wayland): released keys detection (#378)
On Wayland display `update` function handles key events and then saves current key state to `keys_prev`. As the resut when we exit from `update/update_with_buffer` and `keys_prev` and `keys` are equal, so `get_keys_released` is basically noop. * Move `key_handler.update()` before handling new key events so that on exit `keys_prev` contains old data and `key` contains new data (without overwriting old data). Issue: #377
1 parent 056c5af commit 8c38fb7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/os/posix/wayland.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,8 @@ impl Window {
776776
self.should_close = true;
777777
}
778778

779+
self.key_handler.update();
780+
779781
for event in self.input.iter_keyboard_events() {
780782
use wayland_client::protocol::wl_keyboard::Event;
781783

@@ -951,8 +953,6 @@ impl Window {
951953
_ => {}
952954
}
953955
}
954-
955-
self.key_handler.update();
956956
}
957957

958958
fn handle_key(

0 commit comments

Comments
 (0)