-
Notifications
You must be signed in to change notification settings - Fork 868
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
use cfg aliases throught the code base #2586
Conversation
d0facdc
to
963fdbb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer if we kept things as close to 1:1 as possible, so I'd prefer if x11
and wayland
were only aliases for their respective features, without also implying linux
. Some cfg
guards were also re-ordered, and I'd prefer if we kept the existing order (this isn't a huge deal, tbh, just a preference).
On the whole, though, I think this is a good change, and it makes our cfg
guards a lot less noisy.
Reverted! |
So, I checked out your changes locally and grepped through for
One issue that did occur to me just now is that |
Thanks, will update them too.
I wanted to name it
Can't I just remove the |
Looks like I can't, so I went ahead and changed it |
My ideas here are not great (mostly just
That's probably fine. As far as I'm aware, there's only really |
Uuh, ok. Why didn't it work? |
I don't know what the built-in see this run https://github.com/rust-windowing/winit/actions/runs/3664441578/jobs/6194851823 |
Sounds acceptable to me for now until a better name is found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of any further issues beyond what's already been mentioned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from os_linuxy
I don't think we really gain much from this (other than an increase in compile-times, and an extra indirection where people have to go see what os_ios
actually means ;) ).
But I'm not that against it, and if you think it would make it easier to integrate GTK, then sure, go for it (though yeah, I still think #2430 is the most "correct" way to go, but eh, that may also just be sunk costs speaking).
Co-authored-by: Mads Marquart <mads@marquart.dk>
TBH, I feel neutral about it, I think we can integrate GTK without it, but it was requested by @kchibisov |
Oof, I forgot about compile-times. I don't think this will add more than a couple of seconds, but any regression is unfortunate.
Can you link that request, just for posterity? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is to structure around the displays, like, so in the end we'll have
x11_platform
wayland_platform
macos_appkit
windows
wasm
android
ios
The OS should be hidden where it makes sense, like for x11/wayland, and if something will try to use Wayland on e.g. macOS, porting will be done by tweaking build.rs to achieve mutually exclusivity and slight updating the inner backend.
The backends are expected to move to a static dispatch marcos based on the displays and not the platforms.
The GTK part could be entirely encapsulated from that, but more about it will be once we come to a point where our backends layout will be adjusted.
For an example about aliases you can take a look at https://github.com/rust-windowing/glutin/blob/master/glutin/build.rs .
Then, @amrbashir, since you've asked what's needs to be done to bring the GTK in the tree. The following layout from that PR should be implemented. It looks kind of ok and @madsmtm could likely help you with that, but for a working concept of such a thing you can look again at glutin. https://github.com/rust-windowing/glutin/blob/master/glutin/src/lib.rs#L42 - that's how dispatch is done in glutin, but @madsmtm has slightly better version of this macro in their work. So the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh... I had understood previously that you were against #2430, @kchibisov, which is why I haven't worked on it more?
(Though these two PRs are not exclusive, so still 👍 from me on this one)
a96ae05
to
40263b2
Compare
src/event_loop.rs
Outdated
target_os = "openbsd", | ||
target_os = "windows" | ||
))] | ||
#[cfg(any(free_unix, windows))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x11 or windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clippy will complain about unused functions on Wayland, changed it to x11, wayland or Windows
Thanks! |
CHANGELOG.md
if knowledge of this change could be valuable to users