get_data = (E_Desk_Area_Data_EC_Get *) data;
eda = get_data->eda;
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ E_Comp *comp;
+ comp = e_comp_get();
+#endif
+
e_comp_ec_list_lock();
for (x = e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
{
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ if (!comp->layers[x].clients) continue;
+
+ EINA_INLIST_REVERSE_FOREACH(comp->layers[x].clients, ec)
+ {
+ if (e_object_is_del(E_OBJECT(ec))) continue;
+ if (!e_desk_area_has_ec(eda, ec)) continue;
+
+ e_comp_ec_list_unlock();
+ get_data->result_ec = ec;
+ return;
+ }
+#else
if (!eda->layers[x].clients) continue;
EINA_INLIST_REVERSE_FOREACH(eda->layers[x].clients, ec)
get_data->result_ec = ec;
return;
}
+#endif
}
e_comp_ec_list_unlock();
get_data = (E_Desk_Area_Data_EC_Get *) data;
eda = get_data->eda;
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ E_Comp *comp;
+ comp = e_comp_get();
+#endif
+
e_comp_ec_list_lock();
for (x = e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x++)
{
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ if (!comp->layers[x].clients) continue;
+
+ EINA_INLIST_FOREACH(comp->layers[x].clients, ec)
+ {
+ if (e_object_is_del(E_OBJECT(ec))) continue;
+ if (!e_desk_area_has_ec(eda, ec)) continue;
+
+ e_comp_ec_list_unlock();
+ get_data->result_ec = ec;
+ return;
+ }
+#else
if (!eda->layers[x].clients) continue;
EINA_INLIST_FOREACH(eda->layers[x].clients, ec)
get_data->result_ec = ec;
return;
}
+#endif
}
e_comp_ec_list_unlock();
eda = pda->desk_area;
ec = client_data->criterion_ec;
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ E_Comp *comp;
+ comp = e_comp_get();
+#endif
+
e_comp_ec_list_lock();
if (EINA_INLIST_GET(ec)->next) //check current layer
{
EINA_INLIST_FOREACH(EINA_INLIST_GET(ec)->next, ec2)
{
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ if (ec == ec2) continue;
+ if (e_object_is_del(E_OBJECT(ec2))) continue;
+ if (!e_desk_area_has_ec(eda, ec)) continue;
+
+ client_data->result_ec = ec2;
+ e_comp_ec_list_unlock();
+ return;
+#else
if (ec == ec2)
{
ELOGF("FATAL", "CHECK the ec inlist next", ec);
e_comp_ec_list_unlock();
return;
}
+#endif
}
}
/* go up the layers until we find one */
for (x = e_comp_canvas_layer_map(ec->layer) + 1; x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x++)
{
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ if (!comp->layers[x].clients) continue;
+
+ EINA_INLIST_FOREACH(comp->layers[x].clients, ec2)
+ {
+ if (ec == ec2)
+ {
+ ELOGF("FATAL", "[eda:%p] EC exist above layer. ec layer_map:%d, cur layer_map:%d",
+ ec, eda, e_comp_canvas_layer_map(ec->layer), x);
+ continue;
+ }
+ if (e_object_is_del(E_OBJECT(ec2))) continue;
+ if (!e_desk_area_has_ec(eda, ec)) continue;
+
+ client_data->result_ec = ec2;
+ e_comp_ec_list_unlock();
+ return;
+ }
+#else
if (!eda->layers[x].clients) continue;
EINA_INLIST_FOREACH(eda->layers[x].clients, ec2)
return;
}
}
+#endif
}
e_comp_ec_list_unlock();
eda = pda->desk_area;
ec = client_data->criterion_ec;
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ E_Comp *comp;
+ comp = e_comp_get();
+#endif
+
e_comp_ec_list_lock();
if (EINA_INLIST_GET(ec)->prev) //check current layer
for (l = EINA_INLIST_GET(ec)->prev; l; l = l->prev)
{
ec2 = EINA_INLIST_CONTAINER_GET(l, E_Client);
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ if (ec == ec2) continue;
+ if (e_object_is_del(E_OBJECT(ec2))) continue;
+ if (!e_desk_area_has_ec(eda, ec)) continue;
+
+ client_data->result_ec = ec2;
+ e_comp_ec_list_unlock();
+ return;
+#else
if (ec == ec2)
{
ELOGF("FATAL", "CHECK the ec inlist prev", ec);
e_comp_ec_list_unlock();
return;
}
+#endif
}
}
for (; x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
{
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ if (!comp->layers[x].clients) continue;
+
+ EINA_INLIST_REVERSE_FOREACH(comp->layers[x].clients, ec2)
+ {
+ if (ec == ec2)
+ {
+ ELOGF("FATAL", "[eda:%p] EC exist below layer. ec layer_map:%d, cur layer_map:%d",
+ ec, eda, e_comp_canvas_layer_map(ec_layer), x);
+ continue;
+ }
+ if (e_object_is_del(E_OBJECT(ec2))) continue;
+ if (!e_desk_area_has_ec(eda, ec)) continue;
+
+ client_data->result_ec = ec2;
+ e_comp_ec_list_unlock();
+ return;
+ }
+#else
if (!eda->layers[x].clients) continue;
EINA_INLIST_REVERSE_FOREACH(eda->layers[x].clients, ec2)
return;
}
}
+#endif
}
e_comp_ec_list_unlock();
eda = pda->desk_area;
ec = client_data->criterion_ec;
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ E_Comp *comp;
+ comp = e_comp_get();
+#endif
+
e_comp_ec_list_lock();
if (EINA_INLIST_GET(ec)->next) //check current layer
{
EINA_INLIST_FOREACH(EINA_INLIST_GET(ec)->next, ec2)
{
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ if (ec == ec2) continue;
+ if (!_desk_area_client_check_visible(ec2)) continue;
+ if (!e_desk_area_has_ec(eda, ec)) continue;
+
+ client_data->result_ec = ec2;
+ e_comp_ec_list_unlock();
+ return;
+#else
if (ec == ec2) continue;
if (_desk_area_client_check_visible(ec2))
{
e_comp_ec_list_unlock();
return;
}
+#endif
}
}
/* go up the layers until we find one */
for (x = e_comp_canvas_layer_map(ec->layer) + 1; x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); x++)
{
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ if (!comp->layers[x].clients) continue;
+ EINA_INLIST_FOREACH(comp->layers[x].clients, ec2)
+ {
+ if (ec == ec2) continue;
+ if (!_desk_area_client_check_visible(ec2)) continue;
+ if (!e_desk_area_has_ec(eda, ec)) continue;
+
+ client_data->result_ec = ec2;
+ e_comp_ec_list_unlock();
+ return;
+ }
+#else
if (!eda->layers[x].clients) continue;
EINA_INLIST_FOREACH(eda->layers[x].clients, ec2)
{
return;
}
}
+#endif
}
e_comp_ec_list_unlock();
eda = pda->desk_area;
ec = client_data->criterion_ec;
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ E_Comp *comp;
+ comp = e_comp_get();
+#endif
+
e_comp_ec_list_lock();
if (EINA_INLIST_GET(ec)->prev) //check current layer
for (l = EINA_INLIST_GET(ec)->prev; l; l = l->prev)
{
ec2 = EINA_INLIST_CONTAINER_GET(l, E_Client);
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ if (ec == ec2) continue;
+ if (!_desk_area_client_check_visible(ec2)) continue;
+ if (!e_desk_area_has_ec(eda, ec)) continue;
+
+ client_data->result_ec = ec2;
+ e_comp_ec_list_unlock();
+ return;
+#else
if (ec == ec2) continue;
if (_desk_area_client_check_visible(ec2))
{
e_comp_ec_list_unlock();
return;
}
+#endif
}
}
x = e_comp_canvas_layer_map(ec->layer);
if (x > 0) x--;
+ e_comp_ec_list_lock();
+
for (; x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--)
{
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ if (!comp->layers[x].clients) continue;
+ EINA_INLIST_REVERSE_FOREACH(comp->layers[x].clients, ec2)
+ {
+ if (ec == ec2) continue;
+ if (!_desk_area_client_check_visible(ec2)) continue;
+ if (!e_desk_area_has_ec(eda, ec)) continue;
+
+ client_data->result_ec = ec2;
+ e_comp_ec_list_unlock();
+ return;
+ }
+#else
if (!eda->layers[x].clients) continue;
EINA_INLIST_REVERSE_FOREACH(eda->layers[x].clients, ec2)
{
if (_desk_area_client_check_visible(ec2))
{
client_data->result_ec = ec2;
+ e_comp_ec_list_unlock();
return;
}
}
+#endif
}
+
+ e_comp_ec_list_unlock();
}
static void
static void
_e_comp_object_layers_add(E_Desk_Area *eda, E_Comp_Object *cw, E_Comp_Object *above, E_Comp_Object *below, Eina_Bool prepend)
{
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ E_Comp *comp;
+ comp = e_comp_get();
+#endif
+
e_comp_ec_list_lock();
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ if (above)
+ {
+ comp->layers[above->layer].clients = eina_inlist_append_relative(comp->layers[above->layer].clients, EINA_INLIST_GET(cw->ec), EINA_INLIST_GET(above->ec));
+ comp->layers[above->layer].clients_count++;
+ _e_comp_object_layers_update(above->layer, E_COMP_INPUT_INLIST_APPEND_RELATIVE, cw->ec, above->ec);
+ }
+ else if (below)
+ {
+ comp->layers[below->layer].clients = eina_inlist_prepend_relative(comp->layers[below->layer].clients, EINA_INLIST_GET(cw->ec), EINA_INLIST_GET(below->ec));
+ comp->layers[below->layer].clients_count++;
+ _e_comp_object_layers_update(below->layer, E_COMP_INPUT_INLIST_PREPEND_RELATIVE, cw->ec, below->ec);
+ }
+ else
+ {
+ if (prepend)
+ {
+ comp->layers[cw->layer].clients = eina_inlist_prepend(comp->layers[cw->layer].clients, EINA_INLIST_GET(cw->ec));
+ _e_comp_object_layers_update(cw->layer, E_COMP_INPUT_INLIST_PREPEND, cw->ec, NULL);
+ }
+ else //this is either the layer object or a tough actin tinactin^W^W^Wfast stacking client
+ {
+ comp->layers[cw->layer].clients = eina_inlist_append(comp->layers[cw->layer].clients, EINA_INLIST_GET(cw->ec));
+ _e_comp_object_layers_update(cw->layer, E_COMP_INPUT_INLIST_APPEND, cw->ec, NULL);
+ }
+ comp->layers[cw->layer].clients_count++;
+ }
+#else
if (above)
{
eda->layers[above->layer].clients = eina_inlist_append_relative(eda->layers[above->layer].clients, EINA_INLIST_GET(cw->ec), EINA_INLIST_GET(above->ec));
}
eda->layers[cw->layer].clients_count++;
}
+#endif
e_comp_ec_list_unlock();
}
static void
_e_comp_object_layers_remove(E_Desk_Area *eda, E_Comp_Object *cw)
{
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ E_Comp *comp;
+ comp = e_comp_get();
+#endif
+
e_comp_ec_list_lock();
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ if (cw->ec && comp->layers[cw->layer].clients)
+ {
+ comp->layers[cw->layer].clients = eina_inlist_remove(comp->layers[cw->layer].clients, EINA_INLIST_GET(cw->ec));
+ comp->layers[cw->layer].clients_count--;
+ _e_comp_object_layers_update(cw->layer, E_COMP_INPUT_INLIST_REMOVE, cw->ec, NULL);
+ }
+#else
if (cw->ec && eda->layers[cw->layer].clients)
{
eda->layers[cw->layer].clients = eina_inlist_remove(eda->layers[cw->layer].clients, EINA_INLIST_GET(cw->ec));
eda->layers[cw->layer].clients_count--;
_e_comp_object_layers_update(cw->layer, E_COMP_INPUT_INLIST_REMOVE, cw->ec, NULL);
}
+#endif
e_comp_ec_list_unlock();
}
E_Comp_Object *cw, *cw2 = NULL;
Evas_Object *o = NULL;
short layer;
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ E_Comp *comp;
+ comp = e_comp_get();
+#endif
cw = evas_object_smart_data_get(obj);
if (!cw) return;
if ((!o) || (o == cw->smart_obj)) break;
if (evas_object_layer_get(o) != layer)
{
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ o = comp->layers[e_comp_canvas_layer_map(E_LAYER_CLIENT_ALERT)].obj;
+#else
o = eda->layers[e_comp_canvas_layer_map(E_LAYER_CLIENT_ALERT)].obj;
+#endif
}
if (!o)
{
short layer;
Evas_Object *o = stack;
Eina_Bool raising = stack_cb == e_comp_object_stack_above;
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ E_Comp *comp;
+ comp = e_comp_get();
+#endif
/* We should consider topmost's layer_pending for subsurface */
if ((cw->ec->layer_block) || _e_comp_object_is_pending(cw->ec))
/* reached the top client layer somehow
* use top client object
*/
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ o = comp->layers[e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR)].obj;
+#else
o = eda->layers[e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR)].obj;
+#endif
}
if (!o)
/* top client layer window hasn't been stacked yet. this probably shouldn't happen?
/* stack it above layer object */
int below_layer;
below_layer = (cw2->layer <= 0)? 0 : cw2->layer - 1 ;
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ stack = comp->layers[below_layer].obj;
+#else
stack = eda->layers[below_layer].obj;
+#endif
}
}
else
if ((new_stack) && (new_stack->layer == cw2->ec->layer))
stack = new_stack->frame;
else
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ stack = comp->layers[cw2->layer].obj;
+#else
stack = eda->layers[cw2->layer].obj;
+#endif
}
}
if (cw->ec->new_client || (!ecstack) || (ecstack->frame != o))
evas_object_data_set(cw->smart_obj, "client_restack", (void*)1);
stack_cb(cw->smart_obj, stack);
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ if (comp->layers[cw->layer].obj)
+ if (evas_object_below_get(cw->smart_obj) == comp->layers[cw->layer].obj)
+#else
if (eda->layers[cw->layer].obj)
if (evas_object_below_get(cw->smart_obj) == eda->layers[cw->layer].obj)
+#endif
{
CRI("STACKING ERROR!!! ec:%p (cw->layer:%d, ec->layer:%d)", cw->ec, cw->layer, cw->ec->layer);
}
E_Client *ec;
Evas_Object *obj, *o, *op;
E_Comp_Object *cw;
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ E_Comp *comp;
+ comp = e_comp_get();
+#endif
eda_client = wl_container_of(listener, eda_client, comp_object_raise);
eda = eda_client->eda;
if (evas_object_layer_get(o) != evas_object_layer_get(obj)) return; //already at top!
/* still stack below override below the layer marker */
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ for (op = o = comp->layers[cw->layer].obj;
+ o && o != comp->layers[cw->layer - 1].obj;
+ op = o, o = evas_object_below_get(o))
+#else
for (op = o = eda->layers[cw->layer].obj;
o && o != eda->layers[cw->layer - 1].obj;
op = o, o = evas_object_below_get(o))
+#endif
{
if (evas_object_smart_smart_get(o))
{
E_Comp_Wl_Client_Data *child_cdata;
unsigned int l;
int oldraise;
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ E_Comp *comp;
+ comp = e_comp_get();
+#endif
eda_client = wl_container_of(listener, eda_client, comp_object_set_layer);
eda = eda_client->eda;
evas_object_stack_below(obj, ec2->frame);
}
else
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ evas_object_stack_below(obj, ec2 ? ec2->frame : comp->layers[cw->layer].obj);
+#else
evas_object_stack_below(obj, ec2 ? ec2->frame : eda->layers[cw->layer].obj);
+#endif
}
return;
}
//if (cw->ec->new_client)
//INF("CLIENT STACKED %p: %u", cw->ec, layer);
e_comp_object_layer_set(obj, layer);
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ if (!comp->layers[cw->layer].obj) return; //this is a layer marker
+ evas_object_stack_below(obj, comp->layers[cw->layer].obj);
+ if (evas_object_below_get(obj) == comp->layers[cw->layer].obj)
+#else
if (!eda->layers[cw->layer].obj) return; //this is a layer marker
evas_object_stack_below(obj, eda->layers[cw->layer].obj);
if (evas_object_below_get(obj) == eda->layers[cw->layer].obj)
+#endif
{
/* can't stack a client above its own layer marker */
CRI("STACKING ERROR!!! ec:%p (cw->layer:%d, ec->layer:%d)", cw->ec, cw->layer, cw->ec->layer);
E_Policy_Desk_Area *pda;
E_Layer ec_layer;
Evas_Object *obj;
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ E_Comp *comp;
+ comp = e_comp_get();
+#endif
EINA_SAFETY_ON_NULL_RETURN_VAL(eda, NULL);
for (ec_layer = e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); ec_layer <= e_comp_canvas_layer_map(E_LAYER_CLIENT_CURSOR); ec_layer++)
{
+#ifdef NEED_REFINE_EDA_LAYERS_LIST
+ obj = comp->layers[ec_layer].obj = evas_object_rectangle_add(e_comp_evas_get());
+#else
obj = eda->layers[ec_layer].obj = evas_object_rectangle_add(e_comp_evas_get());
+#endif
evas_object_layer_set(obj, e_comp_canvas_layer_map_to(ec_layer));
evas_object_name_set(obj, "layer_obj");
}