Switch from ndk-glue to raw-window-handle crate#1418
Conversation
`winit` provides a `raw-window-handle` specifically for crates to process window pointers/references in a crate-agnostic way. `glutin` can use it too, to get rid of its `ndk-glue` dependency which otherwise has a hard versioning dependency as it should be updated in sync with `winit`. Over time this should be worked into the other backends, in turn removing `winit` from the `new_windowed()` function signature and replacing it with `impl HasRawWindowHandle` or `dyn HasRawWindowHandle`. This will also allow Android users to pass generic `Surface`s (first converted to a so-called `NativeWindow` in the NDK through [#272], then passed as `RawWindowHandle` thanks to [#274]) created in Java / Kotlin / Flutter to render to individual UI elements instead of the entire screen with a `NativeActivity` (`ndk-glue`). It'll in turn make the code more generic, too, as `raw-window-handle` has a variant for every platform / windowing system currently supported by glutin. [#272]: rust-mobile/ndk#272 [#274]: rust-mobile/ndk#274
|
This looks good to me. Removing the direct dependency on the glue will make things easier. 👍 |
|
@jamienicol can you give an explicit review approval or should I just merge this in, given that @kchibisov gave me free reign over the Android guts of glutin? |
I've never really been a big fan of the tight coupling between |
|
@maroider the same opinion was voiced by @kchibisov. I think we can have isolated cases where However, some of this may hinge on Android-specific concerns raised recently, regarding platform divergence. (Edit: see also the second paragraph: my intention is to get rid of it almost completely anyway) |
|
Do we have an issue outlining these intentions? If not, then we should probably make one. |
|
I don't think so, as I was planning to just "get it over with in a PR soon/quickly™", but feel free to create one as I don't know when I can (would like to get current open PRs and issues fleshed out, but I do have some in-progress changes to migrate to "pure" |
winitprovides araw-window-handlespecifically for crates to process window pointers/references in a crate-agnostic way.glutincan use it too, to get rid of itsndk-gluedependency which otherwise has a hard versioning dependency as it should be updated in sync withwinit.Over time this should be worked into the other backends, in turn removing
winitfrom thenew_windowed()function signature and replacing it withimpl HasRawWindowHandleordyn HasRawWindowHandle. This will also allow Android users to pass genericSurfaces (first converted to a so-calledNativeWindowin the NDK through #272, then passed asRawWindowHandlethanks to #274) created in Java / Kotlin / Flutter to render to individual UI elements instead of the entire screen with aNativeActivity(ndk-glue). It'll in turn make the code more generic, too, asraw-window-handlehas a variant for every platform / windowing system currently supported by glutin.CC @jamienicol
cargo fmthas been run on this branchcargo docbuilds successfullyCHANGELOG.mdif knowledge of this change could be valuable to users