--- /dev/null
+
+#include "e_tizen_launch_effect_intern.h"
+#include "e_comp_intern.h"
+#include "e_comp_object_intern.h"
+#include "e_comp_wl_intern.h"
+#include "e_pixmap_intern.h"
+#include "e_policy_intern.h"
+#include "e_policy_wl_intern.h"
+#include "e_service_launcher_intern.h"
+#include "e_service_indicator_intern.h"
+#include "e_utils_intern.h"
+
+#include <tizen-launch-server-protocol.h>
+
+typedef struct _E_Tizen_Launch_Effect_Res E_Tizen_Launch_Effect_Res;
+typedef struct _E_Tizen_Launch_Effect_Res_Info E_Tizen_Launch_Effect_Res_Info;
+typedef struct _E_Tizen_Launch_Effect_Splash E_Tizen_Launch_Effect_Splash;
+
+struct _E_Tizen_Launch_Effect {
+ struct wl_global *global;
+ struct wl_display *display;
+
+ /* tizen_launch_effect_interface */
+ Eina_List *tzlaunch_effect; /* list of E_Tizen_Launch_Effect_Res */
+ Eina_List *tzlaunch_effect_info; /* list of E_Tizen_Launch_Effect_Res_Info */
+};
+
+struct _E_Tizen_Launch_Effect_Res
+{
+ struct wl_resource *res_tzlaunch_effect; /* tizen_launch_effect */
+ Eina_List *splash_list; /* list of E_Tizen_Launch_Effect_Splash */
+};
+
+struct _E_Tizen_Launch_Effect_Res_Info
+{
+ uint32_t pid; /* pid */
+ int effect_type; /* effect_type */
+};
+
+struct _E_Tizen_Launch_Effect_Splash
+{
+ struct wl_resource *res_tzlaunch_splash; /* tizen_launch_image */
+ E_Tizen_Launch_Effect_Res *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 */
+
+ Eina_Bool custom_effect_callee; /* custom effect enabled */
+ const char *appid;
+};
+
+typedef enum _Launch_Img_File_type
+{
+ LAUNCH_IMG_FILE_TYPE_ERROR = -1,
+ LAUNCH_IMG_FILE_TYPE_IMAGE = 0,
+ LAUNCH_IMG_FILE_TYPE_EDJ
+} Launch_Img_File_type;
+
+typedef enum _Tzlaunch_Effect_Type
+{
+ TZLAUNCH_EFFECT_TYPE_LAUNCH = 0,
+ TZLAUNCH_EFFECT_TYPE_DEPTH_IN
+} Tzlaunch_Effect_Type;
+
+static E_Tizen_Launch_Effect *g_tizen_launch_effect = NULL;
+static Eina_List *handlers = NULL;
+static Eina_List *hooks_ec = NULL;
+
+#define SPLASH_GROUP_NAME "effect"
+#define SPLASH_CONFIG_CUSTOM_EFFECT_CALLEE "_CUSTOM_EFFECT_CALLEE_"
+
+static void
+_e_tizen_launch_effect_type_unset(uint32_t pid)
+{
+ Eina_List *l;
+ E_Tizen_Launch_Effect_Res_Info *effect_info;
+
+ EINA_LIST_FOREACH(g_tizen_launch_effect->tzlaunch_effect_info, l, effect_info)
+ {
+ if (effect_info->pid == pid)
+ {
+ ELOGF("TZPOL",
+ "Launchscreen effect type unset | pid (%d)",
+ NULL, pid);
+ g_tizen_launch_effect->tzlaunch_effect_info = eina_list_remove(g_tizen_launch_effect->tzlaunch_effect_info, effect_info);
+ memset(effect_info, 0x0, sizeof(E_Tizen_Launch_Effect_Res_Info));
+ E_FREE(effect_info);
+ break;
+ }
+ }
+}
+
+static Eina_List *
+_e_tizen_launch_effect_e_clients_find_by_pid(pid_t pid)
+{
+ E_Client *ec;
+ Eina_List *clients = NULL, *l, *comp_ec_list;
+
+ comp_ec_list = e_comp_ec_list_get();
+ EINA_LIST_FOREACH(comp_ec_list, l, ec)
+ {
+ if (e_object_is_del(E_OBJECT(ec))) continue;
+ if (ec->netwm.pid != pid) continue;
+ clients = eina_list_append(clients, ec);
+ }
+
+ return clients;
+}
+
+static void
+_launch_splash_off(E_Tizen_Launch_Effect_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;
+
+ eina_stringshare_del(tzlaunch_splash->appid);
+ tzlaunch_splash->appid = NULL;
+ eina_stringshare_del(tzlaunch_splash->path);
+ tzlaunch_splash->path = NULL;
+
+
+ ELOGF("TZPOL",
+ "Launchscreen hide | pid %d, replaced:%d, tzlaunch_pixmap:%p, ec_pixmap:%p",
+ ec, tzlaunch_splash->pid, tzlaunch_splash->replaced, tzlaunch_splash->ep, ec->pixmap);
+
+ 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 destroyed.
+ */
+ if (ec->visible)
+ {
+ ec->visible = EINA_FALSE;
+ e_view_client_hide(e_client_view_get(ec));
+ ec->ignored = EINA_TRUE;
+ }
+
+ e_comp_launchscrn_ec_remove(ec);
+
+ e_pixmap_win_id_del(tzlaunch_splash->ep);
+ e_object_del(E_OBJECT(ec));
+ ec = NULL;
+ }
+
+ if (ec)
+ {
+ if (!e_util_strcmp("wl_pointer-cursor", ec->icccm.window_role))
+ {
+ // if Launchscreen is replaced to cursor, than hide
+ e_comp_object_content_unset(ec->frame);
+ ec->visible = EINA_FALSE;
+ e_view_client_hide(e_client_view_get(ec));
+ ec->ignored = EINA_TRUE;
+ }
+ else 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)))
+ {
+ if (ec->first_mapped)
+ {
+ ELOGF("LAUNCH", "SHOW real win by replaced splash ec", ec);
+ e_view_client_signal_emit(e_client_view_get(ec), "e,action,launch_real,done", "e");
+ }
+ e_view_client_signal_emit(e_client_view_get(ec), "e,action,launch,done", "e");
+ }
+ }
+
+ e_comp_launchscrn_ec_remove(ec);
+ }
+
+ if (obj)
+ evas_object_unref(obj);
+
+ tzlaunch_splash->ep = NULL;
+ tzlaunch_splash->replaced = EINA_FALSE;
+}
+
+static void
+_launch_effect_client_del(E_Client *ec)
+{
+ Eina_List *l, *ll;
+ E_Tizen_Launch_Effect_Res *tzlaunch_effect;
+ E_Tizen_Launch_Effect_Splash *tzlaunch_splash;
+
+ EINA_LIST_FOREACH(g_tizen_launch_effect->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_splash_cb_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ E_Tizen_Launch_Effect_Splash *tzlaunch_splash = data;
+
+ if ((tzlaunch_splash) && (tzlaunch_splash->obj == obj))
+ tzlaunch_splash->obj = NULL;
+}
+
+static void
+_launchscreen_splash_cb_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ E_Tizen_Launch_Effect_Splash *tzlaunch_splash = data;
+
+ if ((tzlaunch_splash) && (tzlaunch_splash->obj == obj))
+ _launch_splash_off(tzlaunch_splash);
+}
+
+static Eina_Bool
+_launchscreen_splash_timeout(void *data)
+{
+ E_Tizen_Launch_Effect_Splash *tzlaunch_splash;
+ tzlaunch_splash = (E_Tizen_Launch_Effect_Splash *)data;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(tzlaunch_splash, 0);
+
+ _launch_splash_off(tzlaunch_splash);
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static int
+_e_tizen_launch_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 Eina_Bool
+_launchscreen_splash_setup(E_Tizen_Launch_Effect_Splash *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,
+ struct wl_array *extra_config)
+{
+ E_Client *ec = NULL;
+ E_Comp_Object_Content_Type content_type = 0;
+ Eina_Bool intercepted = EINA_FALSE;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(splash->ec, EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(e_client_view_get(splash->ec), EINA_FALSE);
+
+ ec = splash->ec;
+ ec->effect_type = _e_tizen_launch_effect_type_get(effect_type);
+
+ ELOGF("TZPOL",
+ "Launchscreen setup START| path %s(%d), indicator(%d), angle(%d), effect_type(%s), theme_type(%s)",
+ ec, pfname, ftype, indicator, angle, effect_type, theme_type);
+ ELOGF("TZPOL",
+ "Launchscreen setup | options %p extra_config:%p",
+ ec, options, extra_config);
+
+ splash->path = eina_stringshare_add(pfname);
+ splash->type = ftype;
+ splash->indicator = indicator;
+ splash->indicator_obj = NULL;
+ splash->angle = angle;
+
+ if (indicator)
+ ELOGF("TZPOL", "Launchscreen setup | INDICATOR of the splash screen has benn deprecated. please check!", NULL);
+
+ intercepted = e_policy_interceptor_call(E_POLICY_INTERCEPT_LAUNCHSCREEN_OBJECT_SETUP,
+ ec,
+ pfname, ftype, depth,
+ angle, indicator, options);
+ if (intercepted)
+ {
+ splash->obj = e_comp_object_content_get(ec->frame);
+
+ ELOGF("TZPOL",
+ "Launchscreen setup | was INTERCEPTED : content(%p)",
+ ec, splash->obj);
+ }
+ else //Do original setup process
+ {
+ int comp_w = 0, comp_h = 0;
+ if (splash->type == LAUNCH_IMG_FILE_TYPE_IMAGE)
+ {
+ Evas_Load_Error err;
+
+ content_type = E_COMP_OBJECT_CONTENT_TYPE_EXT_IMAGE;
+ splash->obj = evas_object_image_add(e_comp_evas_get());
+ EINA_SAFETY_ON_NULL_RETURN_VAL(splash->obj, EINA_FALSE);
+
+ evas_object_image_file_set(splash->obj, splash->path, NULL);
+
+ err = evas_object_image_load_error_get(splash->obj);
+ if (err != EVAS_LOAD_ERROR_NONE)
+ {
+ ELOGF("TZPOL",
+ "Launchscreen setup | fail to load image %s : %s",
+ ec, splash->path, evas_load_error_str(err));
+ evas_object_del(splash->obj);
+ splash->obj = NULL;
+ return EINA_FALSE;
+ }
+
+ e_comp_size_get(&comp_w, &comp_h);
+ evas_object_image_fill_set(splash->obj, 0, 0, comp_w, comp_h);
+ evas_object_image_filled_set(splash->obj, EINA_TRUE);
+ }
+ else
+ {
+ content_type = E_COMP_OBJECT_CONTENT_TYPE_EXT_EDJE;
+ splash->obj = edje_object_add(e_comp_evas_get());
+ EINA_SAFETY_ON_NULL_RETURN_VAL(splash->obj, EINA_FALSE);
+
+ if (!edje_object_file_set(splash->obj, splash->path, SPLASH_GROUP_NAME))
+ {
+ Edje_Load_Error err;
+
+ err = edje_object_load_error_get(splash->obj);
+ ELOGF("TZPOL",
+ "Launchscreen setup | fail to load edje %s : %s",
+ ec, splash->path, edje_load_error_str(err));
+ evas_object_del(splash->obj);
+ splash->obj = NULL;
+ return EINA_FALSE;
+
+ }
+
+ evas_object_move(splash->obj, 0, 0);
+ e_comp_size_get(&comp_w, &comp_h);
+ evas_object_resize(splash->obj, comp_w, comp_h);
+ }
+
+ if (depth == 32) ec->argb = EINA_TRUE;
+ else ec->argb = EINA_FALSE;
+ ELOGF("COMP", "Set argb:%d", ec, ec->argb);
+
+ //set splash->obj to a content of ec->frame
+ if (!e_comp_object_content_set(ec->frame, splash->obj, content_type))
+ {
+ ERR("Launchscreen setup | setting comp object content failed ec(%p) obj(%p)",
+ ec, splash->obj);
+ return EINA_FALSE;
+ }
+ }
+
+
+ /* Post job of setup content_type */
+
+ //Parse extra config
+ if ((extra_config) && (extra_config->size))
+ {
+ char *p_char;
+ int len = 0;
+ int size = extra_config->size;
+
+ while (size > 0)
+ {
+ p_char = extra_config->data + len;
+ len = strlen(p_char) + 1;
+ size -= len;
+
+ if (!e_util_strcmp(p_char, SPLASH_CONFIG_CUSTOM_EFFECT_CALLEE))
+ {
+ //parse next data(appid) from array
+ if (size > 0)
+ {
+ p_char = p_char + len;
+ len = strlen(p_char) + 1;
+ size -= len;
+
+ splash->appid = eina_stringshare_add(p_char);
+ splash->custom_effect_callee = EINA_TRUE;
+
+ ELOGF("TZPOL",
+ "Launchscreen setup | custom effect callee set appid(%s)",
+ ec, splash->appid);
+ }
+ else break;
+ }
+ }
+ }
+
+ //ref splash object
+ if (splash->obj)
+ {
+ evas_object_ref(splash->obj);
+
+ evas_object_event_callback_add(splash->obj,
+ EVAS_CALLBACK_DEL,
+ _launchscreen_splash_cb_del, splash);
+ evas_object_event_callback_add(splash->obj,
+ EVAS_CALLBACK_HIDE,
+ _launchscreen_splash_cb_hide, splash);
+ }
+
+ splash->valid = EINA_TRUE;
+ splash->content_type = e_comp_object_content_type_get(ec->frame);
+
+ return EINA_TRUE;
+}
+
+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_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_Tizen_Launch_Effect_Splash *tzlaunch_splash;
+ Eina_Bool res = EINA_FALSE;
+
+ tzlaunch_splash = wl_resource_get_user_data(res_tzlaunch_splash);
+ EINA_SAFETY_ON_NULL_RETURN(tzlaunch_splash);
+
+ ELOGF("TZPOL","Launchscreen launch | START", NULL);
+
+
+ res = _launchscreen_splash_setup(tzlaunch_splash,
+ pfname, ftype,
+ depth, angle,
+ indicator, effect_type,
+ theme_type, options, NULL);
+
+ ELOGF("TZPOL","Launchscreen launch | END res:%d ", NULL, res);
+
+ if (!res)
+ {
+ ERR("Launchscreen launch | Could not complete %s", __FUNCTION__);
+ if (tzlaunch_splash->obj)
+ {
+ evas_object_del(tzlaunch_splash->obj);
+ tzlaunch_splash->obj = NULL;
+ }
+ }
+}
+
+static void
+_tzlaunch_splash_iface_cb_owner(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzlaunch_splash, uint32_t pid)
+{
+ E_Tizen_Launch_Effect_Splash *tzlaunch_splash;
+ E_Client *pre_ec = NULL, *new_ec = NULL, *old_ec;
+ Eina_List *clients, *l;
+ int tw, th;
+ int comp_w = 0, comp_h = 0;
+ E_Comp *comp = e_comp_get();
+
+ tzlaunch_splash = wl_resource_get_user_data(res_tzlaunch_splash);
+ EINA_SAFETY_ON_NULL_RETURN(tzlaunch_splash);
+ EINA_SAFETY_ON_FALSE_RETURN(tzlaunch_splash->valid);
+
+ /* use ec was already created */
+ e_comp_size_get(&comp_w, &comp_h);
+ clients = _e_tizen_launch_effect_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;
+ if (pre_ec->is_cursor) continue;
+ new_ec = pre_ec;
+ e_client_geometry_get(new_ec, NULL, NULL, &tw, &th);
+ if (tw <= 1 || th <= 1)
+ e_view_client_size_set(e_client_view_get(new_ec), comp_w, comp_h);
+ break;
+ }
+ eina_list_free(clients);
+
+ old_ec = tzlaunch_splash->ec;
+ if (new_ec)
+ {
+ if (e_comp_object_content_set(new_ec->frame,
+ tzlaunch_splash->obj,
+ tzlaunch_splash->content_type))
+ {
+ e_client_unignore(new_ec);
+ new_ec->visible = EINA_TRUE;
+ if (new_ec->new_client)
+ comp->new_clients--;
+ new_ec->new_client = EINA_FALSE;
+ new_ec->argb = old_ec->argb;
+ ELOGF("COMP", "Set argb:%d", new_ec, new_ec->argb);
+ new_ec->effect_type = old_ec->effect_type;
+ new_ec->use_splash = EINA_TRUE;
+ e_client_icccm_title_set(new_ec, "launchscreen");
+
+ e_comp_launchscrn_ec_add(new_ec);
+
+ if (tzlaunch_splash->custom_effect_callee)
+ {
+ e_service_launcher_callee_register(new_ec, tzlaunch_splash->appid, tzlaunch_splash->path, SPLASH_GROUP_NAME);
+ }
+
+ e_view_client_show(e_client_view_get(new_ec));
+ e_client_raise(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,
+ 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 */
+ e_comp_launchscrn_ec_remove(old_ec);
+
+ e_pixmap_win_id_del(tzlaunch_splash->ep);
+ e_object_del(E_OBJECT(old_ec));
+ tzlaunch_splash->ep = NULL;
+ }
+ else
+ ERR("Can't set external content for new_ec(%p)", new_ec);
+ }
+ else
+ {
+ old_ec->ignored = EINA_FALSE;
+ old_ec->visible = EINA_TRUE;
+ if (old_ec->new_client)
+ comp->new_clients--;
+ old_ec->new_client = EINA_FALSE;
+ old_ec->icccm.accepts_focus = EINA_TRUE;
+
+ if (tzlaunch_splash->custom_effect_callee)
+ {
+ e_service_launcher_callee_register(old_ec, tzlaunch_splash->appid, tzlaunch_splash->path, SPLASH_GROUP_NAME);
+ }
+
+ e_view_client_show(e_client_view_get(old_ec));
+ e_client_raise(old_ec);
+ }
+
+ EC_CHANGED(tzlaunch_splash->ec);
+ e_comp_visibility_calculation_set(EINA_TRUE);
+
+ if (tzlaunch_splash->timeout)
+ {
+ ecore_timer_del(tzlaunch_splash->timeout);
+ tzlaunch_splash->timeout = NULL;
+ }
+ if (!e_config->launchscreen_without_timer)
+ tzlaunch_splash->timeout = ecore_timer_add(e_config->launchscreen_timeout, _launchscreen_splash_timeout, tzlaunch_splash);
+
+ ELOGF("TZPOL", "Launchscreen img(%d) set owner pid: %d",
+ tzlaunch_splash->ec,
+ wl_resource_get_id(res_tzlaunch_splash), pid);
+
+ tzlaunch_splash->pid = pid;
+ tzlaunch_splash->ec->netwm.pid = pid;
+ tzlaunch_splash->ec->use_splash = EINA_TRUE;
+}
+
+static void
+_tzlaunch_splash_iface_cb_launch_v2(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,
+ struct wl_array *extra_config)
+{
+ E_Tizen_Launch_Effect_Splash *tzlaunch_splash;
+ Eina_Bool res = EINA_FALSE;
+
+ tzlaunch_splash = wl_resource_get_user_data(res_tzlaunch_splash);
+ EINA_SAFETY_ON_NULL_RETURN(tzlaunch_splash);
+
+ ELOGF("TZPOL","Launchscreen launch_v2 | START", NULL);
+
+ res = _launchscreen_splash_setup(tzlaunch_splash,
+ pfname, ftype,
+ depth, angle,
+ indicator, effect_type,
+ theme_type, options, extra_config);
+
+ ELOGF("TZPOL","Launchscreen launch_v2 | END res:%d ", NULL, res);
+
+ if (!res)
+ {
+ ERR("Launchscreen launch_v2 | Could not complete %s", __FUNCTION__);
+ if (tzlaunch_splash->obj)
+ {
+ evas_object_del(tzlaunch_splash->obj);
+ tzlaunch_splash->obj = NULL;
+ }
+ }
+
+}
+
+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,
+ _tzlaunch_splash_iface_cb_launch_v2,
+};
+
+static E_Tizen_Launch_Effect_Splash *
+_tzlaunch_splash_add(struct wl_resource *res_tzlaunch_effect, struct wl_resource *res_tzlaunch_splash)
+{
+ E_Tizen_Launch_Effect_Res *tzlaunch_effect;
+ E_Tizen_Launch_Effect_Splash *tzlaunch_splash;
+
+ tzlaunch_splash = E_NEW(E_Tizen_Launch_Effect_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);
+
+ e_client_icccm_title_set(tzlaunch_splash->ec, "Launchscreen");
+ e_client_icccm_name_set(tzlaunch_splash->ec, "Launchscreen");
+ tzlaunch_splash->ec->ignored = EINA_TRUE;
+
+ e_comp_launchscrn_ec_add(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_splash_destroy(struct wl_resource *res_tzlaunch_splash)
+{
+ E_Tizen_Launch_Effect_Splash *tzlaunch_splash;
+ E_Tizen_Launch_Effect_Res *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);
+ evas_object_event_callback_del_full(tzlaunch_splash->obj, EVAS_CALLBACK_HIDE, _launchscreen_splash_cb_hide, 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);
+
+ eina_stringshare_del(tzlaunch_splash->appid);
+ eina_stringshare_del(tzlaunch_splash->path);
+ memset(tzlaunch_splash, 0x0, sizeof(E_Tizen_Launch_Effect_Splash));
+ E_FREE(tzlaunch_splash);
+}
+
+static void
+_tzlaunch_effect_iface_cb_create_splash_img(struct wl_client *client, struct wl_resource *res_tzlaunch_effect, uint32_t id)
+{
+
+ E_Tizen_Launch_Effect_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);
+
+ ELOGF("TZPOL", "Launchscreen effect create splash img. res_tzlaunch_effect:%p, res_tzlaunch_splash:%p", plaunch_splash->ec, res_tzlaunch_effect, res_tzlaunch_splash);
+
+ 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_tizen_launch_effect_type_get(effect_type);
+
+ clients = _e_tizen_launch_effect_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, tzlaunch_effect_type, pid);
+ }
+ }
+ eina_list_free(clients);
+
+ if (effect_set)
+ _e_tizen_launch_effect_type_unset(pid);
+ else
+ {
+ E_Tizen_Launch_Effect_Res_Info *tzlaunch_effect_info;
+
+ tzlaunch_effect_info = E_NEW(E_Tizen_Launch_Effect_Res_Info, 1);
+ EINA_SAFETY_ON_NULL_RETURN(tzlaunch_effect_info);
+ tzlaunch_effect_info->pid = pid;
+ tzlaunch_effect_info->effect_type = tzlaunch_effect_type;
+ g_tizen_launch_effect->tzlaunch_effect_info = eina_list_append(g_tizen_launch_effect->tzlaunch_effect_info, tzlaunch_effect_info);
+
+ ELOGF("TZPOL",
+ "Launchscreen effect type set | no match ec | effect (%d) pid (%d)",
+ 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_tizen_launch_effect_type_unset(pid);
+}
+
+static void
+_tzlaunch_effect_iface_cb_destroy(struct wl_client *client, struct wl_resource *resource)
+{
+ wl_resource_destroy(resource);
+}
+
+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,
+ _tzlaunch_effect_iface_cb_destroy,
+};
+
+static void
+_tzlaunch_effect_del(E_Tizen_Launch_Effect_Res *tzlaunch_effect)
+{
+ E_Tizen_Launch_Effect_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;
+ }
+
+ g_tizen_launch_effect->tzlaunch_effect = eina_list_remove(g_tizen_launch_effect->tzlaunch_effect, tzlaunch_effect);
+
+ memset(tzlaunch_effect, 0x0, sizeof(E_Tizen_Launch_Effect_Res));
+ E_FREE(tzlaunch_effect);
+}
+
+static E_Tizen_Launch_Effect_Res *
+_tzlaunch_effect_add(struct wl_resource *res_tzlaunch_effect)
+{
+ E_Tizen_Launch_Effect_Res *tzlaunch_effect;
+
+ tzlaunch_effect = E_NEW(E_Tizen_Launch_Effect_Res, 1);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(tzlaunch_effect, NULL);
+
+ tzlaunch_effect->res_tzlaunch_effect = res_tzlaunch_effect;
+
+ g_tizen_launch_effect->tzlaunch_effect = eina_list_append(g_tizen_launch_effect->tzlaunch_effect, tzlaunch_effect);
+
+ return tzlaunch_effect;
+}
+
+static void
+_tzlaunch_effect_cb_unbind(struct wl_resource *res_tzlaunch_effect)
+{
+ E_Tizen_Launch_Effect_Res *tzlaunch_effect = NULL;
+ Eina_List *l, *ll;
+
+ EINA_LIST_FOREACH_SAFE(g_tizen_launch_effect->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_effect_cb_bind(struct wl_client *client, void *data, uint32_t ver, uint32_t id)
+{
+ E_Tizen_Launch_Effect_Res *tzlaunch_effect = NULL;
+ struct wl_resource *res_tzlaunch_effect;
+
+ EINA_SAFETY_ON_NULL_GOTO(g_tizen_launch_effect, 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_launch_effect_interface res: %m");
+ wl_client_post_no_memory(client);
+}
+
+static void
+_e_tizen_launch_effect_type_sync(E_Client *ec)
+{
+ Eina_List *l;
+ E_Tizen_Launch_Effect_Res_Info *effect_info;
+
+ EINA_SAFETY_ON_NULL_RETURN(ec);
+
+ EINA_LIST_FOREACH(g_tizen_launch_effect->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, ec->netwm.pid, effect_info->effect_type);
+ ec->effect_type = effect_info->effect_type;
+ _e_tizen_launch_effect_type_unset(ec->netwm.pid);
+ break;
+ }
+ }
+}
+
+static Eina_Bool
+_e_tizen_launch_effect_cb_client_add(void *data, int type, void *event)
+{
+ E_Event_Client *ev;
+ E_Client *ec;
+
+ ev = event;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ev, ECORE_CALLBACK_PASS_ON);
+
+ ec = ev->ec;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ec, ECORE_CALLBACK_PASS_ON);
+
+ _e_tizen_launch_effect_type_sync(ec);
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static void
+_e_tizen_launch_effect_cb_hook_client_del(void *data, E_Client *ec)
+{
+ _launch_effect_client_del(ec);
+}
+
+EINTERN E_Tizen_Launch_Effect *
+e_tizen_launch_effect_init(struct wl_display *display)
+{
+ if (g_tizen_launch_effect) return g_tizen_launch_effect;
+
+ g_tizen_launch_effect = E_NEW(E_Tizen_Launch_Effect, 1);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(g_tizen_launch_effect, NULL);
+
+ g_tizen_launch_effect->display = display;
+
+ E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_ADD, _e_tizen_launch_effect_cb_client_add, NULL);
+
+ E_CLIENT_HOOK_APPEND(hooks_ec, E_CLIENT_HOOK_DEL, _e_tizen_launch_effect_cb_hook_client_del, NULL);
+
+ return g_tizen_launch_effect;
+}
+
+EINTERN void
+e_tizen_launch_effect_shutdown(void)
+{
+ E_Tizen_Launch_Effect_Res_Info *effect_info;
+
+ if (!g_tizen_launch_effect) return;
+
+ EINA_LIST_FREE(g_tizen_launch_effect->tzlaunch_effect_info, effect_info)
+ {
+ E_FREE(effect_info);
+ }
+
+ wl_global_destroy(g_tizen_launch_effect->global);
+
+ E_FREE(g_tizen_launch_effect);
+}
+
+EINTERN Eina_Bool
+e_tizen_launch_effect_defer_job(E_Tizen_Launch_Effect *tizen_launch_effect)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(g_tizen_launch_effect, EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(tizen_launch_effect, EINA_FALSE);
+
+ if (e_config->global_object_not_provide.launch_effect)
+ return EINA_TRUE;
+
+ if (tizen_launch_effect->global)
+ {
+ WRN("Already created global object for tizen_launch_effect");
+ return EINA_FALSE;
+ }
+
+ tizen_launch_effect->global = wl_global_create(tizen_launch_effect->display,
+ &tizen_launch_effect_interface,
+ 1,
+ NULL,
+ _tzlaunch_effect_cb_bind);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(tizen_launch_effect->global, EINA_FALSE);
+
+ return EINA_TRUE;
+}
+
+EINTERN void
+e_tizen_launch_effect_hide(E_Tizen_Launch_Effect *tizen_launch_effect, uint32_t pid)
+{
+ Eina_List *l, *ll;
+ E_Tizen_Launch_Effect_Res *tzlaunch_effect;
+ E_Tizen_Launch_Effect_Splash *tzlaunch_splash;
+
+ EINA_SAFETY_ON_NULL_RETURN(tizen_launch_effect);
+
+ if(pid <= 0) return;
+
+ EINA_LIST_FOREACH(tizen_launch_effect->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);
+ }
+ }
+}