We add code to control the softkey by module.
Change-Id: Ice65d31fd1d71cd87daa81653d4e356ab070f988
E_Event_Zone_Add *ev;
E_Zone *zone;
E_Config_Policy_Desk *d;
+ E_Policy_Softkey *softkey;
int i, n;
ev = event;
e_policy_desk_add(zone->desks[i]);
}
+ /* add and show softkey */
+ if (e_config->use_softkey)
+ {
+ softkey = e_policy_softkey_get(zone);
+ if (!softkey)
+ softkey = e_policy_softkey_add(zone);
+ }
+
return ECORE_CALLBACK_PASS_ON;
}
E_Event_Zone_Del *ev;
E_Zone *zone;
E_Policy_Desk *pd;
+ E_Policy_Softkey *softkey;
+
int i, n;
ev = event;
if (pd) e_policy_desk_del(pd);
}
+ /* add and show softkey */
+ if (e_config->use_softkey)
+ {
+ softkey = e_policy_softkey_get(zone);
+ if (softkey)
+ e_policy_softkey_del(softkey);
+ }
+
return ECORE_CALLBACK_PASS_ON;
}
if (e_config->use_softkey)
{
softkey = e_policy_softkey_get(ev->desk->zone);
+ if (!softkey)
+ softkey = e_policy_softkey_add(ev->desk->zone);
+
if (eina_hash_find(hash_policy_desks, &ev->desk))
e_policy_softkey_show(softkey);
else
{
E_Policy_Desk *pd;
E_Client *ec;
- E_Policy_Softkey *softkey;
E_Policy_Client *pc;
pd = eina_hash_find(hash_policy_desks, &desk);
_e_policy_client_maximize_policy_apply(pc);
}
}
-
- /* add and show softkey */
- if (e_config->use_softkey)
- {
- softkey = e_policy_softkey_get(desk->zone);
- if (!softkey)
- softkey = e_policy_softkey_add(desk->zone);
- if (e_desk_current_get(desk->zone) == desk)
- e_policy_softkey_show(softkey);
- }
}
void
E_Client *ec;
Eina_List *clients_del = NULL;
E_Policy_Softkey *softkey;
- Eina_Bool keep = EINA_FALSE;
- int i, n;
/* hide and delete softkey */
if (e_config->use_softkey)
softkey = e_policy_softkey_get(pd->zone);
if (e_desk_current_get(pd->zone) == pd->desk)
e_policy_softkey_hide(softkey);
-
- n = pd->zone->desk_y_count * pd->zone->desk_x_count;
- for (i = 0; i < n; i++)
- {
- if (eina_hash_find(hash_policy_desks, &pd->zone->desks[i]))
- {
- keep = EINA_TRUE;
- break;
- }
- }
-
- if (!keep)
- e_policy_softkey_del(softkey);
}
/* remove clients */
typedef struct _E_Policy_System_Info E_Policy_System_Info;
typedef struct _E_Policy_Interceptor E_Policy_Interceptor;
typedef struct _E_Policy_Hook E_Policy_Hook;
+typedef struct _E_Policy_Softkey_Funcs E_Policy_Softkey_Funcs;
typedef enum _E_Policy_Intercept_Point
{
E_Zone *zone;
Evas_Object *home;
Evas_Object *back;
+ Evas_Object *other;
+};
+
+struct _E_Policy_Softkey_Funcs
+{
+ E_Policy_Softkey* (*softkey_create)(E_Zone *zone);
+ void (*softkey_destroy)(E_Policy_Softkey *softkey);
+ void (*softkey_show)(E_Policy_Softkey *softkey);
+ void (*softkey_hide)(E_Policy_Softkey *softkey);
+ void (*softkey_update)(E_Policy_Softkey *softkey);
};
struct _E_Policy
EINTERN E_Policy_Client *e_policy_client_get(E_Client *ec);
EINTERN void e_policy_desk_add(E_Desk *desk);
EINTERN void e_policy_desk_del(E_Policy_Desk *pd);
-EINTERN E_Policy_Client *e_policy_client_launcher_get(E_Zone *zone);
+E_API E_Policy_Client *e_policy_client_launcher_get(E_Zone *zone);
E_API Eina_Bool e_policy_client_is_lockscreen(E_Client *ec);
E_API Eina_Bool e_policy_client_is_home_screen(E_Client *ec);
E_API Eina_Bool e_policy_client_is_keyboard_sub(E_Client *ec);
E_API Eina_Bool e_policy_client_is_keyboard_magnifier(E_Client *ec);
-EINTERN E_Policy_Softkey *e_policy_softkey_add(E_Zone *zone);
-EINTERN void e_policy_softkey_del(E_Policy_Softkey *softkey);
-EINTERN void e_policy_softkey_show(E_Policy_Softkey *softkey);
-EINTERN void e_policy_softkey_hide(E_Policy_Softkey *softkey);
-EINTERN void e_policy_softkey_update(E_Policy_Softkey *softkey);
-EINTERN E_Policy_Softkey *e_policy_softkey_get(E_Zone *zone);
+E_API E_Policy_Softkey *e_policy_softkey_add(E_Zone *zone);
+E_API void e_policy_softkey_del(E_Policy_Softkey *softkey);
+E_API void e_policy_softkey_show(E_Policy_Softkey *softkey);
+E_API void e_policy_softkey_hide(E_Policy_Softkey *softkey);
+E_API void e_policy_softkey_update(E_Policy_Softkey *softkey);
+E_API E_Policy_Softkey *e_policy_softkey_get(E_Zone *zone);
+E_API Eina_Bool e_policy_softkey_module_func_set(E_Policy_Softkey_Funcs *fn);
+E_API void e_policy_softkey_module_func_unset(void);
EINTERN void e_policy_client_visibility_send(E_Client *ec);
EINTERN void e_policy_client_iconify_by_visibility(E_Client *ec);
static Evas_Object *_e_policy_softkey_icon_add(E_Zone *zone, const char *name);
static void _e_policy_softkey_icon_del(Evas_Object *comp_obj);
+static E_Policy_Softkey_Funcs *_e_softkey_funcs = NULL;
+
static void
_e_policy_cb_softkey(void *data, Evas_Object *obj EINA_UNUSED, const char *emission, const char *source EINA_UNUSED)
{
{
E_Policy_Softkey *softkey;
- softkey = E_NEW(E_Policy_Softkey, 1);
- EINA_SAFETY_ON_NULL_RETURN_VAL(softkey, NULL);
+ if (_e_softkey_funcs && _e_softkey_funcs->softkey_create)
+ {
+ softkey = _e_softkey_funcs->softkey_create(zone);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(softkey, NULL);
+ }
+ else
+ {
+ softkey = E_NEW(E_Policy_Softkey, 1);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(softkey, NULL);
- softkey->zone = zone;
- softkey->home = _e_policy_softkey_icon_add(zone, "home");
- softkey->back = _e_policy_softkey_icon_add(zone, "back");
+ softkey->zone = zone;
+ softkey->home = _e_policy_softkey_icon_add(zone, "home");
+ softkey->back = _e_policy_softkey_icon_add(zone, "back");
+ }
e_policy->softkeys = eina_inlist_append(e_policy->softkeys, EINA_INLIST_GET(softkey));
{
if (!softkey) return;
- _e_policy_softkey_icon_del(softkey->home);
- _e_policy_softkey_icon_del(softkey->back);
-
e_policy->softkeys = eina_inlist_remove(e_policy->softkeys, EINA_INLIST_GET(softkey));
- free(softkey);
+ if (_e_softkey_funcs && _e_softkey_funcs->softkey_destroy)
+ return _e_softkey_funcs->softkey_destroy(softkey);
+ else
+ {
+ _e_policy_softkey_icon_del(softkey->home);
+ _e_policy_softkey_icon_del(softkey->back);
+
+ E_FREE(softkey);
+ }
}
void
e_policy_softkey_show(E_Policy_Softkey *softkey)
{
+ if (_e_softkey_funcs && _e_softkey_funcs->softkey_show)
+ return _e_softkey_funcs->softkey_show(softkey);
+
if (!softkey) return;
e_policy_softkey_update(softkey);
void
e_policy_softkey_hide(E_Policy_Softkey *softkey)
{
+ if (_e_softkey_funcs && _e_softkey_funcs->softkey_hide)
+ return _e_softkey_funcs->softkey_hide(softkey);
+
if (!softkey) return;
evas_object_hide(softkey->home);
{
int x, y, w, h, ow, oh, space;
+ if (_e_softkey_funcs && _e_softkey_funcs->softkey_update)
+ return _e_softkey_funcs->softkey_update(softkey);
+
if (!softkey) return;
e_zone_useful_geometry_get(softkey->zone, &x, &y, &w, &h);
return NULL;
}
+
+E_API Eina_Bool
+e_policy_softkey_module_func_set(E_Policy_Softkey_Funcs *fp)
+{
+ EINA_SAFETY_ON_FALSE_RETURN_VAL((_e_softkey_funcs == NULL), EINA_FALSE);
+
+ if (!fp) return EINA_FALSE;
+
+ _e_softkey_funcs = E_NEW(E_Policy_Softkey_Funcs, 1);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(_e_softkey_funcs, EINA_FALSE);
+
+ _e_softkey_funcs->softkey_create = fp->softkey_create;
+ _e_softkey_funcs->softkey_destroy = fp->softkey_destroy;
+ _e_softkey_funcs->softkey_show = fp->softkey_show;
+ _e_softkey_funcs->softkey_hide = fp->softkey_hide;
+ _e_softkey_funcs->softkey_update = fp->softkey_update;
+
+ return EINA_TRUE;
+}
+
+E_API void
+e_policy_softkey_module_func_unset(void)
+{
+ if (!_e_softkey_funcs)
+ return;
+
+ E_FREE(_e_softkey_funcs);
+}