swaywm / wlroots-rs

Attempt at safe Rust bindings for wlroots
MIT License
165 stars 23 forks source link

DataDevice #31

Open Timidger opened 7 years ago

Timidger commented 7 years ago

This is one of the globals that the compositor needs to create at startup.

Either it needs to be provided in the constructor (like the I/O managers) or it needs to be passed in later (like the extension protocols).

I'm up for either, leaning towards the latter since this is sort of an "extension" and it's possible that a compositor may not want to implement this interface (and we should take a page out of wlroots' book and let the user decide).

Either way, it needs to live as long as the compositor and destroyed before it disconnects.

Need to also ensure only one global is registered at a time of this type.

Functions

DataOffer

Events

DataSource

Events

Global Callbacks

They should be callable, setting them may be unsafe but probably not. They are already initialized in global creation. Double check because this could be safe.

Global Cleanup

SethBarberee commented 5 years ago

For resource, do we just want to return the pointer or the wl_resource? I've got code implemented that returns the wl_resource. It's mainly semantics but mainly wondering..

Timidger commented 5 years ago

Honestly for those it's not a big deal since it'll probably never be used by the library user.

Just make an unsafe function that returns whatever is in the struct. Eg if it's a pointer don't dereference it just return it.