summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-03-26 10:15:15 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-03-29 14:02:32 +0100
commit0c0f47796b1126058a24ec424d4a1081fe0c3061 (patch)
tree14bbac395051c7e6a9cddbe9b3db312653d1f281
parentfce4d955962fa2c47bd08b6080aa54cc7dd143e4 (diff)
downloadefl-0c0f47796b1126058a24ec424d4a1081fe0c3061.tar.gz
efl_ui_widget: move from elm_widget_top_get to provider_find
this resolves a lot of cases where focus_highlight API was called on a object, which is not a efl_ui_win object. With this patch we ensure that the object is always a window. Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es> Differential Revision: https://phab.enlightenment.org/D8476
-rw-r--r--src/lib/elementary/efl_ui_widget.c15
-rw-r--r--src/lib/elementary/elm_gengrid.c6
-rw-r--r--src/lib/elementary/elm_genlist.c6
3 files changed, 14 insertions, 13 deletions
diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c
index 620745cbea..15585ca731 100644
--- a/src/lib/elementary/efl_ui_widget.c
+++ b/src/lib/elementary/efl_ui_widget.c
@@ -248,20 +248,21 @@ _elm_widget_item_highlight_in_theme(Evas_Object *obj, Elm_Object_Item *eo_it)
void
_elm_widget_focus_highlight_start(const Evas_Object *obj)
{
- Evas_Object *top = elm_widget_top_get(obj);
+ Evas_Object *top = efl_provider_find(obj, EFL_UI_WIN_CLASS);
- if (top && efl_isa(top, EFL_UI_WIN_CLASS))
- _elm_win_focus_highlight_start(top);
+ EINA_SAFETY_ON_FALSE_RETURN(efl_isa(top, EFL_UI_WIN_CLASS));
+
+ _elm_win_focus_highlight_start(top);
}
Evas_Object *
_efl_ui_widget_focus_highlight_object_get(const Evas_Object *obj)
{
- Evas_Object *top = elm_widget_top_get(obj);
+ Evas_Object *top = efl_provider_find(obj, EFL_UI_WIN_CLASS);
- if (top && efl_isa(top, EFL_UI_WIN_CLASS))
- return _elm_win_focus_highlight_object_get(top);
- return NULL;
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(top, EFL_UI_WIN_CLASS), NULL);
+
+ return _elm_win_focus_highlight_object_get(top);
}
static Eina_Bool
diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c
index 7617df3b07..cefa035264 100644
--- a/src/lib/elementary/elm_gengrid.c
+++ b/src/lib/elementary/elm_gengrid.c
@@ -206,7 +206,7 @@ _item_cache_add(Elm_Gen_Item *it, Eina_List *contents)
Item_Cache *itc = NULL;
ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
Evas_Object *obj = sd->obj;
- Evas_Object *win = elm_widget_top_get(obj);
+ Evas_Object *win = efl_provider_find(obj, EFL_UI_WIN_CLASS);
evas_event_freeze(evas_object_evas_get(obj));
if (sd->item_cache_max > 0)
@@ -1569,7 +1569,7 @@ _elm_gengrid_item_focus_update(Elm_Gen_Item *it)
{
const char *focus_raise;
Evas_Object *obj = WIDGET(it);
- Evas_Object *win = elm_widget_top_get(obj);
+ Evas_Object *win = efl_provider_find(obj, EFL_UI_WIN_CLASS);
ELM_GENGRID_DATA_GET(obj, sd);
if (elm_win_focus_highlight_enabled_get(win) || _elm_config->win_auto_focus_enable)
@@ -2373,7 +2373,7 @@ _elm_gengrid_item_unfocused(Elm_Object_Item *eo_it)
{
ELM_GENGRID_ITEM_DATA_GET(eo_it, it);
Evas_Object *obj = WIDGET(it);
- Evas_Object *win = elm_widget_top_get(obj);
+ Evas_Object *win = efl_provider_find(obj, EFL_UI_WIN_CLASS);
ELM_GENGRID_DATA_GET(obj, sd);
if (it->generation < sd->generation)
diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c
index a2ad60c590..0cdec229b9 100644
--- a/src/lib/elementary/elm_genlist.c
+++ b/src/lib/elementary/elm_genlist.c
@@ -1599,7 +1599,7 @@ _item_cache_add(Elm_Gen_Item *it, Eina_List *contents)
Item_Cache *itc = NULL;
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
Evas_Object *obj = sd->obj;
- Evas_Object *win = elm_widget_top_get(obj);
+ Evas_Object *win = efl_provider_find(obj, EFL_UI_WIN_CLASS);
Evas *e = evas_object_evas_get(obj);
evas_event_freeze(e);
@@ -1809,7 +1809,7 @@ _elm_genlist_item_focus_update(Elm_Gen_Item *it)
{
const char *focus_raise;
Evas_Object *obj = WIDGET(it);
- Evas_Object *win = elm_widget_top_get(obj);
+ Evas_Object *win = efl_provider_find(obj, EFL_UI_WIN_CLASS);
ELM_GENLIST_DATA_GET(obj, sd);
if (elm_win_focus_highlight_enabled_get(win)
@@ -2907,7 +2907,7 @@ _elm_genlist_item_unfocused(Elm_Object_Item *eo_it)
ELM_GENLIST_ITEM_DATA_GET(eo_it, it);
Evas_Object *obj = WIDGET(it);
- Evas_Object *win = elm_widget_top_get(obj);
+ Evas_Object *win = efl_provider_find(obj, EFL_UI_WIN_CLASS);
ELM_GENLIST_DATA_GET(obj, sd);
if (_is_no_select(it))