Skip to content

Commit 05fe983

Browse files
authored
android: Use event identifier instead of userdata pointer (#1826)
ndk-glue currently sets both the `ident` field and user-data pointer to `0` or `1` for the event pipe and input queue respectively, to tell these sources apart. While it works to reinterpret this `data` pointer as integer identifier it shouldn't be abused for that, in particular when one may wish to provide extra information with an event in the future; then the `data` field is used as pointer (or abused as abstract value) for that.
1 parent d1a7749 commit 05fe983

File tree

1 file changed

+1
-1
lines changed
  • src/platform_impl/android

1 file changed

+1
-1
lines changed

src/platform_impl/android/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ enum EventSource {
3030

3131
fn poll(poll: Poll) -> Option<EventSource> {
3232
match poll {
33-
Poll::Event { data, .. } => match data as usize {
33+
Poll::Event { ident, .. } => match ident {
3434
0 => Some(EventSource::Callback),
3535
1 => Some(EventSource::InputQueue),
3636
_ => unreachable!(),

0 commit comments

Comments
 (0)