Setting a visible touch point with lv_indev_set_cursor() eats up UI events in v6.0?


I’ve been using v5.3 for a while in a test project of mine, and have been using lv_indev_set_cursor to set a cursor object to show the location of the touch for debugging purposed. This worked fine.

Now I upgraded to v6.0 and everything works, as long as I don’t show the cursor. With a cursor object set using lv_indev_set_cursor`, the UI gets completely unresponsive (no events of any kind on any object event handler) - but the cursor itself shows and moves as expected.

I have the same project with SDL2 on my Mac and on the actual target (a OpenWrt MIPS board), the behaviour is the same on both.

Here’s my cursor init code:

pointer_indev_drv.read_cb = evdev_read;
pointer_indev = lv_indev_drv_register(&pointer_indev_drv);
lv_obj_t *cursor;
cursor = lv_obj_create(lv_scr_act(), NULL);
lv_obj_set_size(cursor, 24, 24);
static lv_style_t style_round;
lv_style_copy(&style_round, &lv_style_plain);
style_round.body.radius = LV_RADIUS_CIRCLE;
style_round.body.main_color = LV_COLOR_RED;
style_round.body.opa = LV_OPA_COVER;
lv_obj_set_style(cursor, &style_round);
lv_indev_set_cursor(pointer_indev, cursor);

If I build with SHOW_MOUSE_CURSOR=1, the cursor shows but the UI does not respond. Otherwise, everything is ok.

Any ideas what could be wrong?


You should disable the “clickable” attribute of the cursor with lv_obj_set_click(cursor, false). Now you click on the cursor because it’s the top object.

I’ll update the docs the mention this.

Hi, thanks a lot for the speedy solution.

Totally makes sense that the cursor object needs to be click-transparent!

However as the code had worked in v5.3 I was suspecting something more hidden/difficult rather than thinking of the obvious :wink:

I wonder it worked in v5.3 but anyway, it’s working again :slight_smile: