From c336d126d8cc8f2091293651a4b6e635ba87f413 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Fri, 6 Mar 2015 11:46:44 +0900 Subject: [PATCH] e_comp exposed as global Change-Id: I7dcb641a05327f9ce23951c545459662d7fa06ba --- src/e_mod_config.c | 15 +++--------- src/e_mod_main.c | 66 ++++++++++++++++++++++++-------------------------- src/e_mod_rotation.c | 60 +++++++++++++++++++++------------------------ src/e_mod_softkey.c | 4 +-- src/e_mod_visivility.c | 14 +++-------- 5 files changed, 68 insertions(+), 91 deletions(-) diff --git a/src/e_mod_config.c b/src/e_mod_config.c index 751be29..9ab3b0d 100644 --- a/src/e_mod_config.c +++ b/src/e_mod_config.c @@ -84,7 +84,6 @@ _pol_cfd_data_free(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdat static int _pol_cfd_data_basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata) { - E_Comp *comp; E_Zone *zone; E_Desk *desk; Pol_Softkey *softkey; @@ -133,8 +132,7 @@ _pol_cfd_data_basic_apply(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data EINA_LIST_FOREACH(cfdata->conf->desks, l, d) { - comp = e_comp_number_get(d->comp_num); - zone = e_comp_zone_number_get(comp, d->zone_num); + zone = e_comp_zone_number_get(e_comp, d->zone_num); desk = e_desk_at_xy_get(zone, d->x, d->y); if (!desk) continue; @@ -228,12 +226,9 @@ static Evas_Object * _pol_cfd_data_basic_widgets_create(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dialog_Data *cfdata) { Evas_Object *base, *fl, *lb, *lo, *o; - E_Comp *comp; E_Zone *zone; Eina_List *l; - comp = e_comp_get(NULL); - base = e_widget_list_add(evas, 0, 0); fl = e_widget_framelist_add(evas, _("Softkey"), 0); fl = e_widget_framelist_add(evas, _("Softkey"), 0); @@ -257,14 +252,14 @@ _pol_cfd_data_basic_widgets_create(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, e_widget_ilist_multi_select_set(o, EINA_FALSE); e_widget_size_min_set(o, 100, 100); e_widget_on_change_hook_set(o, _pol_cfd_hook_zone_change, cfdata); - EINA_LIST_REVERSE_FOREACH(comp->zones, l, zone) + EINA_LIST_REVERSE_FOREACH(e_comp->zones, l, zone) e_widget_ilist_append(o, NULL, zone->name, NULL, zone, NULL); e_widget_ilist_go(o); e_widget_ilist_selected_set(o, 0); e_widget_list_object_append(lo, o, 1, 1, 0.5); /* update virtual desktops of first zone */ - zone = eina_list_data_get(comp->zones); + zone = eina_list_data_get(e_comp->zones); _pol_cfd_desk_list_update(cfdata, zone); e_widget_framelist_object_append(fl, lo); @@ -276,7 +271,6 @@ _pol_cfd_data_basic_widgets_create(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, void e_mod_pol_conf_init(Mod *mod) { - E_Comp *comp; E_Zone *zone; E_Desk *desk; Config *conf; @@ -318,8 +312,7 @@ e_mod_pol_conf_init(Mod *mod) conf->use_softkey = 1; conf->softkey_size = 42; - comp = e_comp_get(NULL); - zone = e_zone_current_get(comp); + zone = e_zone_current_get(e_comp); desk = e_desk_current_get(zone); _pol_conf_desk_add(conf, desk); } diff --git a/src/e_mod_main.c b/src/e_mod_main.c index c27381e..2b51b63 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -635,7 +635,6 @@ void e_mod_pol_desk_add(E_Desk *desk) { Pol_Desk *pd; - E_Comp *comp; E_Client *ec; Pol_Softkey *softkey; const Eina_List *l; @@ -650,12 +649,11 @@ e_mod_pol_desk_add(E_Desk *desk) eina_hash_add(hash_pol_desks, &desk, pd); /* add clients */ - EINA_LIST_FOREACH(e_comp_list(), l, comp) - E_CLIENT_FOREACH(comp, ec) - { - if (pd->desk == ec->desk) - _pol_client_add(ec); - } + E_CLIENT_FOREACH(e_comp, ec) + { + if (pd->desk == ec->desk) + _pol_client_add(ec); + } /* add and show softkey */ if (_pol_mod->conf->use_softkey) @@ -783,10 +781,9 @@ EAPI void * e_modapi_init(E_Module *m) { Mod *mod; - E_Comp *comp; E_Zone *zone; Config_Desk *d; - const Eina_List *l, *ll; + const Eina_List *l; int i, n; char buf[PATH_MAX]; @@ -813,32 +810,31 @@ e_modapi_init(E_Module *m) e_mod_pol_conf_init(mod); - EINA_LIST_FOREACH(e_comp_list(), l, comp) - EINA_LIST_FOREACH(comp->zones, ll, zone) - { - //Eina_Bool home_add = EINA_FALSE; - n = zone->desk_y_count * zone->desk_x_count; - for (i = 0; i < n; i++) - { - d = e_mod_pol_conf_desk_get_by_nums(_pol_mod->conf, - comp->num, - zone->num, - zone->desks[i]->x, - zone->desks[i]->y); - if (d) - { - e_mod_pol_desk_add(zone->desks[i]); - //home_add = EINA_TRUE; - } - } - - /* FIXME: should consider the case that illume-home module - * is not loaded yet and make it configurable. - * and also, this code will be enabled when e_policy stuff lands in e. - */ - //if (home_add) - // e_policy_zone_home_add_request(zone); - } + EINA_LIST_FOREACH(e_comp->zones, l, zone) + { + //Eina_Bool home_add = EINA_FALSE; + n = zone->desk_y_count * zone->desk_x_count; + for (i = 0; i < n; i++) + { + d = e_mod_pol_conf_desk_get_by_nums(_pol_mod->conf, + e_comp->num, + zone->num, + zone->desks[i]->x, + zone->desks[i]->y); + if (d) + { + e_mod_pol_desk_add(zone->desks[i]); + //home_add = EINA_TRUE; + } + } + + /* FIXME: should consider the case that illume-home module + * is not loaded yet and make it configurable. + * and also, this code will be enabled when e_policy stuff lands in e. + */ + //if (home_add) + // e_policy_zone_home_add_request(zone); + } E_LIST_HANDLER_APPEND(handlers, E_EVENT_ZONE_ADD, _pol_cb_zone_add, NULL); diff --git a/src/e_mod_rotation.c b/src/e_mod_rotation.c index a35373d..f685bd4 100644 --- a/src/e_mod_rotation.c +++ b/src/e_mod_rotation.c @@ -430,51 +430,45 @@ _e_client_rotation_is_dependent_parent(const E_Client *ec) static Eina_Bool _e_client_rotation_zone_set(E_Zone *zone) { - E_Comp *comp; - Eina_List *cl; E_Client *ec = NULL; Eina_Bool res = EINA_FALSE; Eina_Bool ret = EINA_FALSE; + E_Zone *ez; + Eina_List *zl; /* step 1. make the list needs to be rotated. */ - EINA_LIST_FOREACH(e_comp_list(), cl, comp) + EINA_LIST_FOREACH(e_comp->zones, zl, ez) { - E_Zone *ez; - Eina_List *zl; + Eina_List *l; - EINA_LIST_FOREACH(comp->zones, zl, ez) + if (ez != zone) continue; + + EINA_LIST_REVERSE_FOREACH(zone->comp->clients, l, ec) { - Eina_List *l; + if(ec->zone != zone) continue; + + // if this window has parent and window type isn't "ECORE_X_WINDOW_TYPE_NORMAL", + // it will be rotated when parent do rotate itself. + // so skip here. + if ((ec->parent) && + (ec->netwm.type != E_WINDOW_TYPE_NORMAL)) continue; + + // default type is "E_CLIENT_ROTATION_TYPE_NORMAL", + // but it can be changed to "E_CLIENT_ROTATION_TYPE_DEPENDENT" by illume according to its policy. + // if it's not normal type window, will be rotated by illume. + // so skip here. + if (ec->e.state.rot.type != E_CLIENT_ROTATION_TYPE_NORMAL) continue; - if (ez != zone) continue; + if ((!evas_object_visible_get(ec->frame)) || + (!E_INTERSECTS(ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h, + ec->x, ec->y, ec->w, ec->h))) continue; - EINA_LIST_REVERSE_FOREACH(zone->comp->clients, l, ec) + res = e_client_rotation_set(ec, zone->rot.curr); + if (!res) { - if(ec->zone != zone) continue; - - // if this window has parent and window type isn't "ECORE_X_WINDOW_TYPE_NORMAL", - // it will be rotated when parent do rotate itself. - // so skip here. - if ((ec->parent) && - (ec->netwm.type != E_WINDOW_TYPE_NORMAL)) continue; - - // default type is "E_CLIENT_ROTATION_TYPE_NORMAL", - // but it can be changed to "E_CLIENT_ROTATION_TYPE_DEPENDENT" by illume according to its policy. - // if it's not normal type window, will be rotated by illume. - // so skip here. - if (ec->e.state.rot.type != E_CLIENT_ROTATION_TYPE_NORMAL) continue; - - if ((!evas_object_visible_get(ec->frame)) || - (!E_INTERSECTS(ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h, - ec->x, ec->y, ec->w, ec->h))) continue; - - res = e_client_rotation_set(ec, zone->rot.curr); - if (!res) - { - ; - } - else ret = EINA_TRUE; + ; } + else ret = EINA_TRUE; } } diff --git a/src/e_mod_softkey.c b/src/e_mod_softkey.c index 45c0bdd..09fe1c3 100644 --- a/src/e_mod_softkey.c +++ b/src/e_mod_softkey.c @@ -33,7 +33,7 @@ _pol_softkey_iconify(E_Zone *zone, Eina_Bool all) desk = e_desk_current_get(zone); launcher = e_mod_pol_client_launcher_get(zone); - E_CLIENT_REVERSE_FOREACH(e_comp_get(desk), ec) + E_CLIENT_REVERSE_FOREACH(e_comp, ec) { if (e_client_util_ignored_get(ec)) continue; if (!e_client_util_desk_visible(ec, desk)) continue; @@ -61,7 +61,7 @@ _pol_softkey_icon_add(E_Zone *zone, const char *name) Evas_Object *obj, *comp_obj; char path[PATH_MAX], group[PATH_MAX]; - obj = edje_object_add(e_comp_get(NULL)->evas); + obj = edje_object_add(e_comp->evas); snprintf(group, sizeof(group), "e/modules/policy-mobile/softkey/%s", name); snprintf(path, sizeof(path), "%s/e-module-policy.edj", diff --git a/src/e_mod_visivility.c b/src/e_mod_visivility.c index 8454ca3..74c41d5 100644 --- a/src/e_mod_visivility.c +++ b/src/e_mod_visivility.c @@ -278,18 +278,12 @@ e_mod_pol_zone_visibility_calc(E_Zone *zone) void e_mod_pol_visibility_calc(void) { - E_Comp *comp; - Eina_List *cl; + E_Zone *zone; + Eina_List *zl; - EINA_LIST_FOREACH(e_comp_list(), cl, comp) + EINA_LIST_FOREACH(e_comp->zones, zl, zone) { - E_Zone *zone; - Eina_List *zl; - - EINA_LIST_FOREACH(comp->zones, zl, zone) - { - e_mod_pol_zone_visibility_calc(zone); - } + e_mod_pol_zone_visibility_calc(zone); } } -- 2.7.4