conform: indicator opacity mode implementation 11/81711/5
authorWonki Kim <wonki_.kim@samsung.com>
Thu, 28 Jul 2016 02:36:31 +0000 (11:36 +0900)
committerWonki Kim <wonki_.kim@samsung.com>
Wed, 3 Aug 2016 08:15:43 +0000 (17:15 +0900)
behaviors of the indicator based on opacity mode
have been implementated.

@tizen_feature

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

index 6c1b250..31ee57b 100644 (file)
@@ -584,6 +584,78 @@ _create_landscape_indicator(Evas_Object *obj)
    return land_indicator;
 }
 
+// TIZEN_ONLY(20160801): indicator implementation
+static Eina_Bool
+_indicator_visible_type_set(Evas_Object *obj, Eina_Bool visible)
+{
+   Evas_Object *top = NULL;
+   Ecore_Wl_Window *wlwin = NULL;
+
+   top = elm_widget_top_get(obj);
+   if (!top) return EINA_FALSE;
+
+   wlwin = elm_win_wl_window_get(top);
+   if (!wlwin) return EINA_FALSE;
+
+   if (visible)
+     {
+        ecore_wl_indicator_visible_type_set(wlwin, ECORE_WL_INDICATOR_VISIBLE_TYPE_SHOWN);
+     }
+   else
+     {
+        ecore_wl_indicator_visible_type_set(wlwin, ECORE_WL_INDICATOR_VISIBLE_TYPE_HIDDEN);
+     }
+   return EINA_TRUE;
+}
+static Eina_Bool
+_indicator_hide_effect(void *data)
+{
+   Evas_Object *conformant = data;
+
+   DBG("[INDICATOR]Hide effect ");
+   ELM_CONFORMANT_DATA_GET(conformant, sd);
+   sd->on_indicator_effect = EINA_FALSE;
+
+   if(((sd->rot == 90) || (sd->rot == 270)) ||
+       (sd->ind_o_mode == ELM_WIN_INDICATOR_TRANSPARENT))
+      {
+        elm_object_signal_emit(conformant, "indicator,hide,effect", "elm");
+        sd->indicator_effect_timer = NULL;
+        _indicator_visible_type_set(data, EINA_FALSE);
+      }
+   return ECORE_CALLBACK_CANCEL;
+}
+static void
+_indicator_show_effect(Evas_Object *conformant, double duration)
+{
+   ELM_CONFORMANT_DATA_GET(conformant, sd);
+   DBG("[IND]Show effect ");
+
+   sd->on_indicator_effect = EINA_TRUE;
+   elm_object_signal_emit(conformant, "indicator,show,effect", "elm");
+
+   if (sd->indicator_effect_timer) ecore_timer_del(sd->indicator_effect_timer);
+      sd->indicator_effect_timer = ecore_timer_add(duration, _indicator_hide_effect, conformant);
+}
+static void
+_indicator_post_appearance_changed(Evas_Object *conformant)
+{
+   ELM_CONFORMANT_DATA_GET(conformant, sd);
+
+   if((sd->indmode != ELM_WIN_INDICATOR_SHOW))
+     {
+        _indicator_visible_type_set(conformant, EINA_FALSE);
+        return;
+     }
+
+   if ((sd->ind_o_mode == ELM_WIN_INDICATOR_OPACITY_UNKNOWN) ||
+       (sd->indmode == ELM_WIN_INDICATOR_UNKNOWN))
+     return;
+
+   _indicator_visible_type_set(conformant, EINA_TRUE);
+   _indicator_show_effect(conformant, 3);
+}
+// END
 static void
 _indicator_mode_set(Evas_Object *conformant, Elm_Win_Indicator_Mode indmode)
 {
@@ -645,7 +717,6 @@ _indicator_opacity_set(Evas_Object *conformant, Elm_Win_Indicator_Opacity_Mode i
      elm_object_signal_emit(conformant, "elm,state,indicator,opaque", "elm");
    /////////////////////////////////////////////////////////////////////////////
 }
-
 static Eina_Bool
 _on_indicator_mode_changed(void *data,
                            Eo *obj, const Eo_Event_Description *desc EINA_UNUSED,
@@ -661,10 +732,17 @@ _on_indicator_mode_changed(void *data,
 
    indmode = elm_win_indicator_mode_get(win);
    ind_o_mode = elm_win_indicator_opacity_get(win);
+
+   Eina_Bool sc = ((indmode != sd->indmode) | (ind_o_mode != sd->ind_o_mode)) ; // TIZEN_ONLY(20160801):indicator implementation
+
    if (indmode != sd->indmode)
      _indicator_mode_set(conformant, indmode);
    if (ind_o_mode != sd->ind_o_mode)
      _indicator_opacity_set(conformant, ind_o_mode);
+   // TIZEN_ONLY(20160801):indicator implementation
+   if (sc)
+     _indicator_post_appearance_changed(conformant);
+   // END
    return EINA_TRUE;
 }
 
@@ -683,8 +761,8 @@ _on_rotation_changed(void *data,
    rot = elm_win_rotation_get(win);
 
    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);
    /* this means ELM_WIN_INDICATOR_SHOW never be set.we don't need to change indicator type*/
    if (!old_indi) return EINA_TRUE;
@@ -714,6 +792,16 @@ _on_rotation_changed(void *data,
      }
    return EINA_TRUE;
 }
+// TIZEN_ONLY(20160801):indicator implementation
+static void
+_on_indicator_flick_done(void *data,
+                         Evas_Object *obj EINA_UNUSED,
+                         void *event_info EINA_UNUSED)
+{
+   Evas_Object *conformant = data;
+   _indicator_post_appearance_changed(conformant);
+}
+// END
 
 EOLIAN static Elm_Theme_Apply
 _elm_conformant_elm_widget_theme_apply(Eo *obj, Elm_Conformant_Data *_pd EINA_UNUSED)
@@ -1121,8 +1209,12 @@ _elm_conformant_evas_object_smart_del(Eo *obj, Elm_Conformant_Data *sd)
 #ifdef HAVE_ELEMENTARY_WAYLAND
    evas_object_smart_callback_del_full
      (sd->win, "conformant,changed", _on_conformant_changed, obj);
+   // END
+   // TIZEN_ONLY(20160801): indicator implementation
+   evas_object_smart_callback_del_full
+     (sd->win, "indicator,flick,done", _on_indicator_flick_done, obj);
+   //END
 #endif
-   //
    // TIZEN_ONLY(20160628): Unregister callbacks for ATSPI bridge enable/disable
    _unregister_conformant_atspi_bridge_callbacks(obj);
    //
@@ -1227,8 +1319,12 @@ _elm_conformant_eo_base_constructor(Eo *obj, Elm_Conformant_Data *sd)
 #ifdef HAVE_ELEMENTARY_WAYLAND
    evas_object_smart_callback_add
      (sd->win, "conformant,changed", _on_conformant_changed, obj);
+   // END
+   // TIZEN_ONLY(20160801): indicator implementation
+   evas_object_smart_callback_add
+     (sd->win, "indicator,flick,done", _on_indicator_flick_done, obj);
+   // END
 #endif
-   //
 
    return obj;
 }
index c312314..7c759d4 100644 (file)
@@ -51,6 +51,11 @@ struct _Elm_Conformant_Data
    Ecore_Timer                   *land_indi_timer;
    Ecore_Timer                   *port_indi_timer;
 
+   //TIZEN_ONLY(20160728) : indicator opacity mode implementation//
+   Ecore_Timer                   *indicator_effect_timer;
+   Eina_Bool                      on_indicator_effect : 1;
+   //END
+
    int                            rot;
 };
 
index baec363..a536f16 100644 (file)
@@ -118,6 +118,7 @@ struct _Elm_Win_Data
       Eina_Bool opaque_dirty : 1;
       Ecore_Event_Handler *effect_start_handler;
       Ecore_Event_Handler *effect_end_handler;
+      Ecore_Event_Handler *indicator_flick_handler; // TIZEN_ONLY(20160801): indicator implementation
    } wl;
 #endif
 
@@ -267,6 +268,7 @@ static const char SIG_PROFILE_CHANGED[] = "profile,changed";
 static const char SIG_WM_ROTATION_CHANGED[] = "wm,rotation,changed";
 #ifdef HAVE_ELEMENTARY_WAYLAND
 static const char SIG_CONFORMANT_CHANGED[] = "conformant,changed";
+static const char SIG_INDICATOR_FLICK_DONE[] = "indicator,flick,done"; // TIZEN_ONLY(20160801): indicator implementation
 #endif
 static const char SIG_AUX_HINT_ALLOWED[] = "aux,hint,allowed";
 static const char SIG_VISIBILITY_CHANGED[] = "visibility,changed";
@@ -2180,6 +2182,7 @@ _elm_win_evas_object_smart_del(Eo *obj, Elm_Win_Data *sd)
 #ifdef HAVE_ELEMENTARY_WAYLAND
    ecore_event_handler_del(sd->wl.effect_start_handler);
    ecore_event_handler_del(sd->wl.effect_end_handler);
+   ecore_event_handler_del(sd->wl.indicator_flick_handler); // TIZEN_ONLY(20160801): indicator implementation
 #endif
 
    if (sd->img_obj)
@@ -3566,6 +3569,16 @@ elm_win_precreated_object_get(void)
 }
 //
 
+// TIZEN_ONLY(20160728): Indicator Impelementation
+static Eina_Bool
+_elm_win_wl_indicator_flick(void *data, int type EINA_UNUSED, void *event)
+{
+   ELM_WIN_DATA_GET(data, sd);
+   evas_object_smart_callback_call(sd->obj, SIG_INDICATOR_FLICK_DONE, NULL);
+   return ECORE_CALLBACK_PASS_ON;
+}
+// END
+
 EAPI Evas_Object *
 elm_win_add(Evas_Object *parent,
             const char *name,
@@ -4200,6 +4213,10 @@ _elm_win_finalize_internal(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_
            (ECORE_WL_EVENT_EFFECT_START, _elm_win_wl_effect_start, obj);
         sd->wl.effect_end_handler = ecore_event_handler_add
            (ECORE_WL_EVENT_EFFECT_END, _elm_win_wl_effect_end, obj);
+        // TIZEN_ONLY(20160801): indicator implementation
+        sd->wl.indicator_flick_handler = ecore_event_handler_add
+           (ECORE_WL_EVENT_INDICATOR_FLICK, _elm_win_wl_indicator_flick, obj);
+        // END
      }
 #endif
    else if ((engine) && (!strncmp(engine, "shot:", 5)))
@@ -5596,6 +5613,9 @@ _elm_win_indicator_opacity_set(Eo *obj EINA_UNUSED, Elm_Win_Data *sd, Elm_Win_In
         else if (sd->ind_o_mode == ELM_WIN_INDICATOR_TRANSPARENT)
           ecore_wl_window_indicator_opacity_set
             (sd->wl.win, ECORE_WL_INDICATOR_TRANSPARENT);
+        else if (sd->ind_o_mode == ELM_WIN_INDICATOR_BG_TRANSPARENT)
+          ecore_wl_window_indicator_opacity_set
+            (sd->wl.win, ECORE_WL_INDICATOR_BG_TRANSPARENT);
      }
 #endif
    eo_do(obj, eo_event_callback_call