forked from enlightenment/efl
efl_ui_widget: add implementation for finding the window
the problem with the previous implementation (just redirect the calls to the widget_parent then to the efl_parent is that after invalidate its impossible to find the window where the widget is in. However, there are cases where we want to have access to the window of the widget, for example, to invalidate focus highlight etc.. The window of a widget is always constant, and cannot be changed (as the evas object cannot hop accross different evas) Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com> Differential Revision: https://phab.enlightenment.org/D8475
This commit is contained in:
parent
291ab9a671
commit
fce4d95596
|
@ -5041,6 +5041,7 @@ EOLIAN static Eo *
|
||||||
_efl_ui_widget_efl_object_constructor(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED)
|
_efl_ui_widget_efl_object_constructor(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED)
|
||||||
{
|
{
|
||||||
sd->on_create = EINA_TRUE;
|
sd->on_create = EINA_TRUE;
|
||||||
|
sd->window = efl_provider_find(efl_parent_get(obj), EFL_UI_WIN_CLASS);
|
||||||
_efl_ui_focus_event_redirector(obj, obj);
|
_efl_ui_focus_event_redirector(obj, obj);
|
||||||
efl_canvas_group_clipped_set(obj, EINA_FALSE);
|
efl_canvas_group_clipped_set(obj, EINA_FALSE);
|
||||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||||
|
@ -5329,6 +5330,13 @@ _efl_ui_widget_efl_object_provider_find(const Eo *obj, Elm_Widget_Smart_Data *pd
|
||||||
if ((klass == EFL_CONFIG_INTERFACE) || (klass == EFL_CONFIG_GLOBAL_CLASS))
|
if ((klass == EFL_CONFIG_INTERFACE) || (klass == EFL_CONFIG_GLOBAL_CLASS))
|
||||||
return _efl_config_obj;
|
return _efl_config_obj;
|
||||||
|
|
||||||
|
if (klass == EFL_UI_WIN_CLASS)
|
||||||
|
{
|
||||||
|
if (pd->window)
|
||||||
|
return pd->window;
|
||||||
|
//let the parent_obj lookup handle this
|
||||||
|
}
|
||||||
|
|
||||||
if (klass == EFL_ACCESS_OBJECT_MIXIN)
|
if (klass == EFL_ACCESS_OBJECT_MIXIN)
|
||||||
{
|
{
|
||||||
Efl_Access_Type type = efl_access_object_access_type_get(obj);
|
Efl_Access_Type type = efl_access_object_access_type_get(obj);
|
||||||
|
|
|
@ -328,6 +328,7 @@ typedef struct _Elm_Widget_Smart_Data
|
||||||
Evas_Object *resize_obj; /**< an unique object for each widget that shows the look of a widget. Resize object's geometry is same as the widget. This resize object is different from that of window's resize object. */
|
Evas_Object *resize_obj; /**< an unique object for each widget that shows the look of a widget. Resize object's geometry is same as the widget. This resize object is different from that of window's resize object. */
|
||||||
Evas_Object *hover_obj;
|
Evas_Object *hover_obj;
|
||||||
Evas_Object *bg;
|
Evas_Object *bg;
|
||||||
|
Evas_Object *window;
|
||||||
Eina_List *tooltips, *cursors;
|
Eina_List *tooltips, *cursors;
|
||||||
|
|
||||||
/* "show region" coordinates. all widgets got those because this
|
/* "show region" coordinates. all widgets got those because this
|
||||||
|
|
|
@ -340,6 +340,18 @@ _setup(void)
|
||||||
eina_log_abort_on_critical_set(1);
|
eina_log_abort_on_critical_set(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EFL_START_TEST(efl_ui_test_widget_win_provider_find)
|
||||||
|
{
|
||||||
|
State s;
|
||||||
|
|
||||||
|
_small_ui(&s);
|
||||||
|
ck_assert_ptr_eq(efl_provider_find(s.btn1, EFL_UI_WIN_CLASS), s.win);
|
||||||
|
efl_ui_widget_sub_object_del(s.box, s.btn1);
|
||||||
|
ck_assert_ptr_eq(efl_ui_widget_parent_get(s.btn1), NULL);
|
||||||
|
ck_assert_ptr_eq(efl_provider_find(s.btn1, EFL_UI_WIN_CLASS), s.win);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
void efl_ui_test_widget(TCase *tc)
|
void efl_ui_test_widget(TCase *tc)
|
||||||
{
|
{
|
||||||
tcase_add_checked_fixture(tc, _setup, _shutdown);
|
tcase_add_checked_fixture(tc, _setup, _shutdown);
|
||||||
|
@ -353,4 +365,5 @@ void efl_ui_test_widget(TCase *tc)
|
||||||
tcase_add_test(tc, efl_ui_test_widget_parent_relation);
|
tcase_add_test(tc, efl_ui_test_widget_parent_relation);
|
||||||
tcase_add_test(tc, efl_ui_test_widget_disabled_parent);
|
tcase_add_test(tc, efl_ui_test_widget_disabled_parent);
|
||||||
tcase_add_test(tc, efl_ui_test_widget_disabled_behaviour);
|
tcase_add_test(tc, efl_ui_test_widget_disabled_behaviour);
|
||||||
|
tcase_add_test(tc, efl_ui_test_widget_win_provider_find);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue