diff --git a/content/blog/2024-04-24-winit-2024.md b/content/blog/2024-04-24-winit-2024.md new file mode 100644 index 0000000..401b9e2 --- /dev/null +++ b/content/blog/2024-04-24-winit-2024.md @@ -0,0 +1,51 @@ ++++ +title = "Evaluating winit for cross-platform applications" +authors = ["Daniel McNab"] ++++ + + + + + +Linebender is working to develop cross-platform graphical user interfaces in Rust. +This requires integration with the underlying platform. +In Druid, we used our own platform integration crate, [druid-shell][] (later moved into its own repository as [Glazier][]). +We made this choice to ensure that we could meet the expectations of desktop application users. +Large parts of the Rust ecosystem have settled on using [winit][] to provide platform integration. +In January, we also [decided][tmix-01] to use winit instead of Glazier for [Xilem][] (our next GUI toolkit). +Therefore, we are evaluating how well suited winit is currently for cross-platform non-game applications, with an aim towards improving this. + + + +winit's scope is documented in their [FEATURES][winit features] document. +This gives the objective as supporting features which are common to all platforms. +I have found these common features, such as general window lifecycle management, to work well. +Improvements in the APIs used for these have however historically taken a long time to land. + +The maintainers have shown a willingness to engage with this work. +It is likely that with more investment, other longstanding issues can be addressed sufficiently. +For example, [winit#1497][] tracks an implementation of input methods. +These are important for text input on all platforms, and are necessary to support text input on mobile. +Copy and paste support is another important feature which needs support to be brought into winit. +There is a draft pull request [winit#2156][] which implements this for a subset of platforms. + +To meet user expectations, cross-platform applications also need to interface with the platform specific features which are otherwise outside the declared scope of winit. +winit's position on these is to provide APIs to allow them to be supported outside of. +As an example, on macOS, applications are expected to fill the menu bar, including where there are no windows. +However, this is currently not directly supported by winit. + + +How to talk about accessibility? + +Overall, our evaluation of winit is that it provides a strong foundation of support for most platforms. +However, it currently requires application developers to use a large number of external integrations for critical functionality, which add to the challenging +There have been efforts to produce external crates which support. + +[tmix-01]: @/blog/2024-02-06-tmix-01.md +[druid-shell]: https://crates.io/crates/druid-shell +[winit]: https://crates.io/crates/winit +[glazier]: https://github.com/linebender/glazier +[xilem]: https://github.com/linebender/xilem +[winit#2156]: https://github.com/rust-windowing/winit/pull/2156 +[winit features]: https://github.com/rust-windowing/winit/blob/master/FEATURES.md +[winit#1497]: https://github.com/rust-windowing/winit/issues/1497