elm_hover: delay hover dismiss while handling edje signal

Summary:
elm_hover_dismiss() doesn't hide hover directly, but sends signal only.
It can be translated that "dismiss" do not hide hover only, but handles
some works. (EDC program, callbacks etc.)
However, "dismiss" sends signals after hide hover itself, so following
edje signals are ignored. (Hover cannot be seen already!)
This patch makes hover dismiss delayed while handling edje signal.

@fix

Test Plan: elementary_test hover2

Reviewers: Hermet, cedric

Reviewed By: cedric

Subscribers: woohyun

Differential Revision: https://phab.enlightenment.org/D3068

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
Jee-Yong Um 2015-10-04 15:38:52 +02:00 committed by Cedric BAIL
parent 2ad050a5bc
commit b0bdabff51
2 changed files with 88 additions and 17 deletions

View File

@ -1,5 +1,6 @@
/* TODO: replicate diagonal swallow slots to the other hover styles */
group { name: "elm/hover/base/default";
data.item: "dismiss" "on";
parts {
part { name: "elm.swallow.offset"; type: SWALLOW;
description { state: "default" 0.0;
@ -131,10 +132,18 @@ group { name: "elm/hover/base/default";
signal: "mouse,up,*"; source: "base";
action: SIGNAL_EMIT "elm,action,dismiss" "elm";
}
program { name: "hide";
signal: "elm,action,hide"; source: "elm";
after: "hidefinished";
}
program { name: "hidefinished";
action: SIGNAL_EMIT "elm,action,hide,finished" "elm";
}
}
}
group { name: "elm/hover/base/popout";
data.item: "dismiss" "on";
images.image: "button_normal.png" COMP;
parts {
part { name: "elm.swallow.offset"; type: SWALLOW;
@ -362,7 +371,12 @@ group { name: "elm/hover/base/popout";
program { name: "hide";
signal: "elm,action,hide"; source: "elm";
action: STATE_SET "default" 0.0;
transition: DECELERATE 0.5;
target: "base";
after: "hidefinished";
}
program { name: "hidefinished";
action: SIGNAL_EMIT "elm,action,hide,finished" "elm";
}
program { name: "leftshow";
signal: "elm,action,slot,left,show"; source: "elm";
@ -427,6 +441,7 @@ group { name: "elm/hover/base/hoversel_vertical/default";
alias: "elm/hover/base/hoversel_vertical/entry";
images.image: "button_normal.png" COMP;
images.image: "vertical_separated_bar_glow.png" COMP;
data.item: "dismiss" "on";
data.item: "max_size" "60";
parts {
part { name: "elm.swallow.offset"; type: SWALLOW;
@ -597,7 +612,12 @@ group { name: "elm/hover/base/hoversel_vertical/default";
program { name: "hide";
signal: "elm,action,hide"; source: "elm";
action: STATE_SET "default" 0.0;
transition: DECELERATE 0.5;
target: "base";
after: "hidefinished";
}
program { name: "hidefinished";
action: SIGNAL_EMIT "elm,action,hide,finished" "elm";
}
program { name: "topshow";
@ -645,6 +665,7 @@ group { name: "elm/hover/base/hoversel_vertical/default";
group { name: "elm/hover/base/hoversel_horizontal/default";
alias: "elm/hover/base/hoversel_horizontal/entry";
images.image: "button_normal.png" COMP;
data.item: "dismiss" "on";
data.item: "max_size" "120";
parts {
part { name: "elm.swallow.offset"; type: SWALLOW;
@ -774,6 +795,10 @@ group { name: "elm/hover/base/hoversel_horizontal/default";
action: STATE_SET "default" 0.0;
transition: DECELERATE 0.5;
target: "base";
after: "hidefinished";
}
program { name: "hidefinished";
action: SIGNAL_EMIT "elm,action,hide,finished" "elm";
}
program { name: "leftshow";

View File

@ -510,16 +510,66 @@ _target_move_cb(void *data,
_elm_hover_smt_sub_re_eval(data);
}
static void
_hide_signals_emit(Evas_Object *obj)
{
ELM_HOVER_DATA_GET(obj, sd);
elm_layout_signal_emit(obj, "elm,action,hide", "elm");
ELM_HOVER_PARTS_FOREACH
{
char buf[1024];
if (sd->subs[i].obj)
{
snprintf(buf, sizeof(buf), "elm,action,slot,%s,hide",
sd->subs[i].swallow);
elm_layout_signal_emit(obj, buf, "elm");
}
}
}
static void
_hov_hide_cb(void *data,
Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED,
const char *source EINA_UNUSED)
{
const char *dismissstr;
dismissstr = edje_object_data_get(elm_layout_edje_get(data), "dismiss");
if (dismissstr && !strcmp(dismissstr, "on"))
{
evas_object_hide(data);
eo_do(data, eo_event_callback_call(ELM_HOVER_EVENT_DISMISSED, NULL));
}
}
static void
_hov_dismiss_cb(void *data,
Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED,
const char *source EINA_UNUSED)
{
evas_object_hide(data);
eo_do(data, eo_event_callback_call
(EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, NULL));
eo_do(data, eo_event_callback_call(ELM_HOVER_EVENT_DISMISSED, NULL));
const char *dismissstr;
dismissstr = edje_object_data_get(elm_layout_edje_get(data), "dismiss");
if (dismissstr && !strcmp(dismissstr, "on"))
{
_hide_signals_emit(data);
eo_do(data, eo_event_callback_call
(EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, NULL));
}
else
{
evas_object_hide(data);
eo_do(data, eo_event_callback_call
(EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, NULL));
eo_do(data, eo_event_callback_call(ELM_HOVER_EVENT_DISMISSED, NULL));
} // for backward compatibility
}
EOLIAN static void
@ -538,6 +588,8 @@ _elm_hover_evas_object_smart_add(Eo *obj, Elm_Hover_Data *priv)
elm_layout_signal_callback_add
(obj, "elm,action,dismiss", "*", _hov_dismiss_cb, obj);
elm_layout_signal_callback_add
(obj, "elm,action,hide,finished", "elm", _hov_hide_cb, obj);
priv->offset = evas_object_rectangle_add(evas_object_evas_get(obj));
evas_object_pass_events_set(priv->offset, EINA_TRUE);
@ -599,23 +651,17 @@ _elm_hover_evas_object_smart_show(Eo *obj, Elm_Hover_Data *_pd EINA_UNUSED)
}
EOLIAN static void
_elm_hover_evas_object_smart_hide(Eo *obj, Elm_Hover_Data *sd)
_elm_hover_evas_object_smart_hide(Eo *obj, Elm_Hover_Data *_pd EINA_UNUSED)
{
const char *dismissstr;
eo_do_super(obj, MY_CLASS, evas_obj_smart_hide());
elm_layout_signal_emit(obj, "elm,action,hide", "elm");
// for backward compatibility
dismissstr = edje_object_data_get(elm_layout_edje_get(obj), "dismiss");
ELM_HOVER_PARTS_FOREACH
{
char buf[1024];
if (sd->subs[i].obj)
{
snprintf(buf, sizeof(buf), "elm,action,slot,%s,hide",
sd->subs[i].swallow);
elm_layout_signal_emit(obj, buf, "elm");
}
}
if (!dismissstr || strcmp(dismissstr, "on"))
_hide_signals_emit(obj);
}
EOLIAN static const Elm_Layout_Part_Alias_Description*