diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index dafdb09d48..b5a64ddd21 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -1040,31 +1040,30 @@ static void _elm_win_focus_highlight_anim_setup(Efl_Ui_Win_Data *sd, Evas_Object *obj) { - Evas_Coord tx, ty, tw, th; + Eina_Rectangle rt; Evas_Coord px, py, pw, ph; Edje_Message_Int_Set *m; Evas_Object *target = sd->focus_highlight.cur.target; evas_object_geometry_get(obj, &px, &py, &pw, &ph); - elm_widget_focus_highlight_geometry_get(target, &tx, &ty, &tw, &th); - evas_object_move(obj, tx, ty); - evas_object_resize(obj, tw, th); + rt = elm_widget_focus_highlight_geometry_get(target); + efl_gfx_geometry_set(obj, rt.x, rt.y, rt.w, rt.h); - if ((px == tx) && (py == ty) && (pw == tw) && (ph == th)) return; + if ((px == rt.x) && (py == rt.y) && (pw == rt.w) && (ph == rt.h)) return; if (!_elm_config->focus_highlight_clip_disable) evas_object_clip_unset(obj); m = alloca(sizeof(*m) + (sizeof(int) * 8)); m->count = 8; - m->val[0] = px - tx; - m->val[1] = py - ty; + m->val[0] = px - rt.x; + m->val[1] = py - rt.y; m->val[2] = pw; m->val[3] = ph; m->val[4] = 0; m->val[5] = 0; - m->val[6] = tw; - m->val[7] = th; + m->val[6] = rt.w; + m->val[7] = rt.h; edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m); } @@ -1073,12 +1072,10 @@ _elm_win_focus_highlight_simple_setup(Efl_Ui_Win_Data *sd, Evas_Object *obj) { Evas_Object *clip, *target = sd->focus_highlight.cur.target; - Evas_Coord x, y, w, h; + Eina_Rectangle r; - elm_widget_focus_highlight_geometry_get(target, &x, &y, &w, &h); - - evas_object_move(obj, x, y); - evas_object_resize(obj, w, h); + r = elm_widget_focus_highlight_geometry_get(target); + efl_gfx_geometry_set(obj, r.x, r.y, r.w, r.h); if (!_elm_config->focus_highlight_clip_disable) { diff --git a/src/lib/elementary/elm_colorselector.c b/src/lib/elementary/elm_colorselector.c index 9cd1247e5d..e58d96951a 100644 --- a/src/lib/elementary/elm_colorselector.c +++ b/src/lib/elementary/elm_colorselector.c @@ -2259,18 +2259,22 @@ _access_obj_process(Evas_Object *obj, Eina_Bool is_access) } } -EOLIAN static void -_elm_colorselector_elm_widget_focus_highlight_geometry_get(const Eo *obj EINA_UNUSED, Elm_Colorselector_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +EOLIAN static Eina_Rectangle +_elm_colorselector_elm_widget_focus_highlight_geometry_get(Eo *obj EINA_UNUSED, Elm_Colorselector_Data *sd) { + Eina_Rectangle r = {}; + if (sd->focused_item && (sd->focused == ELM_COLORSELECTOR_PALETTE)) { ELM_COLOR_ITEM_DATA_GET(sd->focused_item, focus_it); - evas_object_geometry_get(VIEW(focus_it), x, y, w, h); + evas_object_geometry_get(VIEW(focus_it), &r.x, &r.y, &r.w, &r.h); } else if(sd->focused == ELM_COLORSELECTOR_COMPONENTS) - evas_object_geometry_get(sd->cb_data[sd->sel_color_type]->colorbar, x, y, w, h); + evas_object_geometry_get(sd->cb_data[sd->sel_color_type]->colorbar, &r.x, &r.y, &r.w, &r.h); else - evas_object_geometry_get(obj, x, y, w, h); + evas_object_geometry_get(obj, &r.x, &r.y, &r.w, &r.h); + + return r; } EOLIAN static void diff --git a/src/lib/elementary/elm_colorselector.eo b/src/lib/elementary/elm_colorselector.eo index cf6beafbf5..70ef3bc224 100644 --- a/src/lib/elementary/elm_colorselector.eo +++ b/src/lib/elementary/elm_colorselector.eo @@ -112,7 +112,7 @@ class Elm.Colorselector (Efl.Ui.Layout, Elm.Interface.Atspi_Widget_Action, Elm.Widget.focus_next_manager_is; Elm.Widget.focus_next; Elm.Widget.focus_direction_manager_is; - Elm.Widget.focus_highlight_geometry_get; + Elm.Widget.focus_highlight_geometry { get; } Elm.Widget.on_access_update; Elm.Widget.widget_event; Elm.Interface.Atspi_Widget_Action.elm_actions { get; } diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c index d0a837bdc6..854550a26f 100644 --- a/src/lib/elementary/elm_gengrid.c +++ b/src/lib/elementary/elm_gengrid.c @@ -5480,10 +5480,11 @@ elm_gengrid_nth_item_get(const Evas_Object *obj, unsigned int nth) return EO_OBJ(it); } -EOLIAN static void -_elm_gengrid_elm_widget_focus_highlight_geometry_get(const Eo *obj, Elm_Gengrid_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +EOLIAN static Eina_Rectangle +_elm_gengrid_elm_widget_focus_highlight_geometry_get(Eo *obj, Elm_Gengrid_Data *sd) { Evas_Coord ox, oy, oh, ow, item_x = 0, item_y = 0, item_w = 0, item_h = 0; + Eina_Rectangle r = {}; evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh); @@ -5495,37 +5496,39 @@ _elm_gengrid_elm_widget_focus_highlight_geometry_get(const Eo *obj, Elm_Gengrid_ } else { - evas_object_geometry_get(obj, x, y, w, h); - return; + evas_object_geometry_get(obj, &r.x, &r.y, &r.w, &r.h); + return r; } - *x = item_x; - *y = item_y; - *w = item_w; - *h = item_h; + r.x = item_x; + r.y = item_y; + r.w = item_w; + r.h = item_h; if (sd->horizontal) { if (item_x < ox) { - *x = ox; + r.x = ox; } else if (item_x > (ox + ow - item_w)) { - *x = ox + ow - item_w; + r.x = ox + ow - item_w; } } else { if (item_y < oy) { - *y = oy; + r.y = oy; } else if (item_y > (oy + oh - item_h)) { - *y = oy + oh - item_h; + r.y = oy + oh - item_h; } } + + return r; } EOLIAN static Elm_Object_Item * diff --git a/src/lib/elementary/elm_gengrid.eo b/src/lib/elementary/elm_gengrid.eo index 2fa4211961..d4145e74af 100644 --- a/src/lib/elementary/elm_gengrid.eo +++ b/src/lib/elementary/elm_gengrid.eo @@ -556,7 +556,7 @@ class Elm.Gengrid (Efl.Ui.Layout, Elm.Interface_Scrollable, Elm.Widget.on_focus; Elm.Widget.focus_region { get; } Elm.Widget.widget_event; - Elm.Widget.focus_highlight_geometry_get; + Elm.Widget.focus_highlight_geometry { get; } Elm.Widget.focused_item { get; } Elm.Widget.item_loop_enabled { get; set; } Elm.Interface_Scrollable.bounce_allow { set; } diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c index e57cc82c3e..369ef1d85e 100644 --- a/src/lib/elementary/elm_genlist.c +++ b/src/lib/elementary/elm_genlist.c @@ -8432,10 +8432,11 @@ elm_genlist_nth_item_get(const Evas_Object *obj, unsigned int nth) return EO_OBJ(it); } -EOLIAN static void -_elm_genlist_elm_widget_focus_highlight_geometry_get(const Eo *obj, Elm_Genlist_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +EOLIAN static Eina_Rectangle +_elm_genlist_elm_widget_focus_highlight_geometry_get(Eo *obj, Elm_Genlist_Data *sd) { Evas_Coord ox, oy, oh, ow, item_x = 0, item_y = 0, item_w = 0, item_h = 0; + Eina_Rectangle r = {}; evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh); @@ -8447,32 +8448,34 @@ _elm_genlist_elm_widget_focus_highlight_geometry_get(const Eo *obj, Elm_Genlist_ } else { - evas_object_geometry_get(obj, x, y, w, h); - return; + evas_object_geometry_get(obj, &r.x, &r.y, &r.w, &r.h); + return r; } - *x = item_x; - *y = item_y; - *w = item_w; - *h = item_h; + r.x = item_x; + r.y = item_y; + r.w = item_w; + r.h = item_h; if (item_y < oy) { - *y = oy; + r.y = oy; } if (item_y > (oy + oh - item_h)) { - *y = oy + oh - item_h; + r.y = oy + oh - item_h; } if ((item_x + item_w) > (ox + ow)) { - *w = ow; + r.w = ow; } if (item_x < ox) { - *x = ox; + r.x = ox; } + + return r; } EOLIAN static Elm_Object_Item * diff --git a/src/lib/elementary/elm_genlist.eo b/src/lib/elementary/elm_genlist.eo index 86a1f09e7a..9e1b041f77 100644 --- a/src/lib/elementary/elm_genlist.eo +++ b/src/lib/elementary/elm_genlist.eo @@ -536,7 +536,7 @@ class Elm.Genlist (Efl.Ui.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable, Elm.Widget.focus_next_manager_is; Elm.Widget.widget_sub_object_add; Elm.Widget.on_access_update; - Elm.Widget.focus_highlight_geometry_get; + Elm.Widget.focus_highlight_geometry { get; } Elm.Widget.focus_next; Elm.Widget.on_focus; Elm.Widget.focus_direction_manager_is; diff --git a/src/lib/elementary/elm_list.c b/src/lib/elementary/elm_list.c index 81e5733d38..abfc36a4e8 100644 --- a/src/lib/elementary/elm_list.c +++ b/src/lib/elementary/elm_list.c @@ -3089,12 +3089,8 @@ _elm_list_focus_on_selection_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd) return sd->focus_on_selection_enabled; } -static void -_elm_list_item_coordinates_adjust(Elm_List_Item_Data *it, - Evas_Coord *x, - Evas_Coord *y, - Evas_Coord *w, - Evas_Coord *h) +static Eina_Rectangle +_elm_list_item_coordinates_adjust(Elm_List_Item_Data *it) { Evas_Coord ix, iy, iw, ih, vx, vy, vw, vh; @@ -3113,21 +3109,22 @@ _elm_list_item_coordinates_adjust(Elm_List_Item_Data *it, if ((ix + iw) > (vx + vw)) iw = (vx + vw - ix); - *x = ix; - *y = iy; - *w = iw; - *h = ih; + return (Eina_Rectangle) { ix, iy, iw, ih }; } -EOLIAN static void -_elm_list_elm_widget_focus_highlight_geometry_get(const Eo *obj EINA_UNUSED, Elm_List_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +EOLIAN static Eina_Rectangle +_elm_list_elm_widget_focus_highlight_geometry_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd) { + Eina_Rectangle r = {}; + if (sd->focused_item) { ELM_LIST_ITEM_DATA_GET(sd->focused_item, focus_it); - _elm_list_item_coordinates_adjust(focus_it, x, y, w, h); - elm_widget_focus_highlight_focus_part_geometry_get(VIEW(focus_it), x, y, w, h); + r = _elm_list_item_coordinates_adjust(focus_it); + elm_widget_focus_highlight_focus_part_geometry_get(VIEW(focus_it), &r.x, &r.y, &r.w, &r.h); } + + return r; } EOLIAN static Elm_Object_Item* diff --git a/src/lib/elementary/elm_list.eo b/src/lib/elementary/elm_list.eo index 452beff3ac..b8a20db99a 100644 --- a/src/lib/elementary/elm_list.eo +++ b/src/lib/elementary/elm_list.eo @@ -437,7 +437,7 @@ class Elm.List (Efl.Ui.Layout, Elm.Interface_Scrollable, Elm.Widget.focus_next_manager_is; Elm.Widget.focus_direction_manager_is; Elm.Widget.on_access_update; - Elm.Widget.focus_highlight_geometry_get; + Elm.Widget.focus_highlight_geometry { get; } Elm.Widget.focus_next; Elm.Widget.on_disabled_update; Elm.Widget.on_focus; diff --git a/src/lib/elementary/elm_toolbar.c b/src/lib/elementary/elm_toolbar.c index 852fc6251f..67a291004d 100644 --- a/src/lib/elementary/elm_toolbar.c +++ b/src/lib/elementary/elm_toolbar.c @@ -3008,39 +3008,36 @@ _elm_toolbar_elm_widget_on_access_update(Eo *obj EINA_UNUSED, Elm_Toolbar_Data * _access_obj_process(sd, _elm_toolbar_smart_focus_next_enable); } -static void -_elm_toolbar_coordinates_adjust(Elm_Toolbar_Item_Data *it, - Evas_Coord *x, - Evas_Coord *y, - Evas_Coord *w, - Evas_Coord *h) +static Eina_Rectangle +_elm_toolbar_coordinates_adjust(Elm_Toolbar_Item_Data *it) { ELM_TOOLBAR_DATA_GET(WIDGET(it), sd); Evas_Coord ix, iy, iw, ih, vx, vy, vw, vh; + Eina_Rectangle r; evas_object_geometry_get(sd->hit_rect, &vx, &vy, &vw, &vh); evas_object_geometry_get(VIEW(it), &ix, &iy, &iw, &ih); - *x = ix; - *y = iy; - *w = iw; - *h = ih; + r = (Eina_Rectangle) { ix, iy, iw, ih }; + if (!efl_ui_dir_is_horizontal(sd->dir, EINA_TRUE)) { //TODO: Enhance it later. if ((ix < vx) || (ix + iw) > (vx + vw) || (iy + ih) > (vy + vh)) - *y = iy - ih; + r.y = iy - ih; else if (iy < vy) - *y = iy + ih; + r.y = iy + ih; } else { //TODO: Enhance it later. if ((iy < vy) || (ix + iw) > (vx + vw) || (iy + ih) > (vy + vh)) - *x = ix - iw; + r.x = ix - iw; else if (ix < vx) - *x = ix + iw; + r.x = ix + iw; } + + return r; } EOLIAN static void @@ -3050,19 +3047,21 @@ _elm_toolbar_item_efl_ui_focus_object_focus_set(Eo *obj, Elm_Toolbar_Item_Data * elm_wdg_item_focus_set(obj, focus); } -EOLIAN static void -_elm_toolbar_elm_widget_focus_highlight_geometry_get(const Eo *obj, Elm_Toolbar_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +EOLIAN static Eina_Rectangle +_elm_toolbar_elm_widget_focus_highlight_geometry_get(Eo *obj, Elm_Toolbar_Data *sd) { + Eina_Rectangle r = {}; + if (sd->focused_item) { ELM_TOOLBAR_ITEM_DATA_GET(sd->focused_item, focus_it); - _elm_toolbar_coordinates_adjust - (focus_it, x, y, w, h); - elm_widget_focus_highlight_focus_part_geometry_get - (VIEW(focus_it), x, y, w, h); + r = _elm_toolbar_coordinates_adjust(focus_it); + elm_widget_focus_highlight_focus_part_geometry_get(VIEW(focus_it), &r.x, &r.y, &r.w, &r.h); } else - evas_object_geometry_get(obj, x, y, w, h); + evas_object_geometry_get(obj, &r.x, &r.y, &r.w, &r.h); + + return r; } EAPI Evas_Object * diff --git a/src/lib/elementary/elm_toolbar.eo b/src/lib/elementary/elm_toolbar.eo index 133fa69699..c3478d044d 100644 --- a/src/lib/elementary/elm_toolbar.eo +++ b/src/lib/elementary/elm_toolbar.eo @@ -327,7 +327,7 @@ class Elm.Toolbar (Elm.Widget, Elm.Interface_Scrollable, Efl.Ui.Direction, Elm.Widget.on_focus; Elm.Widget.translate; Elm.Widget.widget_event; - Elm.Widget.focus_highlight_geometry_get; + Elm.Widget.focus_highlight_geometry { get; } Elm.Widget.focused_item { get; } Efl.Ui.Direction.direction { get; set; [[Only supports $vertical and $horizontal. Default is $horizontal.]] } Elm.Widget.focus_register; diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c index 6060c2f4dc..6e82914d3e 100644 --- a/src/lib/elementary/elm_widget.c +++ b/src/lib/elementary/elm_widget.c @@ -1087,6 +1087,9 @@ _elm_widget_focus_region_show(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED) EOLIAN static Eina_Bool _elm_widget_focus_highlight_style_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd, const char *style) { + // FIXME: This does not return the proper error code! Who cares if the + // string was changed?? This should return false if the desired style does + // not exist... if (eina_stringshare_replace(&sd->focus_highlight_style, style)) return EINA_TRUE; return EINA_FALSE; } @@ -4475,17 +4478,18 @@ elm_widget_focus_highlight_focus_part_geometry_get(const Evas_Object *obj, if (th != *h) *h = th; } -EOLIAN static void -_elm_widget_focus_highlight_geometry_get(const Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +EOLIAN static Eina_Rectangle +_elm_widget_focus_highlight_geometry_get(Eo *obj, Elm_Widget_Smart_Data *sd) { Evas_Coord ox = 0, oy = 0, ow = 0, oh = 0; Evas_Object *scroller = (Evas_Object *)obj; + Eina_Rectangle r = {}; - evas_object_geometry_get(obj, x, y, w, h); - elm_widget_focus_highlight_focus_part_geometry_get(sd->resize_obj, x, y, w, h); + evas_object_geometry_get(obj, &r.x, &r.y, &r.w, &r.h); + elm_widget_focus_highlight_focus_part_geometry_get(sd->resize_obj, &r.x, &r.y, &r.w, &r.h); if (_elm_config->focus_autoscroll_mode != ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN) - return; + return r; while (scroller) { @@ -4493,19 +4497,21 @@ _elm_widget_focus_highlight_geometry_get(const Eo *obj, Elm_Widget_Smart_Data *s { elm_interface_scrollable_content_viewport_geometry_get(scroller, &ox, &oy, &ow, &oh); - if (*y < oy) - *y = oy; - else if ((oy + oh) < (*y + *h)) - *y = (oy + oh - *h); - else if (*x < ox) - *x = ox; - else if ((ox + ow) < (*x + *w)) - *x = (ox + ow - *w); + if (r.y < oy) + r.y = oy; + else if ((oy + oh) < (r.y + r.h)) + r.y = (oy + oh - r.h); + else if (r.x < ox) + r.x = ox; + else if ((ox + ow) < (r.x + r.w)) + r.x = (ox + ow - r.w); break; } scroller = elm_widget_parent_get(scroller); } + + return r; } EOLIAN static Elm_Object_Item* diff --git a/src/lib/elementary/elm_widget.eo b/src/lib/elementary/elm_widget.eo index ed640f828e..144cdc0b57 100644 --- a/src/lib/elementary/elm_widget.eo +++ b/src/lib/elementary/elm_widget.eo @@ -532,6 +532,30 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible, mode: Elm.Focus.Region.Show_Mode; [[Focus region show mode]] } } + @property focus_highlight_geometry { + [[The rectangle region to be highlighted on focus. + + This is a rectangle region where the focus highlight should be + displayed. + ]] + get { + [[This is a read-only property.]] + } + values { + region: Eina.Rectangle; [[The rectangle area.]] + } + } + @property focus_highlight_style { + [[Control the widget focus highlight style.]] + set { + return: bool; [[$true on success, $false otherwise.]] + } + get { + } + values { + style: string; [[The name of the focus highlight style.]] + } + } /* Old focus API. FIXME: Needs massive clean up! */ @property focus_order { @@ -588,15 +612,6 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible, @in relative_child: Efl.Canvas.Object @optional; [[The relative object to position the child.]] } } - focus_highlight_geometry_get @const { - [[Get the focus highlight geometry of widget.]] - params { - @out x: int; [[X coordinate]] - @out y: int; [[Y coordinate]] - @out w: int; [[Width]] - @out h: int; [[Height]] - } - } focus_cycle { [[Give focus to next object with specific focus direction in object tree.]] @@ -746,19 +761,6 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible, } } - /* Other focus APIs */ - @property focus_highlight_style { - [[Control the widget focus highlight style.]] - set { - return: bool; [[$true on success, $false otherwise.]] - } - get { - } - values { - style: string; [[The name of the focus highlight style.]] - } - } - /* Focus Manager API */ focus_register { [[Register focus with focus manager]] diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h index a089b35a83..a910ba4ae1 100644 --- a/src/lib/elementary/elm_widget.h +++ b/src/lib/elementary/elm_widget.h @@ -771,7 +771,7 @@ EAPI const char *elm_widget_access_info_get(const Evas_Object *obj); EAPI Elm_Object_Item *elm_widget_focused_item_get(const Evas_Object *obj); EAPI void elm_widget_orientation_mode_disabled_set(Evas_Object *obj, Eina_Bool disabled); EAPI Eina_Bool elm_widget_orientation_mode_disabled_get(const Evas_Object *obj); -EAPI void elm_widget_focus_highlight_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); +EAPI Eina_Rectangle elm_widget_focus_highlight_geometry_get(const Evas_Object *obj); void _elm_widget_item_highlight_in_theme(Evas_Object *obj, Elm_Object_Item *it); EAPI void elm_widget_focus_move_policy_set(Evas_Object *obj, Elm_Focus_Move_Policy policy); EAPI Elm_Focus_Move_Policy elm_widget_focus_move_policy_get(const Evas_Object *obj);