static Eina_Bool _e_comp_wl_subsurface_synchronized_get(E_Comp_Wl_Subsurf_Data *sdata);
static void _e_comp_wl_subsurface_synchronized_commit(E_Client *ec);
static void _e_comp_wl_subsurface_remove_from_parent(E_Client *parent, E_Client *subc);
+static void _e_comp_wl_subsurface_child_remove(E_Comp_Wl_Client_Data *parent_cdata, E_Client *child);
+static void _e_comp_wl_subsurface_place_above(E_Client *parent, E_Client *subc, E_Client *above);
+static void _e_comp_wl_subsurface_place_below(E_Client *parent, E_Client *subc, E_Client *below);
static void
_e_comp_wl_subsurface_restack_bg_rectangle(E_Client *ec)
if (!ec->comp_data->sub.list_changed) return (EINA_FALSE | need_restack);
ec->comp_data->sub.list_changed = EINA_FALSE;
+ E_FREE_FUNC(ec->comp_data->sub.list, eina_list_free);
/* TODO: need to check more complicated subsurface tree */
EINA_LIST_FOREACH(ec->comp_data->sub.list_pending, l, subc)
{
- ec->comp_data->sub.list = eina_list_remove(ec->comp_data->sub.list, subc);
ec->comp_data->sub.list = eina_list_append(ec->comp_data->sub.list, subc);
_e_comp_wl_subsurface_order_commit(subc);
}
+ E_FREE_FUNC(ec->comp_data->sub.below_list, eina_list_free);
EINA_LIST_FOREACH(ec->comp_data->sub.below_list_pending, l, subc)
{
- ec->comp_data->sub.below_list = eina_list_remove(ec->comp_data->sub.below_list, subc);
ec->comp_data->sub.below_list = eina_list_append(ec->comp_data->sub.below_list, subc);
_e_comp_wl_subsurface_order_commit(subc);
return;
}
- if (!ecs->comp_data->sub.data) return;
-
- parent->comp_data->sub.list_pending =
- eina_list_remove(parent->comp_data->sub.list_pending, ec);
-
- parent->comp_data->sub.list_pending =
- eina_list_append_relative(parent->comp_data->sub.list_pending, ec, ecs);
-
- parent->comp_data->sub.list_changed = EINA_TRUE;
+ _e_comp_wl_subsurface_place_above(parent, ec, ecs);
}
static void
return;
}
- if (!ecs->comp_data->sub.data) return;
-
- parent->comp_data->sub.list_pending =
- eina_list_remove(parent->comp_data->sub.list_pending, ec);
-
- parent->comp_data->sub.list_pending =
- eina_list_prepend_relative(parent->comp_data->sub.list_pending, ec, ecs);
-
- parent->comp_data->sub.list_changed = EINA_TRUE;
+ _e_comp_wl_subsurface_place_below(parent, ec, ecs);
}
static void
{
return (ec->comp_data) ? (ec->comp_data->sub.data) : NULL;
}
+
+static void
+_e_comp_wl_subsurface_child_remove(E_Comp_Wl_Client_Data *parent_cdata, E_Client *child)
+{
+ if (parent_cdata->sub.list_pending)
+ {
+ parent_cdata->sub.list_pending =
+ eina_list_remove(parent_cdata->sub.list_pending, child);
+ }
+ if (parent_cdata->sub.below_list_pending)
+ {
+ parent_cdata->sub.below_list_pending =
+ eina_list_remove(parent_cdata->sub.below_list_pending, child);
+ }
+}
+
+static void
+_e_comp_wl_subsurface_place_above(E_Client *parent, E_Client *subc, E_Client *above)
+{
+ E_Comp_Wl_Client_Data *pc;
+
+ pc = parent->comp_data;
+
+ _e_comp_wl_subsurface_child_remove(pc, subc);
+
+ if (parent == above)
+ {
+ pc->sub.list_pending = eina_list_prepend(pc->sub.list_pending, subc);
+ }
+ else if (eina_list_data_find(pc->sub.list_pending, above))
+ {
+ pc->sub.list_pending =
+ eina_list_append_relative(pc->sub.list_pending, subc, above);
+ }
+ else
+ {
+ pc->sub.below_list_pending =
+ eina_list_append_relative(pc->sub.below_list_pending, subc, above);
+ }
+
+ pc->sub.list_changed = EINA_TRUE;
+}
+
+static void
+_e_comp_wl_subsurface_place_below(E_Client *parent, E_Client *subc, E_Client *below)
+{
+ E_Comp_Wl_Client_Data *pc;
+
+ pc = parent->comp_data;
+
+ _e_comp_wl_subsurface_child_remove(pc, subc);
+
+ if (parent == below)
+ {
+ pc->sub.below_list_pending =
+ eina_list_append(pc->sub.below_list_pending, subc);
+ }
+ else if (eina_list_data_find(pc->sub.list_pending, below))
+ {
+ pc->sub.list_pending =
+ eina_list_prepend_relative(pc->sub.list_pending, subc, below);
+ }
+ else
+ {
+ pc->sub.below_list_pending =
+ eina_list_prepend_relative(pc->sub.below_list_pending, subc, below);
+ }
+
+ pc->sub.list_changed = EINA_TRUE;
+}