Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blog: Evaluating winit for cross-platform applications #49

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions content/blog/2024-04-24-winit-2024.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
+++
title = "Evaluating winit for cross-platform applications"
authors = ["Daniel McNab"]
+++

<!-- Post's date SHOULD be changed -->

<!-- Introduction section, not for the paper -->

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 -->

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.
<!-- example of keyboard input/ui events key -->
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.
<!-- <https://github.com/rust-windowing/winit/pull/1583> -->

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
Loading