ext-foriegn-toplevel-list-v1: add toplevel index/ordering
The toplevel list protocol is useful for implementing things like taskbars. However, one issue is that the ordering of the toplevels is unspecified. For your traditional stacking compositor this is pretty much a non issue, but for a scrolling compositor like niri this becomes more problematic when you have lots of windows and would like to know where one particular window is. For this, the toplevel list needs to expose some sort of ordering to the client. I can think of two approaches to this:
- Add an
index
event toext_foreign_toplevel_handle_v1
, which is sent whenever a toplevel's place in the list changes
- Pros: Simple, intuitive
- Cons: Can result in lots of protocol noise if a toplevel position moves drastically
- Add an
after
/before
(or both) event to the toplevel handle, that gives the identifier of another existing toplevel
- Pros: Less protocol noise, potentially less restrictive for compositors
- Cons: Less intuitive than the index, I haven't fully thought of all of the corner cases
I think such an event could also be optional for compositors to emit, as it would be a waste of time if a compositor doesn't have a meaningful ordering relationship of toplevels to actually emit an ordering event.