e_policy_wl: setup splash object after sending prepare event when splash owner is set 51/242251/1
authorDuna Oh <duna.oh@samsung.com>
Tue, 25 Aug 2020 05:10:36 +0000 (14:10 +0900)
committerDuna Oh <duna.oh@samsung.com>
Tue, 25 Aug 2020 07:26:10 +0000 (16:26 +0900)
Change-Id: If48672a5bfd3f5a6a44a24de940c3494591c4649

src/bin/e_policy_wl.c
src/bin/services/e_service_launcher.c

index b71b2c7a9d3aee9ae99461ac1e1129d80345d513..470653da41610f0d3374b92bbddb8aca3c1948a2 100644 (file)
@@ -6286,6 +6286,59 @@ _tzlaunch_splash_iface_cb_launch(struct wl_client *client EINA_UNUSED, struct wl
           }
      }
 }
+static Eina_Bool
+_launchscreen_splash_obj_set(E_Client *ec, E_Policy_Wl_Tzlaunch_Splash *splash)
+{
+   if (splash->type == 0)
+     {
+        Evas_Load_Error err;
+
+        splash->obj = evas_object_image_add(e_comp->evas);
+        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",
+                   "Launch Splash Obj 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;
+          }
+
+          evas_object_image_fill_set(splash->obj, 0, 0, e_comp->w, e_comp->h);
+          evas_object_image_filled_set(splash->obj, EINA_TRUE);
+     }
+   else
+     {
+        splash->obj = edje_object_add(e_comp->evas);
+        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",
+                   "Launch Splash Obj 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);
+        evas_object_resize(splash->obj, e_comp->w, e_comp->h);
+     }
+   ELOGF("TZPOL",
+         "Launch Splash Obj setup | succeed to load obj from %s",
+         ec, splash->path);
+
+   return EINA_TRUE;
+}
 
 static void
 _tzlaunch_splash_iface_cb_owner(struct wl_client *client EINA_UNUSED, struct wl_resource *res_tzlaunch_splash, uint32_t pid)
@@ -6314,35 +6367,46 @@ _tzlaunch_splash_iface_cb_owner(struct wl_client *client EINA_UNUSED, struct wl_
 
    if (tzlaunch_splash->custom_effect_callee)
      {
-        old_ec->ignored = EINA_FALSE;
-        old_ec->visible = EINA_TRUE;
-        if (old_ec->new_client)
-          e_comp->new_clients--;
-        old_ec->new_client = EINA_FALSE;
-        old_ec->icccm.accepts_focus = EINA_TRUE;
-
         if (new_ec)
           e_service_launcher_callee_register(new_ec, pid, tzlaunch_splash->appid, tzlaunch_splash->type, tzlaunch_splash->path, SPLASH_GROUP_NAME);
         else
           e_service_launcher_callee_register(old_ec, pid, tzlaunch_splash->appid, tzlaunch_splash->type, tzlaunch_splash->path, SPLASH_GROUP_NAME);
 
-        if (tzlaunch_splash->timeout)
+        if (_launchscreen_splash_obj_set(old_ec, tzlaunch_splash))
           {
-             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);
+             old_ec->argb = EINA_FALSE;
+             ELOGF("LAUNCHER_SRV", "Set argb:%d", old_ec, old_ec->argb);
 
-        ELOGF("TZPOL", "Launchscreen img(%d) set owner pid: %d new_ec:%p old_ec:%p",
-              tzlaunch_splash->ec,
-              wl_resource_get_id(res_tzlaunch_splash), pid, new_ec, old_ec);
+             //set tzlaunch_splash->obj to a content of ec->frame
+             E_Comp_Object_Content_Type content_type = 0;
+             if (tzlaunch_splash->type == 0)
+               content_type = E_COMP_OBJECT_CONTENT_TYPE_EXT_IMAGE;
+             else
+               content_type = E_COMP_OBJECT_CONTENT_TYPE_EXT_EDJE;
+             if (!e_comp_object_content_set(old_ec->frame, tzlaunch_splash->obj, content_type))
+               {
+                  ELOGF("LAUNCHER_SRV", "Launchscreen set owner setup | setting comp object content failed obj(%p)",
+                  old_ec, tzlaunch_splash->obj);
+                  return;
+               }
 
-        tzlaunch_splash->pid = pid;
-        tzlaunch_splash->ec->netwm.pid = pid;
-        tzlaunch_splash->ec->use_splash = EINA_TRUE;
+             //ref splash object
+             if (tzlaunch_splash->obj)
+               {
+                  ELOGF("LAUNCHER_SRV", "Launchscreen set owner setup | tzlaunch_splash->obj:%p", old_ec, 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);
+               }
 
-        return;
+             tzlaunch_splash->valid = EINA_TRUE;
+             tzlaunch_splash->content_type = content_type;
+          }
      }
 
    if (new_ec)
@@ -6402,6 +6466,8 @@ _tzlaunch_splash_iface_cb_owner(struct wl_client *client EINA_UNUSED, struct wl_
         old_ec->new_client = EINA_FALSE;
         old_ec->icccm.accepts_focus = EINA_TRUE;
 
+        e_policy_animatable_lock(old_ec, E_POLICY_ANIMATABLE_CUSTOMIZED, 1);
+
         evas_object_show(old_ec->frame);
         e_client_raise(old_ec);
      }
index 7fa1ca8a03d402e4e4c7547ee5496e8a2eaf06f5..3c4a61cc2aff2a94b864de4eb48985cf747eb04d 100644 (file)
@@ -72,6 +72,7 @@ struct _E_Service_Launcher
                                                           //w-home main window when home key is pressed.
 
    Eina_List                           *consumers;        //list launcher consumer of launcher ec
+   struct wl_client                    *wlclient;
 };
 
 struct _E_Service_Launcher_Handler
@@ -115,6 +116,7 @@ static void                _launcher_handler_launcher_pre_runner_set(E_Service_L
 static void                _launcher_handler_launcher_pre_runner_unset(E_Service_Launcher *lc);
 
 ////////////////////////////////////////////////////////////////////
+
 static Eina_List *
 _launcher_clients_find_by_pid(pid_t pid)
 {
@@ -300,6 +302,7 @@ _launcher_post_forward(E_Service_Launcher *lc, Eina_Bool success)
 
    lc->serial = 0;
    lc->target.pid = -1;
+   lc->wlclient = NULL;
 
    E_FREE_FUNC(lc->target.appid, eina_stringshare_del);
    E_FREE_FUNC(lc->target.splash_path, eina_stringshare_del);
@@ -561,6 +564,9 @@ _launcher_prepare_send(E_Service_Launcher *lc,
                                      shared_widget_info ? shared_widget_info : "None",
                                      lc->serial);
 
+   if (lc->wlclient)
+     wl_client_flush(lc->wlclient);
+
    wl_array_release(&info_array);
    return EINA_TRUE;
 fail:
@@ -1092,7 +1098,7 @@ _launcher_cb_destroy(struct wl_client *client EINA_UNUSED,
 }
 
 static void
-_launcher_cb_launch(struct wl_client *client EINA_UNUSED,
+_launcher_cb_launch(struct wl_client *client,
                     struct wl_resource *res_tws_lc,
                     const char *app_id,
                     const char *instance_id,
@@ -1137,6 +1143,7 @@ _launcher_cb_launch(struct wl_client *client EINA_UNUSED,
 
    lc->serial = serial;
    lc->target.pid = pid;
+   lc->wlclient = client;
 
    if (pid >= 0 )
      {