From a9784399009caa1aaeebd7bc4300a6d3b4cad763 Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Wed, 17 Apr 2024 15:49:23 +0100 Subject: [PATCH 1/2] Add evaluation of winit --- content/blog/2024-04-24-winit-2024.md | 44 +++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 content/blog/2024-04-24-winit-2024.md 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..d4e21e3 --- /dev/null +++ b/content/blog/2024-04-24-winit-2024.md @@ -0,0 +1,44 @@ ++++ +title = "Evaluating winit for cross-platform applications" +authors = ["Daniel McNab"] ++++ + + + +Linebender is working to develop cross-platform graphical user interfaces in Rust. +This naturally requires interaction with the underlying platform. +In Druid, we used our own platform integration crate, [druid-shell][] (later moved into its own repository as [Glazier][]). +In January, we [decided][tmix-01] to use [winit][] instead for Xilem (our next GUI toolkit). +The Rust ecosystem has generally settled on using winit to provide platform integration. +For example, winit is used by the [Bevy][] game engine (in the default configuration). + + + +winit's scope is documented in their [FEATURES][winit features] document. +This gives the objective as supporting features which are common to all platforms. +Platform specific features are then expected to be built outside of winit. +These common features generally work well, although there are a few features which might be expected to be supported, but are not yet available. +Copy and paste support is another feature. +There is a draft pull request ([winit#2156][]) + +In Druid we have taken great care to ensure that user expectations of native applications are considered. +We intend to continue similarly in Xilem, ensuring that Xilem applications can be respectful of their user's . +However, to meet these expectations, Xilem does need to interface with platform specific features. +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. + + + +Menu bars, 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 +[bevy]: https://bevyengine.org/ +[glazier]: https://github.com/linebender/glazier +[winit#2156]: https://github.com/rust-windowing/winit/pull/2156 +[winit features]: https://github.com/rust-windowing/winit/blob/master/FEATURES.md From 48dbb4b29d195989b8b719f53fc121388dceb5b3 Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Thu, 18 Apr 2024 15:46:54 +0100 Subject: [PATCH 2/2] Push draft for office hours --- content/blog/2024-04-24-winit-2024.md | 39 ++++++++++++++++----------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/content/blog/2024-04-24-winit-2024.md b/content/blog/2024-04-24-winit-2024.md index d4e21e3..401b9e2 100644 --- a/content/blog/2024-04-24-winit-2024.md +++ b/content/blog/2024-04-24-winit-2024.md @@ -5,31 +5,37 @@ authors = ["Daniel McNab"] + + Linebender is working to develop cross-platform graphical user interfaces in Rust. -This naturally requires interaction with the underlying platform. +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][]). -In January, we [decided][tmix-01] to use [winit][] instead for Xilem (our next GUI toolkit). -The Rust ecosystem has generally settled on using winit to provide platform integration. -For example, winit is used by the [Bevy][] game engine (in the default configuration). +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. -Platform specific features are then expected to be built outside of winit. -These common features generally work well, although there are a few features which might be expected to be supported, but are not yet available. -Copy and paste support is another feature. -There is a draft pull request ([winit#2156][]) - -In Druid we have taken great care to ensure that user expectations of native applications are considered. -We intend to continue similarly in Xilem, ensuring that Xilem applications can be respectful of their user's . -However, to meet these expectations, Xilem does need to interface with platform specific features. +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. - +However, this is currently not directly supported by winit. -Menu bars, accessibility. +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 @@ -38,7 +44,8 @@ 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 -[bevy]: https://bevyengine.org/ [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