Iced, a cross-platform GUI library for Rust
github.com
github.com
git clone https://github.com/hecrj/iced.git
cd iced/
cargo run --package tour
This ran the Tour example without any glitches, warnings, missing dependencies or any other annoyance. Don’t know yet whether this has what I need for my applications, but in any case it has left a very pleasant impression.Although, how does that even work, hooking into OS accessibility from a GUI rendered custom from-scratch? Is there an API for that that's divorced from the native OS GUI?
Windows is the one I know best. The current native accessibility API for Windows is called UI Automation. It's not tied to any high-level UI framework, though a UIA tree needs to be associated with a window handle (HWND).
Mac and iOS have Objective-C accessibility APIs as part of their respective native UI frameworks (AppKit and UIKit). I have cursory knowledge of those APIs from a previous job but never implemented either of them from scratch. Android likewise has a Java-based accessibility API as part of its framework. Yes, this means that non-Java-based toolkits have to do JNI bridging to implement accessibility on Android. sigh I've never done this myself either.
The only desktop environment for the free Unixes that has full-featured accessibility support, particularly for blind people, is GNOME, which has a D-Bus-based accessibility API called AT-SPI. GTK implements this API through a module called ATK. Qt also implements it. BTW, the Orca screen reader for GNOME was originally developed by a friend of mine.
Probably the best place to find an implementation of all of these APIs is one of the open-source web browser engines. Note though that on Windows, these engines implement a legacy accessibility API called MSAA (Microsoft Active Accessibility) and an unofficial extension of that API called IAccessible2. Chromium has a work-in-progress native UI Automation implementation, largely developed by the Microsoft Edge team.
Disclosure: I work at Microsoft, on the team that develops UI Automation and the Narrator screen reader.
Citation needed
For the other 99% of apps, a clean, clear mental model for the developer is pretty nice to have, and this looks like a very nice implementation. I'd use it!
In the end, constructing a GUI from that would be questionable and would end up being even more uglier than a barebones Qt5 example. You might as well create your own in-game GUI library or use ImGUI with Rust bindings.
Web browser and OS UI toolkits are also GPU accelerated these days. In fact, that's completely silly to do any kind of rendering on the CPU when you have a GPU available! It's just way slower and much more expensive in terms of power consumption.
really depends on what you want to draw. there is still nothing that renders fonts with freetype quality on the GPU and rendering paths / drawings / svg-like stuff is still a pain as the only GPU maker who cares about 2D drawing is NVidia.
Inefficient in what way? Performance? Is it noticable? Why should I care unless it's noticable and hindering UX? Should we all be writing out GUIs in assembly then?
I notice that in many of these GUI frameworks that effort is duplicated. Flutter creates a lot of widgets for iOS and Android, but if you don't want to use Dart, we'll, you'll have to reimplement those widgets yourself again. Instead, what should happen is that they should compile to a standard format, most likely WASM, and then you can use any language (that targets WASM, which I think will be most of them in the future) to interface with those widgets or components. They can be in the form of a canvas renderer such as Skia, which is what Google uses for Chrome and Flutter, and also used by some other GUI projects like Revery for ReasonML. This way, there's one common format and people can write the functionality code in whatever language they'd like.
Or be based on a standard canvas-level API that would be easy to support in most languages (à la OpenGL, but much easier to use for 2D, and more complete (windowing, user events, text, images, etc.), or like P0267R0 but not confined to a particular language).
Also missing is mobile support.
There's therefore enough of an abstraction which could be used to get Iced to create Windows/Cocoa/GTK/Qt native widgets (in much the same way it currently creates VDOM elements for the web, thus getting some level of accessibility by default). Then Iced could provide additional a11y information to the backend by means of properties on the virtual objects.
That's anyway what the Web world does already with SCSS or the fashion to embed your styling directly in JS ....