Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Buildscripts/release-sdk-esp32.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ def main():
# lvgl (basics)
{'src': 'build/esp-idf/lvgl__lvgl/liblvgl__lvgl.a', 'dst': 'Libraries/lvgl/binary/liblvgl.a'},
{'src': 'Libraries/lvgl/lvgl.h', 'dst': 'Libraries/lvgl/include/'},
{'src': 'Libraries/lvgl/lv_version.h', 'dst': 'Libraries/lvgl/include/'},
{'src': 'Libraries/lvgl/lvgl_private.h', 'dst': 'Libraries/lvgl/include/'},
{'src': 'Libraries/lvgl/include/**/*.h', 'dst': 'Libraries/lvgl/include/include/'},
Comment thread
KenVanHoeylandt marked this conversation as resolved.
{'src': 'Libraries/lvgl/LICENCE*.*', 'dst': 'Libraries/lvgl/'},
{'src': 'Libraries/lvgl/src/lv_conf_kconfig.h', 'dst': 'Libraries/lvgl/include/lv_conf.h'},
{'src': 'Libraries/lvgl/include/lvgl/config/lv_conf_kconfig.h', 'dst': 'Libraries/lvgl/include/lv_conf.h'},
{'src': 'Libraries/lvgl/src/**/*.h', 'dst': 'Libraries/lvgl/include/src/'},
# elf_loader
{'src': 'managed_components/espressif__elf_loader/*.cmake', 'dst': 'Libraries/elf_loader/'},
Expand Down
3 changes: 2 additions & 1 deletion Buildscripts/release-sdk-posix.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ def main():
# lvgl (basics)
{'src': 'buildsim/Libraries/lvgl/lib/liblvgl.a', 'dst': 'Libraries/lvgl/binary/liblvgl.a'},
{'src': 'Libraries/lvgl/lvgl.h', 'dst': 'Libraries/lvgl/include/'},
{'src': 'Libraries/lvgl/lv_version.h', 'dst': 'Libraries/lvgl/include/'},
{'src': 'Libraries/lvgl/lvgl_private.h', 'dst': 'Libraries/lvgl/include/'},
{'src': 'Libraries/lvgl/include/**/*.h', 'dst': 'Libraries/lvgl/include/include/'},
Comment thread
KenVanHoeylandt marked this conversation as resolved.
{'src': 'Libraries/lvgl/LICENCE*.*', 'dst': 'Libraries/lvgl/'},
{'src': 'lv_conf.h', 'dst': 'Libraries/lvgl/include/'},
{'src': 'Libraries/lvgl/src/**/*.h', 'dst': 'Libraries/lvgl/include/src/'},
Expand Down
1 change: 0 additions & 1 deletion Buildscripts/sdkconfig-default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y
# size, and a smaller buffer fails mid-transfer with MBEDTLS_ERR_SSL_INVALID_RECORD (-0x7200).
CONFIG_MBEDTLS_DYNAMIC_BUFFER=y
# LVGL
CONFIG_LV_USE_USER_DATA=y
CONFIG_LV_USE_FS_STDIO=y
CONFIG_LV_FS_STDIO_LETTER=65
CONFIG_LV_FS_STDIO_PATH=""
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ if (NOT DEFINED ENV{ESP_IDF_VERSION})
set(CONFIG_LV_BUILD_DEMOS OFF CACHE BOOL "" FORCE)
set(CONFIG_LV_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory(Libraries/lvgl) # Added as idf component for ESP and as library for other targets
target_link_libraries(lvgl PRIVATE SDL2-static)
# PUBLIC: lvgl.h includes the SDL driver headers when LV_USE_PRIVATE_API is set
target_link_libraries(lvgl PUBLIC SDL2-static)

# Tests
add_subdirectory(Tests)
Expand Down
2 changes: 1 addition & 1 deletion Libraries/lvgl
Submodule lvgl updated 6424 files
36 changes: 36 additions & 0 deletions Modules/lvgl-module/include/lvgl/widgets/list.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once

#include <lvgl.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief Creates a list: a flex column of full-width text rows and buttons.
* @param[in] parent the parent object for the new list
* @return the created list
*/
lv_obj_t* lvgl_list_create(lv_obj_t* parent);

/**
* @brief Adds a full-width text row (a section header) to a list.
* @param[in] list the list created with lvgl_list_create()
* @param[in] text the text of the row, or NULL to leave it empty
* @return the created label
*/
lv_obj_t* lvgl_list_add_text(lv_obj_t* list, const char* text);

/**
* @brief Adds a full-width button with an optional icon and text to a list.
* @param[in] list the list created with lvgl_list_create()
* @param[in] icon an image source (e.g. a symbol), or NULL for no icon
* @param[in] text the button text, or NULL for no text
* @return the created button
*/
lv_obj_t* lvgl_list_add_button(lv_obj_t* list, const void* icon, const char* text);

#ifdef __cplusplus
}
#endif
6 changes: 3 additions & 3 deletions Modules/lvgl-module/source/devices/keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ static void textarea_hide_keyboard(lv_event_t* event) {

void lvgl_software_keyboard_construct(LvglSoftwareKeyboard* keyboard, lv_obj_t* parent) {
keyboard->object = lv_keyboard_create(parent);
lv_obj_add_flag(keyboard->object, LV_OBJ_FLAG_HIDDEN);
lv_obj_set_hidden(keyboard->object, true);
last_software_keyboard = *keyboard;
}

Expand All @@ -262,13 +262,13 @@ void lvgl_software_keyboard_destruct(LvglSoftwareKeyboard* keyboard) {

void lvgl_software_keyboard_show(LvglSoftwareKeyboard* keyboard, lv_obj_t* textarea) {
assert(keyboard->object != nullptr);
lv_obj_clear_flag(keyboard->object, LV_OBJ_FLAG_HIDDEN);
lv_obj_set_hidden(keyboard->object, false);
lv_keyboard_set_textarea(keyboard->object, textarea);
}

void lvgl_software_keyboard_hide(LvglSoftwareKeyboard* keyboard) {
assert(keyboard->object != nullptr);
lv_obj_add_flag(keyboard->object, LV_OBJ_FLAG_HIDDEN);
lv_obj_set_hidden(keyboard->object, true);
}

bool lvgl_software_keyboard_is_enabled() {
Expand Down
12 changes: 6 additions & 6 deletions Modules/lvgl-module/source/devices/trackball.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ static void show_cursor(LvglTrackballCtx* ctx, lv_indev_t* indev) {
if (ctx->cursor == nullptr) {
return;
}
lv_obj_remove_flag(ctx->cursor, LV_OBJ_FLAG_CLICKABLE);
lv_obj_set_clickable(ctx->cursor, false);
lv_indev_set_cursor(indev, ctx->cursor);
}

lv_image_set_src(ctx->cursor, ctx->cursor_image_src);
if (ctx->settings.enabled) {
lv_obj_remove_flag(ctx->cursor, LV_OBJ_FLAG_HIDDEN);
lv_obj_set_hidden(ctx->cursor, false);
} else {
lv_obj_add_flag(ctx->cursor, LV_OBJ_FLAG_HIDDEN);
lv_obj_set_hidden(ctx->cursor, true);
}
}

Expand All @@ -77,7 +77,7 @@ static void hide_cursor(LvglTrackballCtx* ctx) {
if (ctx->cursor == nullptr) {
return;
}
lv_obj_add_flag(ctx->cursor, LV_OBJ_FLAG_HIDDEN);
lv_obj_set_hidden(ctx->cursor, true);
}

// Reports one key event per read: the button as the enter key, and movement as arrow key presses along its strongest axis.
Expand Down Expand Up @@ -280,9 +280,9 @@ error_t lvgl_trackball_set_settings(lv_indev_t* indev, const struct LvglTrackbal
// hide_cursor() just hid above (enabled is independent of mode, and defaults to true).
if (ctx->cursor != nullptr && ctx->settings.mode == LVGL_TRACKBALL_MODE_POINTER) {
if (ctx->settings.enabled) {
lv_obj_remove_flag(ctx->cursor, LV_OBJ_FLAG_HIDDEN);
lv_obj_set_hidden(ctx->cursor, false);
} else {
lv_obj_add_flag(ctx->cursor, LV_OBJ_FLAG_HIDDEN);
lv_obj_set_hidden(ctx->cursor, true);
}
}

Expand Down
20 changes: 13 additions & 7 deletions Modules/lvgl-module/source/grid_navigation.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
#include <lvgl/grid_navigation.h>

// Marks containers with grid navigation, so the keyboard sends them up and down keys
constexpr lv_obj_flag_t GRID_NAVIGATION_FLAG = LV_OBJ_FLAG_USER_1;

static void remove_from_group(lv_obj_t* child) {
if (lv_obj_get_group(child) != nullptr) {
lv_group_remove_obj(child);
Expand All @@ -21,7 +18,7 @@ static void on_child_created(lv_event_t* event) {

// Matches which children grid navigation can focus
static bool is_focusable(lv_obj_t* obj) {
return !lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN) && lv_obj_has_flag(obj, static_cast<lv_obj_flag_t>(LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_CLICK_FOCUSABLE));
return !lv_obj_is_hidden(obj) && lv_obj_is_clickable(obj) && lv_obj_is_click_focusable(obj);
}

// Finds the next focusable child after (or before) the given index
Expand Down Expand Up @@ -138,7 +135,6 @@ void lvgl_grid_navigation_add(lv_obj_t* container) {
// Added after grid navigation's own handler, so it runs after it
lv_obj_add_event_cb(container, on_container_focused, LV_EVENT_FOCUSED, nullptr);
lv_obj_add_event_cb(container, on_container_key, LV_EVENT_KEY, nullptr);
lv_obj_add_flag(container, GRID_NAVIGATION_FLAG);

const uint32_t child_count = lv_obj_get_child_count(container);
for (uint32_t i = 0; i < child_count; i++) {
Expand All @@ -164,7 +160,6 @@ void lvgl_grid_navigation_remove(lv_obj_t* container) {
lv_obj_remove_event_cb(container, on_child_created);
lv_obj_remove_event_cb(container, on_container_focused);
lv_obj_remove_event_cb(container, on_container_key);
lv_obj_remove_flag(container, GRID_NAVIGATION_FLAG);

if (group == nullptr) {
return;
Expand Down Expand Up @@ -243,5 +238,16 @@ lv_obj_t* lvgl_grid_navigation_get_focused(lv_obj_t* container) {
}

bool lvgl_grid_navigation_is_container(const lv_obj_t* obj) {
return obj != nullptr && lv_obj_has_flag(obj, GRID_NAVIGATION_FLAG);
if (obj == nullptr) {
return false;
}
// Grid navigation containers are the objects with this module's focus handler
auto* container = const_cast<lv_obj_t*>(obj);
const uint32_t event_count = lv_obj_get_event_count(container);
for (uint32_t i = 0; i < event_count; i++) {
if (lv_event_dsc_get_cb(lv_obj_get_event_dsc(container, i)) == on_container_focused) {
return true;
}
}
return false;
}
12 changes: 10 additions & 2 deletions Modules/lvgl-module/source/insets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,20 @@ static void update_edge_padding(void* data) {
// The curve is widest at the object's edge that is nearest to the display's top or bottom
const int32_t inset = std::max(lvgl_display_get_row_inset(display, coords.y1), lvgl_display_get_row_inset(display, coords.y2));
const int32_t right_edge = lv_display_get_horizontal_resolution(display) - 1;
lv_obj_set_style_pad_left(padding->obj, padding->base_left + std::max<int32_t>(0, inset - coords.x1), LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(padding->obj, padding->base_right + std::max<int32_t>(0, inset - (right_edge - coords.x2)), LV_STATE_DEFAULT);
const int32_t pad_left = padding->base_left + std::max<int32_t>(0, inset - coords.x1);
const int32_t pad_right = padding->base_right + std::max<int32_t>(0, inset - (right_edge - coords.x2));
// Setting a style marks the layout as dirty, which would resize the object and call this again
if (lv_obj_get_style_pad_left(padding->obj, LV_PART_MAIN) != pad_left) {
lv_obj_set_style_pad_left(padding->obj, pad_left, LV_STATE_DEFAULT);
}
if (lv_obj_get_style_pad_right(padding->obj, LV_PART_MAIN) != pad_right) {
lv_obj_set_style_pad_right(padding->obj, pad_right, LV_STATE_DEFAULT);
}
}

// The position is final once the layout pass that changed the size has finished
static void on_size_changed(lv_event_t* event) {
lv_async_call_cancel(update_edge_padding, lv_event_get_user_data(event));
lv_async_call(update_edge_padding, lv_event_get_user_data(event));
}

Expand Down
2 changes: 1 addition & 1 deletion Modules/lvgl-module/source/png_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <lvgl.h>
#include <src/core/lv_global.h>
#include <src/draw/lv_image_decoder_private.h>
#include <src/image/lv_image_decoder_private.h>

#define DECODER_NAME "LODEPNG"

Expand Down
28 changes: 28 additions & 0 deletions Modules/lvgl-module/source/symbols.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <lvgl/widgets/card.h>
#include <lvgl/widgets/chip.h>
#include <lvgl/widgets/icon_button.h>
#include <lvgl/widgets/list.h>
#include <lvgl/widgets/page_indicator.h>
#include <lvgl/widgets/spinner.h>
#include <lvgl/widgets/toolbar.h>
Expand All @@ -25,6 +26,8 @@

#include <lvgl.h>

// Deprecated LVGL functions stay exported for existing apps
LV_DEPRECATIONS_IGNORE_BEGIN
const struct ModuleSymbol lvgl_module_symbols[] = {
// lvgl_module
DEFINE_MODULE_SYMBOL(lvgl_lock),
Expand Down Expand Up @@ -94,6 +97,10 @@ const struct ModuleSymbol lvgl_module_symbols[] = {
// lvgl_icon_button
DEFINE_MODULE_SYMBOL(lvgl_icon_button_create),
DEFINE_MODULE_SYMBOL(lvgl_icon_button_create_variant),
// lvgl_list
DEFINE_MODULE_SYMBOL(lvgl_list_create),
DEFINE_MODULE_SYMBOL(lvgl_list_add_text),
DEFINE_MODULE_SYMBOL(lvgl_list_add_button),
// lvgl_spinner
DEFINE_MODULE_SYMBOL(lvgl_spinner_create),
// lvgl_toolbar
Expand Down Expand Up @@ -167,6 +174,26 @@ const struct ModuleSymbol lvgl_module_symbols[] = {
DEFINE_MODULE_SYMBOL(lv_obj_is_valid),
DEFINE_MODULE_SYMBOL(lv_obj_remove_event_cb),
DEFINE_MODULE_SYMBOL(lv_obj_remove_flag),
DEFINE_MODULE_SYMBOL(lv_obj_set_hidden),
DEFINE_MODULE_SYMBOL(lv_obj_is_hidden),
DEFINE_MODULE_SYMBOL(lv_obj_set_clickable),
DEFINE_MODULE_SYMBOL(lv_obj_is_clickable),
DEFINE_MODULE_SYMBOL(lv_obj_set_click_focusable),
DEFINE_MODULE_SYMBOL(lv_obj_is_click_focusable),
DEFINE_MODULE_SYMBOL(lv_obj_set_checkable),
DEFINE_MODULE_SYMBOL(lv_obj_is_checkable),
DEFINE_MODULE_SYMBOL(lv_obj_set_scrollable),
DEFINE_MODULE_SYMBOL(lv_obj_is_scrollable),
DEFINE_MODULE_SYMBOL(lv_obj_set_scroll_on_focus),
DEFINE_MODULE_SYMBOL(lv_obj_is_scroll_on_focus),
DEFINE_MODULE_SYMBOL(lv_obj_set_ignore_layout),
DEFINE_MODULE_SYMBOL(lv_obj_is_ignore_layout),
DEFINE_MODULE_SYMBOL(lv_obj_set_floating),
DEFINE_MODULE_SYMBOL(lv_obj_is_floating),
DEFINE_MODULE_SYMBOL(lv_obj_set_event_bubble),
DEFINE_MODULE_SYMBOL(lv_obj_is_event_bubble),
DEFINE_MODULE_SYMBOL(lv_obj_set_gesture_bubble),
DEFINE_MODULE_SYMBOL(lv_obj_is_gesture_bubble),
DEFINE_MODULE_SYMBOL(lv_obj_remove_state),
DEFINE_MODULE_SYMBOL(lv_obj_set_pos),
DEFINE_MODULE_SYMBOL(lv_obj_set_flex_align),
Expand Down Expand Up @@ -584,3 +611,4 @@ const struct ModuleSymbol lvgl_module_symbols[] = {
DEFINE_MODULE_SYMBOL(lv_area_get_height),
MODULE_SYMBOL_TERMINATOR,
};
LV_DEPRECATIONS_IGNORE_END
41 changes: 25 additions & 16 deletions Modules/lvgl-module/source/themes/lv_theme_material.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ extern const lv_obj_class_t lvgl_chip_class;
extern const lv_obj_class_t lvgl_badge_class;
extern const lv_obj_class_t lvgl_page_indicator_class;
extern const lv_obj_class_t lvgl_page_indicator_dot_class;
extern const lv_obj_class_t lvgl_list_class;
extern const lv_obj_class_t lvgl_list_text_class;
extern const lv_obj_class_t lvgl_list_button_class;

#define NEUTRAL_4 lv_color_hex(0x0E0E0E)
#define NEUTRAL_6 lv_color_hex(0x131313)
Expand Down Expand Up @@ -491,18 +494,10 @@ typedef struct {
#if LV_USE_BUTTONMATRIX || LV_USE_KEYBOARD
lv_style_t key_selected;
#endif
#if LV_USE_LIST
lv_style_t list;
#endif
#if LV_USE_LIST
lv_style_t list_item;
#endif
#if LV_USE_LIST || LV_USE_TABLE
lv_style_t list_item_focused;
#endif
#if LV_USE_LIST
lv_style_t list_subheader;
#endif
#if LV_USE_TABVIEW
lv_style_t tabs;
#endif
Expand Down Expand Up @@ -1193,17 +1188,14 @@ static void style_init(my_theme_t * theme)
lv_style_set_text_color(&theme->styles.key_selected, KEY_SELECTED_TEXT_COLOR);
#endif

#if LV_USE_LIST
style_init_reset(&theme->styles.list);
lv_style_set_bg_color(&theme->styles.list, LIST_COLOR);
lv_style_set_bg_opa(&theme->styles.list, LV_OPA_COVER);
lv_style_set_pad_hor(&theme->styles.list, 0);
lv_style_set_pad_ver(&theme->styles.list, LIST_PAD);
lv_style_set_pad_gap(&theme->styles.list, 0);
lv_style_set_clip_corner(&theme->styles.list, true);
#endif

#if LV_USE_LIST
style_init_reset(&theme->styles.list_item);
lv_style_set_bg_color(&theme->styles.list_item, LIST_ITEM_COLOR);
lv_style_set_bg_opa(&theme->styles.list_item, LIST_ITEM_OPACITY);
Expand All @@ -1214,23 +1206,18 @@ static void style_init(my_theme_t * theme)
lv_style_set_border_color(&theme->styles.list_item, LIST_DIVIDER_COLOR);
lv_style_set_border_width(&theme->styles.list_item, LIST_DIVIDER_WIDTH);
lv_style_set_border_side(&theme->styles.list_item, LV_BORDER_SIDE_BOTTOM);
#endif

#if LV_USE_LIST || LV_USE_TABLE
style_init_reset(&theme->styles.list_item_focused);
lv_style_set_bg_color(&theme->styles.list_item_focused, LIST_ITEM_FOCUSED_COLOR);
lv_style_set_bg_opa(&theme->styles.list_item_focused, LV_OPA_COVER);
lv_style_set_text_color(&theme->styles.list_item_focused, LIST_ITEM_FOCUSED_TEXT_COLOR);
#endif

#if LV_USE_LIST
style_init_reset(&theme->styles.list_subheader);
lv_style_set_text_color(&theme->styles.list_subheader, LIST_SUBHEADER_TEXT_COLOR);
lv_style_set_text_font(&theme->styles.list_subheader, theme->config.font_small);
lv_style_set_pad_hor(&theme->styles.list_subheader, LIST_ITEM_PAD_HOR);
lv_style_set_pad_top(&theme->styles.list_subheader, LIST_ITEM_PAD_VER);
lv_style_set_pad_bottom(&theme->styles.list_subheader, LIST_PAD);
#endif

#if LV_USE_TABVIEW
style_init_reset(&theme->styles.tabs);
Expand Down Expand Up @@ -2096,6 +2083,28 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
return;
}
#endif
if(lv_obj_check_type(obj, &lvgl_list_class)) {
/* flex_list */
lv_obj_add_style(obj, &theme->styles.list, 0);
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
lv_obj_add_style(obj, &theme->styles.scrollbar_scrolled, LV_PART_SCROLLBAR | LV_STATE_SCROLLED);
return;
}
if(lv_obj_check_type(obj, &lvgl_list_text_class)) {
/* flex_list_text */
lv_obj_add_style(obj, &theme->styles.list_subheader, 0);
return;
}
if(lv_obj_check_type(obj, &lvgl_list_button_class)) {
/* flex_list_button */
lv_obj_add_style(obj, &theme->styles.list_item, 0);
lv_obj_add_style(obj, &theme->styles.transition_exit, 0);
lv_obj_add_style(obj, &theme->styles.state_pressed, LV_STATE_PRESSED);
lv_obj_add_style(obj, &theme->styles.transition_enter, LV_STATE_PRESSED);
lv_obj_add_style(obj, &theme->styles.list_item_focused, LV_STATE_FOCUS_KEY);
lv_obj_add_style(obj, &theme->styles.disabled, LV_STATE_DISABLED);
return;
}
#if LV_USE_TABLE
if(lv_obj_check_type(obj, &lv_table_class)) {
/* table */
Expand Down
Loading
Loading