way-cooler / rust-wlc

[DEPRECATED] Rust bindings for wlc, the Wayland compositor library
54 stars 12 forks source link

Is wlc_surface_get_textures supported, and if so, how to use it? #67

Closed olejorgenb closed 7 years ago

olejorgenb commented 7 years ago

I'm trying to use the surface textures to implement expose-ish functionality. (ref: https://github.com/way-cooler/way-cooler/pull/284)

The raw c function is exposed https://github.com/way-cooler/rust-wlc/blob/master/src/render.rs#L72 but no wrapper exists (like eg. read_pixels)

I'm very new to rust, so sorry in advance if some of this doesn't make sense or should be obvious :)

Ps: this is how wlc.rs does it: https://github.com/Drakulix/wlc.rs/blob/master/src/render/mod.rs#L188

Timidger commented 7 years ago

Hey there.

Yes, it looks like we wrap it incorrectly (e.g we don't have a bool as a return type). I was a little hasty when wrapping these since I just needed the other render functions (namely, read and write pixels, which is why there are wrappers for it). Since wlc is "deprecated" already in my mind since we eventually will switch off of it, I think I've gotten a little too loose with this repo :P.

To coerce a WlcView into a surface pointer, if I remember correctly, you'll need to use this into method here. BUT after looking at that a little closer, it looks like that was defined wrong...it should be using wlc_view_get_surface, and then passing THAT handle to wlc_surface_get_wl_resource....so those are two things that need to be fixed before that can be accomplished.

I might be able to fix those things tonight, but if you're feeling confident feel free to submit a patch with those changes.

olejorgenb commented 7 years ago

Thanks for quick reply!

Since wlc is "deprecated" already in my mind since we eventually will switch off of it, I think I've gotten a little too loose with this repo :P.

Can you elaborate on this? You plan to move away from wlc as the "backend" for way-cooler?

I can play around a bit based on the feedback first. I've got thing set up so I can modify build way-cooler against my local wlc-rust.

Timidger commented 7 years ago

Can you elaborate on this? You plan to move away from wlc as the "backend" for way-cooler?

Yes, see this thread for more details.

olejorgenb commented 7 years ago

Reading through that thread it seems foolish to expend to much energy on wlc specific things at this time. (Feel free to close this issue)

Timidger commented 7 years ago

@olejorgenb I'll at least expend energy to fix the issues you pointed out (the incorrectly bound wlc functions, and the issue w/ the WlcView into impl for WlResource), and close this when those are fixed.