Skip to content
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

[WIP] wayland-rs-0.20.0 #165

Merged
merged 60 commits into from
Apr 20, 2018
Merged

[WIP] wayland-rs-0.20.0 #165

merged 60 commits into from
Apr 20, 2018

Conversation

elinorbgr
Copy link
Member

@elinorbgr elinorbgr commented Feb 25, 2018

Currently WIP, complete rework of the libs to significantly improve the APIs and reduce the unsafe code use, as well as pave the road for a full-rust implementation of the protocol.

TODO:

  • commons:

    • API documentation
    • Crate documentation
  • scanner:

    • client code generation
    • server code generation
  • client:

    • object implementation & dispatching
    • connection initialization
    • multiple queues handling (non-send support)
    • convenience code for handling globals
    • wayland-egl
    • wayland-cursor
    • API documentation
    • Crate documentation
  • server:

    • object implementation & dispatching
    • non-send implementation support
    • server initialization
    • client tracking
    • multiple event queues & event sources
    • API documentation
    • Crate documentation

@elinorbgr elinorbgr force-pushed the wayland_rs_20 branch 3 times, most recently from f9ed232 to f28bcf5 Compare February 25, 2018 15:18
@coveralls
Copy link

Coverage Status

Coverage remained the same at 0.0% when pulling f9ed232 on wayland_rs_20 into 0379ed1 on master.

@coveralls
Copy link

coveralls commented Feb 25, 2018

Coverage Status

Coverage increased (+82.3%) to 82.315% when pulling b091117 on wayland_rs_20 into 8e6b642 on master.

@Timidger
Copy link
Contributor

... as well as pave the road for a full-rust implementation of the protocol.

I must be out of the loop with this...is there still an attempt to rewrite Wayland in Rust?

@elinorbgr
Copy link
Member Author

Well, it's mostly a "leave the door open" thing. It's something I've been wanting to work on for some time now, and this refactor allows me to cleanly keep the possibility to do this in the future.

Basically, the idea is that as newer versions of mesa use the dmabuf extension protocol internally (rather than wl_drm), there is technically no long-term blocker to have a full rust implementation of the protocol, at least server-side (I don't know how things are regarding nvidia, but I won't make my hopes high...).

On the other hand, I want to also experiment with ideas such as "rust-implementation of the protocol with a public C api", which would allow wayland-rs to be a system-wide implementation of wayland.

So with this new refactor, the wayland-rs crates have "native_lib" cargo feature, enabled by default, which makes them use the C libs as backend. On day, I may succeed in making a native implementation, in which case removing this feature will use it. (For now, all the code will remain as unimplemented!()).

But there is not timeline nor priority for this. The core reason of this refactor is to address usability issues we encountered in smithay, and try to make the API more rust-friendly overall.

@Timidger
Copy link
Contributor

Ah ok thanks for the update.

I remember there was talk a while back about skylane being a potential implementation, but was shot down due to the mesa issues you mentioned. The fact that is unblocked is news to me, and very welcome.

I'm way too busy at the moment with Way Cooler and wlroots-rs, but maybe in the future if that is still planned / being worked on I'll look into helping out. At the very least, it will be another implementation which will be nice since everyone just uses the reference one and there should be alternatives (especially in such a safe language).

@elinorbgr
Copy link
Member Author

@mitchmindtree @Drakulix : Thanks for the proofreading!

@elinorbgr
Copy link
Member Author

I'm considering this done, though if someone want to give their opinion on the API, this would be very welcome.

I've made 3 examples which I think represent mostly how the API feels like client side, you can see them here: https://github.com/Smithay/wayland-rs/tree/wayland_rs_20/wayland-client/examples

I've not made any examples server-side (yet ?), mostly because a minimal meaningful server is much more complex than a minimal meaningful client. But the APIs client-side and server-side are very similar overall.

Copy link
Member

@Drakulix Drakulix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found some more typos in the examples, but I like the api overall. Feels very clean and like a simple abstraction, that does not hide too much details of the protocol.

// with version 1 when advertized, and provide a callback that
// will handle the created wl_seat to implement them
//
// NOTE: the type annotations are necessayr because rustc's
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

necessary

|seat: Result<NewProxy<_>, _>, ()| {
// here seat is a result, as failure can happen if the server
// advertized an lower version than we requested.
// This cannot happer here as we requested version 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

happen


use wayland_client::protocol::wl_display::RequestsTrait;

// A minimal example printing the list of globals abvertized by the server and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

advertized

@elinorbgr
Copy link
Member Author

Alright, this has been polished enough and I'm happy with the current state of things. Minor additional fixes shall come in new PRs an releases.

@elinorbgr elinorbgr merged commit e866a27 into master Apr 20, 2018
@elinorbgr elinorbgr deleted the wayland_rs_20 branch July 18, 2018 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants