ivi-shell: clear order.layer_list before reordering it
authorUcan, Emre (ADITG/SW1) <eucan@de.adit-jv.com>
Thu, 20 Aug 2015 14:13:30 +0000 (14:13 +0000)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Fri, 21 Aug 2015 08:53:43 +0000 (11:53 +0300)
commit174257bdf82dd62596d330b8f12bc1a6d6d935bb
tree0b43a5d101a50152bd0b46f759a61060240518b5
parent38fcf381be99d6c53711909001ef3e52073d0324
ivi-shell: clear order.layer_list before reordering it

It is only possible to remove a layer from the order.layer_list of a
screen, when ivi_layout_screen_set_render_order is called with an empty
array.  Therefore, list of layers are cumulated if the API is called
many times with different list of layers.

Change how the flags are set:
    - Introduce the dirty parameter for triggering the render order change.
    - IVI_NOTIFICATION_REMOVE/ADD flags are set only at commit_screen_list.

Checking wl_list_empty() on a link offers no information: if it returns
true, wl_list_remove() is safe to do. If it returns false, you still do
not know if wl_list_remove() is safe; the link could be part of a list,
or the link could be "uninitialized" (e.g. just wl_list_remove()'d).
(From Pekka Paalanen's comment at
http://lists.freedesktop.org/archives/wayland-devel/2015-August/023987.html).

Calling wl_list_init just before wl_list_insert is redundant.  Because
the links of the list are not read before it is overwritten by
wl_list_insert.

Use assert to control if the ivilayer->order.surface_list is empty.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
[Pekka: line-wrapped commit message]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
ivi-shell/ivi-layout.c