probonopd / wayland-x11-compat-protocols

The missing Wayland protocols for features that are available in X11 (but are denied by the official Wayland protocols)
117 stars 3 forks source link

Clarify zwlr_foreign_toplevel_handle_v1 vs. xdg_toplevel #20

Open probonopd opened 11 months ago

probonopd commented 11 months ago

In X11, there is the concept of a "window" which can be referred to by its unique Window ID (wid).

On Wayland, there is zwlr_foreign_toplevel_handle_v1 and xdg_toplevel. Apparently the latter is for native Wayland applications whereas the former isn't.

Question: Can native Wayland applications use zwlr_foreign_toplevel_handle_v1 too? Or do we have to have provisions for windows created by native Wayland applications (using xdg_toplevel) and for windows not created by native Wayland applications (using zwlr_foreign_toplevel_handle_v1)?

i509VCB commented 11 months ago

zwlr_foreign_toplevel_handle_v1 can refer to an xwayland, xdg toplevel or any window type that behaves like a toplevel.

There is a ext_foreign_toplevel_list protocol intended to succeeded the wlr protocol, just needs a new extension protocol to reach parity. The goal of that protocol is to act as an opaque handle to desktop-like windows from other processes.

probonopd commented 11 months ago

Thanks for the clarification @i509VCB. So would you say that we should be using zwlr_foreign_toplevel_handle_v1 instead of xdg_toplevel whenever we need to refer to windows regardless of whether they come from Wayland or X11 applications?

myownfriend commented 11 months ago

@probonopd for questions about the existing protocol, it might be better to ask them in the official repo. They'll be able to give you suggestions on what to do.

Anything beginning with zwlr is a wlroots-specific protocol, not an official Wayland protocol. ext_foreign_toplevel_list is an official Wayland protocol.

https://gitlab.freedesktop.org/wayland/wayland-protocols/-/tree/main/staging/ext-foreign-toplevel-list?ref_type=heads

i509VCB commented 11 months ago

Just to note I am the author of the ext protocol, so feel free to bug me with questions.

I'll get to probono's question when I get home, currently out for new years

i509VCB commented 11 months ago

Thanks for the clarification @i509VCB. So would you say that we should be using zwlr_foreign_toplevel_handle_v1 instead of xdg_toplevel whenever we need to refer to windows regardless of whether they come from Wayland or X11 applications?

I'd say it depends on the context:

If the goal is to provide a function where the client only cares about it's own windows, then xdg_surface/xdg_toplevel work well here.

If the goal is to provide a function where some other client's windows might be involved, then ext_foreign_toplevel_handle_v1 would probably be what you'd want to use.

probonopd commented 11 months ago

That is very reasonable, thanks a lot @i509VCB. Happy New Year!