BigW Consortium Gitlab

Commit d58a83cd by Gabor Kiss-Vamosi

lv_mbox: Translate LV_GROUP_KEY_UP/DOWN to LV_GROUP_KEY_LEFT/RIGHT

parent 69c5373d
......@@ -602,7 +602,8 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
break;
}
}
ext->btn_id_pr = area_below;
if(area_below < ext->btn_cnt) ext->btn_id_pr = area_below;
}
lv_obj_invalidate(btnm);
} else if(c == LV_GROUP_KEY_UP) {
......@@ -611,10 +612,10 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
if(ext->btn_id_pr == LV_BTNM_PR_NONE) {
ext->btn_id_pr = 0;
} else {
uint16_t area_above;
int16_t area_above;
lv_coord_t pr_center = ext->button_areas[ext->btn_id_pr].x1 + (lv_area_get_width(&ext->button_areas[ext->btn_id_pr]) >> 1);
for(area_above = ext->btn_id_pr; area_above > 0; area_above --) {
for(area_above = ext->btn_id_pr; area_above >= 0; area_above --) {
if(ext->button_areas[area_above].y1 < ext->button_areas[ext->btn_id_pr].y1 &&
pr_center >= ext->button_areas[area_above].x1 - style->body.padding.hor &&
pr_center <= ext->button_areas[area_above].x2)
......@@ -622,7 +623,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
break;
}
}
ext->btn_id_pr = area_above;
if(area_above >= 0) ext->btn_id_pr = area_above;
}
lv_obj_invalidate(btnm);
......
......@@ -348,6 +348,16 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
{
lv_res_t res;
/*Translate LV_GROUP_KEY_UP/DOWN to LV_GROUP_KEY_LEFT/RIGHT */
char c_trans = 0;
if(sign == LV_SIGNAL_CONTROLL) {
c_trans = *((char*)param);
if(c_trans == LV_GROUP_KEY_DOWN) c_trans = LV_GROUP_KEY_LEFT;
if(c_trans == LV_GROUP_KEY_UP) c_trans = LV_GROUP_KEY_RIGHT;
param = &c_trans;
}
/* Include the ancient signal function */
res = ancestor_signal(mbox, sign, param);
if(res != LV_RES_OK) return res;
......@@ -356,7 +366,6 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
if(sign == LV_SIGNAL_CORD_CHG) {
if(lv_obj_get_width(mbox) != lv_area_get_width(param)) {
mbox_realign(mbox);
}
}
else if(sign == LV_SIGNAL_STYLE_CHG) {
......
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