Commit Graph
253 Commits
Author SHA1 Message Date
Liu 90dbba2cdd feat(widgets): migrate textinput editing to the stb_textedit kernel
- vendor stb_textedit and add the textedit core with canonical text
- map edit indices to pd_text layout for caret, selection and hit testing
- support caret movement, selection, clipboard, undo/redo, password,
  read-only and multiline editing
- render selections with the accent color and configurable text color
- fix caret scaling, input-group repaint and zero-size reflow regressions
- add integration tests, a preview page and internals notes
2026-11-22 20:11:20 +08:00
Liu b0c031f8dc feat: add window icon support
- Add ptk_window_set_icons with Win32 WM_SETICON, X11 _NET_WM_ICON and fb no-op.

- Add LCUI window/default icon APIs, DPI-aware HICON selection and pre-rendered built-in icon assets.

- Add pandagl memory image readers and fix bilinear zoom edge sampling.

- Cover file/data icons, defaults and high-DPI sizes with integration tests.
2026-11-21 23:26:34 +08:00
Liu dc0ab38546 feat(styles): add switchable accent color themes
- generate an override stylesheet for each preset from style-nova
- add the ui_theme_* API, custom colors and single-slot loading
- persist the choice and add the navbar color picker
- keep badge variants, tooltip arrows and swatches consistent
2026-11-21 23:26:31 +08:00
Liu 64ea750885 feat(css): allow unloading style rules by source
- track rules by the source name passed to the loader
- add css_remove_style_rules() and ui_unload_css_string()
- refresh computed styles after removal and cover it with a test
2026-11-21 22:23:12 +08:00
Liu a9d94e2188 fix(font): use the resolved family name for fontconfig aliases
lcui_fc_fonts_init used the candidate name for aliases. When fontconfig falls back (for example no Ubuntu Mono on CI), the alias pointed at a family that was never loaded, so monospace/sans-serif/serif resolved to -2 and text rendering was empty. Query FC_FAMILY and use the actual loaded family.
2026-11-21 15:58:53 +08:00
Liu a9de756541 test(css): identify properties and cursor values in assertions 2026-11-21 15:58:52 +08:00
Liu e26cd958a0 fix(ptk): emit window size event synchronously on Windows
Hidden windows may not receive WM_SIZE, so the gallery native resize tests saw stale root sizes. Emit PTK_EVENT_SIZE with the requested client size, matching the X11 backend.
2026-11-21 14:45:27 +08:00
Liu 7c72628f23 fix(ui-server): apply window resize before the first frame
ui_server_on_window_resize() required INITIALIZED, but the doc-viewer tests resize a window before ui_server_update transitions PENDING to INITIALIZED, especially under Xvfb, so the resize was ignored. Update the widget whenever a connection exists.
2026-11-21 13:46:27 +08:00
Liu 279eacd3ad fix(css): report unsupported declarations at debug level
Tailwind-generated doc-viewer CSS contains standard values LCUI does not implement (fixed, sticky, grid, table, ...). Skipping them is expected fallback behavior, so log the property or value at debug level instead of error.
2026-11-21 13:42:01 +08:00
Liu 7404070d5e fix(pandagl): release fontconfig global caches on shutdown
FcInitLoadConfigAndFonts() leaves fontconfig global configuration and caches allocated; FcConfigDestroy() only releases the per-call config. Call FcFini() when the font library is destroyed.
2026-11-20 00:15:26 +08:00
Liu 87d63f3c8a fix(ptk): keep cached window size in sync on Windows
ptk_window_set_size() only issued SetWindowPos(); the cached client size was updated later by WM_SIZE. Closing a window immediately after create/set_size saved the stale 320x240 size. Update the cache with the requested client size, matching the X11 backend.
2026-11-19 23:39:49 +08:00
Liu edf192475d test(css): identify properties in inheritance assertions
The shorthand and default-inheritance checks reused one fixed description inside loops, so the log showed identical lines with no property context. Include the selector and property name in each assertion name.
2026-11-19 23:38:27 +08:00
Liu 7449e6fb4a feat(pandagl): add quiet font loading for optional fonts
pd_font_try_load_file() reports failures at debug level so platform probes, test candidates and CSS @font-face no longer spam errors for missing system fonts. pd_font_load_file() and XML font resources still report errors, and initialization warns once when no usable default font exists.
2026-11-19 23:37:21 +08:00
Liu ed25199836 fix(pandagl): zero glyph bitmap metrics on init
pd_glyph_bitmap_init() only cleared the bitmap fields. When glyph rendering failed and fell back to .notdef, the cached bitmap kept uninitialised metrics, so pd_text_update_line_size() read garbage (valgrind: conditional jump on uninitialised value) and text widths became nondeterministic.
2026-11-19 22:38:10 +08:00
Liu 464eed1402 build: centralize package versions and standardize on C11
versions.json is now the single source of truth; scripts/sync-versions.mjs keeps xmake descriptors, tracked version headers and package.json in sync. Sub-library versions are aligned with the published 1.0.0 packages. C11 is set at the project level, and _GNU_SOURCE is defined on POSIX so strict C11 still exposes clock_gettime, strdup and recursive pthread mutexes.
2026-11-19 22:03:59 +08:00
Liu 9f1cb8a6e1 test: stabilize layout tests for Linux font metrics
Use Linux-specific expected heights for Ubuntu Mono wrapping, relax the auto-size width bound, and fix selector/style leaks in the CSS text decoration tests.
2026-11-19 22:03:59 +08:00
Liu 0e0bf7b179 fix(ui): image listener removal should free list nodes
list_unlink() leaves the node allocated. Use list_delete_node() when removing listeners, and destroy listener nodes when the image source is destroyed.
2026-11-19 22:03:59 +08:00
Liu ac011085ec fix(ui): event initialization should clear uninitialized mouse data
Synthetic click events only set target/type/data, leaving mouse coordinates uninitialized. Zero the event before assigning fields so hit testing does not read undefined values.
2026-11-19 22:03:59 +08:00
Liu 01b022bd4c fix(ptk): X11 window geometry should reflect requested values
Cache the requested client size and position immediately, emit a size event for unmapped windows, and close hidden windows without waiting for a window manager that may not exist. This keeps synchronous get_size/get_position and close callbacks correct under Xvfb and WSLg.
2026-11-19 22:03:59 +08:00
Liu c4b9000d36 build: make static library merging opt-in
Keep the sub-library archives separate by default so add_deps() can export each library's own links for tests and development builds. The merge-archive option restores the self-contained lcui library for release/Debian builds, and CI enables it only after tests pass. yutil-tests also needs C11 for its u8 string literals.
2026-11-19 01:26:36 +08:00
Liu 2e58a3936d refactor(ctest): implement timing without yutil
ctest only used y_gettime() for the elapsed time report, which pulled the yutil static library and its private dependency ordering into every test target. Replace it with a local monotonic clock (clock_gettime on POSIX, GetTickCount on Windows) and drop the yutil dependency from ctest and ctest-tests.
2026-11-19 01:20:07 +08:00
Liu a5444668ac test: unused helpers should be removed and footer initialized
Drop ad_count_children and count_by_type, which no longer have any callers, and initialize footer to NULL before scanning dialog children to silence GCC's -Wmaybe-uninitialized in release builds.
2026-11-19 01:19:58 +08:00
Liu ee6fc1956d fix(ui): debug log should not keep an unused style pointer
cs is only read by UI_DEBUG_MSG, and debug logging compiles the message away in release builds. Reference child->computed_style directly in the log arguments so GCC does not warn about an unused local.
2026-11-19 01:19:58 +08:00
Liu e92a4d3906 fix(css): property table coverage should compare int values
GCC reports -Werror=enum-compare because CSS_PROP_TABLE_COUNT is an anonymous enum while STYLE_KEY_TOTAL belongs to css_prop_key_t. Cast both operands to int so the compile-time coverage check also builds with GCC.
2026-11-19 01:19:58 +08:00
Liu 18b74cc9f1 fix(ui): make fit-content width and tooltip reveal deterministic
Initialize the fit-content width during CSS cascade instead of leaving a
stack-garbage value, and apply tooltip visibility in the reveal frame so the
behavior no longer depends on an extra layout pass.
2026-11-16 00:03:50 +08:00
Liu 86662849bd fix(ui): serialize image loading and start the loader after init
lcui_ui_init created the loader thread before ui_init() had created the image cache, list and mutex, so the thread could enter ui_load_images with uninitialized state (libpng reader crash in the background-style suite). Start the thread after ui_init and guard all image loader entry points with a mutex shared by the loader and UI threads.
2026-11-16 00:03:50 +08:00
Liu 6f3348cb07 fix(ui): refresh canvas box when overflow styles change
Box shadow and text decoration overflow grow the canvas box without changing the layout size, so ui_widget_update_box_size was skipped and the canvas box stayed stale. Recompute it after every style update.
2026-11-16 00:03:50 +08:00
Liu 093a6a1e35 feat: add explicit window lifecycle and per-window event routing
- add the window API and lifecycle design specs
- lcui_init no longer creates a window; settings loading is explicit
- add lcui_window_* create/bind/geometry/state/show/close api
- replace display modes with window options and quit-on-last-window
- add per-window event scopes and window-based pointer/keyboard routing
- keep pending updates for widgets appended during a frame
- migrate examples, tests, previews and internals docs
- remove default-scope focus and mouseover getters
2026-11-16 00:03:50 +08:00
Liu 9217b1ca3a feat(styles): add light and dark theme support
- share shadcn neutral color tokens between both Tailwind configs
- rewrite Tailwind dark selectors into LCUI-compatible descendant selectors
- theme style-nova components and doc-viewer surfaces for dark mode
- generate GitHub Light and GitHub Dark syntax line pairs for code blocks
- support alpha channels in text style tag colors
- keep focus rings and scrollbars visible on dark surfaces
- use a neutral code surface instead of GitHub's blue-tinted background
2026-11-15 23:40:42 +08:00
Liu 855855263b feat(css): add align-self support for flex items
- register align-self and resolve auto against the container align-items
- apply per-item alignment to measuring, cross-axis layout and static positions
- align item media icons with the first title line
2026-11-14 00:31:15 +08:00
Liu cbf051e061 fix(ui): refresh status styles only for matched selectors
- skip style refreshes when no :hover/:active/:focus selector matches
- detect self and descendant status selectors separately before refresh
- preserve API text content across CSS content overrides and restore it on exit
- cover unmatched, matched and text-content status changes in integration tests
2026-11-13 22:18:29 +08:00
Liu 1f46778893 fix(ui): stabilize layout measurement and style refresh
- restore intrinsic sizes before measuring flex and block children
- resolve percentage widths against indefinite parents as auto
- reflow parents when child content changes and refresh background geometry
- ignore hidden flex items in gap insertion and use spec static positions
- keep text paint size in sync with the current capture scale
2026-11-13 21:56:39 +08:00
Liu 78b401c1b5 fix(router): reuse matched components on sibling navigation
- keep the mounted component when the matched component name is unchanged
- initialize matched_widget and add regression tests for nested layouts
2026-11-08 00:20:46 +08:00
Liu a23c16f5c5 feat(widgets): add input group widget 2026-11-08 00:20:36 +08:00
Liu 20b3221cfd fix(ui): stabilize flex layout and add layout contract tests
- merge own sizehint with child layout extent; keep sizehint callable
- support cross-axis auto margins and flex-basis content/percentage
- fix space-evenly gap, canvas destroy, breadcrumb intrinsic width and dynamic text intrinsic refresh
- add flex contract, sizehint, empty layout and field layout suites
- move empty/field scenarios to theme-independent test fixtures
- document layout coverage and known gaps
2026-11-08 00:20:31 +08:00
Liu af3c76c239 fix(router): remove unused libui dependency 2026-11-08 00:20:30 +08:00
Liu c575d7fab5 refactor(worker): internalize worker task queue
- move the worker queue into src/lcui_worker.c
- expose only lcui_worker_* from <LCUI/worker.h>
- reuse the global async queue in anchor
- fix double unlock, active-state race and cancel target
- add worker integration tests
2026-11-08 00:20:29 +08:00
Liu ef42f0894c refactor(ui): move router widgets into core widgets
- move router-link and router-view into src/widgets
- add <LCUI/widgets/router.h> and aggregate it in widgets.h
- remove the libui-router target and package
2026-11-08 00:20:29 +08:00
Liu 7ecac3ae2b refactor(ui-server): merge ui-cursor into ui-server
- move cursor.c and ui_cursor.h into libui-server
- remove the libui-cursor target and package
- drop the unused ui.h and yutil dependencies
- declare libcss explicitly for ui-server
2026-11-08 00:20:28 +08:00
Liu 22c883b79e fix(ui): wrap and stabilize flex column text layout
Persist parent width constraint (source + generation) and wrap text at it; six-pass flex layout with <=1 reflow per child; fit-content clamp for centered auto-width children; re-derive centered column cross width from constraint on standalone reflow; fixed-cross flex containers ignore child size hint. Record row main-axis allocation as a persisted constraint so a flex:1 child keeps its width across standalone reflow. Measure/layout phase split, measurement cache invalidation test, and sizehint capability flag so zero-size results are not mistaken for missing sizehints. Add layout engine rules doc and integration tests (wrap, empty, empty-basic, field-checkbox remount, empty media icon).
2026-11-08 00:20:27 +08:00
Liu 0c842a10b8 fix(ptk): remove cross-process window assertion 2026-11-02 22:31:23 +08:00
Liu 47014c5dbb feat(widgets): add popover widget 2026-10-28 23:40:31 +08:00
Liu f760db2176 fix(ui): ui_widget_render should re-anchor offscreen captures in logical units 2026-10-18 15:42:22 +08:00
Liu ad0ce709ee feat(pandagl): add pd_canvas_rotate and pd_canvas_mask_composite 2026-10-18 15:42:20 +08:00
Liu 7154337944 feat(widgets): add button variants, sizes and themed styles with docs 2026-10-17 21:16:51 +08:00
Liu 218f900a58 feat(pandagl): support variable fonts and fix font fallback
Expand variable fonts into static weight instances via the wght axis so font-weight resolves to a real face.

