summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2014-02-09 19:53:54 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2014-02-09 19:56:07 +0900
commit37eb8fd233365e2922d9d0b372bd040d697f2555 (patch)
tree66d2e320857090ea73d803c0e11b8b05f84c55c7
parent5680efe581fb243699948fbb6cd3bff96cf68854 (diff)
focus: Added focus_highlight_geometry_get() into elm_widget.
Summary: Currently, elm_win was handling focus_highlight geometry of widgets. Removed elm_win_focus_highlight_geometry_get() from elm_win and now elm_widget handles focus highlight geometry. This is required to support the focus highlight on elm widget items. Test Plan: elementary_test -> focus Reviewers: seoz, raster, woohyun CC: nirajkr Differential Revision: https://phab.enlightenment.org/D530
-rw-r--r--src/lib/elm_widget.c45
-rw-r--r--src/lib/elm_widget.h17
-rw-r--r--src/lib/elm_win.c37
3 files changed, 64 insertions, 35 deletions
diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c
index 9cd464d22..7558d9cc7 100644
--- a/src/lib/elm_widget.c
+++ b/src/lib/elm_widget.c
@@ -4861,6 +4861,49 @@ _elm_widget_newest_focus_order_get(Eo *obj, void *_pd, va_list *list)
4861} 4861}
4862 4862
4863EAPI void 4863EAPI void
4864elm_widget_focus_highlight_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
4865{
4866 ELM_WIDGET_CHECK(obj);
4867 eo_do(obj, elm_wdg_focus_highlight_geometry_get(x, y, w, h));
4868}
4869
4870static void
4871_elm_widget_focus_highlight_geometry_get(Eo *obj, void *_pd, va_list *list)
4872{
4873 Evas_Coord *x = va_arg(*list, Evas_Coord *);
4874 Evas_Coord *y = va_arg(*list, Evas_Coord *);
4875 Evas_Coord *w = va_arg(*list, Evas_Coord *);
4876 Evas_Coord *h = va_arg(*list, Evas_Coord *);
4877
4878 Evas_Coord tx = 0, ty = 0, tw = 0, th = 0;
4879 const char *target_hl_part = NULL;
4880 Evas_Object *edje_obj = NULL;
4881 Elm_Widget_Smart_Data *sd = _pd;
4882
4883 evas_object_geometry_get(obj, x, y, w, h);
4884 if (sd->resize_obj && eo_isa(sd->resize_obj, EDJE_OBJ_CLASS))
4885 {
4886 edje_obj = sd->resize_obj;
4887 if (!(target_hl_part = edje_object_data_get(edje_obj, "focus_part")))
4888 return;
4889 }
4890 else if (sd->resize_obj && eo_isa(sd->resize_obj, ELM_OBJ_LAYOUT_CLASS))
4891 {
4892 edje_obj = elm_layout_edje_get(sd->resize_obj);
4893 if (!(target_hl_part = elm_layout_data_get(sd->resize_obj, "focus_part")))
4894 return;
4895 }
4896 else return;
4897
4898 edje_object_part_geometry_get(edje_obj, target_hl_part,
4899 &tx, &ty, &tw, &th);
4900 *x += tx;
4901 *y += ty;
4902 if (tw != *w) *w = tw;
4903 if (th != *h) *h = th;
4904}
4905
4906EAPI void
4864elm_widget_activate(Evas_Object *obj, Elm_Activate act) 4907elm_widget_activate(Evas_Object *obj, Elm_Activate act)
4865{ 4908{
4866 Evas_Object *parent; 4909 Evas_Object *parent;
@@ -6614,6 +6657,7 @@ _class_constructor(Eo_Class *klass)
6614 6657
6615 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_CAN_FOCUS_CHILD_LIST_GET), _elm_widget_can_focus_child_list_get), 6658 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_CAN_FOCUS_CHILD_LIST_GET), _elm_widget_can_focus_child_list_get),
6616 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_NEWEST_FOCUS_ORDER_GET), _elm_widget_newest_focus_order_get), 6659 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_NEWEST_FOCUS_ORDER_GET), _elm_widget_newest_focus_order_get),
6660 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_HIGHLIGHT_GEOMETRY_GET), _elm_widget_focus_highlight_geometry_get),
6617 6661
6618 EO_OP_FUNC_SENTINEL 6662 EO_OP_FUNC_SENTINEL
6619 }; 6663 };
@@ -6767,6 +6811,7 @@ static const Eo_Op_Description op_desc[] = {
6767 6811
6768 EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_CAN_FOCUS_CHILD_LIST_GET, "Get the list of focusable child objects."), 6812 EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_CAN_FOCUS_CHILD_LIST_GET, "Get the list of focusable child objects."),
6769 EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_NEWEST_FOCUS_ORDER_GET, "Get the newest focused object and its order."), 6813 EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_NEWEST_FOCUS_ORDER_GET, "Get the newest focused object and its order."),
6814 EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_FOCUS_HIGHLIGHT_GEOMETRY_GET, "Get the focus highlight geometry of widget."),
6770 6815
6771 EO_OP_DESCRIPTION_SENTINEL 6816 EO_OP_DESCRIPTION_SENTINEL
6772}; 6817};
diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h
index 085ac6115..b1d317248 100644
--- a/src/lib/elm_widget.h
+++ b/src/lib/elm_widget.h
@@ -736,6 +736,7 @@ EAPI const char *elm_widget_access_info_get(const Evas_Object *obj);
736EAPI void elm_widget_orientation_set(Evas_Object *obj, int rotation); 736EAPI void elm_widget_orientation_set(Evas_Object *obj, int rotation);
737EAPI void elm_widget_orientation_mode_disabled_set(Evas_Object *obj, Eina_Bool disabled); 737EAPI void elm_widget_orientation_mode_disabled_set(Evas_Object *obj, Eina_Bool disabled);
738EAPI Eina_Bool elm_widget_orientation_mode_disabled_get(const Evas_Object *obj); 738EAPI Eina_Bool elm_widget_orientation_mode_disabled_get(const Evas_Object *obj);
739EAPI void elm_widget_focus_highlight_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
739EAPI Elm_Widget_Item *_elm_widget_item_new(Evas_Object *parent, size_t alloc_size); 740EAPI Elm_Widget_Item *_elm_widget_item_new(Evas_Object *parent, size_t alloc_size);
740EAPI void _elm_widget_item_free(Elm_Widget_Item *item); 741EAPI void _elm_widget_item_free(Elm_Widget_Item *item);
741EAPI Evas_Object *_elm_widget_item_widget_get(const Elm_Widget_Item *item); 742EAPI Evas_Object *_elm_widget_item_widget_get(const Elm_Widget_Item *item);
@@ -1274,6 +1275,7 @@ enum
1274 1275
1275 ELM_WIDGET_SUB_ID_CAN_FOCUS_CHILD_LIST_GET, 1276 ELM_WIDGET_SUB_ID_CAN_FOCUS_CHILD_LIST_GET,
1276 ELM_WIDGET_SUB_ID_NEWEST_FOCUS_ORDER_GET, 1277 ELM_WIDGET_SUB_ID_NEWEST_FOCUS_ORDER_GET,
1278 ELM_WIDGET_SUB_ID_FOCUS_HIGHLIGHT_GEOMETRY_GET,
1277#if 0 1279#if 0
1278 ELM_WIDGET_SUB_ID_THEME_APPLY, /* API + virtual*/ 1280 ELM_WIDGET_SUB_ID_THEME_APPLY, /* API + virtual*/
1279 ELM_WIDGET_SUB_ID_THEME_SPECIFIC, 1281 ELM_WIDGET_SUB_ID_THEME_SPECIFIC,
@@ -2671,5 +2673,18 @@ typedef void * (*list_data_get_func_type)(const Eina_List * l);
2671 */ 2673 */
2672#define elm_wdg_orientation_mode_disabled_get(ret) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ORIENTATION_MODE_DISABLED_GET), EO_TYPECHECK(Eina_Bool *, ret) 2674#define elm_wdg_orientation_mode_disabled_get(ret) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ORIENTATION_MODE_DISABLED_GET), EO_TYPECHECK(Eina_Bool *, ret)
2673 2675
2674#endif 2676/**
2677 * @def elm_wdg_focus_highlight_geometry_get
2678 * @since 1.9
2679 *
2680 * Get the focus highlight geometry of widget.
2681 *
2682 * @param[in] x
2683 * @param[in] y
2684 * @param[in] w
2685 * @param[in] z
2686 *
2687 */
2688#define elm_wdg_focus_highlight_geometry_get(x, y, w, h) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_HIGHLIGHT_GEOMETRY_GET), EO_TYPECHECK(Evas_Coord *, x), EO_TYPECHECK(Evas_Coord *, y), EO_TYPECHECK(Evas_Coord *, w), EO_TYPECHECK(Evas_Coord *, h)
2675 2689
2690#endif
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index 5b17f2134..4a143d81c 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -683,37 +683,6 @@ _elm_win_focus_highlight_visible_set(Elm_Win_Smart_Data *sd,
683} 683}
684 684
685static void 685static void
686_elm_win_focus_highlight_geometry_get(Evas_Object *target, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
687{
688 Evas_Coord tx = 0, ty = 0, tw = 0, th = 0;
689 const char *target_hl_part = NULL;
690 Evas_Object *edje_obj = NULL;
691 ELM_WIDGET_DATA_GET_OR_RETURN(target, wd);
692
693 evas_object_geometry_get(target, x, y, w, h);
694 if (wd->resize_obj && eo_isa(wd->resize_obj, EDJE_OBJ_CLASS))
695 {
696 edje_obj = wd->resize_obj;
697 if (!(target_hl_part = edje_object_data_get(edje_obj, "focus_part")))
698 return;
699 }
700 else if (wd->resize_obj && eo_isa(wd->resize_obj, ELM_OBJ_LAYOUT_CLASS))
701 {
702 edje_obj = elm_layout_edje_get(wd->resize_obj);
703 if (!(target_hl_part = elm_layout_data_get(wd->resize_obj, "focus_part")))
704 return;
705 }
706 else return;
707
708 edje_object_part_geometry_get(edje_obj, target_hl_part,
709 &tx, &ty, &tw, &th);
710 *x += tx;
711 *y += ty;
712 if (tw != *w) *w = tw;
713 if (th != *h) *h = th;
714}
715
716static void
717_elm_win_focus_highlight_anim_setup(Elm_Win_Smart_Data *sd, 686_elm_win_focus_highlight_anim_setup(Elm_Win_Smart_Data *sd,
718 Evas_Object *obj) 687 Evas_Object *obj)
719{ 688{
@@ -724,8 +693,8 @@ _elm_win_focus_highlight_anim_setup(Elm_Win_Smart_Data *sd,
724 Evas_Object *target = sd->focus_highlight.cur.target; 693 Evas_Object *target = sd->focus_highlight.cur.target;
725 694
726 evas_object_geometry_get(sd->obj, NULL, NULL, &w, &h); 695 evas_object_geometry_get(sd->obj, NULL, NULL, &w, &h);
727 _elm_win_focus_highlight_geometry_get(target, &tx, &ty, &tw, &th); 696 elm_widget_focus_highlight_geometry_get(target, &tx, &ty, &tw, &th);
728 _elm_win_focus_highlight_geometry_get(previous, &px, &py, &pw, &ph); 697 elm_widget_focus_highlight_geometry_get(previous, &px, &py, &pw, &ph);
729 evas_object_move(obj, tx, ty); 698 evas_object_move(obj, tx, ty);
730 evas_object_resize(obj, tw, th); 699 evas_object_resize(obj, tw, th);
731 evas_object_clip_unset(obj); 700 evas_object_clip_unset(obj);
@@ -751,7 +720,7 @@ _elm_win_focus_highlight_simple_setup(Elm_Win_Smart_Data *sd,
751 Evas_Coord x, y, w, h; 720 Evas_Coord x, y, w, h;
752 721
753 clip = evas_object_clip_get(target); 722 clip = evas_object_clip_get(target);
754 _elm_win_focus_highlight_geometry_get(target, &x, &y, &w, &h); 723 elm_widget_focus_highlight_geometry_get(target, &x, &y, &w, &h);
755 724
756 evas_object_move(obj, x, y); 725 evas_object_move(obj, x, y);
757 evas_object_resize(obj, w, h); 726 evas_object_resize(obj, w, h);