Cloudef / wlc

High-level Wayland compositor library
MIT License
330 stars 58 forks source link

Implement functions to get surface textures #135

Closed ammen99 closed 8 years ago

ammen99 commented 8 years ago

This allows compositors to draw surfaces the way they want to, so that they can also create custom animations.

New functions: wlc_output_get_renderer() wlc_surface_get_textures() wlc_surface_get_subsurfaces() wlc_get_subsurface_geometry() wlc_surface_flush_frame_callbacks()

Maybe resolves #8 ?

ammen99 commented 8 years ago

Updated I just noticed that when setting mask to 0, animated native wayland clients(for ex. weston-subsurfaces) stops updating. My guess without looking at the code is that it uses frame callbacks which aren't called(with mask set to 0). Is that correct? In this case we'll either need to change view.render.pre to return a bool value whether we should actually draw the view or maybe we would need a single flag(maybe choose a specific bit in view mask or a new field)?

Cloudef commented 8 years ago

When mask is 0, you are indicating the view is not visible. Wlc will optimize it out from render loop (similarly, if view is culled (behind something) the render hook will not be called).

Your suggestion would not work as the pre/post hooks per view are not called at all, only output post/pre (pre only if background is visible). This would need special casing, to tell wlc not to cull view with some option.

ammen99 commented 8 years ago

I meant not to set view mask to 0 at all, but use this additional flag as the way to tell wlc not to display the view on screen(meaning it must be processed by render loop, but not drawn).

ammen99 commented 8 years ago

This is what I had on mind, if you can think of a better way, tell me.

Cloudef commented 8 years ago

This will not work if the view is culled by wlc (Actually pre hook should not be called at all if mask == 0). I'd rather you give view or surface option in wlc-render for this specific purpose.

ammen99 commented 8 years ago

OK, will do this later.

ammen99 commented 8 years ago

What do you think of this? You were right, I forgot that frame callbacks can be pushed outside the render loop :)

Cloudef commented 8 years ago

Yeah this is good.

r4dr3fr4d commented 8 years ago

IIiya, can I PM/email you to discuss creating some animations?

On Wed, Mar 9, 2016 at 3:24 AM, Iliya Bozhinov notifications@github.com wrote:

Do you think this is ready for merge?

— Reply to this email directly or view it on GitHub https://github.com/Cloudef/wlc/pull/135#issuecomment-194201797.

ammen99 commented 8 years ago

@raycewest Yes, sure. My email is iliyabo@hotmail.com

ammen99 commented 8 years ago

@Cloudef I updated the commit.

Cloudef commented 8 years ago

Thanks, merged.

ammen99 commented 8 years ago

@Cloudef Sorry to "wake" an already merged pull request, but what I want to say is that it will be good if we added also wlc_view_commit_state() for surf->parent_view in wlc_surface_flush_frame_callbacks() to make sure that views can be moved while drawing custom animations(they don't get updated until they're drawn by wlc because they aren't committed). Or maybe I should add another function dedicated to doing only this? What do you think? The changes are just 3 lines(at the bottom of flush_frame_callbacks():

    struct wlc_view *v;
    if ((v = convert_from_wlc_handle(surf->parent_view, "view"))                     
        wlc_view_commit_state(v, &v->pending, &v->commit);                                                   
Cloudef commented 8 years ago

It's not technically correct. But the commits in wlc aren't anyways for now. (They sort of violate wayland protocol) I'm okay with that addition.