Add pd_font_get_glyph_index and skip faces lacking a glyph during family fallback, so a missing glyph keeps falling back instead of stopping at a cached .notdef.

Fix an off-by-one in find_bolder_weight/find_lighter_weight (must index weights[weight-1]), which dereferenced NULL and crashed on sparse-weight families.

Cover these with variable-font, CJK-fallback and weight-fallback tests.
2026-10-17 21:16:48 +08:00
Liu 708611a727 feat(ui-server): sync system cursor with hovered widget style
Expose ui_get_mouseover() and, at the end of ui_server_update(), resolve
the first non-auto cursor up the hover ancestor chain (emulating CSS
inheritance), then apply it to the owning window. Runs after style
recomputation so :hover and dynamic changes take effect in the same
frame; resets to auto when the hovered widget is destroyed.
2026-10-17 21:16:47 +08:00
Liu 237a5b66f2 feat(ptk): add per-window cursor api for win32, x11 and fb
Add ptk_window_set/get_cursor() and a driver vtable. Win32 keeps the
cursor via WM_SETCURSOR (NONE hides it), X11 defines a cached cursor-font
shape (NONE uses a transparent pixmap), framebuffer records only. Values
map to the closest system cursor where no exact match exists.
2026-10-17 21:16:46 +08:00
Liu 844802374d feat(css): support cursor property with standard keyword values
Register the `cursor` property (36 standard keywords, no url() images),
add css_cursor_t, a 6-bit type_bits field and the 34 new keywords, and
implement css_cascade_cursor(). Defaults to `auto`.
2026-10-17 21:16:46 +08:00
Liu 251bf2fa54 feat(ui): propagate inherited CSS values to dependent children 2026-10-17 21:16:45 +08:00