BigW Consortium Gitlab

Commit ad22d4b9 by Gabor Kiss-Vamosi

LV_GROUP_KEY_ENTER_LONG: improve objects behaviour

parent e5bba052
...@@ -356,13 +356,15 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data) ...@@ -356,13 +356,15 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
data->key = i->proc.last_key; data->key = i->proc.last_key;
if(data->key == LV_GROUP_KEY_NEXT) { if(data->key == LV_GROUP_KEY_NEXT) {
lv_group_focus_next(i->group); lv_group_focus_next(i->group);
} }
else if(data->key == LV_GROUP_KEY_PREV) { else if(data->key == LV_GROUP_KEY_PREV) {
lv_group_focus_prev(i->group); lv_group_focus_prev(i->group);
} }
else { else if(data->key == LV_GROUP_KEY_ENTER && i->proc.long_pr_sent) {
lv_group_send_data(i->group, data->key); /*Do nothing. Don't send the ENTER if ENTER_LONG was sent*/
} else {
lv_group_send_data(i->group, data->key);
} }
i->proc.pr_timestamp = 0; i->proc.pr_timestamp = 0;
......
...@@ -384,7 +384,6 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param) ...@@ -384,7 +384,6 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
else if(c == LV_GROUP_KEY_ENTER_LONG) { else if(c == LV_GROUP_KEY_ENTER_LONG) {
if(ext->actions[LV_BTN_ACTION_LONG_PR] && state != LV_BTN_STATE_INA) { if(ext->actions[LV_BTN_ACTION_LONG_PR] && state != LV_BTN_STATE_INA) {
res = ext->actions[LV_BTN_ACTION_LONG_PR](btn); res = ext->actions[LV_BTN_ACTION_LONG_PR](btn);
ext->long_pr_action_executed = 1;
} }
} }
} }
......
...@@ -627,7 +627,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param) ...@@ -627,7 +627,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
} }
lv_obj_invalidate(btnm); lv_obj_invalidate(btnm);
}else if(c == LV_GROUP_KEY_ENTER) { }else if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) {
if(ext->action != NULL) { if(ext->action != NULL) {
uint16_t txt_i = get_button_text(btnm, ext->btn_id_pr); uint16_t txt_i = get_button_text(btnm, ext->btn_id_pr);
if(txt_i != LV_BTNM_PR_NONE) { if(txt_i != LV_BTNM_PR_NONE) {
......
...@@ -305,7 +305,7 @@ static lv_res_t lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param) ...@@ -305,7 +305,7 @@ static lv_res_t lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param)
char c = *((char*)param); char c = *((char*)param);
if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_DOWN || if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_DOWN ||
c == LV_GROUP_KEY_LEFT || c == LV_GROUP_KEY_UP || c == LV_GROUP_KEY_LEFT || c == LV_GROUP_KEY_UP ||
c == LV_GROUP_KEY_ENTER) { c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) {
lv_btn_set_state(ext->bullet, lv_btn_get_state(cb)); lv_btn_set_state(ext->bullet, lv_btn_get_state(cb));
} }
} }
......
...@@ -549,7 +549,7 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par ...@@ -549,7 +549,7 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
lv_ddlist_pos_current_option(ddlist); lv_ddlist_pos_current_option(ddlist);
lv_obj_invalidate(ddlist); lv_obj_invalidate(ddlist);
} }
} else if(c == LV_GROUP_KEY_ENTER) { } else if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) {
if(ext->opened) { if(ext->opened) {
ext->sel_opt_id_ori = ext->sel_opt_id; ext->sel_opt_id_ori = ext->sel_opt_id;
ext->opened = 0; ext->opened = 0;
......
...@@ -570,7 +570,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param) ...@@ -570,7 +570,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
lv_page_focus(list, btn_prev, ext->anim_time); lv_page_focus(list, btn_prev, ext->anim_time);
} }
} }
} else if(c == LV_GROUP_KEY_ENTER) { } else if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) {
/*Get the 'pressed' button*/ /*Get the 'pressed' button*/
lv_obj_t * btn = NULL; lv_obj_t * btn = NULL;
btn = get_next_btn(list, btn); btn = get_next_btn(list, btn);
......
...@@ -321,7 +321,7 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par ...@@ -321,7 +321,7 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
if(ext->ddlist.sel_opt_id > 0) { if(ext->ddlist.sel_opt_id > 0) {
lv_roller_set_selected(roller, ext->ddlist.sel_opt_id - 1, true); lv_roller_set_selected(roller, ext->ddlist.sel_opt_id - 1, true);
} }
} else if(c == LV_GROUP_KEY_ENTER) { } else if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) {
if(ext->ddlist.action) ext->ddlist.action(roller); if(ext->ddlist.action) ext->ddlist.action(roller);
ext->ddlist.sel_opt_id_ori = ext->ddlist.sel_opt_id; /*Set the entered value as default*/ ext->ddlist.sel_opt_id_ori = ext->ddlist.sel_opt_id; /*Set the entered value as default*/
} }
......
...@@ -243,7 +243,7 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param) ...@@ -243,7 +243,7 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param)
else if(sign == LV_SIGNAL_CONTROLL) { else if(sign == LV_SIGNAL_CONTROLL) {
char c = *((char*)param); char c = *((char*)param);
if(c == LV_GROUP_KEY_ENTER) { if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ENTER_LONG) {
if(lv_sw_get_state(sw)) lv_sw_off(sw); if(lv_sw_get_state(sw)) lv_sw_off(sw);
else lv_sw_on(sw); else lv_sw_on(sw);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment