5 ms·
The OS should provide a safe API for how to draw native widgets and how they behave. Then you can draw your own anywhere.
by chrisseaton 4y ago
The OS should provide a safe API for how to draw native widgets and how they behave. Then you can draw your own anywhere.
- kevingadd 4y agofwiw, Windows does have an API (called uxtheme, I believe) that you can use to draw native widgets.
- rossy 4y agoFirefox already used uxtheme for that. A lot of programs and toolkits do, since the heavyweight HWND-based comctl32 controls aren't suitable for things like browsers because they're slow, hard to render without flicker, there's a limit on how many you can have, they don't play well with effects like opacity and transform3d() and so on. Even Internet Explorer did[1]. I guess uxtheme is unsuitable for win32k lockdown for some reason, probably because it's GDI-based. [1]: https://devblogs.microsoft.com/oldnewthing/20050211-00/?p=36473 https://devblogs.microsoft.com/oldnewthing/20050211-00/?p=36...
- dblohm7 4y ago(I used to work on the blog author’s team, and in fact dealt with some of the COM issues mentioned in the post) You’re right, uxtheme can’t be called directly from content because of win32k dependencies. One option could be for content to request the parent to draw those controls, but as you can imagine there are drawbacks to doing that. As usual, there are a lot of trade offs involved.
- Gigachad 4y agoThere already is a safe API with Wayland + some sandboxing layer. Problem is for the longest time the Nvidia drivers didn't work with Wayland. They now do so the reasons to use X11 become vanishingly small.
- chrisseaton 4y ago> There already is a safe API with Wayland + some sandboxing layer. I didn’t think Weyland had its own toolkit? And can you run for example Weyland on Windows?
- TingPing 4y agoWayland is just IPC for passing around buffers and inputs. It's used by WSL but not native apps.
- rockdoe 4y agoOn Linux the widgets are drawn by GTK and/or Qt, not Wayland. Also, the problem, I guess, is not just drawing (which could be done securely in a frame-buffer), but that you have to receive the events.