summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordivyesh purohit <div.purohit@samsung.com>2016-01-04 15:08:49 -0800
committerCedric BAIL <cedric@osg.samsung.com>2016-01-04 15:08:52 -0800
commitd19f943d8dc94584c529d7b9423de5ee3eb3a211 (patch)
tree2ecf1a93bf2130df7db68e1889d0c2fd756af7f6
parent0e8baac884cf42159966fe199e6bc85edfb929c4 (diff)
hoversel: fix hover position in hoversel, when it goes out of the viewport
Summary: Hoversel Widget is designed in such a way that it accepts top/bottom/left/right directions , internally it uses hover widget which does not take care if its content goes of it's parent (Elm_Win in most cases) . this patch ensures that the drop-down content remains restricted in visible hover_parent. it would fix T2965 Signed-off-by: divyesh purohit <div.purohit@samsung.com> Signed-off-by: Jee-Yong Um <conr2d@gmail.com> Test Plan: Open entry widget and right click to show a hoversel widget, check if the hoversel or hover content goes out of the window. this is what hoversel would look like after this patch {F27551} Screenshots of top-left / top-right/ bottom-left and bottom-right corners in entry after this patch {F27553} {F27554} {F27555} {F27557} Reviewers: shilpasingh, conr2d, raster, cedric, Hermet Subscribers: rajeshps, govi Projects: #elementary Maniphest Tasks: T2965 Differential Revision: https://phab.enlightenment.org/D3513 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--data/themes/edc/elm/button.edc4
-rw-r--r--data/themes/edc/elm/hover.edc169
-rw-r--r--src/lib/elc_hoversel.c15
-rw-r--r--src/lib/elm_entry.c20
4 files changed, 160 insertions, 48 deletions
diff --git a/data/themes/edc/elm/button.edc b/data/themes/edc/elm/button.edc
index 8b9811c56..2134d41e3 100644
--- a/data/themes/edc/elm/button.edc
+++ b/data/themes/edc/elm/button.edc
@@ -1069,7 +1069,7 @@ group { name: "elm/button/base/hoversel_vertical_entry/default";
1069 image { "base"; nomouse; 1069 image { "base"; nomouse;
1070 desc { "default"; 1070 desc { "default";
1071 fixed: 1 1; 1071 fixed: 1 1;
1072 rel1.offset: -6 0; 1072 rel1.offset: 0 0;
1073 image.normal: "vgrad_med_dark.png"; 1073 image.normal: "vgrad_med_dark.png";
1074 fill.smooth: 0; 1074 fill.smooth: 0;
1075 TILED_HORIZ(120) 1075 TILED_HORIZ(120)
@@ -1174,7 +1174,7 @@ group { name: "elm/button/base/hoversel_vertical_entry/default";
1174 color_class: "hoversel_text"; 1174 color_class: "hoversel_text";
1175 color3: 255 255 255 255; 1175 color3: 255 255 255 255;
1176 text { font: FN; size: 10; 1176 text { font: FN; size: 10;
1177 align: -1 0.5; 1177 align: 0.0 0.5;
1178 min: 0 0; 1178 min: 0 0;
1179 text_class: "button"; 1179 text_class: "button";
1180 } 1180 }
diff --git a/data/themes/edc/elm/hover.edc b/data/themes/edc/elm/hover.edc
index 7466f0d84..8a7ed497f 100644
--- a/data/themes/edc/elm/hover.edc
+++ b/data/themes/edc/elm/hover.edc
@@ -445,6 +445,24 @@ group { name: "elm/hover/base/hoversel_vertical/default";
445 // max_size limits the maximum size of expanded hoversel 445 // max_size limits the maximum size of expanded hoversel
446 // when it's scrollable. 446 // when it's scrollable.
447 //data.item: "max_size" "60"; 447 //data.item: "max_size" "60";
448 script {
449 public visible = 0;
450 public right = 0;
451 public topshow2() {
452 if (get_int(right) == 0)
453 run_program(PROGRAM:"topshow_default");
454 else
455 run_program(PROGRAM:"topshow_right");
456 set_int(visible, 1);
457 }
458 public bottomshow2() {
459 if (get_int(right) == 0)
460 run_program(PROGRAM:"bottomshow_default");
461 else
462 run_program(PROGRAM:"bottomshow_right");
463 set_int(visible, 1);
464 }
465 }
448 parts { 466 parts {
449 part { name: "elm.swallow.offset"; type: SWALLOW; 467 part { name: "elm.swallow.offset"; type: SWALLOW;
450 description { state: "default" 0.0; 468 description { state: "default" 0.0;
@@ -466,11 +484,11 @@ group { name: "elm/hover/base/hoversel_vertical/default";
466 description { state: "default" 0.0; 484 description { state: "default" 0.0;
467 rel1.to_x: "limit0"; 485 rel1.to_x: "limit0";
468 rel1.to_y: "elm.swallow.slot.top"; 486 rel1.to_y: "elm.swallow.slot.top";
469 rel1.offset: -10 -6; 487 rel1.offset: -2 -4;
470 rel2.to_x: "limit1"; 488 rel2.to_x: "limit1";
471 rel2.to_y: "elm.swallow.slot.middle"; 489 rel2.to_y: "elm.swallow.slot.middle";
472 rel2.relative: 1.0 0.0; 490 rel2.relative: 1.0 0.0;
473 rel2.offset: 9 5; 491 rel2.offset: 9 4;
474 image { 492 image {
475 normal: "button_normal.png"; 493 normal: "button_normal.png";
476 border: 7 7 7 7; 494 border: 7 7 7 7;
@@ -481,10 +499,10 @@ group { name: "elm/hover/base/hoversel_vertical/default";
481 rel1.to_x: "limit0"; 499 rel1.to_x: "limit0";
482 rel1.to_y: "elm.swallow.slot.middle"; 500 rel1.to_y: "elm.swallow.slot.middle";
483 rel1.relative: 0.0 1.0; 501 rel1.relative: 0.0 1.0;
484 rel1.offset: -10 -4; 502 rel1.offset: -2 -4;
485 rel2.to_x: "limit1"; 503 rel2.to_x: "limit1";
486 rel2.to_y: "elm.swallow.slot.bottom"; 504 rel2.to_y: "elm.swallow.slot.bottom";
487 rel2.offset: 9 5; 505 rel2.offset: 9 4;
488 image { 506 image {
489 normal: "button_normal.png"; 507 normal: "button_normal.png";
490 border: 7 7 7 7; 508 border: 7 7 7 7;
@@ -558,7 +576,7 @@ group { name: "elm/hover/base/hoversel_vertical/default";
558 clip_to: "topclip"; 576 clip_to: "topclip";
559 description { state: "default" 0.0; 577 description { state: "default" 0.0;
560 visible: 1; 578 visible: 1;
561 align: 0.5 0.0; 579 align: 0.0 0.0;
562 rel1.to: "elm.swallow.slot.middle"; 580 rel1.to: "elm.swallow.slot.middle";
563 rel1.relative: 0.0 0.0; 581 rel1.relative: 0.0 0.0;
564 rel1.offset: 0 -1; 582 rel1.offset: 0 -1;
@@ -568,7 +586,17 @@ group { name: "elm/hover/base/hoversel_vertical/default";
568 } 586 }
569 description { state: "visible" 0.0; 587 description { state: "visible" 0.0;
570 inherit: "default" 0.0; 588 inherit: "default" 0.0;
571 align: 0.5 1.0; 589 align: 0.0 1.0;
590 }
591 description { state: "right" 0.0;
592 inherit: "default" 0.0;
593 align: 1.0 0.0;
594 rel2.offset: -9 0;
595 }
596 description { state: "right_visible" 0.0;
597 inherit: "default" 0.0;
598 align: 1.0 1.0;
599 rel2.offset: -9 0;
572 } 600 }
573 } 601 }
574 part { name: "bottomclip"; type: RECT; 602 part { name: "bottomclip"; type: RECT;
@@ -580,7 +608,7 @@ group { name: "elm/hover/base/hoversel_vertical/default";
580 part { name: "elm.swallow.slot.bottom"; type: SWALLOW; 608 part { name: "elm.swallow.slot.bottom"; type: SWALLOW;
581 clip_to: "bottomclip"; 609 clip_to: "bottomclip";
582 description { state: "default" 0.0; 610 description { state: "default" 0.0;
583 align: 0.5 1.0; 611 align: 0.0 1.0;
584 rel1.to: "elm.swallow.slot.middle"; 612 rel1.to: "elm.swallow.slot.middle";
585 rel1.relative: 0.0 1.0; 613 rel1.relative: 0.0 1.0;
586 rel1.offset: 0 2; 614 rel1.offset: 0 2;
@@ -590,7 +618,17 @@ group { name: "elm/hover/base/hoversel_vertical/default";
590 } 618 }
591 description { state: "visible" 0.0; 619 description { state: "visible" 0.0;
592 inherit: "default" 0.0; 620 inherit: "default" 0.0;
593 align: 0.5 0.0; 621 align: 0.0 0.0;
622 }
623 description { state: "right" 0.0;
624 inherit: "default" 0.0;
625 align: 1.0 1.0;
626 rel2.offset: -9 0;
627 }
628 description { state: "right_visible" 0.0;
629 inherit: "default" 0.0;
630 align: 1.0 0.0;
631 rel2.offset: -9 0;
594 } 632 }
595 } 633 }
596 part { name: "elm.swallow.slot.middle"; 634 part { name: "elm.swallow.slot.middle";
@@ -621,45 +659,114 @@ group { name: "elm/hover/base/hoversel_vertical/default";
621 program { name: "hidefinished"; 659 program { name: "hidefinished";
622 action: SIGNAL_EMIT "elm,action,hide,finished" "elm"; 660 action: SIGNAL_EMIT "elm,action,hide,finished" "elm";
623 } 661 }
624
625 program { name: "topshow"; 662 program { name: "topshow";
626 signal: "elm,action,slot,top,show"; source: "elm"; 663 signal: "elm,action,slot,top,show"; source: "elm";
664 script {
665 set_state(PART:"limit0", "visible", 0.0);
666 set_state(PART:"limit1", "visible", 0.0);
667 set_state(PART:"button_image", "default", 0.0);
668 topshow2();
669 }
670 }
671 program { name: "topshow_default";
627 action: STATE_SET "visible" 0.0; 672 action: STATE_SET "visible" 0.0;
628 transition: DECELERATE 0.5;
629 target: "elm.swallow.slot.top"; 673 target: "elm.swallow.slot.top";
674 transition: DECELERATE 0.5;
630 } 675 }
631 program { name: "topshow3"; 676 program { name: "topshow_right";
632 signal: "elm,action,slot,top,show"; source: "elm"; 677 action: STATE_SET "right_visible" 0.0;
633 action: STATE_SET "default" 0.0; 678 target: "elm.swallow.slot.top";
634 target: "button_image"; 679 transition: DECELERATE 0.5;
635 target: "limit0";
636 target: "limit1";
637 } 680 }
638 program { name: "tophide"; 681 program { name: "tophide";
639 signal: "elm,action,slot,top,hide"; source: "elm"; 682 signal: "elm,action,slot,top,hide";
683 source: "elm";
684 script {
685 if (get_int(right) == 0)
686 run_program(PROGRAM:"tophide_default");
687 else
688 run_program(PROGRAM:"tophide_right");
689 set_int(visible, 0);
690 }
691 }
692 program { name: "tophide_default";
640 action: STATE_SET "default" 0.0; 693 action: STATE_SET "default" 0.0;
694 target: "elm.swallow.slot.top";
641 transition: DECELERATE 0.5; 695 transition: DECELERATE 0.5;
696 }
697 program { name: "tophide_right";
698 action: STATE_SET "right" 0.0;
642 target: "elm.swallow.slot.top"; 699 target: "elm.swallow.slot.top";
700 transition: DECELERATE 0.5;
643 } 701 }
644
645 program { name: "bottomshow"; 702 program { name: "bottomshow";
646 signal: "elm,action,slot,bottom,show"; source: "elm"; 703 signal: "elm,action,slot,bottom,show"; source: "elm";
704 script {
705 set_state(PART:"limit0", "bottom", 0.0);
706 set_state(PART:"limit1", "bottom", 0.0);
707 set_state(PART:"button_image", "bottom", 0.0);
708 bottomshow2();
709 }
710 }
711 program { name: "bottomshow_default";
647 action: STATE_SET "visible" 0.0; 712 action: STATE_SET "visible" 0.0;
648 transition: DECELERATE 0.5;
649 target: "elm.swallow.slot.bottom"; 713 target: "elm.swallow.slot.bottom";
714 transition: DECELERATE 0.5;
650 } 715 }
651 program { name: "bottomshow3"; 716 program { name: "bottomshow_right";
652 signal: "elm,action,slot,bottom,show"; source: "elm"; 717 action: STATE_SET "right_visible" 0.0;
653 action: STATE_SET "bottom" 0.0; 718 target: "elm.swallow.slot.bottom";
654 target: "button_image"; 719 transition: DECELERATE 0.5;
655 target: "limit0";
656 target: "limit1";
657 } 720 }
658 program { name: "bottomhide"; 721 program { name: "bottomhide";
659 signal: "elm,action,slot,bottom,hide"; source: "elm"; 722 signal: "elm,action,slot,bottom,hide"; source: "elm";
723 script {
724 if (get_int(right) == 0) {
725 run_program(PROGRAM:"bottomhide_default");
726 }
727 else {
728 run_program(PROGRAM:"bottomhide_right");
729 }
730 set_int(visible, 0);
731 }
732 }
733 program { name: "bottomhide_default";
660 action: STATE_SET "default" 0.0; 734 action: STATE_SET "default" 0.0;
735 target: "elm.swallow.slot.bottom";
661 transition: DECELERATE 0.5; 736 transition: DECELERATE 0.5;
737 }
738 program { name: "bottomhide_right";
739 action: STATE_SET "right" 0.0;
662 target: "elm.swallow.slot.bottom"; 740 target: "elm.swallow.slot.bottom";
741 transition: DECELERATE 0.5;
742 }
743 program { name: "align_right";
744 signal: "elm,state,align,right"; source: "elm";
745 script {
746 set_int(right, 1);
747 if (get_int(visible) == 0) {
748 set_state(PART:"elm.swallow.slot.top", "right", 0.0);
749 set_state(PART:"elm.swallow.slot.bottom", "right", 0.0);
750 }
751 else {
752 set_state(PART:"elm.swallow.slot.top", "right_visible", 0.0);
753 set_state(PART:"elm.swallow.slot.bottom", "right_visible", 0.0);
754 }
755 }
756 }
757 program { name: "align_default";
758 signal: "elm,state,align,default"; source: "elm";
759 script {
760 set_int(right, 0);
761 if (get_int(visible) == 0) {
762 set_state(PART:"elm.swallow.slot.top", "default", 0.0);
763 set_state(PART:"elm.swallow.slot.bottom", "default", 0.0);
764 }
765 else {
766 set_state(PART:"elm.swallow.slot.top", "visible", 0.0);
767 set_state(PART:"elm.swallow.slot.bottom", "visible", 0.0);
768 }
769 }
663 } 770 }
664 } 771 }
665} 772}
@@ -701,7 +808,7 @@ group { name: "elm/hover/base/hoversel_horizontal/default";
701 description { state: "default" 0.0; 808 description { state: "default" 0.0;
702 rel1.to_x: "elm.swallow.slot.left"; 809 rel1.to_x: "elm.swallow.slot.left";
703 rel1.to_y: "elm.swallow.slot.left"; 810 rel1.to_y: "elm.swallow.slot.left";
704 rel1.offset: -10 -10; 811 rel1.offset: -10 0;
705 rel2.to_x: "elm.swallow.slot.middle"; 812 rel2.to_x: "elm.swallow.slot.middle";
706 rel2.to_y: "elm.swallow.slot.left"; 813 rel2.to_y: "elm.swallow.slot.left";
707 rel2.relative: 0.0 1.0; 814 rel2.relative: 0.0 1.0;
@@ -716,7 +823,7 @@ group { name: "elm/hover/base/hoversel_horizontal/default";
716 rel1.to_x: "elm.swallow.slot.middle"; 823 rel1.to_x: "elm.swallow.slot.middle";
717 rel1.to_y: "elm.swallow.slot.right"; 824 rel1.to_y: "elm.swallow.slot.right";
718 rel1.relative: 1.0 0.0; 825 rel1.relative: 1.0 0.0;
719 rel1.offset: -5 -10; 826 rel1.offset: -5 0;
720 rel2.to_x: "elm.swallow.slot.right"; 827 rel2.to_x: "elm.swallow.slot.right";
721 rel2.to_y: "elm.swallow.slot.right"; 828 rel2.to_y: "elm.swallow.slot.right";
722 rel2.offset: 10 9; 829 rel2.offset: 10 9;
@@ -737,7 +844,7 @@ group { name: "elm/hover/base/hoversel_horizontal/default";
737 part { name: "elm.swallow.slot.left"; type: SWALLOW; 844 part { name: "elm.swallow.slot.left"; type: SWALLOW;
738 clip_to: "leftclip"; 845 clip_to: "leftclip";
739 description { state: "default" 0.0; 846 description { state: "default" 0.0;
740 align: 0.0 0.5; 847 align: 0.0 0.0;
741 rel1.to: "elm.swallow.slot.middle"; 848 rel1.to: "elm.swallow.slot.middle";
742 rel1.relative: 0.0 0.0; 849 rel1.relative: 0.0 0.0;
743 rel1.offset: -1 0; 850 rel1.offset: -1 0;
@@ -749,7 +856,7 @@ group { name: "elm/hover/base/hoversel_horizontal/default";
749 inherit: "default" 0.0; 856 inherit: "default" 0.0;
750 rel1.offset: -7 0; 857 rel1.offset: -7 0;
751 rel2.offset: -7 -1; 858 rel2.offset: -7 -1;
752 align: 1.0 0.5; 859 align: 1.0 0.0;
753 } 860 }
754 } 861 }
755 part { name: "rightclip"; type: RECT; 862 part { name: "rightclip"; type: RECT;
@@ -761,7 +868,7 @@ group { name: "elm/hover/base/hoversel_horizontal/default";
761 part { name: "elm.swallow.slot.right"; type: SWALLOW; 868 part { name: "elm.swallow.slot.right"; type: SWALLOW;
762 clip_to: "rightclip"; 869 clip_to: "rightclip";
763 description { state: "default" 0.0; 870 description { state: "default" 0.0;
764 align: 1.0 0.5; 871 align: 1.0 0.0;
765 rel1.to: "elm.swallow.slot.middle"; 872 rel1.to: "elm.swallow.slot.middle";
766 rel1.relative: 1.0 0.0; 873 rel1.relative: 1.0 0.0;
767 rel1.offset: 0 0; 874 rel1.offset: 0 0;
@@ -773,7 +880,7 @@ group { name: "elm/hover/base/hoversel_horizontal/default";
773 inherit: "default" 0.0; 880 inherit: "default" 0.0;
774 rel1.offset: 6 0; 881 rel1.offset: 6 0;
775 rel2.offset: -6 -1; 882 rel2.offset: -6 -1;
776 align: 0.0 0.5; 883 align: 0.0 0.0;
777 } 884 }
778 } 885 }
779 part { name: "elm.swallow.slot.middle"; type: SWALLOW; 886 part { name: "elm.swallow.slot.middle"; type: SWALLOW;
diff --git a/src/lib/elc_hoversel.c b/src/lib/elc_hoversel.c
index ab7271a8e..20285c432 100644
--- a/src/lib/elc_hoversel.c
+++ b/src/lib/elc_hoversel.c
@@ -334,9 +334,20 @@ _resizing_eval(Evas_Object *obj, Elm_Hoversel_Data *sd)
334 334
335 if (xx < 0) xx = x; 335 if (xx < 0) xx = x;
336 if ((xx + ww) > (x + w)) 336 if ((xx + ww) > (x + w))
337 ww = (x + w) - xx; 337 {
338 if ((obj_x + obj_w - x) > ((x + w) - obj_x))
339 {
340 elm_layout_signal_emit(sd->hover, "elm,state,align,right", "elm");
341 if ((obj_x + obj_w - ww) < x)
342 ww = obj_x + obj_w - x;
343 }
344 else
345 {
346 elm_layout_signal_emit(sd->hover, "elm,state,align,default", "elm");
347 ww = (x + w) - xx;
348 }
349 }
338 } 350 }
339
340 evas_object_size_hint_min_set(sd->spacer, ww, hh); 351 evas_object_size_hint_min_set(sd->spacer, ww, hh);
341} 352}
342 353
diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c
index abec604b5..4246f900b 100644
--- a/src/lib/elm_entry.c
+++ b/src/lib/elm_entry.c
@@ -1235,13 +1235,13 @@ _elm_entry_elm_widget_sub_object_del(Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, E
1235static void 1235static void
1236_hoversel_position(Evas_Object *obj) 1236_hoversel_position(Evas_Object *obj)
1237{ 1237{
1238 Evas_Coord cx, cy, cw, ch, x, y, mw, mh; 1238 Evas_Coord cx, cy, cw, ch, x, y, mw, mh, w, h;
1239 1239
1240 ELM_ENTRY_DATA_GET(obj, sd); 1240 ELM_ENTRY_DATA_GET(obj, sd);
1241 1241
1242 cx = cy = 0; 1242 cx = cy = 0;
1243 cw = ch = 1; 1243 cw = ch = 1;
1244 evas_object_geometry_get(sd->entry_edje, &x, &y, NULL, NULL); 1244 evas_object_geometry_get(sd->entry_edje, &x, &y, &w, &h);
1245 if (sd->use_down) 1245 if (sd->use_down)
1246 { 1246 {
1247 cx = sd->downx - x; 1247 cx = sd->downx - x;
@@ -1254,18 +1254,12 @@ _hoversel_position(Evas_Object *obj)
1254 (sd->entry_edje, "elm.text", &cx, &cy, &cw, &ch); 1254 (sd->entry_edje, "elm.text", &cx, &cy, &cw, &ch);
1255 1255
1256 evas_object_size_hint_min_get(sd->hoversel, &mw, &mh); 1256 evas_object_size_hint_min_get(sd->hoversel, &mw, &mh);
1257 if (cw < mw) 1257 if (cx + mw > w)
1258 { 1258 cx = w - mw;
1259 cx += (cw - mw) / 2; 1259 if (cy + mh > h)
1260 cw = mw; 1260 cy = h - mh;
1261 }
1262 if (ch < mh)
1263 {
1264 cy += (ch - mh) / 2;
1265 ch = mh;
1266 }
1267 evas_object_move(sd->hoversel, x + cx, y + cy); 1261 evas_object_move(sd->hoversel, x + cx, y + cy);
1268 evas_object_resize(sd->hoversel, cw, ch); 1262 evas_object_resize(sd->hoversel, mw, mh);
1269} 1263}
1270 1264
1271static void 1265static void