// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_tileview.c
// Function: lv_tileview_scrl_signal
static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
{

    lv_res_t res;

    /* Include the ancient signal function */
    res = ancestor_scrl_signal(scrl, sign, param);
    if(res != LV_RES_OK) return res;
    if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, "");

    lv_obj_t * tileview         = lv_obj_get_parent(scrl);
    const lv_style_t * style_bg = lv_tileview_get_style(tileview, LV_TILEVIEW_STYLE_MAIN);

    /*Apply constraint on moving of the tileview*/
    if(sign == LV_SIGNAL_CORD_CHG) {
        lv_indev_t * indev = lv_indev_get_act();
        if(indev) {
            lv_tileview_ext_t * ext = lv_obj_get_ext_attr(tileview);

            /*Set horizontal drag constraint if no vertical constraint an dragged to valid x
             * direction */
            if(ext->drag_ver == 0 &&
               ((ext->drag_right_en && indev->proc.types.pointer.drag_sum.x <= -LV_INDEV_DEF_DRAG_LIMIT) ||
                (ext->drag_left_en && indev->proc.types.pointer.drag_sum.x >= LV_INDEV_DEF_DRAG_LIMIT))) {
                ext->drag_hor = 1;
            }
            /*Set vertical drag constraint if no horizontal constraint an dragged to valid y
             * direction */
            if(ext->drag_hor == 0 &&
               ((ext->drag_bottom_en && indev->proc.types.pointer.drag_sum.y <= -LV_INDEV_DEF_DRAG_LIMIT) ||
                (ext->drag_top_en && indev->proc.types.pointer.drag_sum.y >= LV_INDEV_DEF_DRAG_LIMIT))) {
                ext->drag_ver = 1;
            }

#if LV_USE_ANIMATION
            if(ext->drag_hor) {
                ext->page.edge_flash.top_ip    = 0;
                ext->page.edge_flash.bottom_ip = 0;
            }

            if(ext->drag_ver) {
                ext->page.edge_flash.right_ip = 0;
                ext->page.edge_flash.left_ip  = 0;
            }
#endif

            lv_coord_t x = lv_obj_get_x(scrl);
            lv_coord_t y = lv_obj_get_y(scrl);
            lv_coord_t h = lv_obj_get_height(tileview);
            lv_coord_t w = lv_obj_get_width(tileview);
            if(ext->drag_top_en == 0) {
                if(y > -(ext->act_id.y * h) && indev->proc.types.pointer.vect.y > 0 && ext->drag_hor == 0) {
#if LV_USE_ANIMATION
                    if(ext->page.edge_flash.enabled && ext->page.edge_flash.left_ip == 0 &&
                       ext->page.edge_flash.right_ip == 0 && ext->page.edge_flash.top_ip == 0 &&
                       ext->page.edge_flash.bottom_ip == 0) {
                        ext->page.edge_flash.top_ip = 1;
                        lv_page_start_edge_flash(tileview);
                    }
#endif

                    lv_obj_set_y(scrl, -ext->act_id.y * h + style_bg->body.padding.top);
                }
            }
            if(ext->drag_bottom_en == 0 && indev->proc.types.pointer.vect.y < 0 && ext->drag_hor == 0) {
                if(y < -(ext->act_id.y * h)) {
#if LV_USE_ANIMATION
                    if(ext->page.edge_flash.enabled && ext->page.edge_flash.left_ip == 0 &&
                       ext->page.edge_flash.right_ip == 0 && ext->page.edge_flash.top_ip == 0 &&
                       ext->page.edge_flash.bottom_ip == 0) {
                        ext->page.edge_flash.bottom_ip = 1;
                        lv_page_start_edge_flash(tileview);
                    }
#endif
                }

                lv_obj_set_y(scrl, -ext->act_id.y * h + style_bg->body.padding.top);
            }
            if(ext->drag_left_en == 0) {
                if(x > -(ext->act_id.x * w) && indev->proc.types.pointer.vect.x > 0 && ext->drag_ver == 0) {
#if LV_USE_ANIMATION
                    if(ext->page.edge_flash.enabled && ext->page.edge_flash.left_ip == 0 &&
                       ext->page.edge_flash.right_ip == 0 && ext->page.edge_flash.top_ip == 0 &&
                       ext->page.edge_flash.bottom_ip == 0) {
                        ext->page.edge_flash.left_ip = 1;
                        lv_page_start_edge_flash(tileview);
                    }
#endif

                    lv_obj_set_x(scrl, -ext->act_id.x * w + style_bg->body.padding.left);
                }
            }
            if(ext->drag_right_en == 0 && indev->proc.types.pointer.vect.x < 0 && ext->drag_ver == 0) {
                if(x < -(ext->act_id.x * w)) {
#if LV_USE_ANIMATION
                    if(ext->page.edge_flash.enabled && ext->page.edge_flash.left_ip == 0 &&
                       ext->page.edge_flash.right_ip == 0 && ext->page.edge_flash.top_ip == 0 &&
                       ext->page.edge_flash.bottom_ip == 0) {
                        ext->page.edge_flash.right_ip = 1;
                        lv_page_start_edge_flash(tileview);
                    }
#endif
                }

                lv_obj_set_x(scrl, -ext->act_id.x * w + style_bg->body.padding.top);
            }

            /*Apply the drag constraints*/
            if(ext->drag_ver == 0)
                lv_obj_set_y(scrl, -ext->act_id.y * lv_obj_get_height(tileview) + style_bg->body.padding.top);
            if(ext->drag_hor == 0)
                lv_obj_set_x(scrl, -ext->act_id.x * lv_obj_get_width(tileview) + style_bg->body.padding.left);
        }
    }
    return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r15
