-
Notifications
You must be signed in to change notification settings - Fork 123
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 Rust modules to replace namespace prefixes #316
Comments
The reorganization within protocols to flatten them sounds good overall, but I think we should keep each protocol of wayland-protocols into its own module, to keep some clarity of what goes with what mostly. So, maybe an organization like:
I'm not really sure where the |
That makes sense.
I think it would work best at the crate level, since it's rare that you need both in the same scope. |
Why is this distinction needed? The types on both seem to be the same, e.g.: wayland_protocols::wlr::unstable::data_control::v1::server::zwlr_data_control_offer_v1 wayland_protocols::wlr::unstable::data_control::v1::client::zwlr_data_control_offer_v1 I can't find any that actually differ; can't the same types be used for clients and servers? |
The first struct has a different representation and set of methods. |
You're right. And including all of them in a same struct would result in really bad developer experience. |
With the current API, to use the
wl_data_device_manager
object, you have to importprotocol::wl_data_device_manager::WlDataDeviceManager
.If it were to be put in a
wl
module rather than aprotocol
module, some redundant parts could be removed:wl::data_device_manager::DataDeviceManager
.Since it's the main item in the module, it could be re-exported in the parent module (similar to std::collections), so you'd only need
wl::DataDeviceManager
.Event/Request/other enums could stay in the module, accessed like
wl::data_device_manager::Event
.Currently, request/event since-versions are module-level constants, like
wl_data_device_manager::REQ_CREATE_DATA_SOURCE_SINCE
. With associated constants, that can bewl_data_device_manager::Request::CREATE_DATA_SOURCE_SINCE
. This is separate from the namespace change, but can be done if it's being changed anyway.This doesn't only work with prefixes, this can be used for unstable versions too, so
wayland_protocols::wlr::unstable::layer_shell::v1::client::zwlr_layer_shell_v1::ZwlrLayerShellV1
can become something likewayland_protocols::client::zwlr::v1::layer_shell::LayerShell
. But I'm not sure about this one, since multiple v1 protocols from the same namespace aren't really related by that alone.The prefix/suffix for each protocol would have to be annotated for wayland-scanner, which would only remove them, and the module organization could be done manually.
The text was updated successfully, but these errors were encountered: