Object Visibility and Rendering Issue when Screen Transparency is enabled.
Setup:
- LVGL version: 7.1 Wayland
LV_COLOR_SCREEN_TRANSP
is set to 1
in lv_conf.h
.
- The screen’s opacity is set to
LV_OPA_TRANSP
.
- The display opacity is set to
LV_OPA_TRANSP
with lv_disp_set_bg_opa(NULL, LV_OPA_TRANSP);
I’m encountering issues with object visibility toggling and partial rendering when screen transparency is enabled
Scenario:
I have a button that toggles the visibility of a list containing checkboxes. The list is aligned at the bottom-left of the button.
Code Example:
/* Create a button /
lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL);
lv_obj_set_size(btn, 100, 50);
lv_obj_set_pos(btn,2,0)
lv_obj_set_event_cb(btn, btn_event_handler); / Button event callback */
/* Create a list and align it */
lv_obj_t * list = lv_list_create(lv_scr_act(), NULL);
lv_obj_align(list, btn, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
/* Create checkboxes as children of the list */
lv_obj_t * chk1 = lv_checkbox_create(list, NULL);
lv_checkbox_set_text(chk1, “Checkbox 1”);
lv_obj_t * chk2 = lv_checkbox_create(list, NULL);
lv_checkbox_set_text(chk2, “Checkbox 2”);
lv_obj_t * chk3 = lv_checkbox_create(list, NULL);
lv_checkbox_set_text(chk3, “Checkbox 3”);
/* Event callback for button to toggle visibility of the list /
void btn_event_handler(lv_obj_t * obj, lv_event_t event) {
if (event == LV_EVENT_CLICKED) {
if (lv_obj_get_hidden(list)) {
lv_obj_set_hidden(list, false); / Show the list /
} else {
lv_obj_set_hidden(list, true); / Hide the list */
}
}
}
Issues:
1. Visibility Toggling Issue
- I’m using
lv_obj_get_hidden(list)
and lv_obj_set_hidden(list, true/false)
to toggle the visibility of the list.
- The visibility toggling works correctly, but when screen transparency is enabled, the list doesn’t visually show or hide, even though the
lv_obj_get_hidden(list)
returns correct state.
2. Partial Rendering
- Even when the list is visible, only parts of the child objects (like the checkbox bullet) are rendered. The checkbox labels and background are not rendered properly or appear invisible.
- This issue only occurs when screen transparency is enabled. When transparency is disabled, everything works fine.
Verified that styles (background opacity, text opacity) are set to LV_OPA_COVER
where needed.
Tried lv_obj_invalidate(screen)
after toggling visibility to ensure proper redraw.