widget: Rename focus_region (EO)

This region has little to do with focus, as it's more of a region of
interest within the widget, and not directly related to the highlight
geometry, for instance. It's related to focus in the sense that only
widgets with focus would really care about this region.

I decided to change this name after talking with @bu5hm4n.
Note that gengrid uses this but is also completely broken (the focus
highlight floats around and you don't even see the focused item).

Note: This is very close to show_region but I'm not sure those can be
merged safely (since the default "focus_region" is NULL while the
default "show_region" is the widget's geometry).

Ref T5363
This commit is contained in:
Jean-Philippe Andre 2017-10-12 18:16:42 +09:00
parent 19dff85519
commit 72f1fbf4f1
12 changed files with 43 additions and 32 deletions

View File

@ -1250,7 +1250,7 @@ _efl_ui_text_elm_widget_on_focus_update(Eo *obj, Efl_Ui_Text_Data *sd, Elm_Objec
}
EOLIAN static Eina_Rect
_efl_ui_text_elm_widget_focus_region_get(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
_efl_ui_text_elm_widget_interest_region_get(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd)
{
Evas_Coord edje_x, edje_y, elm_x, elm_y;
Eina_Rect r = {};

View File

@ -361,7 +361,7 @@ class Efl.Ui.Text (Efl.Ui.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
Elm.Widget.on_access_activate;
Elm.Widget.theme_apply;
Elm.Widget.on_focus_update;
Elm.Widget.focus_region { get; }
Elm.Widget.interest_region { get; }
Elm.Widget.on_disabled_update;
Elm.Widget.widget_sub_object_del;
Elm.Interface_Scrollable.policy { set; }

View File

@ -1308,7 +1308,7 @@ _elm_entry_elm_widget_on_focus_update(Eo *obj, Elm_Entry_Data *sd, Elm_Object_It
}
EOLIAN static Eina_Rect
_elm_entry_elm_widget_focus_region_get(Eo *obj, Elm_Entry_Data *sd)
_elm_entry_elm_widget_interest_region_get(Eo *obj, Elm_Entry_Data *sd)
{
Evas_Coord cx, cy, cw, ch;
Evas_Coord edx, edy;

View File

@ -960,7 +960,7 @@ class Elm.Entry (Efl.Ui.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
Elm.Widget.on_access_activate;
Elm.Widget.theme_apply;
Elm.Widget.on_focus_update;
Elm.Widget.focus_region { get; }
Elm.Widget.interest_region { get; }
Elm.Widget.on_disabled_update;
Elm.Widget.widget_sub_object_del;
Elm.Interface_Scrollable.policy { set; }

View File

@ -141,10 +141,9 @@ enum Efl.Ui.Focus.Direction
last = 6
}
enum Elm.Focus.Region.Show_Mode
enum Efl.Ui.Interest_Region_Mode
{
[[Focus region show mode.]]
legacy: elm_focus_region_show;
widget, [[As a widget.]]
item, [[As an item.]]
}

View File

@ -45,6 +45,11 @@ typedef enum
ELM_OBJECT_LAYER_LAST /**< last layer known by Elementary */
} Elm_Object_Layer;
/** How the focus region should be calculated (not related to input focus). */
typedef Efl_Ui_Interest_Region_Mode Elm_Focus_Region_Show_Mode;
#define ELM_FOCUS_REGION_SHOW_WIDGET EFL_UI_INTEREST_REGION_MODE_WIDGET
#define ELM_FOCUS_REGION_SHOW_ITEM EFL_UI_INTEREST_REGION_MODE_ITEM
/**************************************************************************/
EAPI extern int ELM_ECORE_EVENT_ETHUMB_CONNECT;

View File

@ -3539,7 +3539,7 @@ _elm_gengrid_elm_widget_on_focus_update(Eo *obj, Elm_Gengrid_Data *sd, Elm_Objec
}
EOLIAN static Eina_Rect
_elm_gengrid_elm_widget_focus_region_get(Eo *obj, Elm_Gengrid_Data *sd)
_elm_gengrid_elm_widget_interest_region_get(Eo *obj, Elm_Gengrid_Data *sd)
{
Eina_Rect r = {};
@ -3560,7 +3560,7 @@ _elm_gengrid_elm_widget_focus_region_get(Eo *obj, Elm_Gengrid_Data *sd)
}
end:
return elm_obj_widget_focus_region_get(efl_super(obj, MY_CLASS));
return elm_obj_widget_interest_region_get(efl_super(obj, MY_CLASS));
}
static Eina_Bool _elm_gengrid_smart_focus_next_enable = EINA_FALSE;

View File

@ -550,7 +550,7 @@ class Elm.Gengrid (Efl.Ui.Layout, Elm.Interface_Scrollable,
Elm.Widget.theme_apply;
Elm.Widget.on_access_update;
Elm.Widget.on_focus_update;
Elm.Widget.focus_region { get; }
Elm.Widget.interest_region { get; }
Elm.Widget.widget_event;
Elm.Widget.focus_highlight_geometry { get; }
Elm.Widget.focused_item { get; }

View File

@ -1050,7 +1050,7 @@ _elm_panel_toggle(Eo *obj, Elm_Panel_Data *_pd EINA_UNUSED)
}
EOLIAN static Eina_Rect
_elm_panel_elm_widget_focus_region_get(Eo *obj, Elm_Panel_Data *sd)
_elm_panel_elm_widget_interest_region_get(Eo *obj, Elm_Panel_Data *sd)
{
Eina_Rect r = {};

View File

@ -83,7 +83,7 @@ class Elm.Panel (Efl.Ui.Layout, Efl.Ui.Focus.Layer, Elm.Interface_Scrollable,
Elm.Widget.on_disabled_update;
Elm.Widget.on_access_update;
Elm.Widget.widget_event;
Elm.Widget.focus_region { get; }
Elm.Widget.interest_region { get; }
Elm.Interface.Atspi_Widget_Action.elm_actions { get; }
Efl.Part.part;
}

View File

@ -1045,8 +1045,8 @@ _propagate_event_legacy(Eo *parent, const Efl_Event *event, Eo *obj, Elm_Event_C
* If elm_widget_focus_region_get() returns an empty rect (w or h <= 0),
* this function will ignore region show action.
*/
EOLIAN static void
_elm_widget_focus_region_show(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED)
EAPI void
elm_widget_focus_region_show(Eo *obj)
{
Evas_Coord ox, oy;
Eina_Rect r;
@ -2532,7 +2532,7 @@ _elm_widget_show_region_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
* @ingroup Widget
*/
EOLIAN static Eina_Rect
_elm_widget_focus_region_get(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED)
_elm_widget_interest_region_get(Eo *obj, Elm_Widget_Smart_Data *_pd EINA_UNUSED)
{
Eina_Rect r = {};
r.size = efl_gfx_size_get(obj);
@ -3450,13 +3450,13 @@ _elm_widget_focused_item_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *_pd EIN
}
EOLIAN static void
_elm_widget_focus_region_show_mode_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *_pd, Elm_Focus_Region_Show_Mode mode)
_elm_widget_interest_region_mode_set(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *_pd, Elm_Focus_Region_Show_Mode mode)
{
_pd->focus_region_show_mode = mode;
}
EOLIAN static Elm_Focus_Region_Show_Mode
_elm_widget_focus_region_show_mode_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *_pd)
_elm_widget_interest_region_mode_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *_pd)
{
return _pd->focus_region_show_mode;
}

View File

@ -395,14 +395,14 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
unchanged.
]]
values {
region: Eina.Rect; [[The region of interest.]]
region: Eina.Rect; [[The region to show.]]
force: bool; [[Set to $true to force show even if unchanged.]]
}
}
get {
[[Returns the current region of interest.]]
[[Returns the current region to show.]]
values {
region: Eina.Rect; [[The region of interest.]]
region: Eina.Rect; [[The region to show.]]
}
}
}
@ -422,10 +422,10 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
[[Pop scroller freeze]]
}
/* FIXME: This is not 100% related to focus. This documentation needs
* further fixing. */
@property focus_region @protected {
[[Region to show when focus changes within this widget.
/* Region of interest */
@property interest_region @protected {
[[Region of interest inside this widget, that should be given
priority to be visible inside a scroller.
When this widget or one of its subwidgets is given focus, this
region should be shown, which means any parent scroller should
@ -439,9 +439,10 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
widget. W,H must be greater or equal to 1 for this region to be
taken into account, otherwise it is ignored.
See also @.focus_region_show.
See also @.interest_region_mode
]]
get {
legacy: elm_widget_focus_region_get;
}
values {
region: Eina.Rect;
@ -449,19 +450,25 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
will be ignored, and no action will be taken.]]
}
}
focus_region_show @protected {
[[Show the region of interest inside this widget.
@property interest_region_mode {
[[Defines how @.show_region should be calculated.
See also @.focus_region.
It is up to the implementation of @.show_region.get to take this
value into account (or ignore it).
]]
}
@property focus_region_show_mode {
[[Control the focus_region_show mode.]]
get {
legacy: elm_widget_focus_region_show_mode_get;
}
set {
legacy: elm_widget_focus_region_show_mode_set;
}
values {
/* FIXME: This enum is in Elm namespace! */
mode: Elm.Focus.Region.Show_Mode; [[Focus region show mode]]
mode: Efl.Ui.Interest_Region_Mode;
[[Whether to show a specific item or the widget as a whole.]]
}
}
/* Focus highlight (visual focus rectangle) properties */
@property focus_highlight_geometry @protected {
[[The rectangle region to be highlighted on focus.