YaLTeR / wl-clipboard-rs

A safe Rust crate for working with the Wayland clipboard.
Apache License 2.0
223 stars 16 forks source link

Implement copy_multi, see #9 #10

Closed ghost closed 4 years ago

ghost commented 4 years ago

I've tried implementing copy_multi, but this code doesn't seem to work as intended. It seems to overwrite all selections with the last one, rather then offering them simultaneously.

YaLTeR commented 4 years ago

That's because you do device.set_selection() per-mime-type, while it should be done once, for all offered mime types; and then when a certain mime type is requested for that offer, the correct data should be sent as the response.

I suggest adding a test for multiple mime types right away so that it's easy to see if it works properly.

ghost commented 4 years ago

Thank'you for the feedback, I'll see to it!

ghost commented 4 years ago

I implemented a test that passes, but I'm not sure if it checks the correct behavior for "contents" (assert_eq!(contents, [1, 3, 3, 7, 2, 4, 4]);)

ghost commented 4 years ago

This simple gist using the api seems to work fine.

ghost commented 4 years ago

Done. I think it's ready to be merged. The thing about RAII guards in make_source belongs to another issue/pull request, in my opinion.

YaLTeR commented 4 years ago

Thanks!