-
Notifications
You must be signed in to change notification settings - Fork 877
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
Split Winit up into multiple crates #3433
Comments
Is there any interest in splitting We would also need to incorporate #2395 as we already included that change in our fork which was implemented based on #2148. |
Hmm, I guess that actually makes a lot of sense - and it might even be useful for I've reserved the crate name |
I'd be happy to help with the migration if there is a repo I can contribute to, or should it live within this repo? |
I'll bring it up in our meeting on friday, then I'll get back to you with a plan. |
We talked about it, and don't really think we want to pull in the extra dependency for I think we agreed on doing the split like I described in #3455 (comment), have put up #3518 to move the module, then you're free to submit PRs to improve that afterwards. |
Hey, thank you for this initiative. Do you think a split like this would enable us to use winit types (like keycodes) independently from winit and in external APIs. I am finding winits input and event types, especially the KeyCode to be massively beneficial to use in e.g game engine or ui library public APIs rather than re-defining the enum and using Would this be a usecase you would be willing to support, I.e; using winit even types in the API (I am ok with breaking changes and refactors, just as long as I can use these in an API) :) |
Given that the |
Part of #3367, opening to discuss separately.
Winit is designed around a single crate with a specific set of backends, which is great for users that can use that, but there is a need for other backends that are not implemented in Winit today, like GTK. Additionally, the backend-specific extensions that we do have usually constrain some other part of the design.
So it would probably be useful to try to split Winit into multiple smaller crates (though still in the same repository), to ease doing this work. The top-level
winit
crate would still remain.Along with this, we'd want a way to write out-of-tree backends, and allow the user to integrate them into their application. This could probably be solved by introducing internal / "backend" traits, and keep a
dyn
in structures inside thewinit
crate.A rough implementation plan could be:
winit-core
crate, which contains the common types that all backends use (likedpi
and keyboard types)winit-core
, but still have the mainwinit
crate "merge" these backends withcfg
s, not with a trait.winit-core
, that implements the desired functionality, and move each backend to also implement those traits.winit
crate to an API that is notcfg
-based, butdyn Trait
-based.winit-common
crate to have shared functionality between the crates, which will be intended for winit internal usage and help writing new backends.@kchibisov: I've tried to fairly faithfully reproduce what I felt was the important points from #3367, but please edit this issue description with your own.
The text was updated successfully, but these errors were encountered: