elm_conform: Remove legacy to coraborate with current indicator properly 90/116690/2 accepted/tizen/3.0/common/20170303.085539 accepted/tizen/3.0/ivi/20170302.222252 accepted/tizen/3.0/mobile/20170302.222028 accepted/tizen/3.0/tv/20170302.222138 accepted/tizen/3.0/wearable/20170302.222206 submit/tizen_3.0/20170302.035746
authorWonki Kim <wonki_.kim@samsung.com>
Mon, 27 Feb 2017 16:05:42 +0000 (01:05 +0900)
committerHosang Kim <hosang12.kim@samsung.com>
Tue, 28 Feb 2017 03:33:52 +0000 (12:33 +0900)
elm_conform has had two indivisual indicators for each rotation angle.
However elm_conform don't have to have two indicator as tizen 2.4 did,
because indicator server daemon structure has been changed.

And current legacy logic on conform makes problem on the indicator server.
This commit removes legacy logic to coraborate with current indicator server properly

@tizen_only

Change-Id: I37187720684fb0d756b88454e4ded379ca5ae197
Signed-off-by: Wonki Kim <wonki_.kim@samsung.com>
src/lib/elm_conform.c
src/lib/elm_widget_conform.h

index 66bcd34908eb32f044d94e8d5c293c7add1582fc..3f431acb1cd028f2aa408c0629fef4fa010369a4 100644 (file)
@@ -262,10 +262,13 @@ _conformant_part_sizing_eval(Evas_Object *obj,
           ecore_wl_window_indicator_geometry_get(wlwin, &sx, &sy, &sw, &sh);
 #endif
 //
-        if (((sd->rot == 90) || (sd->rot == 270)) && sd->landscape_indicator)
-          _conformant_part_size_hints_set(obj, sd->landscape_indicator, sx, sy, sw, sh);
-        else if (((sd->rot == 0) || (sd->rot == 180)) && sd->portrait_indicator)
-          _conformant_part_size_hints_set(obj, sd->portrait_indicator, sx, sy, sw, sh);
+        // TIZEN_ONLY(20170228): Remove legacy to coraborate with current indicator properly
+        //if (((sd->rot == 90) || (sd->rot == 270)) && sd->landscape_indicator)
+        //  _conformant_part_size_hints_set(obj, sd->landscape_indicator, sx, sy, sw, sh);
+        //else if (((sd->rot == 0) || (sd->rot == 180)) && sd->portrait_indicator)
+        //  _conformant_part_size_hints_set(obj, sd->portrait_indicator, sx, sy, sw, sh);
+        _conformant_part_size_hints_set(obj, sd->indicator, sx, sy, sw, sh);
+        //END
      }
 
    if (part_type & ELM_CONFORMANT_VIRTUAL_KEYPAD_PART)
@@ -473,6 +476,8 @@ _conformant_parts_swallow(Evas_Object *obj)
      ELM_SAFE_FREE(sd->softkey, evas_object_del);
 }
 
+// TIZEN_ONLY(20170228): Remove legacy to coraborate with current indicator properly
+/*
 static Eina_Bool
 _port_indicator_connect_cb(void *data)
 {
@@ -572,6 +577,55 @@ _port_indicator_disconnected(void *data,
                                          _port_indicator_connect_cb, conform);
    return EINA_TRUE;
 }
+*/
+static Eina_Bool
+_indicator_connect_cb(void *data)
+{
+   const char   *indicator_serv_name;
+   ELM_CONFORMANT_DATA_GET(data, sd);
+
+   if (!sd) return ECORE_CALLBACK_CANCEL;
+   if (sd->indmode != ELM_WIN_INDICATOR_SHOW)
+     {
+        sd->indi_timer = NULL;
+        return ECORE_CALLBACK_CANCEL;
+     }
+   indicator_serv_name = elm_config_indicator_service_get(0);
+   if (!indicator_serv_name)
+     {
+        DBG("Conformant cannot find indicator service name\n");
+        sd->indi_timer = NULL;
+        return ECORE_CALLBACK_CANCEL;
+     }
+   if (strchr(indicator_serv_name, '/'))
+     {
+        sd->indi_timer = NULL;
+        return ECORE_CALLBACK_CANCEL;
+     }
+   if (elm_plug_connect(sd->indicator, indicator_serv_name, 0, EINA_FALSE))
+     {
+        DBG("Conformant connect to server[%s]\n", indicator_serv_name);
+        sd->indi_timer = NULL;
+        return ECORE_CALLBACK_CANCEL;
+     }
+   return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool
+_indicator_disconnected(void *data,
+                        Eo *obj EINA_UNUSED,
+                        const Eo_Event_Description *desc EINA_UNUSED,
+                        void *event_info EINA_UNUSED)
+{
+   Evas_Object *conform = data;
+
+   ELM_CONFORMANT_DATA_GET(conform, sd);
+
+   sd->indi_timer = ecore_timer_add(ELM_CONFORM_INDICATOR_TIME,
+                                    _indicator_connect_cb, conform);
+   return EINA_TRUE;
+}
+// END
 
 //TIZEN_ONLY(20170104): add plug message feature.
 // procotol version - change this as needed
@@ -620,8 +674,9 @@ _plug_msg_handle(void *data,
 
    return EINA_TRUE;
 }
-//
 
+// TIZEN_ONLY(20170228): Remove legacy to coraborate with current indicator properly
+/*
 static Evas_Object *
 _create_portrait_indicator(Evas_Object *obj)
 {
@@ -712,6 +767,53 @@ _create_landscape_indicator(Evas_Object *obj)
    evas_object_size_hint_max_set(land_indicator, -1, 0);
    return land_indicator;
 }
+*/
+static Evas_Object *
+_create_indicator(Evas_Object *obj)
+{
+   Evas_Object *indicator = NULL;
+   const char *indicator_serv_name;
+
+   ELM_CONFORMANT_DATA_GET(obj, sd);
+
+   indicator_serv_name = elm_config_indicator_service_get(0);
+   if (!indicator_serv_name)
+     {
+        DBG("Conformant cannot get indicator service name\n");
+        return NULL;
+     }
+   if (strchr(indicator_serv_name, '/'))
+     {
+        return NULL;
+     }
+
+   indicator = elm_plug_add(obj);
+   if (!indicator)
+     {
+        DBG("Conformant cannot create plug to server[%s]\n", indicator_serv_name);
+        return NULL;
+     }
+
+   if (!elm_plug_connect(indicator, indicator_serv_name, 0, EINA_FALSE))
+     {
+        DBG("Conformant cannot connect to server[%s]\n", indicator_serv_name);
+        sd->indi_timer = ecore_timer_add(ELM_CONFORM_INDICATOR_TIME,
+                                          _indicator_connect_cb, obj);
+     }
+
+   elm_widget_sub_object_add(obj, indicator);
+   //TIZEN_ONLY(20170104): add plug message feature.
+   eo_do(indicator, eo_event_callback_add
+     (ELM_PLUG_EVENT_MESSAGE_RECEIVED, _plug_msg_handle, obj));
+   //
+   eo_do(indicator, eo_event_callback_add
+     (ELM_PLUG_EVENT_IMAGE_DELETED, _indicator_disconnected, obj));
+   evas_object_size_hint_min_set(indicator, -1, 0);
+   evas_object_size_hint_max_set(indicator, -1, 0);
+
+   return indicator;
+}
+//END
 
 // TIZEN_ONLY(20160801): indicator implementation
 #ifdef HAVE_ELEMENTARY_WAYLAND
@@ -854,6 +956,8 @@ _indicator_mode_set(Evas_Object *conformant, Elm_Win_Indicator_Mode indmode)
         //create new indicator
         if (!old_indi)
           {
+             // TIZEN_ONLY(20170228): Remove legacy to coraborate with current indicator properly
+             /*
              if ((sd->rot == 90)||(sd->rot == 270))
                {
                   if (!sd->landscape_indicator)
@@ -870,6 +974,12 @@ _indicator_mode_set(Evas_Object *conformant, Elm_Win_Indicator_Mode indmode)
                   if (!sd->portrait_indicator) return;
                   elm_layout_content_set(conformant, INDICATOR_PART, sd->portrait_indicator);
                }
+             */
+             if (!sd->indicator)
+               sd->indicator = _create_indicator(conformant);
+             if (!sd->indicator) return;
+               elm_layout_content_set(conformant, INDICATOR_PART, sd->indicator);
+             //END
 
           }
         elm_object_signal_emit(conformant, "elm,state,indicator,show", "elm");
@@ -941,8 +1051,11 @@ _on_rotation_changed(void *data,
    if (rot == sd->rot) return EINA_TRUE;
    sd->rot = rot;
    _indicator_post_appearance_changed(conformant); // TIZEN_ONLY(20160801):indicator implementation
-   old_indi = elm_layout_content_unset(conformant, INDICATOR_PART);
+   return EINA_TRUE;
+   // TIZEN_ONLY(20170228): Remove legacy to coraborate with current indicator properly
+   //old_indi = elm_layout_content_unset(conformant, INDICATOR_PART);
    /* this means ELM_WIN_INDICATOR_SHOW never be set.we don't need to change indicator type*/
+   /*
    if (!old_indi) return EINA_TRUE;
    evas_object_hide(old_indi);
 
@@ -969,6 +1082,8 @@ _on_rotation_changed(void *data,
         elm_layout_content_set(conformant, INDICATOR_PART, sd->portrait_indicator);
      }
    return EINA_TRUE;
+   */
+   //END
 }
 // TIZEN_ONLY(20160801):indicator implementation
 static void
@@ -1373,6 +1488,9 @@ _elm_conformant_evas_object_smart_del(Eo *obj, Elm_Conformant_Data *sd)
    ecore_job_del(sd->show_region_job);
    ecore_timer_del(sd->port_indi_timer);
    ecore_timer_del(sd->land_indi_timer);
+
+   // TIZEN_ONLY(20170228): Remove legacy to coraborate with current indicator properly
+   /*
    //TIZEN_ONLY(20170104): add plug message feature.
    eo_do(sd->portrait_indicator,
          eo_event_callback_del(ELM_PLUG_EVENT_MESSAGE_RECEIVED,
@@ -1387,6 +1505,10 @@ _elm_conformant_evas_object_smart_del(Eo *obj, Elm_Conformant_Data *sd)
    //
    evas_object_del(sd->portrait_indicator);
    evas_object_del(sd->landscape_indicator);
+   */
+   evas_object_del(sd->indicator);
+   //END
+
 
    evas_object_data_set(sd->win, "\377 elm,conformant", NULL);
 
index 9b3ea541686247bb3470dcd62bfd7681c7ee37f3..6f61eb679c82c2d435b7ffa86b8ca9cc1dc3db23 100644 (file)
@@ -61,6 +61,8 @@ struct _Elm_Conformant_Data
    //END
 
    int                            rot;
+   Evas_Object                   *indicator;
+   Ecore_Timer                   *indi_timer;
 };
 
 /* Enum to identify conformant swallow parts */