diff --git a/src/core/lv_obj.c b/src/core/lv_obj.c index c81cfd684..4a51bae05 100644 --- a/src/core/lv_obj.c +++ b/src/core/lv_obj.c @@ -64,8 +64,8 @@ typedef struct _lv_event_dsc_t{ /********************** * STATIC PROTOTYPES **********************/ -static void lv_obj_constructor(lv_obj_t * obj); -static void lv_obj_destructor(lv_obj_t * obj); +static void lv_obj_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); +static void lv_obj_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_obj_draw(lv_obj_t * obj, lv_event_t e); static void lv_obj_event_cb(lv_obj_t * obj, lv_event_t e); static void draw_scrollbar(lv_obj_t * obj, const lv_area_t * clip_area); @@ -575,8 +575,9 @@ bool lv_obj_is_valid(const lv_obj_t * obj) * STATIC FUNCTIONS **********************/ -static void lv_obj_constructor(lv_obj_t * obj) +static void lv_obj_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); LV_TRACE_OBJ_CREATE("begin"); lv_obj_t * parent = obj->parent; @@ -604,9 +605,10 @@ static void lv_obj_constructor(lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static void lv_obj_destructor(lv_obj_t * p) +static void lv_obj_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { - lv_obj_t * obj = p; + LV_UNUSED(class_p); + if(obj->spec_attr) { if(obj->spec_attr->children) { lv_mem_free(obj->spec_attr->children); diff --git a/src/core/lv_obj_class.c b/src/core/lv_obj_class.c index 1965762e5..6824e4397 100644 --- a/src/core/lv_obj_class.c +++ b/src/core/lv_obj_class.c @@ -115,16 +115,16 @@ lv_obj_t * lv_obj_create_from_class(const lv_obj_class_t * class_p, lv_obj_t * p return obj; } -void _lv_obj_destruct(lv_obj_t * obj) +void _lv_obj_destructor(lv_obj_t * obj) { - if(obj->class_p->destructor_cb) obj->class_p->destructor_cb(obj); + if(obj->class_p->destructor_cb) obj->class_p->destructor_cb(obj->class_p, obj); if(obj->class_p->base_class) { /*Don't let the descendant methods run during destructing the ancestor type*/ obj->class_p = obj->class_p->base_class; /*Call the base class's destructor too*/ - _lv_obj_destruct(obj); + _lv_obj_destructor(obj); } } @@ -170,7 +170,7 @@ static void lv_obj_construct(lv_obj_t * obj) /*Restore the original class*/ obj->class_p = original_class_p; - if(obj->class_p->constructor_cb) obj->class_p->constructor_cb(obj); + if(obj->class_p->constructor_cb) obj->class_p->constructor_cb(obj->class_p, obj); } static uint32_t get_instance_size(const lv_obj_class_t * class_p) diff --git a/src/core/lv_obj_class.h b/src/core/lv_obj_class.h index e5487d5db..9c232b160 100644 --- a/src/core/lv_obj_class.h +++ b/src/core/lv_obj_class.h @@ -45,8 +45,8 @@ typedef enum { */ typedef struct _lv_obj_class_t { const struct _lv_obj_class_t * base_class; - void (*constructor_cb)(struct _lv_obj_t * obj); - void (*destructor_cb)(struct _lv_obj_t * obj); + void (*constructor_cb)(const struct _lv_obj_class_t * class_p, struct _lv_obj_t * obj); + void (*destructor_cb)(const struct _lv_obj_class_t * class_p, struct _lv_obj_t * obj); #if LV_USE_USER_DATA void * user_data; #endif @@ -70,7 +70,7 @@ typedef struct _lv_obj_class_t { */ struct _lv_obj_t * lv_obj_create_from_class(const struct _lv_obj_class_t * class_p, struct _lv_obj_t * parent); -void _lv_obj_destruct(struct _lv_obj_t * obj); +void _lv_obj_destructor(struct _lv_obj_t * obj); bool lv_obj_is_editable(struct _lv_obj_t * obj); diff --git a/src/core/lv_obj_tree.c b/src/core/lv_obj_tree.c index f96f60a03..44a328ed9 100644 --- a/src/core/lv_obj_tree.c +++ b/src/core/lv_obj_tree.c @@ -373,7 +373,7 @@ static void obj_del_core(lv_obj_t * obj) } /*All children deleted. Now clean up the object specific data*/ - _lv_obj_destruct(obj); + _lv_obj_destructor(obj); /*Remove the screen for the screen list*/ if(obj->parent == NULL) { diff --git a/src/extra/widgets/calendar/lv_calendar.c b/src/extra/widgets/calendar/lv_calendar.c index da10abca9..32f27e5b1 100644 --- a/src/extra/widgets/calendar/lv_calendar.c +++ b/src/extra/widgets/calendar/lv_calendar.c @@ -23,7 +23,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void my_constructor(lv_obj_t * obj); +static void my_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void draw_event_cb(lv_obj_t * obj, lv_event_t e); static uint8_t get_day_of_week(uint32_t year, uint32_t month, uint32_t day); @@ -206,8 +206,9 @@ bool lv_calendar_get_pressed_date(const lv_obj_t * obj, lv_calendar_date_t * dat * STATIC FUNCTIONS **********************/ -static void my_constructor(lv_obj_t * obj) +static void my_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); lv_calendar_t * calendar = (lv_calendar_t *)obj; /*Initialize the allocated 'ext'*/ diff --git a/src/extra/widgets/colorwheel/lv_colorwheel.c b/src/extra/widgets/colorwheel/lv_colorwheel.c index ab75c354a..048150d9d 100644 --- a/src/extra/widgets/colorwheel/lv_colorwheel.c +++ b/src/extra/widgets/colorwheel/lv_colorwheel.c @@ -32,7 +32,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_colorwheel_constructor(lv_obj_t * obj); +static void lv_colorwheel_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_colorwheel_event(lv_obj_t * obj, lv_event_t e); static void draw_disc_grad(lv_obj_t * obj); @@ -208,8 +208,9 @@ bool lv_colorwheel_get_color_mode_fixed(lv_obj_t * obj) * STATIC FUNCTIONS **********************/ -static void lv_colorwheel_constructor(lv_obj_t * obj) +static void lv_colorwheel_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); lv_colorwheel_t * colorwheel = (lv_colorwheel_t *)obj; colorwheel->hsv.h = 0; colorwheel->hsv.s = 100; diff --git a/src/extra/widgets/imgbtn/lv_imgbtn.c b/src/extra/widgets/imgbtn/lv_imgbtn.c index e1af3d7c9..51da085de 100644 --- a/src/extra/widgets/imgbtn/lv_imgbtn.c +++ b/src/extra/widgets/imgbtn/lv_imgbtn.c @@ -23,7 +23,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_imgbtn_constructor(lv_obj_t * obj); +static void lv_imgbtn_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void draw_main(lv_obj_t * obj); static void lv_imgbtn_event(lv_obj_t * imgbtn, lv_event_t e); static void refr_img(lv_obj_t * imgbtn); @@ -147,8 +147,9 @@ const void * lv_imgbtn_get_src_right(lv_obj_t * obj, lv_imgbtn_state_t state) * STATIC FUNCTIONS **********************/ -static void lv_imgbtn_constructor(lv_obj_t * obj) +static void lv_imgbtn_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); lv_imgbtn_t * imgbtn = (lv_imgbtn_t *)obj; /*Initialize the allocated 'ext'*/ lv_memset_00((void *)imgbtn->img_src_mid, sizeof(imgbtn->img_src_mid)); diff --git a/src/extra/widgets/keyboard/lv_keyboard.c b/src/extra/widgets/keyboard/lv_keyboard.c index c0189109f..44731d2b5 100644 --- a/src/extra/widgets/keyboard/lv_keyboard.c +++ b/src/extra/widgets/keyboard/lv_keyboard.c @@ -23,7 +23,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_keyboard_constructor(lv_obj_t * obj); +static void lv_keyboard_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_keyboard_update_map(lv_obj_t * obj); @@ -320,8 +320,9 @@ void lv_keyboard_def_event_cb(lv_obj_t * obj, lv_event_t event) * STATIC FUNCTIONS **********************/ -static void lv_keyboard_constructor(lv_obj_t * obj) +static void lv_keyboard_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICK_FOCUSABLE); lv_keyboard_t * keyboard = (lv_keyboard_t *)obj; diff --git a/src/extra/widgets/led/lv_led.c b/src/extra/widgets/led/lv_led.c index 7cea3a7a5..e50ae975d 100644 --- a/src/extra/widgets/led/lv_led.c +++ b/src/extra/widgets/led/lv_led.c @@ -29,7 +29,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_led_constructor(lv_obj_t * obj); +static void lv_led_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_led_event(lv_obj_t * obj, lv_event_t e); /********************** @@ -147,8 +147,9 @@ uint8_t lv_led_get_brightness(const lv_obj_t * obj) * STATIC FUNCTIONS **********************/ -static void lv_led_constructor(lv_obj_t * obj) +static void lv_led_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); lv_led_t * led = (lv_led_t *)obj; led->color = lv_theme_get_color_primary(obj); led->bright = LV_LED_BRIGHT_MAX; diff --git a/src/extra/widgets/spinbox/lv_spinbox.c b/src/extra/widgets/spinbox/lv_spinbox.c index 768084ae3..db50fbde6 100644 --- a/src/extra/widgets/spinbox/lv_spinbox.c +++ b/src/extra/widgets/spinbox/lv_spinbox.c @@ -22,7 +22,7 @@ * STATIC PROTOTYPES **********************/ -static void lv_spinbox_constructor(lv_obj_t * obj); +static void lv_spinbox_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_spinbox_event(lv_obj_t * obj, lv_event_t e); static void lv_spinbox_updatevalue(lv_obj_t * obj); @@ -269,8 +269,9 @@ void lv_spinbox_decrement(lv_obj_t * obj) * STATIC FUNCTIONS **********************/ -static void lv_spinbox_constructor(lv_obj_t * obj) +static void lv_spinbox_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); LV_LOG_TRACE("begin"); lv_spinbox_t * spinbox = (lv_spinbox_t *)obj; diff --git a/src/extra/widgets/tabview/lv_tabview.c b/src/extra/widgets/tabview/lv_tabview.c index cb1b0ec68..a51383ac5 100644 --- a/src/extra/widgets/tabview/lv_tabview.c +++ b/src/extra/widgets/tabview/lv_tabview.c @@ -20,8 +20,8 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_tabview_constructor(lv_obj_t * obj); -static void lv_tabview_destructor(lv_obj_t * obj); +static void lv_tabview_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); +static void lv_tabview_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void btns_event_cb(lv_obj_t * btns, lv_event_t e); static void cont_event_cb(lv_obj_t * cont, lv_event_t e); @@ -146,8 +146,9 @@ lv_obj_t * lv_tabview_get_tab_btns(lv_obj_t * tv) * STATIC FUNCTIONS **********************/ -static void lv_tabview_constructor(lv_obj_t * obj) +static void lv_tabview_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); lv_tabview_t * tabview = (lv_tabview_t *)obj; tabview->tab_pos = tabpos_create; @@ -209,8 +210,9 @@ static void lv_tabview_constructor(lv_obj_t * obj) lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLL_ON_FOCUS); } -static void lv_tabview_destructor(lv_obj_t * obj) +static void lv_tabview_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); lv_tabview_t * tabview = (lv_tabview_t *)obj; uint32_t i; diff --git a/src/extra/widgets/tileview/lv_tileview.c b/src/extra/widgets/tileview/lv_tileview.c index df7c67854..4edb5a1ac 100644 --- a/src/extra/widgets/tileview/lv_tileview.c +++ b/src/extra/widgets/tileview/lv_tileview.c @@ -20,8 +20,8 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_tileview_constructor(lv_obj_t * obj); -static void lv_tileview_tile_constructor(lv_obj_t * obj); +static void lv_tileview_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); +static void lv_tileview_tile_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void tileview_event_cb(lv_obj_t * tv, lv_event_t e); /********************** @@ -101,8 +101,9 @@ void lv_obj_set_tile_id(lv_obj_t * tv, uint32_t col_id, uint32_t row_id, lv_anim * STATIC FUNCTIONS **********************/ -static void lv_tileview_constructor(lv_obj_t * obj) +static void lv_tileview_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); lv_obj_set_size(obj, LV_SIZE_PCT(100), LV_SIZE_PCT(100)); lv_obj_add_event_cb(obj, tileview_event_cb, NULL); lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ONE); @@ -111,8 +112,9 @@ static void lv_tileview_constructor(lv_obj_t * obj) } -static void lv_tileview_tile_constructor(lv_obj_t * obj) +static void lv_tileview_tile_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); lv_obj_t * parent = lv_obj_get_parent(obj); lv_obj_set_size(obj, LV_SIZE_PCT(100), LV_SIZE_PCT(100)); lv_obj_set_pos(obj, create_col_id * lv_obj_get_width_fit(parent), create_row_id * lv_obj_get_height_fit(parent)); diff --git a/src/extra/widgets/win/lv_win.c b/src/extra/widgets/win/lv_win.c index ca9ebe966..74b622b0a 100644 --- a/src/extra/widgets/win/lv_win.c +++ b/src/extra/widgets/win/lv_win.c @@ -21,7 +21,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_win_constructor(lv_obj_t * obj); +static void lv_win_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); /********************** * STATIC VARIABLES @@ -86,8 +86,9 @@ lv_obj_t * lv_win_get_content(lv_obj_t * win) * STATIC FUNCTIONS **********************/ -static void lv_win_constructor(lv_obj_t * obj) +static void lv_win_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); lv_obj_t * parent = lv_obj_get_parent(obj); lv_obj_set_size(obj, lv_obj_get_width(parent), lv_obj_get_height(parent)); lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_COLUMN); diff --git a/src/misc/lv_tlsf.c b/src/misc/lv_tlsf.c index 1c605edd7..0ae03c9e0 100644 --- a/src/misc/lv_tlsf.c +++ b/src/misc/lv_tlsf.c @@ -818,7 +818,7 @@ static void* block_prepare_used(control_t* control, block_header_t* block, size_ } /* Clear structure and point all empty lists at the null block. */ -static void control_construct(control_t* control) +static void control_constructor(control_t* control) { int i, j; @@ -1113,7 +1113,7 @@ tlsf_t tlsf_create(void* mem) return 0; } - control_construct(tlsf_cast(control_t*, mem)); + control_constructor(tlsf_cast(control_t*, mem)); return tlsf_cast(tlsf_t, mem); } diff --git a/src/widgets/lv_arc.c b/src/widgets/lv_arc.c index c83c3fac3..80db692d0 100644 --- a/src/widgets/lv_arc.c +++ b/src/widgets/lv_arc.c @@ -30,7 +30,7 @@ * STATIC PROTOTYPES **********************/ -static void lv_arc_constructor(lv_obj_t * obj); +static void lv_arc_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_arc_draw(lv_obj_t * obj); static void lv_arc_event(lv_obj_t * obj, lv_event_t e); static void inv_arc_area(lv_obj_t * arc, uint16_t start_angle, uint16_t end_angle, lv_part_t part); @@ -479,8 +479,9 @@ lv_arc_type_t lv_arc_get_type(const lv_obj_t * obj) * STATIC FUNCTIONS **********************/ -static void lv_arc_constructor(lv_obj_t * obj) +static void lv_arc_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); LV_TRACE_OBJ_CREATE("begin"); lv_arc_t * arc = (lv_arc_t *)obj; diff --git a/src/widgets/lv_bar.c b/src/widgets/lv_bar.c index fee672c27..6de4d2bcd 100644 --- a/src/widgets/lv_bar.c +++ b/src/widgets/lv_bar.c @@ -45,8 +45,8 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_bar_constructor(lv_obj_t * obj); -static void lv_bar_destructor(lv_obj_t * obj); +static void lv_bar_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); +static void lv_bar_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_bar_event(lv_obj_t * bar, lv_event_t e); static void draw_indic(lv_obj_t * bar); static void lv_bar_set_value_with_anim(lv_obj_t * obj, int16_t new_value, int16_t * value_ptr, @@ -200,8 +200,9 @@ lv_bar_mode_t lv_bar_get_mode(lv_obj_t * obj) * STATIC FUNCTIONS **********************/ -static void lv_bar_constructor(lv_obj_t * obj) +static void lv_bar_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); LV_TRACE_OBJ_CREATE("begin"); lv_bar_t * bar = (lv_bar_t *)obj; @@ -221,8 +222,9 @@ static void lv_bar_constructor(lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static void lv_bar_destructor(lv_obj_t * obj) +static void lv_bar_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); lv_bar_t * bar = (lv_bar_t *)obj; lv_anim_del(&bar->cur_value_anim, NULL); diff --git a/src/widgets/lv_btn.c b/src/widgets/lv_btn.c index c208a4660..668b04567 100644 --- a/src/widgets/lv_btn.c +++ b/src/widgets/lv_btn.c @@ -23,7 +23,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_btn_constructor(lv_obj_t * obj); +static void lv_btn_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); /********************** * STATIC VARIABLES @@ -55,8 +55,9 @@ lv_obj_t * lv_btn_create(lv_obj_t * parent) * STATIC FUNCTIONS **********************/ -static void lv_btn_constructor(lv_obj_t * obj) +static void lv_btn_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); LV_TRACE_OBJ_CREATE("begin"); lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE); diff --git a/src/widgets/lv_btnmatrix.c b/src/widgets/lv_btnmatrix.c index 782cb9687..70d65a997 100644 --- a/src/widgets/lv_btnmatrix.c +++ b/src/widgets/lv_btnmatrix.c @@ -32,8 +32,8 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_btnmatrix_constructor(lv_obj_t * obj); -static void lv_btnmatrix_destructor(lv_obj_t * obj); +static void lv_btnmatrix_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); +static void lv_btnmatrix_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_btnmatrix_event(lv_obj_t * obj, lv_event_t e); static void draw_main(lv_obj_t * obj); @@ -356,8 +356,10 @@ bool lv_btnmatrix_get_one_checked(const lv_obj_t * obj) * STATIC FUNCTIONS **********************/ -static void lv_btnmatrix_constructor(lv_obj_t * obj) +static void lv_btnmatrix_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); + LV_TRACE_OBJ_CREATE("begin"); lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj; btnm->btn_cnt = 0; btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; @@ -369,16 +371,19 @@ static void lv_btnmatrix_constructor(lv_obj_t * obj) lv_btnmatrix_set_map(obj, lv_btnmatrix_def_map); - LV_LOG_TRACE("finshed"); + LV_TRACE_OBJ_CREATE("finshed"); } -static void lv_btnmatrix_destructor(lv_obj_t * obj) +static void lv_btnmatrix_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_TRACE_OBJ_CREATE("begin"); + LV_UNUSED(class_p); lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj; lv_mem_free(btnm->button_areas); lv_mem_free(btnm->ctrl_bits); btnm->button_areas = NULL; btnm->ctrl_bits = NULL; + LV_TRACE_OBJ_CREATE("finshed"); } static void lv_btnmatrix_event(lv_obj_t * obj, lv_event_t e) diff --git a/src/widgets/lv_canvas.c b/src/widgets/lv_canvas.c index 980d7d7fa..7066bae8f 100644 --- a/src/widgets/lv_canvas.c +++ b/src/widgets/lv_canvas.c @@ -27,7 +27,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_canvas_constructor(lv_obj_t * obj); +static void lv_canvas_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void set_set_px_cb(lv_disp_drv_t * disp_drv, lv_img_cf_t cf); static void set_px_true_color_alpha(lv_disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, @@ -892,22 +892,23 @@ void lv_canvas_draw_arc(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_ * STATIC FUNCTIONS **********************/ -static void lv_canvas_constructor(lv_obj_t * obj) +static void lv_canvas_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { - LV_TRACE_OBJ_CREATE("begin"); + LV_UNUSED(class_p); + LV_TRACE_OBJ_CREATE("begin"); - lv_canvas_t * canvas = (lv_canvas_t *)obj; + lv_canvas_t * canvas = (lv_canvas_t *)obj; - canvas->dsc.header.always_zero = 0; - canvas->dsc.header.cf = LV_IMG_CF_TRUE_COLOR; - canvas->dsc.header.h = 0; - canvas->dsc.header.w = 0; - canvas->dsc.data_size = 0; - canvas->dsc.data = NULL; + canvas->dsc.header.always_zero = 0; + canvas->dsc.header.cf = LV_IMG_CF_TRUE_COLOR; + canvas->dsc.header.h = 0; + canvas->dsc.header.w = 0; + canvas->dsc.data_size = 0; + canvas->dsc.data = NULL; - lv_img_set_src(obj, &canvas->dsc); + lv_img_set_src(obj, &canvas->dsc); - LV_TRACE_OBJ_CREATE("finished"); + LV_TRACE_OBJ_CREATE("finished"); } static void set_set_px_cb(lv_disp_drv_t * disp_drv, lv_img_cf_t cf) diff --git a/src/widgets/lv_chart.c b/src/widgets/lv_chart.c index e44bf60af..df56d87f8 100644 --- a/src/widgets/lv_chart.c +++ b/src/widgets/lv_chart.c @@ -36,8 +36,8 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_chart_constructor(lv_obj_t * obj); -static void lv_chart_destructor(lv_obj_t * obj); +static void lv_chart_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); +static void lv_chart_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_chart_event(lv_obj_t * obj, lv_event_t e); static void draw_div_lines(lv_obj_t * obj , const lv_area_t * mask); @@ -564,8 +564,9 @@ uint32_t lv_chart_get_pressed_point(const lv_obj_t * obj) * STATIC FUNCTIONS **********************/ -static void lv_chart_constructor(lv_obj_t * obj) +static void lv_chart_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); LV_TRACE_OBJ_CREATE("begin"); lv_chart_t * chart = (lv_chart_t *)obj; @@ -590,8 +591,11 @@ static void lv_chart_constructor(lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static void lv_chart_destructor(lv_obj_t * obj) +static void lv_chart_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); + LV_TRACE_OBJ_CREATE("begin"); + lv_chart_t * chart = (lv_chart_t *)obj; lv_chart_series_t * ser; while(chart->series_ll.head) { @@ -603,6 +607,8 @@ static void lv_chart_destructor(lv_obj_t * obj) lv_mem_free(ser); } _lv_ll_clear(&chart->series_ll); + + LV_TRACE_OBJ_CREATE("finished"); } static void lv_chart_event(lv_obj_t * obj, lv_event_t e) diff --git a/src/widgets/lv_checkbox.c b/src/widgets/lv_checkbox.c index a8289436d..dc433e167 100644 --- a/src/widgets/lv_checkbox.c +++ b/src/widgets/lv_checkbox.c @@ -26,8 +26,8 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_checkbox_constructor(lv_obj_t * obj); -static void lv_checkbox_destructor(lv_obj_t * obj); +static void lv_checkbox_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); +static void lv_checkbox_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_checkbox_event(lv_obj_t * obj, lv_event_t e); static void lv_checkbox_draw(lv_obj_t * obj); @@ -111,8 +111,9 @@ const char * lv_checkbox_get_text(const lv_obj_t * obj) * STATIC FUNCTIONS **********************/ -static void lv_checkbox_constructor(lv_obj_t * obj) +static void lv_checkbox_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); LV_TRACE_OBJ_CREATE("begin"); lv_checkbox_t * cb = (lv_checkbox_t *)obj; @@ -126,13 +127,17 @@ static void lv_checkbox_constructor(lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static void lv_checkbox_destructor(lv_obj_t * obj) +static void lv_checkbox_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); + LV_TRACE_OBJ_CREATE("begin"); + lv_checkbox_t * cb = (lv_checkbox_t *)obj; if(!cb->static_txt) { lv_mem_free(cb->txt); cb->txt = NULL; } + LV_TRACE_OBJ_CREATE("finished"); } static void lv_checkbox_event(lv_obj_t * obj, lv_event_t e) diff --git a/src/widgets/lv_dropdown.c b/src/widgets/lv_dropdown.c index 87a7ee011..423b69576 100644 --- a/src/widgets/lv_dropdown.c +++ b/src/widgets/lv_dropdown.c @@ -37,13 +37,13 @@ * STATIC PROTOTYPES **********************/ static lv_obj_t * lv_dropdown_list_create(lv_obj_t * parent); -static void lv_dropdown_constructor(lv_obj_t * obj); -static void lv_dropdown_destructor(lv_obj_t * obj); +static void lv_dropdown_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); +static void lv_dropdown_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_dropdown_event(lv_obj_t * obj, lv_event_t e); static void draw_main(lv_obj_t * obj); -static void lv_dropdownlist_constructor(lv_obj_t * obj); -static void lv_dropdownlist_destructor(lv_obj_t * list_obj); +static void lv_dropdownlist_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); +static void lv_dropdownlist_destructor(const lv_obj_class_t * class_p, lv_obj_t * list_obj); static void lv_dropdown_list_event(lv_obj_t * list, lv_event_t e); static void draw_list(lv_obj_t * obj); @@ -538,8 +538,9 @@ static lv_obj_t * lv_dropdown_list_create(lv_obj_t * parent) return lv_obj_create_from_class(&lv_dropdownlist_class, parent); } -static void lv_dropdown_constructor(lv_obj_t * obj) +static void lv_dropdown_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); LV_TRACE_OBJ_CREATE("begin"); lv_dropdown_t * dropdown = (lv_dropdown_t *)obj; @@ -564,8 +565,9 @@ static void lv_dropdown_constructor(lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static void lv_dropdown_destructor(lv_obj_t * obj) +static void lv_dropdown_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); lv_dropdown_t * dropdown = (lv_dropdown_t *)obj; if(dropdown->list) { @@ -579,8 +581,9 @@ static void lv_dropdown_destructor(lv_obj_t * obj) } } -static void lv_dropdownlist_constructor(lv_obj_t * obj) +static void lv_dropdownlist_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); LV_TRACE_OBJ_CREATE("begin"); lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS); @@ -589,8 +592,9 @@ static void lv_dropdownlist_constructor(lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static void lv_dropdownlist_destructor(lv_obj_t * list_obj) +static void lv_dropdownlist_destructor(const lv_obj_class_t * class_p, lv_obj_t * list_obj) { + LV_UNUSED(class_p); lv_dropdown_list_t * list = (lv_dropdown_list_t *)list_obj; lv_obj_t * dropdown_obj = list->dropdown; lv_dropdown_t * dropdown = (lv_dropdown_t *)dropdown_obj; diff --git a/src/widgets/lv_img.c b/src/widgets/lv_img.c index d9a1ab855..fcc55f37b 100644 --- a/src/widgets/lv_img.c +++ b/src/widgets/lv_img.c @@ -28,8 +28,8 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_img_constructor(lv_obj_t * obj); -static void lv_img_destructor(lv_obj_t * obj); +static void lv_img_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); +static void lv_img_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_img_event(lv_obj_t * obj, lv_event_t e); static void draw_img(lv_obj_t * obj, lv_event_t e); @@ -360,8 +360,9 @@ bool lv_img_get_antialias(lv_obj_t * obj) * STATIC FUNCTIONS **********************/ -static void lv_img_constructor(lv_obj_t * obj) +static void lv_img_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); LV_TRACE_OBJ_CREATE("begin"); lv_img_t * img = (lv_img_t *)obj; @@ -385,8 +386,9 @@ static void lv_img_constructor(lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static void lv_img_destructor(lv_obj_t * obj) +static void lv_img_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); lv_img_t * img = (lv_img_t *)obj; if(img->src_type == LV_IMG_SRC_FILE || img->src_type == LV_IMG_SRC_SYMBOL) { lv_mem_free((void*)img->src); diff --git a/src/widgets/lv_label.c b/src/widgets/lv_label.c index 44e4b548a..25edcc164 100644 --- a/src/widgets/lv_label.c +++ b/src/widgets/lv_label.c @@ -34,8 +34,8 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_label_constructor(lv_obj_t * obj); -static void lv_label_destructor(lv_obj_t * obj); +static void lv_label_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); +static void lv_label_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_label_event_cb(lv_obj_t * obj, lv_event_t e); static void draw_main(lv_obj_t * obj); @@ -692,8 +692,9 @@ void lv_label_cut_text(lv_obj_t * obj, uint32_t pos, uint32_t cnt) * STATIC FUNCTIONS **********************/ -static void lv_label_constructor(lv_obj_t * obj) +static void lv_label_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); LV_TRACE_OBJ_CREATE("begin"); lv_label_t * label = (lv_label_t *)obj; @@ -727,8 +728,9 @@ static void lv_label_constructor(lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static void lv_label_destructor(lv_obj_t * obj) +static void lv_label_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); lv_label_t * label = (lv_label_t *)obj; lv_label_dot_tmp_free(obj); diff --git a/src/widgets/lv_line.c b/src/widgets/lv_line.c index e2dc36ce3..fddef75f1 100644 --- a/src/widgets/lv_line.c +++ b/src/widgets/lv_line.c @@ -28,7 +28,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_line_constructor(lv_obj_t * obj); +static void lv_line_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_line_event(lv_obj_t * obj, lv_event_t e); /********************** @@ -103,8 +103,9 @@ bool lv_line_get_y_invert(const lv_obj_t * obj) * STATIC FUNCTIONS **********************/ -static void lv_line_constructor(lv_obj_t * obj) +static void lv_line_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); LV_TRACE_OBJ_CREATE("begin"); lv_line_t * line = (lv_line_t *)obj; diff --git a/src/widgets/lv_meter.c b/src/widgets/lv_meter.c index 1f97fde5f..3f1639cf2 100644 --- a/src/widgets/lv_meter.c +++ b/src/widgets/lv_meter.c @@ -27,8 +27,8 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_meter_constructor(lv_obj_t * obj); -static void lv_meter_destructor(lv_obj_t * obj); +static void lv_meter_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); +static void lv_meter_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_meter_event(lv_obj_t * obj, lv_event_t e); static void draw_arcs(lv_obj_t * obj, const lv_area_t * clip_area, const lv_area_t * scale_area); static void draw_ticks_and_labels(lv_obj_t * obj, const lv_area_t * clip_area, const lv_area_t * scale_area); @@ -246,8 +246,9 @@ void lv_meter_set_indicator_end_value(lv_obj_t * obj, lv_meter_indicator_t * ind * STATIC FUNCTIONS **********************/ -static void lv_meter_constructor(lv_obj_t * obj) +static void lv_meter_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); LV_TRACE_OBJ_CREATE("begin"); lv_meter_t * meter = (lv_meter_t *)obj; @@ -257,8 +258,9 @@ static void lv_meter_constructor(lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static void lv_meter_destructor(lv_obj_t * obj) +static void lv_meter_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); lv_meter_t * meter = (lv_meter_t *)obj; lv_meter_scale_t * scale; scale = _lv_ll_get_head(&meter->scale_ll); diff --git a/src/widgets/lv_roller.c b/src/widgets/lv_roller.c index b9ed4645a..3fcc384d8 100644 --- a/src/widgets/lv_roller.c +++ b/src/widgets/lv_roller.c @@ -28,7 +28,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_roller_constructor(lv_obj_t * obj); +static void lv_roller_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_roller_event(lv_obj_t * obj, lv_event_t e); static void lv_roller_label_event(lv_obj_t * label, lv_event_t e); static void draw_main(lv_obj_t * obj, lv_event_t e); @@ -283,8 +283,9 @@ uint16_t lv_roller_get_option_cnt(const lv_obj_t * obj) **********************/ -static void lv_roller_constructor(lv_obj_t * obj) +static void lv_roller_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); lv_roller_t * roller = (lv_roller_t*)obj; roller->mode = LV_ROLLER_MODE_NORMAL; diff --git a/src/widgets/lv_slider.c b/src/widgets/lv_slider.c index 352d1093b..62927c5f9 100644 --- a/src/widgets/lv_slider.c +++ b/src/widgets/lv_slider.c @@ -31,7 +31,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_slider_constructor(lv_obj_t * obj); +static void lv_slider_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_slider_event(lv_obj_t * obj, lv_event_t e); static void position_knob(lv_obj_t * obj, lv_area_t * knob_area, lv_coord_t knob_size, bool hor); static void draw_knob(lv_obj_t * obj); @@ -74,8 +74,9 @@ bool lv_slider_is_dragged(const lv_obj_t * obj) * STATIC FUNCTIONS **********************/ -static void lv_slider_constructor(lv_obj_t * obj) +static void lv_slider_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); lv_slider_t * slider = (lv_slider_t *)obj; /*Initialize the allocated 'slider'*/ diff --git a/src/widgets/lv_switch.c b/src/widgets/lv_switch.c index 8ef76a18e..62887a92b 100644 --- a/src/widgets/lv_switch.c +++ b/src/widgets/lv_switch.c @@ -33,7 +33,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_switch_constructor(lv_obj_t * obj); +static void lv_switch_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_switch_event(lv_obj_t * obj, lv_event_t e); static void draw_main(lv_obj_t * obj); @@ -68,8 +68,9 @@ lv_obj_t * lv_switch_create(lv_obj_t * parent) * STATIC FUNCTIONS **********************/ -static void lv_switch_constructor(lv_obj_t * obj) +static void lv_switch_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); LV_TRACE_OBJ_CREATE("begin"); lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE); diff --git a/src/widgets/lv_table.c b/src/widgets/lv_table.c index 9c3b07d44..7de7e0518 100644 --- a/src/widgets/lv_table.c +++ b/src/widgets/lv_table.c @@ -29,8 +29,8 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_table_constructor(lv_obj_t * obj); -static void lv_table_destructor(lv_obj_t * obj); +static void lv_table_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); +static void lv_table_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_table_event(lv_obj_t * obj, lv_event_t e); static void draw_main(lv_obj_t * obj); static lv_coord_t get_row_height(lv_obj_t * obj, uint16_t row_id, const lv_font_t * font, @@ -402,8 +402,9 @@ void lv_table_get_selected_cell(lv_obj_t * obj, uint16_t * row, uint16_t * col) * STATIC FUNCTIONS **********************/ -static void lv_table_constructor(lv_obj_t * obj) +static void lv_table_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); LV_TRACE_OBJ_CREATE("begin"); lv_table_t * table = (lv_table_t *)obj; @@ -420,8 +421,9 @@ static void lv_table_constructor(lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static void lv_table_destructor(lv_obj_t * obj) +static void lv_table_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); lv_table_t * table = (lv_table_t *)obj; /*Free the cell texts*/ uint16_t i; diff --git a/src/widgets/lv_textarea.c b/src/widgets/lv_textarea.c index 61981f6f0..d68c45eb9 100644 --- a/src/widgets/lv_textarea.c +++ b/src/widgets/lv_textarea.c @@ -42,8 +42,8 @@ /********************** * STATIC PROTOTYPES **********************/ -static void lv_textarea_constructor(lv_obj_t * obj); -static void lv_textarea_destructor(lv_obj_t * obj); +static void lv_textarea_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); +static void lv_textarea_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_textarea_event(lv_obj_t * obj, lv_event_t e); static void cursor_blink_anim_cb(void * obj, int32_t show); static void pwd_char_hider_anim(void * obj, int32_t x); @@ -795,40 +795,42 @@ void lv_textarea_cursor_up(lv_obj_t * obj) * STATIC FUNCTIONS **********************/ -static void lv_textarea_constructor(lv_obj_t * obj) +static void lv_textarea_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); LV_TRACE_OBJ_CREATE("begin"); lv_textarea_t * ta = (lv_textarea_t *)obj; - ta->pwd_mode = 0; - ta->pwd_tmp = NULL; - ta->pwd_show_time = LV_TEXTAREA_DEF_PWD_SHOW_TIME; - ta->accepted_chars = NULL; - ta->max_length = 0; - ta->cursor.show = 1; - ta->cursor.pos = 0; - ta->cursor.click_pos = 1; - ta->cursor.valid_x = 0; - ta->one_line = 0; - #if LV_LABEL_TEXT_SEL - ta->text_sel_en = 0; - #endif - ta->label = NULL; - ta->placeholder_txt = NULL; + ta->pwd_mode = 0; + ta->pwd_tmp = NULL; + ta->pwd_show_time = LV_TEXTAREA_DEF_PWD_SHOW_TIME; + ta->accepted_chars = NULL; + ta->max_length = 0; + ta->cursor.show = 1; + ta->cursor.pos = 0; + ta->cursor.click_pos = 1; + ta->cursor.valid_x = 0; + ta->one_line = 0; +#if LV_LABEL_TEXT_SEL + ta->text_sel_en = 0; +#endif + ta->label = NULL; + ta->placeholder_txt = NULL; - ta->label = lv_label_create(obj); - lv_label_set_long_mode(ta->label, LV_LABEL_LONG_WRAP); - lv_label_set_text(ta->label, ""); - lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS); + ta->label = lv_label_create(obj); + lv_label_set_long_mode(ta->label, LV_LABEL_LONG_WRAP); + lv_label_set_text(ta->label, ""); + lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS); - start_cursor_blink(obj); + start_cursor_blink(obj); - LV_TRACE_OBJ_CREATE("finished"); + LV_TRACE_OBJ_CREATE("finished"); } -static void lv_textarea_destructor(lv_obj_t * obj) +static void lv_textarea_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { + LV_UNUSED(class_p); lv_textarea_t * ta = (lv_textarea_t *)obj; if(ta->pwd_tmp != NULL) {