Stacking subsurface siblings

Pekka Paalanen ppaalanen at
Wed Jun 17 07:20:15 PDT 2015

On Tue, 16 Jun 2015 23:47:03 +0800
Jonas Ã…dahl <jadahl at> wrote:

> On Tue, Jun 16, 2015 at 04:46:55PM +0200, Arnaud Vrac wrote:
> > Hi,
> > 
> > I'm wondering if a behaviour of weston related to subsurfaces is either a
> > bug or intended. The protocol description is not clear on what happens in
> > the following cases:
> > 
> > Suppose I have a shell surface (BLUE) and two subsurfaces (RED, GREEN). I
> > want to stack them to I get RED, GREEN, BLUE from bottom to top.
> > 
> > If I do:
> > 
> > wl_subsurface_place_below(GREEN->subsurface, BLUE->surface);
> > wl_subsurface_place_below(RED->subsurface, GREEN->surface);
> > 
> > It works, but if I do:
> > 
> > wl_subsurface_place_below(RED->subsurface, GREEN->surface);
> > wl_subsurface_place_below(GREEN->subsurface, BLUE->surface);
> > 
> > The order is GREEN, RED, BLUE instead.
> > 
> > Logically the sibling relative order should be kept in the second case, but
> > it's not. The protocol is not clear on what should happen, what is the
> > expected result ?
> The protocol says "This sub-surface is taken from the stack, and put
> back just above the reference surface, changing the z-order of the
> sub-surfaces." Considering this, if you first placed a surface below
> another, placing again, that relationship may have been broken by the
> new operation. In other words, the "tree" is not moved, just the
> subsurface you placed.

Something here makes my brain hurt...

Let's start with a stack from bottom to top:
B, R, G (or equally: B, G, R)

> > wl_subsurface_place_below(RED->subsurface, GREEN->surface);

Take R out:
B, G
Put R below G:
B, R, G

> > wl_subsurface_place_below(GREEN->subsurface, BLUE->surface);

Take G out:
B, R
Put G below B:
G, B, R

But that's not what you got.

I used to think of the stacking of parent with its immediate children
as an ordered list of { parent, immediate children }. I can't recall
the design discussion since it was years ago, but that's what we ended
up with.

Unfortunately I don't think I can dive into this right now.


More information about the wayland-devel mailing list