movl %esi, %r14d
movq %rdi, %rbx
callq *0x4c970(%rip)          # 0x5e350
movl %eax, %ebp
cmpb $0x1, %al
jne 0x11d46
cmpb $0x7, %r14b
jne 0x11a0d
leaq 0x2da4e(%rip), %rsi     # 0x3f445
movq %r15, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x684b
movq %rbx, %rdi
callq 0x47bc
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
callq 0x122b2
movb $0x1, %bpl
cmpb $0x2, %r14b
jne 0x11d46
movq %rax, %r13
callq 0x35b3
testq %rax, %rax
je 0x11d46
movq %rax, %r14
movq %r15, %rdi
callq 0x6747
movq %rax, %r12
movb 0x60(%rax), %al
testb $0x20, %al
jne 0x11a74
testb $0x8, %al
je 0x11a61
cmpw $-0x9, 0x44(%r14)
jl 0x11a6d
testb $0x4, %al
je 0x11a74
cmpw $0xa, 0x44(%r14)
jl 0x11a74
orb $0x10, %al
movb %al, 0x60(%r12)
testb $0x10, %al
jne 0x11a99
testb $0x2, %al
je 0x11a84
cmpw $-0x9, 0x46(%r14)
jl 0x11a90
testb $0x1, %al
je 0x11a9f
cmpw $0xa, 0x46(%r14)
jl 0x11a9f
orb $0x20, %al
movb %al, 0x60(%r12)
jmp 0x11a9f
andb $-0x7, 0x40(%r12)
movq %r14, 0x18(%rsp)
movq %r13, 0x8(%rsp)
testb $0x20, %al
je 0x11ab3
andb $-0x19, 0x40(%r12)
movq %rbx, %rdi
callq 0x48ca
movw %ax, 0x16(%rsp)
movq %rbx, %rdi
callq 0x4902
movl %eax, %r13d
movq %r15, %rdi
callq 0x5332
movl %eax, %r14d
movq %r15, %rdi
callq 0x5308
movb 0x60(%r12), %sil
movswl %r13w, %edi
movswl %r14w, %r13d
testb $0x1, %sil
jne 0x11b68
movswl 0x5e(%r12), %ecx
movl %r13d, %edx
imull %ecx, %edx
negl %edx
cmpl %edx, %edi
jle 0x11b68
testb $0x10, %sil
jne 0x11b68
movq 0x18(%rsp), %rdx
cmpw $0x0, 0x42(%rdx)
jle 0x11b68
movl %edi, 0x24(%rsp)
movl %eax, 0x4(%rsp)
movb 0x40(%r12), %al
movl %eax, %edx
andb $0x1f, %dl
cmpb $0x1, %dl
jne 0x11b41
orb $0x2, %al
movb %al, 0x40(%r12)
movq %r15, %rdi
callq 0x24c93
movzwl 0x5e(%r12), %ecx
imull %r14d, %ecx
movq 0x8(%rsp), %rax
movzwl 0x16(%rax), %eax
subl %ecx, %eax
movswl %ax, %esi
movq %rbx, %rdi
callq 0x51d0
movb 0x60(%r12), %sil
movl 0x4(%rsp), %eax
movl 0x24(%rsp), %edi
testb $0x2, %sil
jne 0x11be6
testb $0x10, %sil
jne 0x11be6
movq 0x18(%rsp), %rcx
cmpw $0x0, 0x42(%rcx)
jns 0x11be6
movswl 0x5e(%r12), %esi
imull %esi, %r13d
negl %r13d
cmpl %r13d, %edi
movl %eax, 0x4(%rsp)
jge 0x11bc2
movb 0x40(%r12), %cl
movl %ecx, %edx
andb $0x1f, %dl
cmpb $0x1, %dl
movq 0x8(%rsp), %r13
jne 0x11bc7
orb $0x4, %cl
movb %cl, 0x40(%r12)
movq %r15, %rdi
callq 0x24c93
movzwl 0x5e(%r12), %esi
jmp 0x11bc7
movq 0x8(%rsp), %r13
imull %r14d, %esi
movzwl 0x16(%r13), %ecx
subl %esi, %ecx
movswl %cx, %esi
movq %rbx, %rdi
callq 0x51d0
movb 0x60(%r12), %sil
movl 0x4(%rsp), %eax
movswl 0x16(%rsp), %r14d
movswl %ax, %r13d
testb $0x4, %sil
jne 0x11c6b
movswl 0x5c(%r12), %ecx
movl %r13d, %edx
imull %ecx, %edx
negl %edx
cmpl %edx, %r14d
jle 0x11c6b
testb $0x20, %sil
jne 0x11c6b
movq 0x18(%rsp), %rdx
cmpw $0x0, 0x40(%rdx)
jle 0x11c6b
movb 0x40(%r12), %sil
movl %esi, %edx
andb $0x1f, %dl
cmpb $0x1, %dl
movl %eax, 0x4(%rsp)
jne 0x11c49
orb $0x10, %sil
movb %sil, 0x40(%r12)
movq %r15, %rdi
callq 0x24c93
movl 0x4(%rsp), %eax
movzwl 0x5c(%r12), %ecx
imull %eax, %ecx
movq 0x8(%rsp), %rax
movzwl 0x1a(%rax), %eax
subl %ecx, %eax
movswl %ax, %esi
movq %rbx, %rdi
callq 0x5192
movl 0x4(%rsp), %eax
movb 0x60(%r12), %sil
testb $0x8, %sil
jne 0x11ce6
testb $0x20, %sil
jne 0x11ce6
movq 0x18(%rsp), %rcx
cmpw $0x0, 0x40(%rcx)
jns 0x11ce6
movswl 0x5c(%r12), %esi
imull %esi, %r13d
negl %r13d
cmpl %r13d, %r14d
jge 0x11cc7
movb 0x40(%r12), %cl
movl %ecx, %edx
andb $0x1f, %dl
cmpb $0x1, %dl
movq 0x8(%rsp), %r14
jne 0x11ccc
orb $0x8, %cl
movb %cl, 0x40(%r12)
movq %r15, %rdi
movl %eax, %r13d
callq 0x24c93
movl %r13d, %eax
movzwl 0x5c(%r12), %esi
jmp 0x11ccc
movq 0x8(%rsp), %r14
imull %eax, %esi
movzwl 0x16(%r14), %ecx
subl %esi, %ecx
movswl %cx, %esi
movq %rbx, %rdi
callq 0x5192
movb 0x60(%r12), %sil
testb $0x20, %sil
movq 0x8(%rsp), %r13
jne 0x11d1b
movzwl 0x5e(%r12), %r14d
movq %r15, %rdi
callq 0x5332
imulw %r14w, %ax
movzwl 0x16(%r13), %ecx
subl %eax, %ecx
movswl %cx, %esi
movq %rbx, %rdi
callq 0x51d0
movb 0x60(%r12), %sil
testb $0x10, %sil
jne 0x11d46
movzwl 0x5c(%r12), %r14d
movq %r15, %rdi
callq 0x5308
imulw %r14w, %ax
movzwl 0x1a(%r13), %ecx
subl %eax, %ecx
movswl %cx, %esi
movq %rbx, %rdi
callq 0x5192
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq