From bc994c60eee740f613f7ebe4822c4bf75570e603 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 6 May 2020 21:39:45 +0200 Subject: [PATCH] minor fixes --- lv_conf_template.h | 2 +- src/lv_conf_internal.h | 2 +- src/lv_core/lv_obj.c | 7 +++++++ src/lv_themes/lv_theme.h | 4 +--- src/lv_themes/lv_theme_empty.c | 4 +--- src/lv_themes/lv_theme_material.c | 6 +----- src/lv_themes/lv_theme_mono.c | 5 +---- src/lv_themes/lv_theme_template.c | 5 +---- src/lv_widgets/lv_dropdown.c | 1 + src/lv_widgets/lv_msgbox.c | 1 + src/lv_widgets/lv_switch.c | 11 ++++++----- src/lv_widgets/lv_table.c | 1 + 12 files changed, 23 insertions(+), 26 deletions(-) diff --git a/lv_conf_template.h b/lv_conf_template.h index fe9cb1470..645166674 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -123,7 +123,7 @@ typedef int16_t lv_coord_t; #define LV_INDEV_DEF_DRAG_LIMIT 10 /* Drag throw slow-down in [%]. Greater value -> faster slow-down */ -#define LV_INDEV_DEF_DRAG_THROW 20 +#define LV_INDEV_DEF_DRAG_THROW 10 /* Long press time in milliseconds. * Time to send `LV_EVENT_LONG_PRESSSED`) */ diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index c684676a3..0c0a54180 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -188,7 +188,7 @@ /* Drag throw slow-down in [%]. Greater value -> faster slow-down */ #ifndef LV_INDEV_DEF_DRAG_THROW -#define LV_INDEV_DEF_DRAG_THROW 20 +#define LV_INDEV_DEF_DRAG_THROW 10 #endif /* Long press time in milliseconds. diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index 114dfa3cc..4a3c1f34d 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -89,6 +89,7 @@ static void trans_anim_cb(lv_style_trans_t * tr, lv_anim_value_t v); static void trans_anim_start_cb(lv_anim_t * a); static void trans_anim_ready_cb(lv_anim_t * a); static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v); +static void fade_in_anim_ready(lv_anim_t * a); #endif static void lv_event_mark_deleted(lv_obj_t * obj); static void lv_obj_del_async_cb(void * obj); @@ -3335,6 +3336,7 @@ void lv_obj_fade_in(lv_obj_t * obj, uint32_t time, uint32_t delay) lv_anim_set_var(&a, obj); lv_anim_set_values(&a, LV_OPA_TRANSP, LV_OPA_COVER); lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)opa_scale_anim); + lv_anim_set_ready_cb(&a, fade_in_anim_ready); lv_anim_set_time(&a, time); lv_anim_set_delay(&a, delay); lv_anim_start(&a); @@ -3948,6 +3950,11 @@ static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v) lv_obj_set_style_local_opa_scale(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, v); } +static void fade_in_anim_ready(lv_anim_t * a) +{ + lv_style_remove_prop(lv_obj_get_local_style(a->var, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE); +} + #endif static void lv_event_mark_deleted(lv_obj_t * obj) diff --git a/src/lv_themes/lv_theme.h b/src/lv_themes/lv_theme.h index 30ec6c9c5..538c48d9d 100644 --- a/src/lv_themes/lv_theme.h +++ b/src/lv_themes/lv_theme.h @@ -14,10 +14,8 @@ extern "C" { * INCLUDES *********************/ #include "../lv_conf_internal.h" - #include "../lv_core/lv_style.h" - -#include "../../lvgl.h" +#include "../lv_core/lv_obj.h" /********************* * DEFINES diff --git a/src/lv_themes/lv_theme_empty.c b/src/lv_themes/lv_theme_empty.c index a74e9a72d..60f332277 100644 --- a/src/lv_themes/lv_theme_empty.c +++ b/src/lv_themes/lv_theme_empty.c @@ -7,9 +7,7 @@ * INCLUDES *********************/ #include -#include "lv_theme.h" -#include "../lv_widgets/lv_img.h" -#include "../lv_misc/lv_types.h" +#include "../../lvgl.h" /*To see all the widgets*/ #if LV_USE_THEME_EMPTY diff --git a/src/lv_themes/lv_theme_material.c b/src/lv_themes/lv_theme_material.c index 3ba91aaba..1dcaf7f78 100644 --- a/src/lv_themes/lv_theme_material.c +++ b/src/lv_themes/lv_theme_material.c @@ -6,11 +6,7 @@ /********************* * INCLUDES *********************/ -#include -#include "lv_theme.h" -#include "lv_theme_material.h" -#include "../lv_widgets/lv_img.h" -#include "../lv_misc/lv_types.h" +#include "../../lvgl.h" /*To see all the widgets*/ #if LV_USE_THEME_MATERIAL diff --git a/src/lv_themes/lv_theme_mono.c b/src/lv_themes/lv_theme_mono.c index b869b8387..bada62ef4 100644 --- a/src/lv_themes/lv_theme_mono.c +++ b/src/lv_themes/lv_theme_mono.c @@ -6,10 +6,7 @@ /********************* * INCLUDES *********************/ -#include -#include "lv_theme.h" -#include "../lv_widgets/lv_img.h" -#include "../lv_misc/lv_types.h" +#include "../../lvgl.h" /*To see all the widgets*/ #if LV_USE_THEME_MONO diff --git a/src/lv_themes/lv_theme_template.c b/src/lv_themes/lv_theme_template.c index 37575e7d8..76ac4ac33 100644 --- a/src/lv_themes/lv_theme_template.c +++ b/src/lv_themes/lv_theme_template.c @@ -6,10 +6,7 @@ /********************* * INCLUDES *********************/ -#include -#include "lv_theme.h" -#include "../lv_widgets/lv_img.h" -#include "../lv_misc/lv_types.h" +#include "../../lvgl.h" /*To see all the widgets*/ #if LV_USE_THEME_TEMPLATE diff --git a/src/lv_widgets/lv_dropdown.c b/src/lv_widgets/lv_dropdown.c index 60d64e203..6f1eb9059 100644 --- a/src/lv_widgets/lv_dropdown.c +++ b/src/lv_widgets/lv_dropdown.c @@ -13,6 +13,7 @@ #include "../lv_draw/lv_draw.h" #include "../lv_core/lv_group.h" #include "../lv_core/lv_indev.h" +#include "../lv_core/lv_disp.h" #include "../lv_themes/lv_theme.h" #include "../lv_font/lv_symbol_def.h" #include "../lv_misc/lv_anim.h" diff --git a/src/lv_widgets/lv_msgbox.c b/src/lv_widgets/lv_msgbox.c index 2f33f2575..2b731fc87 100644 --- a/src/lv_widgets/lv_msgbox.c +++ b/src/lv_widgets/lv_msgbox.c @@ -11,6 +11,7 @@ #include "../lv_core/lv_debug.h" #include "../lv_core/lv_group.h" +#include "../lv_core/lv_disp.h" #include "../lv_themes/lv_theme.h" #include "../lv_misc/lv_anim.h" #include "../lv_misc/lv_math.h" diff --git a/src/lv_widgets/lv_switch.c b/src/lv_widgets/lv_switch.c index 616b56aa4..918b00e81 100644 --- a/src/lv_widgets/lv_switch.c +++ b/src/lv_widgets/lv_switch.c @@ -19,6 +19,7 @@ #include "../lv_themes/lv_theme.h" #include "../lv_misc/lv_math.h" #include "../lv_core/lv_indev.h" +#include "../lv_core/lv_disp.h" #include "lv_img.h" /********************* @@ -303,17 +304,17 @@ static lv_res_t lv_switch_signal(lv_obj_t * sw, lv_signal_t sign, void * param) if(res != LV_RES_OK) return res; } else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { - lv_style_int_t knob_left = lv_obj_get_style_pad_left(sw, LV_SLIDER_PART_KNOB); - lv_style_int_t knob_right = lv_obj_get_style_pad_right(sw, LV_SLIDER_PART_KNOB); - lv_style_int_t knob_top = lv_obj_get_style_pad_top(sw, LV_SLIDER_PART_KNOB); - lv_style_int_t knob_bottom = lv_obj_get_style_pad_bottom(sw, LV_SLIDER_PART_KNOB); + lv_style_int_t knob_left = lv_obj_get_style_pad_left(sw, LV_SWITCH_PART_KNOB); + lv_style_int_t knob_right = lv_obj_get_style_pad_right(sw, LV_SWITCH_PART_KNOB); + lv_style_int_t knob_top = lv_obj_get_style_pad_top(sw, LV_SWITCH_PART_KNOB); + lv_style_int_t knob_bottom = lv_obj_get_style_pad_bottom(sw, LV_SWITCH_PART_KNOB); /* The smaller size is the knob diameter*/ lv_coord_t knob_size = LV_MATH_MIN(lv_obj_get_width(sw), lv_obj_get_height(sw)) >> 1; knob_size += LV_MATH_MAX(LV_MATH_MAX(knob_left, knob_right), LV_MATH_MAX(knob_bottom, knob_top)); knob_size += 2; /*For rounding error*/ - knob_size += lv_obj_get_draw_rect_ext_pad_size(sw, LV_SLIDER_PART_KNOB); + knob_size += lv_obj_get_draw_rect_ext_pad_size(sw, LV_SWITCH_PART_KNOB); /*Indic. size is handled by bar*/ sw->ext_draw_pad = LV_MATH_MAX(sw->ext_draw_pad, knob_size); diff --git a/src/lv_widgets/lv_table.c b/src/lv_widgets/lv_table.c index c85b38c43..2e0ecd361 100644 --- a/src/lv_widgets/lv_table.c +++ b/src/lv_widgets/lv_table.c @@ -10,6 +10,7 @@ #if LV_USE_TABLE != 0 #include "../lv_core/lv_debug.h" +#include "../lv_core/lv_indev.h" #include "../lv_misc/lv_txt.h" #include "../lv_misc/lv_math.h" #include "../lv_draw/lv_draw_label.h"