From f7aa5d3d34c1142767259880b88a71e0383691af Mon Sep 17 00:00:00 2001 From: parksanghee Date: Wed, 8 Feb 2017 19:28:07 +0900 Subject: [PATCH] e_policy_wl: Implement depth-in concept [Model] Tizen3.0 [BinType] AP [Customer] N/A [Issue#] N/A [Request] Support depth-in [Occurrence Version] N/A [Problem] Not support dpeth-in concept [Cause & Measure] There is no interface to support concept [Checking Method] Setting > Wifi [Team] Window Manager [Developer] Sanghee Park [Solution company] Samsung [Change Type] New feature Change-Id: I845ad4d12659a90eaa79a8984d03246d2d23ee65 --- configure.ac | 2 +- packaging/enlightenment.spec | 1 + src/bin/e_client.h | 2 + src/bin/e_comp_cfdata.c | 3 + src/bin/e_comp_cfdata.h | 1 + src/bin/e_comp_object.c | 1 + src/bin/e_policy_wl.c | 807 ++++++++++++++++++++++++++++++++++++++++++- 7 files changed, 815 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index eca2eb6..8c066cd 100755 --- a/configure.ac +++ b/configure.ac @@ -368,7 +368,7 @@ AC_MSG_RESULT([${have_shm_open}]) AC_SUBST(SHM_OPEN_LIBS) if test "x${e_cv_want_wayland_only}" != "xno" || test "x${e_cv_want_wayland_clients}" != "xno";then - PKG_CHECK_MODULES([WAYLAND], [wayland-server >= 1.8.0 xkbcommon uuid xdg-shell-server scaler-server transform-server screenshooter-server tizen-extension-server], + PKG_CHECK_MODULES([WAYLAND], [wayland-server >= 1.8.0 xkbcommon uuid xdg-shell-server scaler-server transform-server screenshooter-server tizen-extension-server tizen-launch-server], [ have_wayland=yes AC_DEFINE_UNQUOTED([HAVE_WAYLAND],[1],[enable wayland support]) diff --git a/packaging/enlightenment.spec b/packaging/enlightenment.spec index cb7ac8e..d8ac03b 100755 --- a/packaging/enlightenment.spec +++ b/packaging/enlightenment.spec @@ -37,6 +37,7 @@ BuildRequires: pkgconfig(transform-server) BuildRequires: pkgconfig(screenshooter-server) BuildRequires: pkgconfig(screenshooter-client) BuildRequires: pkgconfig(tizen-extension-server) +BuildRequires: pkgconfig(tizen-launch-server) BuildRequires: pkgconfig(wayland-tbm-server) BuildRequires: pkgconfig(tizen-remote-surface-server) BuildRequires: pkgconfig(ecore-drm) diff --git a/src/bin/e_client.h b/src/bin/e_client.h index 271fe6b..7be6fac 100644 --- a/src/bin/e_client.h +++ b/src/bin/e_client.h @@ -926,6 +926,8 @@ struct E_Client } remote_surface; Eina_Bool is_cursor : 1; // The client is a cursor client + + int effect_type; }; #define e_client_focus_policy_click(ec) \ diff --git a/src/bin/e_comp_cfdata.c b/src/bin/e_comp_cfdata.c index 2b66a7b..d025b55 100644 --- a/src/bin/e_comp_cfdata.c +++ b/src/bin/e_comp_cfdata.c @@ -36,6 +36,7 @@ e_comp_cfdata_edd_init(E_Config_DD **conf_edd, E_Config_DD **match_edd) E_CONFIG_VAL(D, T, engine, INT); E_CONFIG_VAL(D, T, effect_file, STR); E_CONFIG_VAL(D, T, effect_style, STR); + E_CONFIG_VAL(D, T, depth_in_style, STR); E_CONFIG_VAL(D, T, max_unmapped_time, INT); E_CONFIG_VAL(D, T, min_unmapped_time, INT); E_CONFIG_VAL(D, T, fps_average_range, INT); @@ -94,6 +95,7 @@ e_comp_cfdata_config_new(void) cfg->shadow_style = eina_stringshare_add("default"); cfg->effect_file = NULL; cfg->effect_style = "none"; + cfg->depth_in_style = "none"; cfg->engine = E_COMP_ENGINE_SW; cfg->max_unmapped_time = 10 * 3600; // implement cfg->min_unmapped_time = 5 * 60; // implement @@ -239,6 +241,7 @@ e_comp_cfdata_config_free(E_Comp_Config *cfg) { if (!cfg) return; eina_stringshare_del(cfg->effect_style); + eina_stringshare_del(cfg->depth_in_style); eina_stringshare_del(cfg->effect_file); eina_stringshare_del(cfg->shadow_style); eina_stringshare_del(cfg->launch_file); diff --git a/src/bin/e_comp_cfdata.h b/src/bin/e_comp_cfdata.h index 9c316f1..8b711ed 100644 --- a/src/bin/e_comp_cfdata.h +++ b/src/bin/e_comp_cfdata.h @@ -12,6 +12,7 @@ struct _E_Comp_Config const char *shadow_style; const char *effect_file; const char *effect_style; + const char *depth_in_style; int engine; int max_unmapped_time; int min_unmapped_time; diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c index cbc341b..ed86739 100644 --- a/src/bin/e_comp_object.c +++ b/src/bin/e_comp_object.c @@ -4362,6 +4362,7 @@ e_comp_object_effect_set(Evas_Object *obj, const char *effect) if (!e_comp_object_effect_stop(obj, evas_object_data_get(cw->effect_obj, "_e_comp.end_cb"))) return EINA_FALSE; } + INF("[EFFECT Set] ec[%p] GROUP[%s]\n",cw->ec, buf); edje_object_part_swallow(cw->effect_obj, "e.swallow.content", cw->shobj); if (cw->effect_clip) { diff --git a/src/bin/e_policy_wl.c b/src/bin/e_policy_wl.c index 98c4d1a..3277031 100644 --- a/src/bin/e_policy_wl.c +++ b/src/bin/e_policy_wl.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #ifdef HAVE_CYNARA @@ -49,6 +50,12 @@ typedef enum _Tzsh_Type TZSH_TYPE_CLIENT } Tzsh_Type; +typedef enum _Tzlaunch_Effect_Type +{ + TZLAUNCH_EFFECT_TYPE_LAUNCH = 0, + TZLAUNCH_EFFECT_TYPE_DEPTH_IN +} Tzlaunch_Effect_Type; + typedef struct _E_Policy_Wl_Tzpol { struct wl_resource *res_tzpol; /* tizen_policy_interface */ @@ -144,6 +151,40 @@ typedef struct _E_Policy_Wl_Tzlaunch_Img E_Comp_Object_Content_Type content_type; /* type of content */ } E_Policy_Wl_Tzlaunch_Img; +typedef struct _E_Policy_Wl_Tzlaunch_Effect +{ + struct wl_resource *res_tzlaunch_effect; /* tizen_launch_effect */ + Eina_List *splash_list; /* list of E_Policy_Wl_Tzlaunch_Img */ +} E_Policy_Wl_Tzlaunch_Effect; + +typedef struct _E_Policy_Wl_Tzlaunch_Splash +{ + struct wl_resource *res_tzlaunch_splash; /* tizen_launch_image */ + E_Policy_Wl_Tzlaunch_Effect *tzlaunch_effect; /* launcher */ + + const char *path; /* image resource path */ + uint32_t type; /* 0: image, 1: edc */ + uint32_t indicator; /* 0: off, 1: on */ + uint32_t angle; /* 0, 90, 180, 270 : rotation angle */ + uint32_t pid; + + Evas_Object *obj; /* launch screen image */ + E_Pixmap *ep; /* pixmap for launch screen client */ + E_Client *ec; /* client for launch screen image */ + Ecore_Timer *timeout; /* launch screen image hide timer */ + Evas_Object *indicator_obj; /* plug object of indicator */ + + Eina_Bool valid; /* validation check */ + Eina_Bool replaced; + E_Comp_Object_Content_Type content_type; /* type of content */ +} E_Policy_Wl_Tzlaunch_Splash; + +typedef struct _E_Policy_Wl_Tzlaunch_Effect_Info +{ + uint32_t pid; /* pid */ + int effect_type; /* effect_type */ +} E_Policy_Wl_Tzlaunch_Effect_Info; + typedef enum _Launch_Img_File_type { LAUNCH_IMG_FILE_TYPE_ERROR = -1, @@ -182,6 +223,10 @@ typedef struct _E_Policy_Wl /* tizen_launchscreen_interface */ Eina_List *tzlaunchs; /* list of E_Policy_Wl_Tzlaunch */ + + /* tizen_launch_effect_interface */ + Eina_List *tzlaunch_effect; /* list of E_Policy_Wl_Tzlaunch_Effect */ + Eina_List *tzlaunch_effect_info; /* list of E_Policy_Wl_Tzlaunch_Effect_Info */ #ifdef HAVE_CYNARA cynara *p_cynara; #endif @@ -247,10 +292,18 @@ static E_Policy_Wl_Tzsh_Client *_e_policy_wl_tzsh_client_add(E_Policy_Wl_Tzsh *t static void _e_policy_wl_tzsh_client_del(E_Policy_Wl_Tzsh_Client *tzsh_client); static void _e_policy_wl_background_state_set(E_Policy_Wl_Surface *psurf, Eina_Bool state); +static void _e_policy_wl_tzlaunch_effect_type_sync(E_Client *ec); +static int _e_policy_wl_tzlaunch_effect_type_get(const char* effect_type); +static void _e_policy_wl_tzlaunch_effect_type_unset(uint32_t pid); + static void _launchscreen_hide(uint32_t pid); static void _launchscreen_client_del(E_Client *ec); static void _launchscreen_img_off(E_Policy_Wl_Tzlaunch_Img *tzlaunch_img); +static void _launch_effect_hide(uint32_t pid); +static void _launch_effect_client_del(E_Client *ec); +static void _launch_splash_off(E_Policy_Wl_Tzlaunch_Splash *tzlaunch_splash); + // -------------------------------------------------------- // E_Policy_Wl_Tzpol // -------------------------------------------------------- @@ -1046,7 +1099,10 @@ e_policy_wl_visibility_send(E_Client *ec, int vis) vis); sent = EINA_TRUE; if (ec->comp_data->mapped) - _launchscreen_hide(ec->netwm.pid); + { + _launchscreen_hide(ec->netwm.pid); + _launch_effect_hide(ec->netwm.pid); + } } } eina_iterator_free(it); @@ -2497,6 +2553,60 @@ _e_policy_wl_background_state_set(E_Policy_Wl_Surface *psurf, Eina_Bool state) } static void +_e_policy_wl_tzlaunch_effect_type_sync(E_Client *ec) +{ + Eina_List *l; + E_Policy_Wl_Tzlaunch_Effect_Info *effect_info; + + EINA_SAFETY_ON_NULL_RETURN(ec); + + EINA_LIST_FOREACH(polwl->tzlaunch_effect_info, l, effect_info) + { + if (effect_info->pid == ec->netwm.pid) + { + ELOGF("TZPOL", + "Launchscreen effect type sync | pid (%d) effect_type (%d)", + ec->pixmap, ec, ec->netwm.pid, effect_info->effect_type); + ec->effect_type = effect_info->effect_type; + _e_policy_wl_tzlaunch_effect_type_unset(ec->netwm.pid); + break; + } + } +} + +static int +_e_policy_wl_tzlaunch_effect_type_get(const char * effect_type) +{ + Tzlaunch_Effect_Type type = TZLAUNCH_EFFECT_TYPE_LAUNCH; + + if (!e_util_strcmp(effect_type, "launch" )) type = TZLAUNCH_EFFECT_TYPE_LAUNCH; + else if (!e_util_strcmp(effect_type, "depth-in" )) type = TZLAUNCH_EFFECT_TYPE_DEPTH_IN; + + return type; +} + +static void +_e_policy_wl_tzlaunch_effect_type_unset(uint32_t pid) +{ + Eina_List *l; + E_Policy_Wl_Tzlaunch_Effect_Info *effect_info; + + EINA_LIST_FOREACH(polwl->tzlaunch_effect_info, l, effect_info) + { + if (effect_info->pid == pid) + { + ELOGF("TZPOL", + "Launchscreen effect type unset | pid (%d)", + NULL, NULL, pid); + polwl->tzlaunch_effect_info = eina_list_remove(polwl->tzlaunch_effect_info, effect_info); + memset(effect_info, 0x0, sizeof(E_Policy_Wl_Tzlaunch_Effect_Info)); + E_FREE(effect_info); + break; + } + } +} + +static void _tzpol_iface_cb_background_state_set(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzpol, uint32_t pid) { E_Policy_Wl_Tzpol *tzpol; @@ -4479,6 +4589,25 @@ _launchscreen_hide(uint32_t pid) } static void +_launch_effect_hide(uint32_t pid) +{ + Eina_List *l, *ll; + E_Policy_Wl_Tzlaunch_Effect *tzlaunch_effect; + E_Policy_Wl_Tzlaunch_Splash *tzlaunch_splash; + + if(pid <= 0) return; + + EINA_LIST_FOREACH(polwl->tzlaunch_effect, l, tzlaunch_effect) + { + EINA_LIST_FOREACH(tzlaunch_effect->splash_list, ll, tzlaunch_splash) + if (tzlaunch_splash->pid == pid) + { + _launch_splash_off(tzlaunch_splash); + } + } +} + +static void _launchscreen_client_del(E_Client *ec) { Eina_List *l, *ll; @@ -4496,6 +4625,23 @@ _launchscreen_client_del(E_Client *ec) } static void +_launch_effect_client_del(E_Client *ec) +{ + Eina_List *l, *ll; + E_Policy_Wl_Tzlaunch_Effect *tzlaunch_effect; + E_Policy_Wl_Tzlaunch_Splash *tzlaunch_splash; + + EINA_LIST_FOREACH(polwl->tzlaunch_effect, l, tzlaunch_effect) + { + EINA_LIST_FOREACH(tzlaunch_effect->splash_list, ll, tzlaunch_splash) + if (tzlaunch_splash->ec == ec) + { + _launch_splash_off(tzlaunch_splash); + } + } +} + +static void _launchscreen_img_cb_indicator_resized(Ecore_Evas *ee) { Evas_Coord_Size size = {0, 0}; @@ -4517,6 +4663,28 @@ _launchscreen_img_cb_indicator_resized(Ecore_Evas *ee) } static void +_launchscreen_splash_cb_indicator_resized(Ecore_Evas *ee) +{ + Evas_Coord_Size size = {0, 0}; + Evas_Object *indicator_obj; + E_Policy_Wl_Tzlaunch_Splash *tzlaunch_splash; + + tzlaunch_splash = ecore_evas_data_get(ee, "tzlaunch_splash"); + if (!tzlaunch_splash) return; + + indicator_obj = tzlaunch_splash->indicator_obj; + + ecore_evas_geometry_get(ee, NULL, NULL, &(size.w), &(size.h)); + ELOGF("TZPOL", "Launchscreen indicator_obj resized(%d x %d)", + NULL, NULL, + size.w, size.h); + evas_object_size_hint_min_set(indicator_obj, size.w, size.h); + evas_object_size_hint_max_set(indicator_obj, size.w, size.h); + e_comp_object_indicator_size_set(tzlaunch_splash->ec->frame, size.w, size.h); +} + + +static void _launchscreen_img_cb_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) { E_Policy_Wl_Tzlaunch_Img *tzlaunch_img = data; @@ -4526,6 +4694,15 @@ _launchscreen_img_cb_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void } static void +_launchscreen_splash_cb_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + E_Policy_Wl_Tzlaunch_Splash *tzlaunch_splash = data; + + if ((tzlaunch_splash) && (tzlaunch_splash->obj == obj)) + tzlaunch_splash->obj = NULL; +} + +static void _launchscreen_img_cb_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) { E_Policy_Wl_Tzlaunch_Img *tzlaunch_img = data; @@ -4535,6 +4712,15 @@ _launchscreen_img_cb_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, voi } static void +_launchscreen_splash_cb_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + E_Policy_Wl_Tzlaunch_Splash *tzlaunch_splash = data; + + if ((tzlaunch_splash) && (tzlaunch_splash->obj == obj)) + _launch_splash_off(tzlaunch_splash); +} + +static void _launchscreen_img_off(E_Policy_Wl_Tzlaunch_Img *tzlaunch_img) { E_Client *ec = NULL; @@ -4613,6 +4799,85 @@ _launchscreen_img_off(E_Policy_Wl_Tzlaunch_Img *tzlaunch_img) tzlaunch_img->replaced = EINA_FALSE; } +static void +_launch_splash_off(E_Policy_Wl_Tzlaunch_Splash *tzlaunch_splash) +{ + E_Client *ec = NULL; + Evas_Object *obj = NULL; + + if (!tzlaunch_splash->valid) return; + if (!tzlaunch_splash->ec) return; + + ec = tzlaunch_splash->ec; + obj = tzlaunch_splash->obj; + + tzlaunch_splash->obj = NULL; + tzlaunch_splash->ec = NULL; + tzlaunch_splash->valid = EINA_FALSE; + if (tzlaunch_splash->timeout) ecore_timer_del(tzlaunch_splash->timeout); + tzlaunch_splash->timeout = NULL; + + ELOGF("TZPOL", + "Launchscreen hide | pid %d", + ec->pixmap, ec, tzlaunch_splash->pid); + + if (tzlaunch_splash->indicator_obj) + { + e_comp_object_indicator_unswallow(ec->frame, tzlaunch_splash->indicator_obj); + evas_object_del(tzlaunch_splash->indicator_obj); + evas_object_unref(tzlaunch_splash->indicator_obj); + tzlaunch_splash->indicator_obj = NULL; + } + + if ((ec->pixmap) && + (ec->pixmap == tzlaunch_splash->ep)) + { + /* case 1: Surface for this pid is not created until timeout or + * launchscreen resource is destroied. + */ + if (ec->visible) + { + ec->visible = EINA_FALSE; + evas_object_hide(ec->frame); + ec->ignored = EINA_TRUE; + } + + e_comp->launchscrns = eina_list_remove(e_comp->launchscrns, ec); + + e_pixmap_win_id_del(tzlaunch_splash->ep); + e_object_del(E_OBJECT(ec)); + ec = NULL; + } + else if (!e_pixmap_resource_get(ec->pixmap)) + { + /* case 2: Surface is created but there's no buffer */ + ec->visible = EINA_FALSE; + ec->ignored = EINA_TRUE; + evas_object_hide(ec->frame); + } + + if (ec) + { + if (!tzlaunch_splash->replaced) + { + if (ec->focused) + e_comp_wl_feed_focus_in(ec); + + /* to send launch,done event to launchscreen client */ + if (!e_object_is_del(E_OBJECT(ec))) + e_comp_object_signal_emit(ec->frame, "e,action,launch,done", "e"); + } + + e_comp->launchscrns = eina_list_remove(e_comp->launchscrns, ec); + } + + if (obj) + evas_object_unref(obj); + + tzlaunch_splash->ep = NULL; + tzlaunch_splash->replaced = EINA_FALSE; +} + static Eina_Bool _launchscreen_timeout(void *data) { @@ -4626,6 +4891,19 @@ _launchscreen_timeout(void *data) return ECORE_CALLBACK_CANCEL; } +static Eina_Bool +_launchscreen_splash_timeout(void *data) +{ + E_Policy_Wl_Tzlaunch_Splash *tzlaunch_splash; + tzlaunch_splash = (E_Policy_Wl_Tzlaunch_Splash *)data; + + EINA_SAFETY_ON_NULL_RETURN_VAL(tzlaunch_splash, 0); + + _launch_splash_off(tzlaunch_splash); + + return ECORE_CALLBACK_CANCEL; +} + static void _tzlaunch_img_iface_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzlaunch_img) { @@ -4633,6 +4911,13 @@ _tzlaunch_img_iface_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_r } static void +_tzlaunch_splash_iface_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzlaunch_splash) +{ + wl_resource_destroy(res_tzlaunch_splash); +} + + +static void _tzlaunch_img_iface_cb_launch(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzlaunch_img, const char *pfname, uint32_t ftype, uint32_t depth, uint32_t angle, @@ -4809,6 +5094,187 @@ error: } static void +_tzlaunch_splash_iface_cb_launch(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzlaunch_splash, + const char *pfname, uint32_t ftype, + uint32_t depth, uint32_t angle, + uint32_t indicator, const char *effect_type, + const char *theme_type, struct wl_array *options) +{ + E_Policy_Wl_Tzlaunch_Splash *tzlaunch_splash; + Evas_Load_Error err; + E_Client *ec = NULL; + E_Comp_Object_Content_Type content_type = 0; + Eina_Bool intercepted = EINA_FALSE; + int tzlaunch_effect_type; + + tzlaunch_splash = wl_resource_get_user_data(res_tzlaunch_splash); + EINA_SAFETY_ON_NULL_RETURN(tzlaunch_splash); + EINA_SAFETY_ON_NULL_RETURN(tzlaunch_splash->ec); + EINA_SAFETY_ON_NULL_RETURN(tzlaunch_splash->ec->frame); + + tzlaunch_effect_type = _e_policy_wl_tzlaunch_effect_type_get(effect_type); + + ec = tzlaunch_splash->ec; + ec->effect_type = tzlaunch_effect_type; + + // TO DO + // invaid parameter handle + ELOGF("TZPOL", + "Launchscreen launch | path %s(%d), indicator(%d), angle(%d), effect_type(%s), theme_type(%s)", + ec->pixmap, ec, pfname, ftype, indicator, angle, effect_type, theme_type); + + tzlaunch_splash->path = pfname; + tzlaunch_splash->type = ftype; + tzlaunch_splash->indicator = indicator; + tzlaunch_splash->angle = angle; + + if (indicator) + { + /* To configure indicator options */ + ec->indicator.state = TIZEN_INDICATOR_STATE_ON; + ec->indicator.visible_type = TIZEN_INDICATOR_VISIBLE_TYPE_SHOWN; + ec->indicator.opacity_mode = TIZEN_INDICATOR_OPACITY_MODE_BG_TRANSPARENT; + } + + intercepted = e_policy_interceptor_call(E_POLICY_INTERCEPT_LAUNCHSCREEN_OBJECT_SETUP, + ec, + pfname, ftype, depth, + angle, indicator, options); + if (intercepted) + { + tzlaunch_splash->obj = e_comp_object_content_get(ec->frame); + + ELOGF("TZPOL", + "Launchscreen object setup was successfully intercepted content(%p)", + ec->pixmap, ec, tzlaunch_splash->obj); + } + else + { + if (tzlaunch_splash->type == LAUNCH_IMG_FILE_TYPE_IMAGE) + { + content_type = E_COMP_OBJECT_CONTENT_TYPE_EXT_IMAGE; + tzlaunch_splash->obj = evas_object_image_add(e_comp->evas); + EINA_SAFETY_ON_NULL_GOTO(tzlaunch_splash->obj, error); + evas_object_image_file_set(tzlaunch_splash->obj, tzlaunch_splash->path, NULL); + + err = evas_object_image_load_error_get(tzlaunch_splash->obj); + EINA_SAFETY_ON_FALSE_GOTO(err == EVAS_LOAD_ERROR_NONE, error); + + evas_object_image_fill_set(tzlaunch_splash->obj, 0, 0, e_comp->w, e_comp->h); + evas_object_image_filled_set(tzlaunch_splash->obj, EINA_TRUE); + } + else + { + content_type = E_COMP_OBJECT_CONTENT_TYPE_EXT_EDJE; + tzlaunch_splash->obj = edje_object_add(e_comp->evas); + EINA_SAFETY_ON_NULL_GOTO(tzlaunch_splash->obj, error); + edje_object_file_set (tzlaunch_splash->obj, tzlaunch_splash->path, APP_DEFINE_GROUP_NAME); + + evas_object_move(tzlaunch_splash->obj, 0, 0); + evas_object_resize(tzlaunch_splash->obj, e_comp->w, e_comp->h); + } + + if (depth == 32) ec->argb = EINA_TRUE; + else ec->argb = EINA_FALSE; + + if (!e_comp_object_content_set(ec->frame, tzlaunch_splash->obj, content_type)) + { + ERR("Setting comp object content for %p failed!", ec); + goto error; + } + + } + + if (indicator) + { + Evas_Object *indicator_obj = NULL; + Eina_Bool ret = EINA_FALSE; + + e_mod_indicator_owner_set(ec); + e_tzsh_indicator_srv_property_update(ec); + + indicator_obj = ecore_evas_extn_plug_new(e_comp->ee); + if (!indicator_obj) + { + ELOGF("TZPOL", + "Launchscreen launch | Faild to create ecore_evas_plug for indicator", + ec->pixmap, ec); + } + else + { + if (e_config->indicator_plug_name) + { + ret = ecore_evas_extn_plug_connect(indicator_obj, e_config->indicator_plug_name, 0, EINA_FALSE); + if (ret) + { + Ecore_Evas *ee; + + ee = ecore_evas_object_ecore_evas_get(indicator_obj); + ecore_evas_data_set(ee, "tzlaunch_splash", tzlaunch_splash); + ecore_evas_callback_resize_set(ee, + _launchscreen_splash_cb_indicator_resized); + e_comp_object_indicator_swallow(ec->frame, indicator_obj); + evas_object_ref(indicator_obj); + ELOGF("TZPOL", + "Launchscreen launch | Succeeded to add indicator object plug_name(%s) indicator_obj(%p)", + ec->pixmap, ec, e_config->indicator_plug_name, indicator_obj); + } + else + { + evas_object_del(indicator_obj); + indicator_obj = NULL; + } + } + + if (!indicator_obj) + { + ELOGF("TZPOL", + "Launchscreen launch | Failed to add indicator object plug_name(%s)", + ec->pixmap, ec, e_config->indicator_plug_name?:"NO PLUG NAME"); + } + } + + tzlaunch_splash->indicator_obj = indicator_obj; + } + + if (tzlaunch_splash->obj) + { + evas_object_ref(tzlaunch_splash->obj); + + evas_object_event_callback_add(tzlaunch_splash->obj, + EVAS_CALLBACK_DEL, + _launchscreen_splash_cb_del, tzlaunch_splash); + evas_object_event_callback_add(tzlaunch_splash->obj, + EVAS_CALLBACK_HIDE, + _launchscreen_splash_cb_hide, tzlaunch_splash); + } + + tzlaunch_splash->valid = EINA_TRUE; + tzlaunch_splash->content_type = e_comp_object_content_type_get(ec->frame); + + ec->ignored = EINA_FALSE; + ec->visible = EINA_TRUE; + ec->new_client = EINA_FALSE; + ec->icccm.accepts_focus = EINA_TRUE; + + evas_object_show(ec->frame); + evas_object_raise(ec->frame); + EC_CHANGED(ec); + + e_client_visibility_calculate(); + + if (tzlaunch_splash->timeout) + ecore_timer_del(tzlaunch_splash->timeout); + tzlaunch_splash->timeout = ecore_timer_add(e_config->launchscreen_timeout, _launchscreen_splash_timeout, tzlaunch_splash); + + return; +error: + ERR("Could not complete %s", __FUNCTION__); + if (tzlaunch_splash->obj) + evas_object_del(tzlaunch_splash->obj); +} + +static void _tzlaunch_img_iface_cb_show(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzlaunch_img) { /* TODO: request launch img show */ @@ -4904,6 +5370,90 @@ _tzlaunch_img_iface_cb_owner(struct wl_client *client EINA_UNUSED, struct wl_res tzlaunch_img->ec->netwm.pid = pid; } +static void +_tzlaunch_splash_iface_cb_owner(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzlaunch_splash, uint32_t pid) +{ + E_Policy_Wl_Tzlaunch_Splash *tzlaunch_splash; + E_Client *pre_ec = NULL, *new_ec = NULL, *old_ec; + Eina_List *clients, *l; + + tzlaunch_splash = wl_resource_get_user_data(res_tzlaunch_splash); + EINA_SAFETY_ON_NULL_RETURN(tzlaunch_splash); + + /* use ec was already created */ + clients = _e_policy_wl_e_clients_find_by_pid(pid); + EINA_LIST_FOREACH(clients, l, pre_ec) + { + if (pre_ec == tzlaunch_splash->ec) continue; + if (!pre_ec->ignored) continue; + new_ec = pre_ec; + break; + } + eina_list_free(clients); + + if (new_ec) + { + if (e_comp_object_content_set(new_ec->frame, + tzlaunch_splash->obj, + tzlaunch_splash->content_type)) + { + old_ec = tzlaunch_splash->ec; + + new_ec->ignored = EINA_FALSE; + new_ec->visible = EINA_TRUE; + new_ec->new_client = EINA_FALSE; + + new_ec->effect_type = old_ec->effect_type; + + e_comp->launchscrns = eina_list_append(e_comp->launchscrns, new_ec); + + evas_object_show(new_ec->frame); + evas_object_stack_above(new_ec->frame, old_ec->frame); + EC_CHANGED(new_ec); + + tzlaunch_splash->ec = new_ec; + tzlaunch_splash->replaced = EINA_TRUE; + + ELOGF("TZPOL", + "Launchscreen client changed | old(%p) new(%p) using obj(%p)", + new_ec->pixmap, new_ec, + old_ec, new_ec, tzlaunch_splash->obj); + + if (tzlaunch_splash->indicator_obj) + { + e_mod_indicator_owner_set(new_ec); + e_tzsh_indicator_srv_property_update(new_ec); + e_comp_object_indicator_unswallow(old_ec->frame, tzlaunch_splash->indicator_obj); + e_comp_object_indicator_swallow(new_ec->frame, tzlaunch_splash->indicator_obj); + } + + /* delete ec was created for launchscreen */ + if (old_ec->visible) + { + old_ec->visible = EINA_FALSE; + evas_object_hide(old_ec->frame); + old_ec->ignored = EINA_TRUE; + } + e_comp->launchscrns = eina_list_remove(e_comp->launchscrns, old_ec); + + e_pixmap_win_id_del(tzlaunch_splash->ep); + e_object_del(E_OBJECT(old_ec)); + tzlaunch_splash->ep = NULL; + + e_client_visibility_calculate(); + } + else + ERR("Can't set external content for new_ec(%p)", new_ec); + } + + ELOGF("TZPOL", "Launchscreen img(%d) set owner pid: %d", + (tzlaunch_splash->ec? tzlaunch_splash->ec->pixmap : NULL), + tzlaunch_splash->ec, + wl_resource_get_id(res_tzlaunch_splash), pid); + + tzlaunch_splash->pid = pid; + tzlaunch_splash->ec->netwm.pid = pid; +} static const struct tizen_launch_image_interface _tzlaunch_img_iface = { @@ -4914,6 +5464,13 @@ static const struct tizen_launch_image_interface _tzlaunch_img_iface = _tzlaunch_img_iface_cb_hide }; +static const struct tizen_launch_splash_interface _tzlaunch_splash_iface = +{ + _tzlaunch_splash_iface_cb_destroy, + _tzlaunch_splash_iface_cb_launch, + _tzlaunch_splash_iface_cb_owner +}; + static E_Policy_Wl_Tzlaunch_Img * _tzlaunch_img_add(struct wl_resource *res_tzlaunch, struct wl_resource *res_tzlaunch_img) { @@ -4957,6 +5514,50 @@ error: return NULL; } +static E_Policy_Wl_Tzlaunch_Splash * +_tzlaunch_splash_add(struct wl_resource *res_tzlaunch_effect, struct wl_resource *res_tzlaunch_splash) +{ + E_Policy_Wl_Tzlaunch_Effect *tzlaunch_effect; + E_Policy_Wl_Tzlaunch_Splash *tzlaunch_splash; + + tzlaunch_splash = E_NEW(E_Policy_Wl_Tzlaunch_Splash, 1); + EINA_SAFETY_ON_NULL_GOTO(tzlaunch_splash, error); + + tzlaunch_effect = wl_resource_get_user_data(res_tzlaunch_effect); + EINA_SAFETY_ON_NULL_GOTO(tzlaunch_effect, error); + + tzlaunch_effect->splash_list = eina_list_append(tzlaunch_effect->splash_list, tzlaunch_splash); + + tzlaunch_splash->tzlaunch_effect = tzlaunch_effect; + tzlaunch_splash->res_tzlaunch_splash = res_tzlaunch_splash; + + tzlaunch_splash->replaced = EINA_FALSE; + tzlaunch_splash->ep = e_pixmap_new(E_PIXMAP_TYPE_EXT_OBJECT, 0); + EINA_SAFETY_ON_NULL_GOTO(tzlaunch_splash->ep, error); + tzlaunch_splash->ec = e_client_new(tzlaunch_splash->ep, 0, 1); + EINA_SAFETY_ON_NULL_GOTO(tzlaunch_splash->ec, error); + + tzlaunch_splash->ec->icccm.title = eina_stringshare_add("Launchscreen"); + tzlaunch_splash->ec->icccm.name = eina_stringshare_add("Launchscreen"); + tzlaunch_splash->ec->ignored = EINA_TRUE; + + e_comp->launchscrns = eina_list_append(e_comp->launchscrns, tzlaunch_splash->ec); + + return tzlaunch_splash; +error: + if (tzlaunch_splash) + { + ERR("Could not initialize launchscreen client"); + if (tzlaunch_splash->ep) + e_pixmap_win_id_del(tzlaunch_splash->ep); + if (tzlaunch_splash->ec) + e_object_del(E_OBJECT(tzlaunch_splash->ec)); + E_FREE(tzlaunch_splash); + } + return NULL; +} + + static void _tzlaunch_img_destroy(struct wl_resource *res_tzlaunch_img) { @@ -4981,6 +5582,30 @@ _tzlaunch_img_destroy(struct wl_resource *res_tzlaunch_img) } static void +_tzlaunch_splash_destroy(struct wl_resource *res_tzlaunch_splash) +{ + E_Policy_Wl_Tzlaunch_Splash *tzlaunch_splash; + E_Policy_Wl_Tzlaunch_Effect *tzlaunch_effect; + + EINA_SAFETY_ON_NULL_RETURN(res_tzlaunch_splash); + + tzlaunch_splash = wl_resource_get_user_data(res_tzlaunch_splash); + EINA_SAFETY_ON_NULL_RETURN(tzlaunch_splash); + + if (tzlaunch_splash->obj) + evas_object_event_callback_del_full(tzlaunch_splash->obj, EVAS_CALLBACK_DEL, _launchscreen_splash_cb_del, tzlaunch_splash); + + _launch_splash_off(tzlaunch_splash); + + tzlaunch_effect = tzlaunch_splash->tzlaunch_effect; + tzlaunch_effect->splash_list = eina_list_remove(tzlaunch_effect->splash_list, tzlaunch_splash); + + memset(tzlaunch_splash, 0x0, sizeof(E_Policy_Wl_Tzlaunch_Splash)); + E_FREE(tzlaunch_splash); +} + + +static void _tzlaunch_iface_cb_create_img(struct wl_client *client, struct wl_resource *res_tzlaunch, uint32_t id) { @@ -5015,12 +5640,100 @@ err: wl_client_post_no_memory(client); } +static void +_tzlaunch_effect_iface_cb_create_splash_img(struct wl_client *client, struct wl_resource *res_tzlaunch_effect, uint32_t id) +{ + + E_Policy_Wl_Tzlaunch_Splash *plaunch_splash; + struct wl_resource *res_tzlaunch_splash; + + res_tzlaunch_splash = wl_resource_create(client, + &tizen_launch_splash_interface, + wl_resource_get_version(res_tzlaunch_effect), + id); + if (!res_tzlaunch_splash) + { + wl_resource_post_error + (res_tzlaunch_effect, + WL_DISPLAY_ERROR_INVALID_OBJECT, + "Invalid res_tzlaunch effect's user data"); + return; + } + + plaunch_splash = _tzlaunch_splash_add(res_tzlaunch_effect, res_tzlaunch_splash); + EINA_SAFETY_ON_NULL_GOTO(plaunch_splash, err); + + wl_resource_set_implementation(res_tzlaunch_splash, + &_tzlaunch_splash_iface, + plaunch_splash, + _tzlaunch_splash_destroy); + + return; + +err: + ERR("Could not create tizen_launch_splash_interface res: %m"); + wl_client_post_no_memory(client); +} + +static void +_tzlaunch_effect_iface_cb_type_set(struct wl_client *client, struct wl_resource *res_tzlaunch_effect, + const char *effect_type, uint32_t pid, struct wl_array *options) +{ + Eina_List *clients, *l; + E_Client *_ec = NULL; + int effect_set = 0; + int tzlaunch_effect_type = _e_policy_wl_tzlaunch_effect_type_get(effect_type); + + clients = _e_policy_wl_e_clients_find_by_pid(pid); + EINA_LIST_FOREACH(clients, l, _ec) + { + if (_ec) + { + _ec->effect_type = tzlaunch_effect_type; + effect_set = 1; + ELOGF("TZPOL", + "Launchscreen effect type set | exist ec | effect (%d) pid (%d)", + _ec->pixmap, _ec, tzlaunch_effect_type, pid); + } + } + eina_list_free(clients); + + if (effect_set) + _e_policy_wl_tzlaunch_effect_type_unset(pid); + else + { + E_Policy_Wl_Tzlaunch_Effect_Info *tzlaunch_effect_info; + + tzlaunch_effect_info = E_NEW(E_Policy_Wl_Tzlaunch_Effect_Info, 1); + EINA_SAFETY_ON_NULL_RETURN(tzlaunch_effect_info); + tzlaunch_effect_info->pid = pid; + tzlaunch_effect_info->effect_type = tzlaunch_effect_type; + polwl->tzlaunch_effect_info = eina_list_append(polwl->tzlaunch_effect_info, tzlaunch_effect_info); + + ELOGF("TZPOL", + "Launchscreen effect type set | no match ec | effect (%d) pid (%d)", NULL, NULL, tzlaunch_effect_type, pid); + } +} + +static void +_tzlaunch_effect_iface_cb_type_unset(struct wl_client *client, struct wl_resource *res_tzlaunch_effect, + uint32_t pid) +{ + _e_policy_wl_tzlaunch_effect_type_unset(pid); +} static const struct tizen_launchscreen_interface _tzlaunch_iface = { _tzlaunch_iface_cb_create_img }; +static const struct tizen_launch_effect_interface _tzlaunch_effect_iface = +{ + _tzlaunch_effect_iface_cb_create_splash_img, + _tzlaunch_effect_iface_cb_type_set, + _tzlaunch_effect_iface_cb_type_unset +}; + static void _tzlaunch_del(E_Policy_Wl_Tzlaunch *tzlaunch) { @@ -5043,6 +5756,29 @@ _tzlaunch_del(E_Policy_Wl_Tzlaunch *tzlaunch) E_FREE(tzlaunch); } +static void +_tzlaunch_effect_del(E_Policy_Wl_Tzlaunch_Effect *tzlaunch_effect) +{ + E_Policy_Wl_Tzlaunch_Splash *plaunch_splash; + Eina_List *l, *ll; + + EINA_SAFETY_ON_NULL_RETURN(tzlaunch_effect); + + // remove tzlaunch created splash list + EINA_LIST_FOREACH_SAFE(tzlaunch_effect->splash_list, l, ll, plaunch_splash) + { + if (plaunch_splash->tzlaunch_effect != tzlaunch_effect) continue; + wl_resource_destroy(plaunch_splash->res_tzlaunch_splash); + break; + } + + polwl->tzlaunch_effect = eina_list_remove(polwl->tzlaunch_effect, tzlaunch_effect); + + memset(tzlaunch_effect, 0x0, sizeof(E_Policy_Wl_Tzlaunch_Effect)); + E_FREE(tzlaunch_effect); +} + + static E_Policy_Wl_Tzlaunch * _tzlaunch_add(struct wl_resource *res_tzlaunch) { @@ -5058,6 +5794,21 @@ _tzlaunch_add(struct wl_resource *res_tzlaunch) return tzlaunch; } +static E_Policy_Wl_Tzlaunch_Effect * +_tzlaunch_effect_add(struct wl_resource *res_tzlaunch_effect) +{ + E_Policy_Wl_Tzlaunch_Effect *tzlaunch_effect; + + tzlaunch_effect = E_NEW(E_Policy_Wl_Tzlaunch_Effect, 1); + EINA_SAFETY_ON_NULL_RETURN_VAL(tzlaunch_effect, NULL); + + tzlaunch_effect->res_tzlaunch_effect = res_tzlaunch_effect; + + polwl->tzlaunch_effect = eina_list_append(polwl->tzlaunch_effect, tzlaunch_effect); + + return tzlaunch_effect; +} + static void _tzlaunch_cb_unbind(struct wl_resource *res_tzlaunch) { @@ -5073,6 +5824,20 @@ _tzlaunch_cb_unbind(struct wl_resource *res_tzlaunch) } static void +_tzlaunch_effect_cb_unbind(struct wl_resource *res_tzlaunch_effect) +{ + E_Policy_Wl_Tzlaunch_Effect *tzlaunch_effect = NULL; + Eina_List *l, *ll; + + EINA_LIST_FOREACH_SAFE(polwl->tzlaunch_effect, l, ll, tzlaunch_effect) + { + if (tzlaunch_effect->res_tzlaunch_effect != res_tzlaunch_effect) continue; + _tzlaunch_effect_del(tzlaunch_effect); + break; + } +} + +static void _tzlaunch_cb_bind(struct wl_client *client, void *data EINA_UNUSED, uint32_t ver, uint32_t id) { E_Policy_Wl_Tzlaunch *tzlaunch = NULL; @@ -5101,6 +5866,35 @@ err: wl_client_post_no_memory(client); } +static void +_tzlaunch_effect_cb_bind(struct wl_client *client, void *data EINA_UNUSED, uint32_t ver, uint32_t id) +{ + E_Policy_Wl_Tzlaunch_Effect *tzlaunch_effect = NULL; + struct wl_resource *res_tzlaunch_effect; + + EINA_SAFETY_ON_NULL_GOTO(polwl, err); + + res_tzlaunch_effect = wl_resource_create(client, + &tizen_launch_effect_interface, + ver, + id); + EINA_SAFETY_ON_NULL_GOTO(res_tzlaunch_effect, err); + + tzlaunch_effect = _tzlaunch_effect_add(res_tzlaunch_effect); + EINA_SAFETY_ON_NULL_GOTO(tzlaunch_effect, err); + + wl_resource_set_implementation(res_tzlaunch_effect, + &_tzlaunch_effect_iface, + tzlaunch_effect, + _tzlaunch_effect_cb_unbind); + + return; + +err: + ERR("Could not create tizen_launchscreen_interface res: %m"); + wl_client_post_no_memory(client); +} + static Eina_Bool _e_policy_wl_cb_hook_intercept_show_helper(void *data, E_Client *ec) { @@ -5598,6 +6392,7 @@ e_policy_wl_client_add(E_Client *ec) _e_policy_wl_surf_client_set(ec); _e_policy_wl_tzsh_client_set(ec); _e_policy_wl_pending_bg_client_set(ec); + _e_policy_wl_tzlaunch_effect_type_sync(ec); } void @@ -5612,6 +6407,7 @@ e_policy_wl_client_del(E_Client *ec) _e_policy_wl_tz_indicator_unset_client(ec); _e_policy_wl_tz_clipboard_unset_client(ec); _launchscreen_client_del(ec); + _launch_effect_client_del(ec); polwl->pending_vis = eina_list_remove(polwl->pending_vis, ec); } @@ -5720,6 +6516,15 @@ e_policy_wl_defer_job(void) polwl->globals = eina_list_append(polwl->globals, global); + global = wl_global_create(e_comp_wl->wl.disp, + &tizen_launch_effect_interface, + 1, + NULL, + _tzlaunch_effect_cb_bind); + EINA_SAFETY_ON_NULL_GOTO(global, err); + + polwl->globals = eina_list_append(polwl->globals, global); + return EINA_TRUE; err: -- 2.7.4