rust-mobile / android-activity

Glue for building Rust applications on Android with NativeActivity or GameActivity
239 stars 48 forks source link

Use common `Keycode` type across backends #92

Closed rib closed 1 year ago

rib commented 1 year ago

There's a notable portability hazard currently due to the game-activity and native-activity backends exposing different Keycode types.

For example https://github.com/rust-windowing/winit/commit/918430979f8219648daade44796c00893e42fdd8#diff-9169a22d6397a250be741006cd857b8a575f804c74cc07e3a4fb8f3341606d9b and https://github.com/rust-windowing/winit/commit/4a36741f9ccaa03ca0842362dd1ebc24fd2a1b11 both recently assumed they could use the ndk::event::Keycode type which inadvertently broke building Winit against the game-activity backend.

We should either use ndk::event::Keycode in both backends or move the current game-activity Keycode type so it can be shared.

Also relates to https://github.com/rust-mobile/android-activity/issues/45

MarijnS95 commented 1 year ago

Perhaps also relates to #48 when considering reusing ndk types that look/feel too similar to their game-activity counterpart.

We could even rewrite parts of the C code to make them similar if desired.