// File: /workspace/github_c_makefile_star2_O3/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 $0x18, %rsp
movq %rdx, %r15
movl %esi, %r14d
movq %rdi, %rbx
callq *0x4dbbe(%rip)          # 0x60350
movl %eax, %ebp
cmpb $0x1, %al
jne 0x12af1
cmpb $0x7, %r14b
jne 0x127bf
leaq 0x30e14(%rip), %rsi     # 0x435bd
movq %r15, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6c02
movq %rbx, %rdi
callq 0x4ab5
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
callq 0x130c4
movb $0x1, %bpl
cmpb $0x2, %r14b
jne 0x12af1
movq %rax, 0x10(%rsp)
callq 0x378a
testq %rax, %rax
je 0x12af1
movq %rax, %r14
movq %r15, %rdi
callq 0x6af7
movq %rax, %r12
movb 0x60(%rax), %al
testb $0x20, %al
jne 0x12828
testb $0x8, %al
je 0x12815
cmpw $-0x9, 0x44(%r14)
jl 0x12821
testb $0x4, %al
je 0x12828
cmpw $0xa, 0x44(%r14)
jl 0x12828
orb $0x10, %al
movb %al, 0x60(%r12)
testb $0x10, %al
jne 0x1284d
testb $0x2, %al
je 0x12838
cmpw $-0x9, 0x46(%r14)
jl 0x12844
testb $0x1, %al
je 0x12853
cmpw $0xa, 0x46(%r14)
jl 0x12853
orb $0x20, %al
movb %al, 0x60(%r12)
jmp 0x12853
andb $-0x7, 0x40(%r12)
movq %r14, 0x8(%rsp)
testb $0x20, %al
je 0x12862
andb $-0x19, 0x40(%r12)
movq %rbx, %rdi
callq 0x4bdd
movw %ax, 0x2(%rsp)
movq %rbx, %rdi
callq 0x4c15
movl %eax, %r13d
movq %r15, %rdi
callq 0x5697
movl %eax, %r14d
movq %r15, %rdi
callq 0x566d
movl %eax, %edi
movb 0x60(%r12), %al
testb $0x1, %al
jne 0x12920
movswl %r13w, %edx
movswl 0x5e(%r12), %ecx
movswl %r14w, %esi
imull %ecx, %esi
negl %esi
cmpl %esi, %edx
movl %r14d, %r8d
jle 0x12923
testb $0x10, %al
movq 0x8(%rsp), %r9
jne 0x12928
cmpw $0x0, 0x42(%r9)
jle 0x12928
movl %edi, 0x4(%rsp)
movb 0x40(%r12), %al
movl %eax, %edx
andb $0x1f, %dl
cmpb $0x1, %dl
jne 0x128f5
orb $0x2, %al
movb %al, 0x40(%r12)
movq %r15, %rdi
movl %r8d, %r14d
callq 0x27028
movl %r14d, %r8d
movzwl 0x5e(%r12), %ecx
imull %r8d, %ecx
movq 0x10(%rsp), %rax
movzwl 0x16(%rax), %eax
subl %ecx, %eax
movswl %ax, %esi
movq %rbx, %rdi
movl %r8d, %r14d
callq 0x5519
movl %r14d, %r8d
movb 0x60(%r12), %al
movl 0x4(%rsp), %edi
jmp 0x12923
movl %r14d, %r8d
movq 0x8(%rsp), %r9
testb $0x2, %al
jne 0x129a8
testb $0x10, %al
jne 0x129a8
cmpw $0x0, 0x42(%r9)
jns 0x129a8
movswl %r13w, %ecx
movswl 0x5e(%r12), %eax
movswl %r8w, %edx
imull %eax, %edx
negl %edx
movl %edi, %r14d
cmpl %edx, %ecx
jge 0x12981
movb 0x40(%r12), %cl
movl %ecx, %edx
andb $0x1f, %dl
cmpb $0x1, %dl
jne 0x12981
orb $0x4, %cl
movb %cl, 0x40(%r12)
movq %r15, %rdi
movl %r8d, 0x4(%rsp)
callq 0x27028
movl 0x4(%rsp), %r8d
movzwl 0x5e(%r12), %eax
imull %r8d, %eax
movq 0x10(%rsp), %rcx
movzwl 0x16(%rcx), %ecx
subl %eax, %ecx
movswl %cx, %esi
movq %rbx, %rdi
callq 0x5519
movb 0x60(%r12), %al
movl %r14d, %edi
movq 0x8(%rsp), %r9
testb $0x4, %al
jne 0x12a22
movswl 0x2(%rsp), %edx
movswl 0x5c(%r12), %ecx
movswl %di, %esi
imull %ecx, %esi
negl %esi
cmpl %esi, %edx
jle 0x12a22
testb $0x20, %al
jne 0x12a22
cmpw $0x0, 0x40(%r9)
jle 0x12a22
movb 0x40(%r12), %al
movl %eax, %edx
andb $0x1f, %dl
cmpb $0x1, %dl
jne 0x129f9
orb $0x10, %al
movb %al, 0x40(%r12)
movl %edi, %r14d
movq %r15, %rdi
callq 0x27028
movl %r14d, %edi
movzwl 0x5c(%r12), %ecx
imull %edi, %ecx
movq 0x10(%rsp), %rax
movzwl 0x1a(%rax), %eax
subl %ecx, %eax
movswl %ax, %esi
movl %edi, %r14d
movq %rbx, %rdi
callq 0x54db
movl %r14d, %edi
movb 0x60(%r12), %al
movq 0x8(%rsp), %r9
testb $0x8, %al
jne 0x12a95
testb $0x20, %al
jne 0x12a95
cmpw $0x0, 0x40(%r9)
movq 0x10(%rsp), %r13
jns 0x12a9a
movswl 0x2(%rsp), %ecx
movswl 0x5c(%r12), %eax
movswl %di, %edx
imull %eax, %edx
negl %edx
cmpl %edx, %ecx
jge 0x12a79
movb 0x40(%r12), %cl
movl %ecx, %edx
andb $0x1f, %dl
cmpb $0x1, %dl
jne 0x12a79
orb $0x8, %cl
movb %cl, 0x40(%r12)
movl %edi, %r14d
movq %r15, %rdi
callq 0x27028
movl %r14d, %edi
movzwl 0x5c(%r12), %eax
imull %edi, %eax
movzwl 0x16(%r13), %ecx
subl %eax, %ecx
movswl %cx, %esi
movq %rbx, %rdi
callq 0x54db
movb 0x60(%r12), %al
jmp 0x12a9a
movq 0x10(%rsp), %r13
testb $0x20, %al
jne 0x12ac8
movzwl 0x5e(%r12), %r14d
movq %r15, %rdi
callq 0x5697
imulw %r14w, %ax
movzwl 0x16(%r13), %ecx
subl %eax, %ecx
movswl %cx, %esi
movq %rbx, %rdi
callq 0x5519
movb 0x60(%r12), %al
testb $0x10, %al
jne 0x12af1
movzwl 0x5c(%r12), %r14d
movq %r15, %rdi
callq 0x566d
imulw %r14w, %ax
movzwl 0x1a(%r13), %ecx
subl %eax, %ecx
movswl %cx, %esi
movq %rbx, %rdi
callq 0x54db
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq