LVGL always returns active screen as currently pressed object

Description

I am trying to use my touch controller as an LVGL input device. LVGL reports the right coordinates when I press the screen, however if I read the currently pressed object (lv_obj_t *act_obj), it has always the same memory address as lv_scr_act() returns regardless the real touched object.

What MCU/Processor/Board and compiler are you using?

Nordic nRF52832

What LVGL version are you using?

v8.3

What do you want to achieve?

Send custom events to the actual pressed object (label, button, etc.) when touch is detected.

What have you tried so far?

I have tried to modify label size

Code to reproduce

main.c: create LVGL widgets


void test_cb(lv_event_t *e) {
    lv_label_set_text(lv_event_get_target(e), "Event received");
}

void create_content() {
    // Create a style
    static lv_style_t style;
    lv_style_init(&style);
    lv_style_set_bg_opa(&style, LV_OPA_COVER);
    lv_style_set_bg_color(&style, lv_color_hex(0x000000));
    lv_obj_add_style(lv_scr_act(), &style, 0);

    // Create a label
    lv_obj_t *time_label = lv_label_create(lv_scr_act());
    lv_label_set_recolor(time_label, true);
    lv_obj_set_align(time_label, LV_ALIGN_CENTER);
    lv_label_set_text(time_label, "Hello world!");
    lv_obj_set_size(time_label, 150, 50);

    // Set event callback
    lv_obj_add_event_cb(time_label, test_cb, LV_EVENT_CUSTOM, NULL);
}

lvgl_indev_glue.c: associate LVGL with input device driver

static lv_indev_drv_t indev_drv;
static lv_indev_t *indev;
static uint32_t LV_EVENT_CUSTOM;

void lvgl_indev_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) {

    // Set the last pressed coordinates
    data -> point.x = get_x();
    data -> point.y = get_y();

    if(touchpad_is_pressed()) {
        data -> state = LV_INDEV_STATE_PR;
    }
    else {
        data -> state = LV_INDEV_STATE_REL;

        if(get_gesture_id() == 0x1c) {
            lv_event_send(indev -> proc.types.pointer.act_obj, LV_EVENT_CUSTOM, NULL); // send an EVENT to the pressed object
            
            // It reports the right coordinates but pressed object is always the active sceen
            printf("Event sent to object: %p (X: %d, Y: %d)\n", indev -> proc.types.pointer.act_obj, indev -> proc.types.pointer.act_point.x, indev -> proc.types.pointer.act_point.y);
    }

void lvgl_indev_init() {
    printf("Initializing LVGL input device...\n");
    cst816s_init(); // Init touch controller
    lv_indev_drv_init(&indev_drv);
    indev_drv.type = LV_INDEV_TYPE_POINTER;
    indev_drv.read_cb = lvgl_indev_read;

    LV_EVENT_CUSTOM = lv_event_register_id();

    indev = lv_indev_drv_register(&indev_drv);
    if(indev == NULL) {
        printf("Error while registering LVGL input device driver\n");
    }
    else {
        printf("LVGL input device initialized successfully\n");
    }
}