Wl_subsurface to GdkWaylandSurface

Hi,

Is there any way to create a GdkWaylandSurface from an already existing wl_subsurface?

Basically, I create wl_surface using zwlr_layer_surface_v1 and then I create wl_subsurface on top of previously created wl_surface. My requirement is to use this wl_subsurface which I already created as a base for a GtkWindow

I see there there is get_wl_surface() exists from GdkWaylandSurface, But it is not a wl_surface created using zwlr_layer_surface_v1.

Let me know if there is any way.

No, there is no way to do that: all the native windowing system surfaces can only be created by GTK itself.

There were some WIP patches at some point that were working towards being able to build your own GtkNative from some custom wl_surface, specifically for supporting layer-shell in GTK4. But AFAIK those haven’t landed yet, or necessarily will land. And I don’t know if there’s anyone still working on them (IIRC it was a System76 initiative)

There’s also gtk4-layer-shell, that just intercepts all of GTK’s Wayland communications and kinda forcibly manipulates them to use layer-shell instead. But this is a potentially fragile and not-officially-supported solution. GTK still thinks it has a normal window, so things can break in new and creative ways. But this doesn’t directly solve your issue, it just lets you use GTK with layer-shell, it doesn’t let you plug in arbitrary surfaces that you obtained on your own (at least it didn’t allow this when I last used it a couple of years ago)

There’s also gtk4-layer-shell

Yes, I learnt about gtk4-layer-shell after asking this question here.

I think it will be great if we have some way to create gtk widget on top of independently created wl_surface/wl_subsurface.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.