summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJee-Yong Um <jc9.um@samsung.com>2015-10-04 15:38:52 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-10-04 15:38:57 +0200
commit32c89740f3fcb6f2c6b9739bea0589517a55c48a (patch)
treeff4e2b480d25804afe676168add0b83fc3ee76e2
parent1634653bb3b56a6344660d6062ee8247a766f434 (diff)
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>
-rw-r--r--data/themes/edc/elm/hover.edc25
-rw-r--r--src/lib/elm_hover.c80
2 files changed, 88 insertions, 17 deletions
diff --git a/data/themes/edc/elm/hover.edc b/data/themes/edc/elm/hover.edc
index b34d36a50..afed7088f 100644
--- a/data/themes/edc/elm/hover.edc
+++ b/data/themes/edc/elm/hover.edc
@@ -1,5 +1,6 @@
1/* TODO: replicate diagonal swallow slots to the other hover styles */ 1/* TODO: replicate diagonal swallow slots to the other hover styles */
2group { name: "elm/hover/base/default"; 2group { name: "elm/hover/base/default";
3 data.item: "dismiss" "on";
3 parts { 4 parts {
4 part { name: "elm.swallow.offset"; type: SWALLOW; 5 part { name: "elm.swallow.offset"; type: SWALLOW;
5 description { state: "default" 0.0; 6 description { state: "default" 0.0;
@@ -131,10 +132,18 @@ group { name: "elm/hover/base/default";
131 signal: "mouse,up,*"; source: "base"; 132 signal: "mouse,up,*"; source: "base";
132 action: SIGNAL_EMIT "elm,action,dismiss" "elm"; 133 action: SIGNAL_EMIT "elm,action,dismiss" "elm";
133 } 134 }
135 program { name: "hide";
136 signal: "elm,action,hide"; source: "elm";
137 after: "hidefinished";
138 }
139 program { name: "hidefinished";
140 action: SIGNAL_EMIT "elm,action,hide,finished" "elm";
141 }
134 } 142 }
135} 143}
136 144
137group { name: "elm/hover/base/popout"; 145group { name: "elm/hover/base/popout";
146 data.item: "dismiss" "on";
138 images.image: "button_normal.png" COMP; 147 images.image: "button_normal.png" COMP;
139 parts { 148 parts {
140 part { name: "elm.swallow.offset"; type: SWALLOW; 149 part { name: "elm.swallow.offset"; type: SWALLOW;
@@ -362,7 +371,12 @@ group { name: "elm/hover/base/popout";
362 program { name: "hide"; 371 program { name: "hide";
363 signal: "elm,action,hide"; source: "elm"; 372 signal: "elm,action,hide"; source: "elm";
364 action: STATE_SET "default" 0.0; 373 action: STATE_SET "default" 0.0;
374 transition: DECELERATE 0.5;
365 target: "base"; 375 target: "base";
376 after: "hidefinished";
377 }
378 program { name: "hidefinished";
379 action: SIGNAL_EMIT "elm,action,hide,finished" "elm";
366 } 380 }
367 program { name: "leftshow"; 381 program { name: "leftshow";
368 signal: "elm,action,slot,left,show"; source: "elm"; 382 signal: "elm,action,slot,left,show"; source: "elm";
@@ -427,6 +441,7 @@ group { name: "elm/hover/base/hoversel_vertical/default";
427 alias: "elm/hover/base/hoversel_vertical/entry"; 441 alias: "elm/hover/base/hoversel_vertical/entry";
428 images.image: "button_normal.png" COMP; 442 images.image: "button_normal.png" COMP;
429 images.image: "vertical_separated_bar_glow.png" COMP; 443 images.image: "vertical_separated_bar_glow.png" COMP;
444 data.item: "dismiss" "on";
430 data.item: "max_size" "60"; 445 data.item: "max_size" "60";
431 parts { 446 parts {
432 part { name: "elm.swallow.offset"; type: SWALLOW; 447 part { name: "elm.swallow.offset"; type: SWALLOW;
@@ -597,7 +612,12 @@ group { name: "elm/hover/base/hoversel_vertical/default";
597 program { name: "hide"; 612 program { name: "hide";
598 signal: "elm,action,hide"; source: "elm"; 613 signal: "elm,action,hide"; source: "elm";
599 action: STATE_SET "default" 0.0; 614 action: STATE_SET "default" 0.0;
615 transition: DECELERATE 0.5;
600 target: "base"; 616 target: "base";
617 after: "hidefinished";
618 }
619 program { name: "hidefinished";
620 action: SIGNAL_EMIT "elm,action,hide,finished" "elm";
601 } 621 }
602 622
603 program { name: "topshow"; 623 program { name: "topshow";
@@ -645,6 +665,7 @@ group { name: "elm/hover/base/hoversel_vertical/default";
645group { name: "elm/hover/base/hoversel_horizontal/default"; 665group { name: "elm/hover/base/hoversel_horizontal/default";
646 alias: "elm/hover/base/hoversel_horizontal/entry"; 666 alias: "elm/hover/base/hoversel_horizontal/entry";
647 images.image: "button_normal.png" COMP; 667 images.image: "button_normal.png" COMP;
668 data.item: "dismiss" "on";
648 data.item: "max_size" "120"; 669 data.item: "max_size" "120";
649 parts { 670 parts {
650 part { name: "elm.swallow.offset"; type: SWALLOW; 671 part { name: "elm.swallow.offset"; type: SWALLOW;
@@ -774,6 +795,10 @@ group { name: "elm/hover/base/hoversel_horizontal/default";
774 action: STATE_SET "default" 0.0; 795 action: STATE_SET "default" 0.0;
775 transition: DECELERATE 0.5; 796 transition: DECELERATE 0.5;
776 target: "base"; 797 target: "base";
798 after: "hidefinished";
799 }
800 program { name: "hidefinished";
801 action: SIGNAL_EMIT "elm,action,hide,finished" "elm";
777 } 802 }
778 803
779 program { name: "leftshow"; 804 program { name: "leftshow";
diff --git a/src/lib/elm_hover.c b/src/lib/elm_hover.c
index 9306c7805..7bfc6dbb5 100644
--- a/src/lib/elm_hover.c
+++ b/src/lib/elm_hover.c
@@ -511,15 +511,65 @@ _target_move_cb(void *data,
511} 511}
512 512
513static void 513static void
514_hide_signals_emit(Evas_Object *obj)
515{
516 ELM_HOVER_DATA_GET(obj, sd);
517
518 elm_layout_signal_emit(obj, "elm,action,hide", "elm");
519
520 ELM_HOVER_PARTS_FOREACH
521 {
522 char buf[1024];
523
524 if (sd->subs[i].obj)
525 {
526 snprintf(buf, sizeof(buf), "elm,action,slot,%s,hide",
527 sd->subs[i].swallow);
528 elm_layout_signal_emit(obj, buf, "elm");
529 }
530 }
531}
532
533static void
534_hov_hide_cb(void *data,
535 Evas_Object *obj EINA_UNUSED,
536 const char *emission EINA_UNUSED,
537 const char *source EINA_UNUSED)
538{
539 const char *dismissstr;
540
541 dismissstr = edje_object_data_get(elm_layout_edje_get(data), "dismiss");
542
543 if (dismissstr && !strcmp(dismissstr, "on"))
544 {
545 evas_object_hide(data);
546 eo_do(data, eo_event_callback_call(ELM_HOVER_EVENT_DISMISSED, NULL));
547 }
548}
549
550static void
514_hov_dismiss_cb(void *data, 551_hov_dismiss_cb(void *data,
515 Evas_Object *obj EINA_UNUSED, 552 Evas_Object *obj EINA_UNUSED,
516 const char *emission EINA_UNUSED, 553 const char *emission EINA_UNUSED,
517 const char *source EINA_UNUSED) 554 const char *source EINA_UNUSED)
518{ 555{
519 evas_object_hide(data); 556 const char *dismissstr;
520 eo_do(data, eo_event_callback_call 557
521 (EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, NULL)); 558 dismissstr = edje_object_data_get(elm_layout_edje_get(data), "dismiss");
522 eo_do(data, eo_event_callback_call(ELM_HOVER_EVENT_DISMISSED, NULL)); 559
560 if (dismissstr && !strcmp(dismissstr, "on"))
561 {
562 _hide_signals_emit(data);
563 eo_do(data, eo_event_callback_call
564 (EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, NULL));
565 }
566 else
567 {
568 evas_object_hide(data);
569 eo_do(data, eo_event_callback_call
570 (EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED, NULL));
571 eo_do(data, eo_event_callback_call(ELM_HOVER_EVENT_DISMISSED, NULL));
572 } // for backward compatibility
523} 573}
524 574
525EOLIAN static void 575EOLIAN static void
@@ -538,6 +588,8 @@ _elm_hover_evas_object_smart_add(Eo *obj, Elm_Hover_Data *priv)
538 588
539 elm_layout_signal_callback_add 589 elm_layout_signal_callback_add
540 (obj, "elm,action,dismiss", "*", _hov_dismiss_cb, obj); 590 (obj, "elm,action,dismiss", "*", _hov_dismiss_cb, obj);
591 elm_layout_signal_callback_add
592 (obj, "elm,action,hide,finished", "elm", _hov_hide_cb, obj);
541 593
542 priv->offset = evas_object_rectangle_add(evas_object_evas_get(obj)); 594 priv->offset = evas_object_rectangle_add(evas_object_evas_get(obj));
543 evas_object_pass_events_set(priv->offset, EINA_TRUE); 595 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)
599} 651}
600 652
601EOLIAN static void 653EOLIAN static void
602_elm_hover_evas_object_smart_hide(Eo *obj, Elm_Hover_Data *sd) 654_elm_hover_evas_object_smart_hide(Eo *obj, Elm_Hover_Data *_pd EINA_UNUSED)
603{ 655{
604 eo_do_super(obj, MY_CLASS, evas_obj_smart_hide()); 656 const char *dismissstr;
605 657
606 elm_layout_signal_emit(obj, "elm,action,hide", "elm"); 658 eo_do_super(obj, MY_CLASS, evas_obj_smart_hide());
607 659
608 ELM_HOVER_PARTS_FOREACH 660 // for backward compatibility
609 { 661 dismissstr = edje_object_data_get(elm_layout_edje_get(obj), "dismiss");
610 char buf[1024];
611 662
612 if (sd->subs[i].obj) 663 if (!dismissstr || strcmp(dismissstr, "on"))
613 { 664 _hide_signals_emit(obj);
614 snprintf(buf, sizeof(buf), "elm,action,slot,%s,hide",
615 sd->subs[i].swallow);
616 elm_layout_signal_emit(obj, buf, "elm");
617 }
618 }
619} 665}
620 666
621EOLIAN static const Elm_Layout_Part_Alias_Description* 667EOLIAN static const Elm_Layout_Part_Alias_Description*