chore(indev) minor formatting

This commit is contained in:
Gabor Kiss-Vamosi
2021-10-19 16:27:43 +02:00
parent 747b6a2a9a
commit 79ab3d29b0

View File

@@ -143,29 +143,32 @@ void lv_indev_reset(lv_indev_t * indev, lv_obj_t * obj)
if(indev) {
indev->proc.reset_query = 1;
if(indev_act == indev) indev_obj_act = NULL;
if(obj == NULL || indev->proc.types.pointer.last_pressed == obj) {
indev->proc.types.pointer.last_pressed = NULL;
}
if(obj == NULL || indev->proc.types.pointer.act_obj == obj) {
indev->proc.types.pointer.act_obj = NULL;
}
if(obj == NULL || indev->proc.types.pointer.last_obj == obj) {
indev->proc.types.pointer.last_obj = NULL;
if(indev->driver->type == LV_INDEV_TYPE_POINTER || indev->driver->type == LV_INDEV_TYPE_KEYPAD) {
if(obj == NULL || indev->proc.types.pointer.last_pressed == obj) {
indev->proc.types.pointer.last_pressed = NULL;
}
if(obj == NULL || indev->proc.types.pointer.act_obj == obj) {
indev->proc.types.pointer.act_obj = NULL;
}
if(obj == NULL || indev->proc.types.pointer.last_obj == obj) {
indev->proc.types.pointer.last_obj = NULL;
}
}
}
else {
lv_indev_t * i = lv_indev_get_next(NULL);
while(i) {
i->proc.reset_query = 1;
if((i->driver->type == LV_INDEV_TYPE_POINTER || i->driver->type == LV_INDEV_TYPE_KEYPAD) &&
(obj == NULL || i->proc.types.pointer.last_pressed == obj)) {
i->proc.types.pointer.last_pressed = NULL;
}
if(obj == NULL || i->proc.types.pointer.act_obj == obj) {
i->proc.types.pointer.act_obj = NULL;
}
if(obj == NULL || i->proc.types.pointer.last_obj == obj) {
i->proc.types.pointer.last_obj = NULL;
if(i->driver->type == LV_INDEV_TYPE_POINTER || i->driver->type == LV_INDEV_TYPE_KEYPAD) {
if(obj == NULL || i->proc.types.pointer.last_pressed == obj) {
i->proc.types.pointer.last_pressed = NULL;
}
if(obj == NULL || i->proc.types.pointer.act_obj == obj) {
i->proc.types.pointer.act_obj = NULL;
}
if(obj == NULL || i->proc.types.pointer.last_obj == obj) {
i->proc.types.pointer.last_obj = NULL;
}
}
i = lv_indev_get_next(i);
}
@@ -990,66 +993,67 @@ static void indev_proc_reset_query_handler(lv_indev_t * indev)
static void indev_click_focus(_lv_indev_proc_t * proc)
{
/*Handle click focus*/
lv_obj_t * obj_to_focus = indev_obj_act;
if(lv_obj_has_flag(obj_to_focus, LV_OBJ_FLAG_CLICK_FOCUSABLE) &&
proc->types.pointer.last_pressed != obj_to_focus) {
lv_group_t * g_act = lv_obj_get_group(obj_to_focus);
lv_group_t * g_prev = proc->types.pointer.last_pressed ? lv_obj_get_group(proc->types.pointer.last_pressed) : NULL;
if(lv_obj_has_flag(indev_obj_act, LV_OBJ_FLAG_CLICK_FOCUSABLE) == false ||
proc->types.pointer.last_pressed == indev_obj_act)
{
return;
}
/*If both the last and act. obj. are in the same group (or no group but it's also the same)*/
if(g_act == g_prev) {
/*The objects are in a group*/
if(g_act) {
lv_group_focus_obj(obj_to_focus);
if(indev_reset_check(proc)) return;
}
/*The object are not in group*/
else {
if(proc->types.pointer.last_pressed) {
lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_DEFOCUSED, indev_act);
if(indev_reset_check(proc)) return;
}
lv_group_t * g_act = lv_obj_get_group(indev_obj_act);
lv_group_t * g_prev = proc->types.pointer.last_pressed ? lv_obj_get_group(proc->types.pointer.last_pressed) : NULL;
lv_event_send(obj_to_focus, LV_EVENT_FOCUSED, indev_act);
if(indev_reset_check(proc)) return;
}
/*If both the last and act. obj. are in the same group (or have no group)*/
if(g_act == g_prev) {
/*The objects are in a group*/
if(g_act) {
lv_group_focus_obj(indev_obj_act);
if(indev_reset_check(proc)) return;
}
/*The object are not in the same group (in different group or one in not a group)*/
/*The object are not in group*/
else {
/*If the prev. obj. is not in a group then defocus it.*/
if(g_prev == NULL && proc->types.pointer.last_pressed) {
if(proc->types.pointer.last_pressed) {
lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_DEFOCUSED, indev_act);
if(indev_reset_check(proc)) return;
}
/*Focus on a non-group object*/
else {
if(proc->types.pointer.last_pressed) {
/*If the prev. object also wasn't in a group defocus it*/
if(g_prev == NULL) {
lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_DEFOCUSED, indev_act);
if(indev_reset_check(proc)) return;
}
/*If the prev. object also was in a group at least "LEAVE" it instead of defocus*/
else {
lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_LEAVE, indev_act);
if(indev_reset_check(proc)) return;
}
lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, indev_act);
if(indev_reset_check(proc)) return;
}
}
/*The object are not in the same group (in different groups or one has no group)*/
else {
/*If the prev. obj. is not in a group then defocus it.*/
if(g_prev == NULL && proc->types.pointer.last_pressed) {
lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_DEFOCUSED, indev_act);
if(indev_reset_check(proc)) return;
}
/*Focus on a non-group object*/
else {
if(proc->types.pointer.last_pressed) {
/*If the prev. object also wasn't in a group defocus it*/
if(g_prev == NULL) {
lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_DEFOCUSED, indev_act);
if(indev_reset_check(proc)) return;
}
/*If the prev. object also was in a group at least "LEAVE" it instead of defocus*/
else {
lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_LEAVE, indev_act);
if(indev_reset_check(proc)) return;
}
}
/*Focus to the act. in its group*/
if(g_act) {
lv_group_focus_obj(obj_to_focus);
if(indev_reset_check(proc)) return;
}
else {
lv_event_send(obj_to_focus, LV_EVENT_FOCUSED, indev_act);
if(indev_reset_check(proc)) return;
}
}
proc->types.pointer.last_pressed = obj_to_focus;
}
/*Focus to the act. in its group*/
if(g_act) {
lv_group_focus_obj(indev_obj_act);
if(indev_reset_check(proc)) return;
}
else {
lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, indev_act);
if(indev_reset_check(proc)) return;
}
}
proc->types.pointer.last_pressed = indev_obj_act;
}
/**