diff --git a/legacy/elementary/ChangeLog b/legacy/elementary/ChangeLog index 881226dcf7..f58cf80d52 100644 --- a/legacy/elementary/ChangeLog +++ b/legacy/elementary/ChangeLog @@ -1495,3 +1495,7 @@ 2013-07-06 Shinwoo Kim * Add elm_access_highlight_next_set, export elm_widget_focus_region_show + +2013-07-07 Thiep Ha + + * Add hide effect for notify. diff --git a/legacy/elementary/NEWS b/legacy/elementary/NEWS index 72ff2bff51..afff7980a2 100644 --- a/legacy/elementary/NEWS +++ b/legacy/elementary/NEWS @@ -122,6 +122,7 @@ Improvements: * Move cursor when mouse moves with longpress. * Show magnifier when selection handlers are pressed or moved. * Change the method to calculate a distance which be scrolled from linear to sine curve. + * Add hide effect for notify. Fixes: * Now elm_datetime_field_limit_set() can set year limits wihtout problems. diff --git a/legacy/elementary/data/themes/widgets/notify.edc b/legacy/elementary/data/themes/widgets/notify.edc index 32bdd545f8..339b59e2f5 100644 --- a/legacy/elementary/data/themes/widgets/notify.edc +++ b/legacy/elementary/data/themes/widgets/notify.edc @@ -96,9 +96,15 @@ group { name: "elm/notify/top/default"; transition: LINEAR 0.5; } program { name: "hide"; - signal: "hide"; + signal: "elm,state,hide"; + source: "elm"; action: STATE_SET "default" 0.0; target: "base"; + transition: LINEAR 0.5; + after: "hide_finished"; + } + program { name: "hide_finished"; + action: SIGNAL_EMIT "elm,action,hide,finished" ""; } } } @@ -139,6 +145,13 @@ group { name: "elm/notify/center/default"; } } } + programs { + program { name: "hide"; + signal: "elm,state,hide"; + source: "elm"; + action: SIGNAL_EMIT "elm,action,hide,finished" ""; + } + } } group { name: "elm/notify/bottom/default"; //this group is a design similar to the inwin group @@ -219,9 +232,15 @@ group { name: "elm/notify/bottom/default"; transition: LINEAR 0.5; } program { name: "hide"; - signal: "hide"; + signal: "elm,state,hide"; + source: "elm"; action: STATE_SET "default" 0.0; target: "base"; + transition: LINEAR 0.5; + after: "hide_finished"; + } + program { name: "hide_finished"; + action: SIGNAL_EMIT "elm,action,hide,finished" ""; } } } @@ -304,9 +323,15 @@ group { name: "elm/notify/left/default"; transition: LINEAR 0.5; } program { name: "hide"; - signal: "hide"; + signal: "elm,state,hide"; + source: "elm"; action: STATE_SET "default" 0.0; target: "base"; + transition: LINEAR 0.5; + after: "hide_finished"; + } + program { name: "hide_finished"; + action: SIGNAL_EMIT "elm,action,hide,finished" ""; } } } @@ -389,9 +414,15 @@ group { name: "elm/notify/right/default"; transition: LINEAR 0.5; } program { name: "hide"; - signal: "hide"; + signal: "elm,state,hide"; + source: "elm"; action: STATE_SET "default" 0.0; target: "base"; + transition: LINEAR 0.5; + after: "hide_finished"; + } + program { name: "hide_finished"; + action: SIGNAL_EMIT "elm,action,hide,finished" ""; } } } @@ -474,9 +505,15 @@ group { name: "elm/notify/top_left/default"; transition: LINEAR 0.5; } program { name: "hide"; - signal: "hide"; + signal: "elm,state,hide"; + source: "elm"; action: STATE_SET "default" 0.0; target: "base"; + transition: LINEAR 0.5; + after: "hide_finished"; + } + program { name: "hide_finished"; + action: SIGNAL_EMIT "elm,action,hide,finished" ""; } } } @@ -559,9 +596,15 @@ group { name: "elm/notify/top_right/default"; transition: LINEAR 0.5; } program { name: "hide"; - signal: "hide"; + signal: "elm,state,hide"; + source: "elm"; action: STATE_SET "default" 0.0; target: "base"; + transition: LINEAR 0.5; + after: "hide_finished"; + } + program { name: "hide_finished"; + action: SIGNAL_EMIT "elm,action,hide,finished" ""; } } } @@ -644,9 +687,15 @@ group { name: "elm/notify/bottom_left/default"; transition: LINEAR 0.5; } program { name: "hide"; - signal: "hide"; + signal: "elm,state,hide"; + source: "elm"; action: STATE_SET "default" 0.0; target: "base"; + transition: LINEAR 0.5; + after: "hide_finished"; + } + program { name: "hide_finished"; + action: SIGNAL_EMIT "elm,action,hide,finished" ""; } } } @@ -729,9 +778,15 @@ group { name: "elm/notify/bottom_right/default"; transition: LINEAR 0.5; } program { name: "hide"; - signal: "hide"; + signal: "elm,state,hide"; + source: "elm"; action: STATE_SET "default" 0.0; target: "base"; + transition: LINEAR 0.5; + after: "hide_finished"; + } + program { name: "hide_finished"; + action: SIGNAL_EMIT "elm,action,hide,finished" ""; } } } diff --git a/legacy/elementary/src/lib/elm_notify.c b/legacy/elementary/src/lib/elm_notify.c index a43d573ffd..d1744ada70 100644 --- a/legacy/elementary/src/lib/elm_notify.c +++ b/legacy/elementary/src/lib/elm_notify.c @@ -248,7 +248,8 @@ _timer_cb(void *data) sd->timer = NULL; if (!evas_object_visible_get(obj)) goto end; - evas_object_hide(obj); + sd->in_timeout = EINA_TRUE; + edje_object_signal_emit(sd->notify, "elm,state,hide", "elm"); evas_object_smart_callback_call(obj, SIG_TIMEOUT, NULL); end: @@ -271,6 +272,8 @@ _elm_notify_smart_show(Eo *obj, void *_pd, va_list *list EINA_UNUSED) { Elm_Notify_Smart_Data *sd = _pd; + sd->had_hidden = EINA_FALSE; + sd->in_timeout = EINA_FALSE; eo_do_super(obj, MY_CLASS, evas_obj_smart_show()); evas_object_show(sd->notify); @@ -284,10 +287,12 @@ _elm_notify_smart_hide(Eo *obj, void *_pd, va_list *list EINA_UNUSED) { Elm_Notify_Smart_Data *sd = _pd; + if (sd->had_hidden && !sd->in_timeout) + return; eo_do_super(obj, MY_CLASS, evas_obj_smart_hide()); - evas_object_hide(sd->notify); - if (!sd->allow_events) evas_object_hide(sd->block_events); + if (!sd->in_timeout) + edje_object_signal_emit(sd->notify, "elm,state,hide", "elm"); ELM_SAFE_FREE(sd->timer, ecore_timer_del); } @@ -433,6 +438,18 @@ _elm_notify_smart_content_unset(Eo *obj, void *_pd, va_list *list) if (ret) *ret = content; } +static void +_hide_finished_cb(void *data, + Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + ELM_NOTIFY_DATA_GET(data, sd); + sd->had_hidden = EINA_TRUE; + evas_object_hide(sd->notify); + if (!sd->allow_events) evas_object_hide(sd->block_events); +} + static void _elm_notify_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED) { @@ -448,6 +465,8 @@ _elm_notify_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED) evas_object_event_callback_add (obj, EVAS_CALLBACK_RESTACK, _restack_cb, obj); + edje_object_signal_callback_add + (priv->notify, "elm,action,hide,finished","", _hide_finished_cb, obj); elm_widget_can_focus_set(obj, EINA_FALSE); elm_notify_align_set(obj, 0.5, 0.0); @@ -458,6 +477,8 @@ _elm_notify_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED) { Elm_Notify_Smart_Data *sd = _pd; + edje_object_signal_callback_del_full + (sd->notify, "elm,action,hide,finished", "", _hide_finished_cb, obj); elm_notify_parent_set(obj, NULL); elm_notify_allow_events_set(obj, EINA_FALSE); if (sd->timer) ecore_timer_del(sd->timer); diff --git a/legacy/elementary/src/lib/elm_widget_notify.h b/legacy/elementary/src/lib/elm_widget_notify.h index 701bb45a78..ac6c006836 100644 --- a/legacy/elementary/src/lib/elm_widget_notify.h +++ b/legacy/elementary/src/lib/elm_widget_notify.h @@ -28,6 +28,8 @@ struct _Elm_Notify_Smart_Data Ecore_Timer *timer; Eina_Bool allow_events : 1; + Eina_Bool had_hidden : 1; + Eina_Bool in_timeout : 1; }; /**