compositor: fix sub-surface view stacking order
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Tue, 19 Nov 2013 12:03:35 +0000 (14:03 +0200)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 19 Nov 2013 20:57:24 +0000 (12:57 -0800)
commitb188e912c3d18b85a39aba603e593ad7c4778325
tree1dea533c7fc2f12f79497ff1fbd4293f69114d12
parent17467d602d0ced9fe6069ba05871f0228319dbf9
compositor: fix sub-surface view stacking order

If you opened a window with sub-surfaces, and then raised another window
on top of that, the underlaying window's main surface was stacked
properly, but the sub-surfaces remained on top of the raised window.
IOW, the raised window was in between the other window and its
sub-surfaces.

This got broken in a7af70436b7dccfacd736626d6719b3e751fd985, "Split the
geometry information from weston_surface out into weston_view".

Fix the issues:

In view_list_add_subsurface_view(), the views need to be added to the
end of the list, not to the head. This alone fixes the above problem,
but causes the sub-surface views to be stacked irrespective of their
surface stacking order. The stacking order in this test case is fixed by
the changes to view_list_add(), but for sub-sub-surfaces a similar
change is needed in view_list_add_subsurface_view() too.

In view_list_add(), build the view list in the sub-surface stacking
order, instead of pulling the parent surface always on top. Also handle
the case, when the subsurface_list is completely empty: the parent
surface's view must still be added.

Reported-by: Julien Isorce <julien.isorce@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Cc: Jason Ekstrand <jason@jlekstrand.net>
src/compositor.c