// File: /workspace/github_c_makefile_star2_O1/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 *0x4dbba(%rip)          # 0x60350
movl %eax, %ebp
cmpb $0x1, %al
jne 0x12ade
cmpb $0x7, %r14b
jne 0x127c3
leaq 0x30c20(%rip), %rsi     # 0x433cd
movq %r15, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6bf5
movq %rbx, %rdi
callq 0x4abf
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
callq 0x13096
movq %rax, 0x10(%rsp)
cmpb $0x2, %r14b
jne 0x12ade
callq 0x3784
testq %rax, %rax
je 0x12ade
movq %rax, %r13
movq %r15, %rdi
callq 0x6ad8
movq %rax, %r12
movb 0x60(%rax), %al
testb $0x20, %al
jne 0x12829
testb $0x8, %al
je 0x12816
cmpw $-0x9, 0x44(%r13)
jl 0x12822
testb $0x4, %al
je 0x12829
cmpw $0xa, 0x44(%r13)
jl 0x12829
orb $0x10, %al
movb %al, 0x60(%r12)
movb 0x60(%r12), %al
testb $0x10, %al
jne 0x12851
testb $0x2, %al
je 0x1283e
cmpw $-0x9, 0x46(%r13)
jl 0x1284a
testb $0x1, %al
je 0x12851
cmpw $0xa, 0x46(%r13)
jl 0x12851
orb $0x20, %al
movb %al, 0x60(%r12)
testb $0x10, 0x60(%r12)
je 0x1285f
andb $-0x7, 0x40(%r12)
testb $0x20, 0x60(%r12)
je 0x1286d
andb $-0x19, 0x40(%r12)
movq %rbx, %rdi
callq 0x4bc6
movw %ax, 0xe(%rsp)
movq %rbx, %rdi
callq 0x4bfe
movl %eax, %r14d
movq %r15, %rdi
callq 0x567b
movw %ax, 0xa(%rsp)
movq %r15, %rdi
callq 0x5651
movb 0x60(%r12), %dil
testb $0x1, %dil
jne 0x12915
movswl %r14w, %ecx
movswl 0x5e(%r12), %edx
movswl 0xa(%rsp), %esi
imull %edx, %esi
negl %esi
cmpl %esi, %ecx
jle 0x12915
testb $0x10, %dil
jne 0x12915
cmpw $0x0, 0x42(%r13)
jle 0x12915
movw %ax, 0xc(%rsp)
movb 0x40(%r12), %al
movl %eax, %ecx
andb $0x1f, %cl
cmpb $0x1, %cl
jne 0x128ee
orb $0x2, %al
movb %al, 0x40(%r12)
movq %r15, %rdi
callq 0x26952
movzwl 0x5e(%r12), %eax
imulw 0xa(%rsp), %ax
movq 0x10(%rsp), %rcx
movzwl 0x16(%rcx), %ecx
subl %eax, %ecx
movswl %cx, %esi
movq %rbx, %rdi
callq 0x5501
movzwl 0xc(%rsp), %eax
movb 0x60(%r12), %cl
testb $0x2, %cl
jne 0x1298e
testb $0x10, %cl
jne 0x1298e
cmpw $0x0, 0x42(%r13)
jns 0x1298e
movw %ax, 0xc(%rsp)
movswl %r14w, %eax
movswl 0x5e(%r12), %ecx
movswl 0xa(%rsp), %edx
imull %ecx, %edx
negl %edx
cmpl %edx, %eax
jge 0x12967
movb 0x40(%r12), %al
movl %eax, %ecx
andb $0x1f, %cl
cmpb $0x1, %cl
jne 0x12967
orb $0x4, %al
movb %al, 0x40(%r12)
movq %r15, %rdi
callq 0x26952
movzwl 0x5e(%r12), %eax
imulw 0xa(%rsp), %ax
movq 0x10(%rsp), %rcx
movzwl 0x16(%rcx), %ecx
subl %eax, %ecx
movswl %cx, %esi
movq %rbx, %rdi
callq 0x5501
movzwl 0xc(%rsp), %eax
movb 0x60(%r12), %dil
testb $0x4, %dil
jne 0x12a09
movswl 0xe(%rsp), %ecx
movswl 0x5c(%r12), %edx
movswl %ax, %esi
imull %edx, %esi
negl %esi
cmpl %esi, %ecx
jle 0x12a09
testb $0x20, %dil
jne 0x12a09
cmpw $0x0, 0x40(%r13)
jle 0x12a09
movb 0x40(%r12), %dl
movl %edx, %ecx
andb $0x1f, %cl
cmpb $0x1, %cl
jne 0x129e3
orb $0x10, %dl
movb %dl, 0x40(%r12)
movl %eax, %r14d
movq %r15, %rdi
callq 0x26952
movl %r14d, %eax
movzwl 0x5c(%r12), %edx
imulw %ax, %dx
movq 0x10(%rsp), %rcx
movzwl 0x1a(%rcx), %ecx
subl %edx, %ecx
movswl %cx, %esi
movl %eax, %r14d
movq %rbx, %rdi
callq 0x54c3
movl %r14d, %eax
movb 0x60(%r12), %cl
testb $0x8, %cl
jne 0x12a7c
testb $0x20, %cl
jne 0x12a7c
cmpw $0x0, 0x40(%r13)
jns 0x12a7c
movswl 0xe(%rsp), %esi
movswl 0x5c(%r12), %ecx
movswl %ax, %edx
imull %ecx, %edx
negl %edx
cmpl %edx, %esi
jge 0x12a5c
movb 0x40(%r12), %dl
movl %edx, %ecx
andb $0x1f, %cl
cmpb $0x1, %cl
jne 0x12a5c
orb $0x8, %dl
movb %dl, 0x40(%r12)
movl %eax, %r14d
movq %r15, %rdi
callq 0x26952
movl %r14d, %eax
movzwl 0x5c(%r12), %edx
imulw %ax, %dx
movq 0x10(%rsp), %rcx
movzwl 0x16(%rcx), %ecx
subl %edx, %ecx
movswl %cx, %esi
movq %rbx, %rdi
callq 0x54c3
testb $0x20, 0x60(%r12)
jne 0x12aad
movzwl 0x5e(%r12), %r14d
movq %r15, %rdi
callq 0x567b
imulw %r14w, %ax
movq 0x10(%rsp), %rcx
movzwl 0x16(%rcx), %ecx
subl %eax, %ecx
movswl %cx, %esi
movq %rbx, %rdi
callq 0x5501
testb $0x10, 0x60(%r12)
jne 0x12ade
movzwl 0x5c(%r12), %r14d
movq %r15, %rdi
callq 0x5651
imulw %r14w, %ax
movq 0x10(%rsp), %rcx
movzwl 0x1a(%rcx), %ecx
subl %eax, %ecx
movswl %cx, %esi
movq %rbx, %rdi
callq 0x54c3
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq