Make winit completely platform-agnostic#2430
Make winit completely platform-agnostic#2430madsmtm wants to merge 9 commits intorust-windowing:masterfrom
winit completely platform-agnostic#2430Conversation
|
While looking for WinRT support, I one way or another ended up in this PR, and although I understand there are no current plans to do it, would be nice if the new structure supported future work on it. With that in mind, based on your initial comment, wouldn't it make more sense to call On another totally separate note, since this will move quite a lot of files, maybe it would be a good idea to adopt the 'newer module system' for stuff inside |
|
Isn't WinRT/UWP deprecated now? What's the point in renaming things for a dead platform? |
...is it? Genuine question, I'm not that into Windows GUI development, so I don't really get what Microsoft's plan is behind the whole 'App SDK' stuff. It seems like the Windows Store only opened doors for Win32 apps last year tho, so unless they deprecated WinRT in the meantime, I feel like it should still be relevant. |
|
I think UWP is basically deprecated, "WinRT" isn't, and there's work on better integrating it with win32 stuff? As part of Microsoft's "Project Reunion". But honestly I don't entirely follow exactly what's going on with these APIs or exactly how Microsoft is using all of these terms. |
This comment was marked as off-topic.
This comment was marked as off-topic.
| } | ||
| // Certain platforms accept a mutable reference in their API. | ||
| #[allow(clippy::unnecessary_mut_passed)] | ||
|
|
There was a problem hiding this comment.
Note: We intentionally don't use the platform! macro here, since this is the "starting point" where we may not know the specific platform yet.
|
We briefly touched this on IRC, but my preference would be to move all backends entirely out of the Winit crate and into separate crates (still a monorepo). Though I'm not against this PR and don't mind approving it, it's probably pointless if we have consensus on the separate crates idea. |
|
As stated, we're going with another idea. |
Builds upon: #2421.
Related: #2093
A great thing about
winitis how it supports a varied number of different platforms. I would like to make it even easier to add support for new platforms. Possible examples include: Mac Catalyst, GNUStep, X11 on macOS, SwiftUI, GTK, KMS/DRM, WinRT, and whatever new thing that vendors may decide we should start using.We already have code in
src/platform_impl/linux/mod.rsto handle the fact that both X11 and Wayland can be present on the same target. While some of the above examples can be bolted on to that existing system, I really feel we need a generic way to handle the cases where more than one platform may be available on a specific target. This PR is an attempt at that.The basic idea is to take the
x11_or_wayland!macro, extend it a bit, and then handle delegation to the desired platform at the top level instead (e.g. insidesrc/event_loop.rs,src/window.rs, ...).I haven't implemented this everywhere yet, wanted to get some feedback first, but compare
src/platform_impl/linux/mod.rsandsrc/event_loop.rsin commite74b801to get a feel for what this would look like.In the end, we would end up with the following directory structure:
(This would also make Wayland and X11 feel a lot less like second-class citizens).
CHANGELOG.mdif knowledge of this change could be valuable to users