From: Jean-Philippe Andre Date: Tue, 7 Nov 2017 05:00:43 +0000 (+0900) Subject: elm: Create legacy widgets with elm_legacy_add X-Git-Tag: submit/sandbox/upgrade/efl120/20180319.053334~1842 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d39bbc149113da5d842f30d046dc04302e54275b;p=platform%2Fupstream%2Fefl.git elm: Create legacy widgets with elm_legacy_add This will be used to solve issues around style_set: if the widget is legacy or pure eo we may need to select a different style. So in the constructor we need to know whether we are legacy or eo. Note that calling style_set in finalize only is too late as we would lose information such as efl_text_set() called inside efl_add(). --- diff --git a/src/lib/elementary/efl_ui_bg.c b/src/lib/elementary/efl_ui_bg.c index 7bb9e8b..73dcdae 100644 --- a/src/lib/elementary/efl_ui_bg.c +++ b/src/lib/elementary/efl_ui_bg.c @@ -114,7 +114,7 @@ EAPI Evas_Object * elm_bg_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/efl_ui_button.c b/src/lib/elementary/efl_ui_button.c index 4576238..d044b4c 100644 --- a/src/lib/elementary/efl_ui_button.c +++ b/src/lib/elementary/efl_ui_button.c @@ -300,7 +300,7 @@ EAPI Evas_Object * elm_button_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/efl_ui_check.c b/src/lib/elementary/efl_ui_check.c index 6a23310..836cc3a 100644 --- a/src/lib/elementary/efl_ui_check.c +++ b/src/lib/elementary/efl_ui_check.c @@ -314,7 +314,7 @@ EAPI Evas_Object * elm_check_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/efl_ui_flip.c b/src/lib/elementary/efl_ui_flip.c index cdaebad..c001567 100644 --- a/src/lib/elementary/efl_ui_flip.c +++ b/src/lib/elementary/efl_ui_flip.c @@ -1866,7 +1866,7 @@ EAPI Evas_Object * elm_flip_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/efl_ui_frame.c b/src/lib/elementary/efl_ui_frame.c index 187b14f..2ca12ad 100644 --- a/src/lib/elementary/efl_ui_frame.c +++ b/src/lib/elementary/efl_ui_frame.c @@ -139,7 +139,7 @@ EAPI Evas_Object * elm_frame_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index 871a268..d87b4be 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -850,7 +850,7 @@ EAPI Evas_Object * elm_image_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - Evas_Object *obj = efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + Evas_Object *obj = elm_legacy_add(MY_CLASS, parent); EFL_UI_IMAGE_DATA_GET(obj, priv); efl_event_callback_add(obj, EFL_GFX_EVENT_CHANGE_SIZE_HINTS, _on_size_hints_changed, priv); diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c index 84f348a..dc2a5ba 100644 --- a/src/lib/elementary/efl_ui_image_zoomable.c +++ b/src/lib/elementary/efl_ui_image_zoomable.c @@ -2717,7 +2717,7 @@ EAPI Evas_Object * elm_photocam_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } static inline void diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index f61d72b..e82ef5f 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -2050,7 +2050,7 @@ EAPI Evas_Object * elm_layout_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/efl_ui_multibuttonentry.c b/src/lib/elementary/efl_ui_multibuttonentry.c index ee019f4..cb489ac 100644 --- a/src/lib/elementary/efl_ui_multibuttonentry.c +++ b/src/lib/elementary/efl_ui_multibuttonentry.c @@ -1713,7 +1713,7 @@ EAPI Evas_Object * elm_multibuttonentry_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } static void diff --git a/src/lib/elementary/efl_ui_panes.c b/src/lib/elementary/efl_ui_panes.c index dea1363..9c46cab 100644 --- a/src/lib/elementary/efl_ui_panes.c +++ b/src/lib/elementary/efl_ui_panes.c @@ -578,7 +578,7 @@ EAPI Evas_Object * elm_panes_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EAPI void diff --git a/src/lib/elementary/efl_ui_progressbar.c b/src/lib/elementary/efl_ui_progressbar.c index 461869c..67b98b1 100644 --- a/src/lib/elementary/efl_ui_progressbar.c +++ b/src/lib/elementary/efl_ui_progressbar.c @@ -575,7 +575,7 @@ EAPI Evas_Object * elm_progressbar_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - Eo *obj = efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + Eo *obj = elm_legacy_add(MY_CLASS, parent); elm_progressbar_unit_format_set(obj, "%.0f %%"); return obj; diff --git a/src/lib/elementary/efl_ui_radio.c b/src/lib/elementary/efl_ui_radio.c index 89d0578..3281fec 100644 --- a/src/lib/elementary/efl_ui_radio.c +++ b/src/lib/elementary/efl_ui_radio.c @@ -384,7 +384,7 @@ EAPI Evas_Object * elm_radio_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EAPI void diff --git a/src/lib/elementary/efl_ui_slider.c b/src/lib/elementary/efl_ui_slider.c index 2fc9689..919e0b7 100644 --- a/src/lib/elementary/efl_ui_slider.c +++ b/src/lib/elementary/efl_ui_slider.c @@ -1483,7 +1483,7 @@ EAPI Evas_Object * elm_slider_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EAPI void diff --git a/src/lib/elementary/efl_ui_video.c b/src/lib/elementary/efl_ui_video.c index 486b13d..3895b1c 100644 --- a/src/lib/elementary/efl_ui_video.c +++ b/src/lib/elementary/efl_ui_video.c @@ -256,7 +256,7 @@ EAPI Evas_Object * elm_video_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 87e7e962..1b7ad80 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -5342,13 +5342,6 @@ _efl_ui_win_efl_object_finalize(Eo *obj, Efl_Ui_Win_Data *sd) return obj; } -EOLIAN static void -_efl_ui_win_efl_canvas_object_legacy_ctor(Eo *obj, Efl_Ui_Win_Data *sd) -{ - sd->legacy.ctor = EINA_TRUE; - efl_canvas_object_legacy_ctor(efl_super(obj, MY_CLASS)); -} - EOLIAN static Efl_Ui_Focus_Manager* _efl_ui_win_elm_widget_focus_manager_create(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *pd EINA_UNUSED, Efl_Ui_Focus_Object *root) { @@ -8089,20 +8082,18 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type) default: break; } - return efl_add(klass, parent, - efl_canvas_object_legacy_ctor(efl_added), - efl_ui_win_name_set(efl_added, name), - efl_ui_win_type_set(efl_added, type)); + return elm_legacy_add(klass, parent, + efl_ui_win_name_set(efl_added, name), + efl_ui_win_type_set(efl_added, type)); } EAPI Evas_Object * elm_win_fake_add(Ecore_Evas *ee) { - return efl_add(MY_CLASS, NULL, - efl_canvas_object_legacy_ctor(efl_added), - _fake_canvas_set(efl_added, ee), - efl_ui_win_name_set(efl_added, NULL), - efl_ui_win_type_set(efl_added, ELM_WIN_FAKE)); + return elm_legacy_add(MY_CLASS, NULL, + _fake_canvas_set(efl_added, ee), + efl_ui_win_name_set(efl_added, NULL), + efl_ui_win_type_set(efl_added, ELM_WIN_FAKE)); } EAPI Evas_Object * @@ -8110,11 +8101,10 @@ elm_win_util_standard_add(const char *name, const char *title) { Evas_Object *win; - win = efl_add(EFL_UI_WIN_CLASS, NULL, - efl_canvas_object_legacy_ctor(efl_added), - efl_text_set(efl_added, title), - efl_ui_win_name_set(efl_added, name), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC)); + win = elm_legacy_add(EFL_UI_WIN_CLASS, NULL, + efl_text_set(efl_added, title), + efl_ui_win_name_set(efl_added, name), + efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC)); if (!win) return NULL; _elm_win_standard_init(win); @@ -8126,11 +8116,10 @@ elm_win_util_dialog_add(Evas_Object *parent, const char *name, const char *title { Evas_Object *win; - win = efl_add(EFL_UI_WIN_CLASS, parent, - efl_canvas_object_legacy_ctor(efl_added), - efl_text_set(efl_added, title), - efl_ui_win_name_set(efl_added, name), - efl_ui_win_type_set(efl_added, EFL_UI_WIN_DIALOG_BASIC)); + win = elm_legacy_add(EFL_UI_WIN_CLASS, parent, + efl_text_set(efl_added, title), + efl_ui_win_name_set(efl_added, name), + efl_ui_win_type_set(efl_added, EFL_UI_WIN_DIALOG_BASIC)); if (!win) return NULL; _elm_win_standard_init(win); @@ -8427,7 +8416,6 @@ ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_win, Efl_Ui_Win_Data) #define EFL_UI_WIN_EXTRA_OPS \ EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_win), \ - ELM_PART_CONTENT_DEFAULT_OPS(efl_ui_win), \ - EFL_OBJECT_OP_FUNC(efl_canvas_object_legacy_ctor, _efl_ui_win_efl_canvas_object_legacy_ctor) + ELM_PART_CONTENT_DEFAULT_OPS(efl_ui_win) #include "efl_ui_win.eo.c" diff --git a/src/lib/elementary/elc_combobox.c b/src/lib/elementary/elc_combobox.c index a7b9e5a..11b4156 100644 --- a/src/lib/elementary/elc_combobox.c +++ b/src/lib/elementary/elc_combobox.c @@ -337,16 +337,7 @@ EAPI Evas_Object * elm_combobox_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); -} - -static inline void -_hover_ctor(Eo *parent, Eo *hover) -{ - ELM_WIDGET_DATA_GET_OR_RETURN(parent, wd); - if (wd->legacy) - efl_canvas_object_legacy_ctor(hover); - efl_gfx_visible_set(hover, EINA_FALSE); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * @@ -370,9 +361,19 @@ _elm_combobox_efl_object_constructor(Eo *obj, Elm_Combobox_Data *sd) snprintf(buf, sizeof(buf), "combobox_vertical/%s", elm_widget_style_get(obj)); //hover - sd->hover = efl_add(ELM_HOVER_CLASS, sd->hover_parent, - _hover_ctor(obj, efl_added), - efl_ui_widget_style_set(efl_added, buf)); + if (elm_widget_is_legacy(obj)) + { + sd->hover = elm_legacy_add(ELM_HOVER_CLASS, sd->hover_parent, + efl_gfx_visible_set(efl_added, EINA_FALSE), + efl_ui_widget_style_set(efl_added, buf)); + } + else + { + sd->hover = efl_add(ELM_HOVER_CLASS, sd->hover_parent, + efl_gfx_visible_set(efl_added, EINA_FALSE), + efl_ui_widget_style_set(efl_added, buf)); + } + evas_object_layer_set(sd->hover, EVAS_LAYER_MAX); efl_ui_mirrored_automatic_set(sd->hover, EINA_FALSE); elm_hover_target_set(sd->hover, obj); diff --git a/src/lib/elementary/elc_ctxpopup.c b/src/lib/elementary/elc_ctxpopup.c index c392d8f..bbe9132 100644 --- a/src/lib/elementary/elc_ctxpopup.c +++ b/src/lib/elementary/elc_ctxpopup.c @@ -1110,7 +1110,7 @@ EAPI Evas_Object * elm_ctxpopup_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - Evas_Object *obj = efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + Evas_Object *obj = elm_legacy_add(MY_CLASS, parent); /* access: parent could be any object such as elm_list which does not know elc_ctxpopup as its child object in the focus_next(); */ diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index a9b8d41..3df9845 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -2043,7 +2043,7 @@ EAPI Evas_Object * elm_fileselector_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elc_fileselector_button.c b/src/lib/elementary/elc_fileselector_button.c index ef4cd00..52b7789 100644 --- a/src/lib/elementary/elc_fileselector_button.c +++ b/src/lib/elementary/elc_fileselector_button.c @@ -262,7 +262,7 @@ EAPI Evas_Object * elm_fileselector_button_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elc_fileselector_entry.c b/src/lib/elementary/elc_fileselector_entry.c index d752e49..048be29 100644 --- a/src/lib/elementary/elc_fileselector_entry.c +++ b/src/lib/elementary/elc_fileselector_entry.c @@ -331,7 +331,7 @@ EAPI Evas_Object * elm_fileselector_entry_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elc_hoversel.c b/src/lib/elementary/elc_hoversel.c index a81212c..e5cf4ff 100644 --- a/src/lib/elementary/elc_hoversel.c +++ b/src/lib/elementary/elc_hoversel.c @@ -685,7 +685,7 @@ EAPI Evas_Object * elm_hoversel_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elc_naviframe.c b/src/lib/elementary/elc_naviframe.c index a56c0cf..97d963e 100644 --- a/src/lib/elementary/elc_naviframe.c +++ b/src/lib/elementary/elc_naviframe.c @@ -1581,7 +1581,7 @@ EAPI Evas_Object * elm_naviframe_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elc_player.c b/src/lib/elementary/elc_player.c index 27645a9..7249bb6 100644 --- a/src/lib/elementary/elc_player.c +++ b/src/lib/elementary/elc_player.c @@ -658,7 +658,7 @@ EAPI Evas_Object * elm_player_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elc_popup.c b/src/lib/elementary/elc_popup.c index fc4f6a4..3a2f221 100644 --- a/src/lib/elementary/elc_popup.c +++ b/src/lib/elementary/elc_popup.c @@ -1515,7 +1515,7 @@ EAPI Evas_Object * elm_popup_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - Evas_Object *obj = efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + Evas_Object *obj = elm_legacy_add(MY_CLASS, parent); ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); wd->highlight_root = EINA_TRUE; diff --git a/src/lib/elementary/elm_access.c b/src/lib/elementary/elm_access.c index fd953d1..47c45a7 100644 --- a/src/lib/elementary/elm_access.c +++ b/src/lib/elementary/elm_access.c @@ -1260,7 +1260,7 @@ static Evas_Object * _elm_access_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_actionslider.c b/src/lib/elementary/elm_actionslider.c index f7ea011..1fdbf29 100644 --- a/src/lib/elementary/elm_actionslider.c +++ b/src/lib/elementary/elm_actionslider.c @@ -539,7 +539,7 @@ EAPI Evas_Object * elm_actionslider_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_box.c b/src/lib/elementary/elm_box.c index b59705d..6b4a886 100644 --- a/src/lib/elementary/elm_box.c +++ b/src/lib/elementary/elm_box.c @@ -366,7 +366,7 @@ EAPI Evas_Object * elm_box_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_bubble.c b/src/lib/elementary/elm_bubble.c index 915bf43..b46018a 100644 --- a/src/lib/elementary/elm_bubble.c +++ b/src/lib/elementary/elm_bubble.c @@ -187,7 +187,7 @@ EAPI Evas_Object * elm_bubble_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_calendar.c b/src/lib/elementary/elm_calendar.c index 5155389..e236bdc 100644 --- a/src/lib/elementary/elm_calendar.c +++ b/src/lib/elementary/elm_calendar.c @@ -1602,7 +1602,7 @@ EAPI Evas_Object * elm_calendar_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_clock.c b/src/lib/elementary/elm_clock.c index 4a2f528..757363d 100644 --- a/src/lib/elementary/elm_clock.c +++ b/src/lib/elementary/elm_clock.c @@ -775,7 +775,7 @@ EAPI Evas_Object * elm_clock_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c index 175bc86..1ce0ffa 100644 --- a/src/lib/elementary/elm_code_widget.c +++ b/src/lib/elementary/elm_code_widget.c @@ -61,8 +61,7 @@ EAPI Evas_Object * elm_code_widget_add(Evas_Object *parent, Elm_Code *code) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, elm_obj_code_widget_code_set(efl_added, code), - efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent, elm_obj_code_widget_code_set(efl_added, code)); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_colorselector.c b/src/lib/elementary/elm_colorselector.c index 710c337..e96ea0a 100644 --- a/src/lib/elementary/elm_colorselector.c +++ b/src/lib/elementary/elm_colorselector.c @@ -1882,9 +1882,8 @@ _palette_colors_load(Evas_Object *obj) } static inline void -_palette_box_prepare(Eo *o, Eina_Bool legacy) +_palette_box_prepare(Eo *o) { - if (legacy) efl_canvas_object_legacy_ctor(o); efl_ui_direction_set(o, EFL_UI_DIR_HORIZONTAL); efl_gfx_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); efl_gfx_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL); @@ -1903,8 +1902,16 @@ _create_colorpalette(Evas_Object *obj) ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); if (sd->palette_box) return; - sd->palette_box = efl_add(EFL_UI_BOX_FLOW_CLASS, obj, - _palette_box_prepare(efl_added, wd->legacy)); + if (elm_widget_is_legacy(obj)) + { + sd->palette_box = elm_legacy_add(EFL_UI_BOX_FLOW_CLASS, obj, + _palette_box_prepare(efl_added)); + } + else + { + sd->palette_box = efl_add(EFL_UI_BOX_FLOW_CLASS, obj, + _palette_box_prepare(efl_added)); + } hpadstr = edje_object_data_get(wd->resize_obj, "horizontal_pad"); if (hpadstr) h_pad = atoi(hpadstr); @@ -2259,7 +2266,7 @@ EAPI Evas_Object * elm_colorselector_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_conform.c b/src/lib/elementary/elm_conform.c index 4e88196..55f04de 100644 --- a/src/lib/elementary/elm_conform.c +++ b/src/lib/elementary/elm_conform.c @@ -992,7 +992,7 @@ EAPI Evas_Object * elm_conformant_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_datetime.c b/src/lib/elementary/elm_datetime.c index 6c9f34d..fc68f87 100644 --- a/src/lib/elementary/elm_datetime.c +++ b/src/lib/elementary/elm_datetime.c @@ -21,7 +21,7 @@ EAPI Evas_Object * elm_datetime_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(EFL_UI_CLOCK_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(EFL_UI_CLOCK_CLASS, parent); } EAPI void diff --git a/src/lib/elementary/elm_dayselector.c b/src/lib/elementary/elm_dayselector.c index ebd038f..68b8dd8 100644 --- a/src/lib/elementary/elm_dayselector.c +++ b/src/lib/elementary/elm_dayselector.c @@ -447,7 +447,7 @@ EAPI Evas_Object * elm_dayselector_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_diskselector.c b/src/lib/elementary/elm_diskselector.c index ee87733..fe27ed7 100644 --- a/src/lib/elementary/elm_diskselector.c +++ b/src/lib/elementary/elm_diskselector.c @@ -1407,7 +1407,7 @@ EAPI Evas_Object * elm_diskselector_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c index da8782a..c6018fc 100644 --- a/src/lib/elementary/elm_entry.c +++ b/src/lib/elementary/elm_entry.c @@ -4005,7 +4005,7 @@ EAPI Evas_Object * elm_entry_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } static void diff --git a/src/lib/elementary/elm_flipselector.c b/src/lib/elementary/elm_flipselector.c index bce73f9..cb078c6 100644 --- a/src/lib/elementary/elm_flipselector.c +++ b/src/lib/elementary/elm_flipselector.c @@ -654,7 +654,7 @@ EAPI Evas_Object * elm_flipselector_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EAPI void diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c index 42ab62b..6923a0b 100644 --- a/src/lib/elementary/elm_gengrid.c +++ b/src/lib/elementary/elm_gengrid.c @@ -4231,7 +4231,7 @@ EAPI Evas_Object * elm_gengrid_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } static void diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c index 8edbe02..6c77edf 100644 --- a/src/lib/elementary/elm_genlist.c +++ b/src/lib/elementary/elm_genlist.c @@ -5783,7 +5783,7 @@ EAPI Evas_Object * elm_genlist_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_gesture_layer.c b/src/lib/elementary/elm_gesture_layer.c index ef28604..d64ff58 100644 --- a/src/lib/elementary/elm_gesture_layer.c +++ b/src/lib/elementary/elm_gesture_layer.c @@ -3834,7 +3834,7 @@ EAPI Evas_Object * elm_gesture_layer_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_glview.c b/src/lib/elementary/elm_glview.c index 5424eb4..d1a96f5 100644 --- a/src/lib/elementary/elm_glview.c +++ b/src/lib/elementary/elm_glview.c @@ -339,18 +339,16 @@ EAPI Evas_Object * elm_glview_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, - elm_obj_glview_version_constructor(efl_added, EVAS_GL_GLES_2_X), - efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent, + elm_obj_glview_version_constructor(efl_added, EVAS_GL_GLES_2_X)); } EAPI Evas_Object * elm_glview_version_add(Evas_Object *parent, Evas_GL_Context_Version version) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, - elm_obj_glview_version_constructor(efl_added, version), - efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent, + elm_obj_glview_version_constructor(efl_added, version)); } EOLIAN static void diff --git a/src/lib/elementary/elm_grid.c b/src/lib/elementary/elm_grid.c index bdfb4a5..f189a7d 100644 --- a/src/lib/elementary/elm_grid.c +++ b/src/lib/elementary/elm_grid.c @@ -90,7 +90,7 @@ EAPI Evas_Object * elm_grid_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_hover.c b/src/lib/elementary/elm_hover.c index 696a080..d87df91 100644 --- a/src/lib/elementary/elm_hover.c +++ b/src/lib/elementary/elm_hover.c @@ -695,7 +695,7 @@ EAPI Evas_Object * elm_hover_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_icon.c b/src/lib/elementary/elm_icon.c index 3515c42..5fdc294 100644 --- a/src/lib/elementary/elm_icon.c +++ b/src/lib/elementary/elm_icon.c @@ -604,7 +604,7 @@ EAPI Evas_Object * elm_icon_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_index.c b/src/lib/elementary/elm_index.c index 72b8793..91fb2e3 100644 --- a/src/lib/elementary/elm_index.c +++ b/src/lib/elementary/elm_index.c @@ -1189,7 +1189,7 @@ EAPI Evas_Object * elm_index_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EAPI void elm_index_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) diff --git a/src/lib/elementary/elm_interface_scrollable.c b/src/lib/elementary/elm_interface_scrollable.c index 522deba..8f1371f 100644 --- a/src/lib/elementary/elm_interface_scrollable.c +++ b/src/lib/elementary/elm_interface_scrollable.c @@ -192,7 +192,7 @@ _elm_pan_content_size_get(Eo *obj EINA_UNUSED, Elm_Pan_Smart_Data *psd, Evas_Coo static Evas_Object * _elm_pan_add(Evas *evas) { - return efl_add(MY_PAN_CLASS, evas, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_PAN_CLASS, evas); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_inwin.c b/src/lib/elementary/elm_inwin.c index 76becb4..7e7cb8a 100644 --- a/src/lib/elementary/elm_inwin.c +++ b/src/lib/elementary/elm_inwin.c @@ -74,7 +74,7 @@ EAPI Evas_Object * elm_win_inwin_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_label.c b/src/lib/elementary/elm_label.c index b9b9887..8d49334 100644 --- a/src/lib/elementary/elm_label.c +++ b/src/lib/elementary/elm_label.c @@ -417,7 +417,7 @@ EAPI Evas_Object * elm_label_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_list.c b/src/lib/elementary/elm_list.c index e343c06..47f63df 100644 --- a/src/lib/elementary/elm_list.c +++ b/src/lib/elementary/elm_list.c @@ -2505,7 +2505,7 @@ EAPI Evas_Object * elm_list_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_map.c b/src/lib/elementary/elm_map.c index 5093e9d..5c2e68d 100644 --- a/src/lib/elementary/elm_map.c +++ b/src/lib/elementary/elm_map.c @@ -4284,7 +4284,7 @@ EAPI Evas_Object * elm_map_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_mapbuf.c b/src/lib/elementary/elm_mapbuf.c index 98fa838..f6886a6 100644 --- a/src/lib/elementary/elm_mapbuf.c +++ b/src/lib/elementary/elm_mapbuf.c @@ -309,7 +309,7 @@ EAPI Evas_Object * elm_mapbuf_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_menu.c b/src/lib/elementary/elm_menu.c index 7cffe95..cb34abb 100644 --- a/src/lib/elementary/elm_menu.c +++ b/src/lib/elementary/elm_menu.c @@ -800,7 +800,7 @@ EAPI Evas_Object * elm_menu_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Efl_Ui_Focus_Manager* diff --git a/src/lib/elementary/elm_notify.c b/src/lib/elementary/elm_notify.c index 7a80d83..afffc90 100644 --- a/src/lib/elementary/elm_notify.c +++ b/src/lib/elementary/elm_notify.c @@ -471,7 +471,7 @@ EAPI Evas_Object * elm_notify_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_panel.c b/src/lib/elementary/elm_panel.c index d6d59ee..b7d4bcd 100644 --- a/src/lib/elementary/elm_panel.c +++ b/src/lib/elementary/elm_panel.c @@ -955,7 +955,7 @@ EAPI Evas_Object * elm_panel_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - Evas_Object *obj = efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + Evas_Object *obj = elm_legacy_add(MY_CLASS, parent); ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL); wd->highlight_root = EINA_TRUE; diff --git a/src/lib/elementary/elm_photo.c b/src/lib/elementary/elm_photo.c index 47b7756..151dc26 100644 --- a/src/lib/elementary/elm_photo.c +++ b/src/lib/elementary/elm_photo.c @@ -297,7 +297,7 @@ EAPI Evas_Object * elm_photo_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_plug.c b/src/lib/elementary/elm_plug.c index de55ef3..9fe6406 100644 --- a/src/lib/elementary/elm_plug.c +++ b/src/lib/elementary/elm_plug.c @@ -136,7 +136,7 @@ EAPI Evas_Object * elm_plug_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_prefs.c b/src/lib/elementary/elm_prefs.c index f5bb289..0077789 100644 --- a/src/lib/elementary/elm_prefs.c +++ b/src/lib/elementary/elm_prefs.c @@ -483,7 +483,7 @@ elm_prefs_add(Evas_Object *parent) return NULL; } - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_route.c b/src/lib/elementary/elm_route.c index 4a03775..ba4f64e 100644 --- a/src/lib/elementary/elm_route.c +++ b/src/lib/elementary/elm_route.c @@ -178,7 +178,7 @@ EAPI Evas_Object * elm_route_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_scroller.c b/src/lib/elementary/elm_scroller.c index 9fe6f14..7198593 100644 --- a/src/lib/elementary/elm_scroller.c +++ b/src/lib/elementary/elm_scroller.c @@ -849,7 +849,7 @@ EAPI Evas_Object * elm_scroller_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } static void diff --git a/src/lib/elementary/elm_segment_control.c b/src/lib/elementary/elm_segment_control.c index de995b4..600219f 100644 --- a/src/lib/elementary/elm_segment_control.c +++ b/src/lib/elementary/elm_segment_control.c @@ -672,7 +672,7 @@ EAPI Evas_Object * elm_segment_control_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_separator.c b/src/lib/elementary/elm_separator.c index 3301445..e720f4e 100644 --- a/src/lib/elementary/elm_separator.c +++ b/src/lib/elementary/elm_separator.c @@ -63,7 +63,7 @@ EAPI Evas_Object * elm_separator_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_slideshow.c b/src/lib/elementary/elm_slideshow.c index af57fa5..b37cba6 100644 --- a/src/lib/elementary/elm_slideshow.c +++ b/src/lib/elementary/elm_slideshow.c @@ -367,7 +367,7 @@ EAPI Evas_Object * elm_slideshow_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_spinner.c b/src/lib/elementary/elm_spinner.c index ac41e98..cad5076 100644 --- a/src/lib/elementary/elm_spinner.c +++ b/src/lib/elementary/elm_spinner.c @@ -1353,7 +1353,7 @@ EAPI Evas_Object * elm_spinner_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EAPI void diff --git a/src/lib/elementary/elm_table.c b/src/lib/elementary/elm_table.c index cd6c193..ca3de60 100644 --- a/src/lib/elementary/elm_table.c +++ b/src/lib/elementary/elm_table.c @@ -129,7 +129,7 @@ EAPI Evas_Object * elm_table_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_thumb.c b/src/lib/elementary/elm_thumb.c index 68202c6..4dfb1df 100644 --- a/src/lib/elementary/elm_thumb.c +++ b/src/lib/elementary/elm_thumb.c @@ -579,7 +579,7 @@ EAPI Evas_Object * elm_thumb_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eo * diff --git a/src/lib/elementary/elm_toolbar.c b/src/lib/elementary/elm_toolbar.c index 64a3706..6df060f 100644 --- a/src/lib/elementary/elm_toolbar.c +++ b/src/lib/elementary/elm_toolbar.c @@ -2948,7 +2948,7 @@ EAPI Evas_Object * elm_toolbar_add(Evas_Object *parent) { EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(MY_CLASS, parent); } EOLIAN static Eina_Bool diff --git a/src/lib/elementary/elm_web2.c b/src/lib/elementary/elm_web2.c index e117497..170ae42 100644 --- a/src/lib/elementary/elm_web2.c +++ b/src/lib/elementary/elm_web2.c @@ -80,7 +80,7 @@ elm_web_add(Evas_Object *parent) { if (!parent || !ewm.class_get) return NULL; - return efl_add(ewm.class_get(), parent, efl_canvas_object_legacy_ctor(efl_added)); + return elm_legacy_add(ewm.class_get(), parent); } EAPI const Efl_Class * diff --git a/src/lib/elementary/elm_widget.c b/src/lib/elementary/elm_widget.c index 26ec156..022f1f3 100644 --- a/src/lib/elementary/elm_widget.c +++ b/src/lib/elementary/elm_widget.c @@ -53,6 +53,8 @@ typedef struct _Elm_Event_Cb_Data Elm_Event_Cb_Data; typedef struct _Elm_Label_Data Elm_Label_Data; typedef struct _Elm_Translate_String_Data Elm_Translate_String_Data; +Eina_Bool _elm_legacy_add = EINA_FALSE; + struct _Elm_Event_Cb_Data { Elm_Event_Cb func; @@ -2968,7 +2970,7 @@ elm_widget_theme_get(const Evas_Object *obj) EOLIAN static Efl_Ui_Theme_Apply _elm_widget_style_set(Eo *obj, Elm_Widget_Smart_Data *sd, const char *style) { - if (!sd->legacy && efl_finalized_get(obj)) + if (!elm_widget_is_legacy(obj) && efl_finalized_get(obj)) { ERR("Efl.Ui.Widget.style can only be set before finalize!"); return EFL_UI_THEME_APPLY_FAILED; @@ -5117,6 +5119,8 @@ _elm_widget_efl_object_constructor(Eo *obj, Elm_Widget_Smart_Data *sd EINA_UNUSE Eo *parent = NULL; sd->on_create = EINA_TRUE; + sd->legacy = _elm_legacy_add; + _elm_legacy_add = EINA_FALSE; efl_canvas_group_clipped_set(obj, EINA_FALSE); obj = efl_constructor(efl_super(obj, MY_CLASS)); efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY); @@ -5170,6 +5174,7 @@ _elm_widget_legacy_ctor(Eo *obj, Elm_Widget_Smart_Data *sd) { efl_canvas_object_legacy_ctor(efl_super(obj, MY_CLASS)); sd->legacy = EINA_TRUE; + _elm_legacy_add = EINA_FALSE; } EOLIAN static void diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h index 82e17bc..aa5d11d 100644 --- a/src/lib/elementary/elm_widget.h +++ b/src/lib/elementary/elm_widget.h @@ -809,11 +809,19 @@ _elm_widget_sub_object_redirect_to_top(Evas_Object *obj, Evas_Object *sobj) return ret; } +/* Internal hack to mark legacy objects as such before construction. + * No need for TLS: Only UI objects created in the main loop matter. */ +extern Eina_Bool _elm_legacy_add; +#define elm_legacy_add(k, p, ...) ({ _elm_legacy_add = 1; \ + efl_add(k, p, efl_canvas_object_legacy_ctor(efl_added), ##__VA_ARGS__); }) + static inline Eina_Bool elm_widget_is_legacy(const Eo *obj) { - Elm_Widget_Smart_Data *sd = (Elm_Widget_Smart_Data *) - efl_data_scope_safe_get(obj, ELM_WIDGET_CLASS); + Elm_Widget_Smart_Data *sd; + + if (_elm_legacy_add) return EINA_TRUE; + sd = (Elm_Widget_Smart_Data *) efl_data_scope_safe_get(obj, ELM_WIDGET_CLASS); return sd ? sd->legacy : EINA_FALSE; }