Skip to content

lvgl host: fix platform_set_embed_parent signature - #31

Merged
defiantnerd merged 1 commit into
mainfrom
fix/lvgl-embed-parent-signature
Aug 28, 2026
Merged

defiantnerd merged 1 commit into
mainfrom
fix/lvgl-embed-parent-signature

Conversation

@defiantnerd

Copy link
Copy Markdown
Owner

A developer configuring with -DNEUI_WITH_LVGL=ON hit platform_set_embed_parent as an undefined symbol at link time. The seam wasn't missing — it was declared with the wrong parameter type.

hosts/crossplatform/platform.h:62 declares:

void platform_set_embed_parent(Session*, uint32_t, void* native_parent);

platform_lvgl.cpp defined the third parameter as unsigned long. That's a different overload, and on MSVC x64 unsigned long is 32-bit so it can't even collapse into the pointer type by accident. The void* version that widgets.cpp:1987 actually calls was never defined. Every other platform layer (win32, macos, linux, ios, null) already used void*.

Changes

  • Match the header signature, and record the value into wd->embed_parent the way the null host does, so the public NEUI_API_EMBED state round-trips. LVGL owns the whole display, so nothing acts on it: there is no foreign native parent, event_fd stays -1, pump_and_tick stays a no-op.
  • Add the embed seam to the stubbed-or-absent list in docs/host-lvgl.md — "might not be needed in LVGL, but the host must still provide it" was itself a doc gap.

Interface audit

Diffed every platform_* seam declared in platform.h against the definitions in all six platform layers (return type + parameter types). This was the only real mismatch. platform_retained_tree_changed / platform_retained_widget_invalidate are LVGL-only seams (guarded by NEUI_PLATFORM_LVGL in the header) and correctly defined only there.

Verification

Not built: platform_lvgl.cpp compiles only on Windows with -DNEUI_WITH_LVGL=ON, and this was authored on macOS. The change is confined to that one file, and get_widget / embed_parent are both already used throughout it — a Windows LVGL build should confirm the link error is gone.

platform.h declares the embed seam as

  void platform_set_embed_parent(Session*, uint32_t, void* native_parent);

but platform_lvgl.cpp defined the third parameter as `unsigned long`. That
is a different overload - and on MSVC x64 `unsigned long` is 32-bit, so it
cannot even collapse into the pointer type by accident. The `void*` version
that widgets.cpp actually calls was therefore never defined, and any
-DNEUI_WITH_LVGL=ON build failed to link with an undefined symbol.

Match the header, and record the value into wd->embed_parent the way the
null host does so the public NEUI_API_EMBED state round-trips. LVGL owns the
whole display, so nothing ever acts on it: there is no foreign native parent
to embed into, event_fd stays -1 and pump_and_tick stays a no-op. Documented
as such in the host's stubbed-or-absent list.

Audited every other platform_* seam in platform.h against all six platform
layers (return type + parameter types); this was the only mismatch.
@defiantnerd
defiantnerd merged commit e65a55e into main Aug 28, 2026
8 checks passed
@defiantnerd
defiantnerd deleted the fix/lvgl-embed-parent-signature branch August 28, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant