ADD primitive KeyEvent handling enough to handle BACK key#1839
Conversation
| virtual_keycode: None, | ||
| modifiers: event::ModifiersState::default(), | ||
| }, | ||
| is_synthetic: true, |
|
@msiglreith / @dvc94ch / @francesca64 might be able to help you out with a review. |
|
If it works, it looks good to me |
it does the job, key codes comes as is and you can later handle the back button/key aka, exit app |
Do you not have the ability to test this code? Generally the maintainer of a platform should be able to test it, otherwise that kinda defeats the purpose... |
|
Not really no. Am I on some sort of list? At the company I work for we don't use rust for ui's (unlikely that we will, since we really just provide typescript bindings for customers) and my focus in my spare time is on research projects that we'll eventually use either internally or in production. Currently I'm grooming 3 such projects and I have a back log of future projects. It would be nice if someone who has developed more recently for android could try it. |
|
You are: https://github.com/rust-windowing/winit/wiki/Testers-and-Contributors Please remove yourself if you're not able to test/review on Android. |
About testing it, there is not too much to test here, it's just a glue code, the key comes from android NDK and you don't wanna test the NDK, later it copies the key code into winit struct and dispatch it using the already tested macro, so you ended up testing if the key got copied properly and for this you are testing the rust language itself. I don't think this is worth testing such small glue. Android plataform is currently useless because you can't handle app exit when user press the BACK button/key, I hope this get merged soon as possible. |
msiglreith
left a comment
There was a problem hiding this comment.
Thanks and sorry as this PR slipped off my backlog - looks good in general!
Please add a short CHANGELOG entry.
Tested with some minimal wgpu example, pressing back and volume buttons to check if it's working
02-22 19:42:19.555 15413 15699 I RustStdoutStderr: (DeviceId(DeviceId), KeyboardInput { scancode: 4, state: Released, virtual_keycode: None, modifiers: (empty) })
02-22 19:42:20.116 15413 15699 I RustStdoutStderr: (DeviceId(DeviceId), KeyboardInput { scancode: 4, state: Released, virtual_keycode: None, modifiers: (empty) })
02-22 19:42:20.148 15413 15699 I RustStdoutStderr: (DeviceId(DeviceId), KeyboardInput { scancode: 4, state: Released, virtual_keycode: None, modifiers: (empty) })
02-22 19:42:21.432 15413 15699 I RustStdoutStderr: (DeviceId(DeviceId), KeyboardInput { scancode: 24, state: Released, virtual_keycode: None, modifiers: (empty) })
02-22 19:42:21.457 15413 15699 I RustStdoutStderr: (DeviceId(DeviceId), KeyboardInput { scancode: 24, state: Released, virtual_keycode: None, modifiers: (empty) })
02-22 19:42:22.018 15413 15699 I RustStdoutStderr: (DeviceId(DeviceId), KeyboardInput { scancode: 25, state: Released, virtual_keycode: None, modifiers: (empty) })
02-22 19:42:22.019 15413 15699 I RustStdoutStderr: (DeviceId(DeviceId), KeyboardInput { scancode: 25, state: Released, virtual_keycode: None, modifiers: (empty) })
msiglreith
left a comment
There was a problem hiding this comment.
Thanks, please add the changelog entry and should be ready to merge then
Done @msiglreith |
cargo fmthas been run on this branchcargo docbuilds successfullyCHANGELOG.mdif knowledge of this change could be valuable to users