mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
send LV_SIGNAL_LONG_PRESS on LV_GROUP_KEY_ENTER long press
This commit is contained in:
parent
bac918d4c8
commit
cfc811900d
@ -336,12 +336,18 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
else if(data->state == LV_INDEV_STATE_PR && i->proc.last_state == LV_INDEV_STATE_PR) {
|
||||
if(data->key == LV_GROUP_KEY_ENTER &&
|
||||
i->proc.long_pr_sent == 0 &&
|
||||
lv_tick_elaps(i->proc.pr_timestamp) > LV_INDEV_LONG_PRESS_TIME &&
|
||||
i->group->edit_mode_en)
|
||||
lv_tick_elaps(i->proc.pr_timestamp) > LV_INDEV_LONG_PRESS_TIME )
|
||||
{
|
||||
i->group->editing = i->group->editing ? 0 : 1; /*Change between edit and navigate*/
|
||||
lv_obj_t * focused = lv_group_get_focused(i->group);
|
||||
if(focused) lv_obj_invalidate(focused);
|
||||
lv_obj_t * focused = lv_group_get_focused(i->group);
|
||||
/*If edit mode is enabled then change between edit and navigate on long press*/
|
||||
if (i->group->edit_mode_en) {
|
||||
i->group->editing = i->group->editing ? 0 : 1;
|
||||
if(focused) lv_obj_invalidate(focused);
|
||||
}
|
||||
/*If edit mode is disabled just send a long press signal*/
|
||||
else {
|
||||
focused->signal_func(focused, LV_SIGNAL_LONG_PRESS, indev_act);
|
||||
}
|
||||
i->proc.long_pr_sent = 1;
|
||||
}
|
||||
}
|
||||
@ -355,9 +361,9 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
} else if(data->key == LV_GROUP_KEY_PREV) {
|
||||
lv_group_focus_prev(i->group);
|
||||
} else if(data->key == LV_GROUP_KEY_ENTER &&
|
||||
(i->proc.long_pr_sent || (i->group->editing == 0 && i->group->edit_mode_en)))
|
||||
(i->group->edit_mode_en && i->group->editing == 0))
|
||||
{
|
||||
/*Do nothing. Don't send the ENTER if pressed long was sent or in navigation mode*/
|
||||
/*Do nothing. Don't send the ENTER if in navigation mode*/
|
||||
} else {
|
||||
lv_group_send_data(i->group, data->key);
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
CSRCS += lv_font_builtin.c
|
||||
CSRCS += lv_font_dejavu_10.c
|
||||
CSRCS += lv_font_dejavu_20.c
|
||||
CSRCS += lv_font_dejavu_30.c
|
||||
|
@ -384,10 +384,11 @@ static bool lv_btn_design(lv_obj_t * btn, const lv_area_t * mask, lv_design_mode
|
||||
ancestor_design(btn, mask, mode);
|
||||
#if USE_LV_ANIMATION
|
||||
if(btn != ink_obj) {
|
||||
lv_draw_rect(&btn->coords, mask,btn->style_p, LV_OPA_COVER);
|
||||
lv_style_t * style = lv_obj_get_style(btn);
|
||||
lv_draw_rect(&btn->coords, mask, style, LV_OPA_COVER);
|
||||
} else {
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
|
||||
lv_opa_t opa_scale = lv_obj_get_opa_scale(obj);
|
||||
lv_opa_t opa_scale = lv_obj_get_opa_scale(btn);
|
||||
|
||||
/*Draw the normal button*/
|
||||
lv_draw_rect(&btn->coords, mask, ext->styles[ink_bg_state], opa_scale);
|
||||
|
@ -5,6 +5,7 @@ CSRCS += lv_theme_night.c
|
||||
CSRCS += lv_theme_templ.c
|
||||
CSRCS += lv_theme_zen.c
|
||||
CSRCS += lv_theme_material.c
|
||||
CSRCS += lv_theme_mono.c
|
||||
|
||||
|
||||
DEPPATH += --dep-path lvgl/lv_themes
|
||||
|
Loading…
x
Reference in New Issue
Block a user