diff options
author | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2019-03-26 09:59:16 +0100 |
---|---|---|
committer | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2019-03-29 14:02:31 +0100 |
commit | fce4d955962fa2c47bd08b6080aa54cc7dd143e4 (patch) | |
tree | aeed663326e5658df06a35f11b7f1b0667f01428 | |
parent | 291ab9a671bf66ab784972e0f85bef3e94546831 (diff) | |
download | efl-fce4d955962fa2c47bd08b6080aa54cc7dd143e4.tar.gz |
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
-rw-r--r-- | src/lib/elementary/efl_ui_widget.c | 8 | ||||
-rw-r--r-- | src/lib/elementary/elm_widget.h | 1 | ||||
-rw-r--r-- | src/tests/elementary/efl_ui_test_widget.c | 13 |
3 files changed, 22 insertions, 0 deletions
diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c index 202171d023..620745cbea 100644 --- a/src/lib/elementary/efl_ui_widget.c +++ b/src/lib/elementary/efl_ui_widget.c @@ -5041,6 +5041,7 @@ EOLIAN static Eo * _efl_ui_widget_efl_object_constructor(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSED) { 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_canvas_group_clipped_set(obj, EINA_FALSE); 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)) 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) { Efl_Access_Type type = efl_access_object_access_type_get(obj); diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h index ca4550ae5e..2f4de74721 100644 --- a/src/lib/elementary/elm_widget.h +++ b/src/lib/elementary/elm_widget.h @@ -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 *hover_obj; Evas_Object *bg; + Evas_Object *window; Eina_List *tooltips, *cursors; /* "show region" coordinates. all widgets got those because this diff --git a/src/tests/elementary/efl_ui_test_widget.c b/src/tests/elementary/efl_ui_test_widget.c index aa9929978d..a49eefe804 100644 --- a/src/tests/elementary/efl_ui_test_widget.c +++ b/src/tests/elementary/efl_ui_test_widget.c @@ -340,6 +340,18 @@ _setup(void) 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) { 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_disabled_parent); tcase_add_test(tc, efl_ui_test_widget_disabled_behaviour); + tcase_add_test(tc, efl_ui_test_widget_win_provider_find); } |