30 Commits
Author SHA1 Message Date
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 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 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 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 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 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 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 0c842a10b8 fix(ptk): remove cross-process window assertion 2026-11-02 22:31:23 +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 3801fdc10f refactor(yutil): rename public APIs and migrate timer to ptk
- charset module renamed to encoding (decode/encode kept)
- time: get_time_ms → y_gettime, sleep_ms → y_sleep
- time: delete get_time_us, get_time_delta, sleep_s
- string: strdup2 → y_strdup, wcsdup2 → y_wcsdup
- string: strtolower → y_strlower, strtrim → y_strtrim
- string: wcstrim → y_wcstrim, strhash → y_strhash
- string: strreplace → y_strreplace, strsplit → y_strsplit
- string: delete wcsreplace, cmdsplit
- math: delete y_iround, y_pow2
- timer module migrated from yutil to ptk as internal timer_scheduler
- WinMain simplified to use __argc/__argv instead of cmdsplit

BREAKING CHANGE: all renamed yutil public APIs require downstream
  to update function names. Deleted APIs require code changes:
  - get_time_us: use y_gettime() for ms timestamps
  - get_time_delta: use y_gettime() - start instead
  - sleep_s: use y_sleep(ms) with millisecond argument
  - wcsreplace: no replacement, had zero callers
  - cmdsplit: WinMain now uses __argc/__argv from CRT
  - timer_list_*: migrated to ptk timer_scheduler_*;
    ptk_reset_timer still available for external use
2026-08-05 22:42:26 +08:00
Liu 6cd01b468e chore: update copyright comment 2026-08-05 22:42:22 +08:00
Liu 7f9f52b904 chore: update copyright and email 2026-08-05 22:42:16 +08:00
Liu 4bb0d51cd5 feat(settings): schema-driven serialization and window state persistence
- Per-window state with [window.<id>] sections in settings.ini
- Settings module split into rendering and window_state subsystems
- Schema-driven (de)serialization with DEFINE_SETTING_INT/BOOL_FIELD macros
- Listener-based change notification via deserialize/serialize callbacks
- Integration tests for get/set, validation, and bind/restore lifecycle
2026-08-05 22:42:14 +08:00
Liu 9fd4bdb89f fix(ptk): ui_server should not bypass platform window destruction flow 2026-08-05 22:42:13 +08:00
Liu fa35037c1a fix(ptk): handler self-removal during dispatch should not cause crash 2026-08-05 22:42:12 +08:00
Liu 2d17001076 chore: remove unused debug log 2026-08-05 22:41:32 +08:00
Liu 926b7252d1 fix(ptk): handle window creation failures on win32 2026-08-05 22:41:26 +08:00
Liu 75dbca815d test: reorganize test suite with xmake test integration
Restructure the test infrastructure with these changes:

* Extend libctest with ctest_suite_t, ctest_parse_args, ctest_run_suites and CTEST_MAIN macro to standardize test entry points; support --grep / --grep= / --list / --interactive flags; add ctest-tests for self-tests.

* Regroup tests by lib boundary: sink unit tests into lib/<name>/tests/ with <lib>_<topic> entry function names, move fixtures into lib/<name>/tests/fixtures/, rename top-level tests/cases/ to tests/integration/ for cross-lib integration tests.

* Add tests/scenes/ for reusable widget tree builders shared by integration cases and visual preview binaries; add tests/previews/ with 4 diagnostic binaries (flex_layout, block_layout, widget_opacity, scrollbar).

* Rewrite all describe/equal description strings using 'should ...' style or noun topic names; drop redundant lcui_quit/lcui_main calls from integration cases.

* Integrate xmake test via add_tests(\default\) and a shared tests.runnable rule defined in the root xmake.lua; the rule wraps the test binary with drmemory (Windows) or valgrind (Linux) when option memcheck=y.

* Drop the lcui-tests aggregation: lcui-tests now contains only integration cases and scenes, not the union of lib tests. Use xmake test to run everything across libs.

* Fix .clang-format: InsertNewlineAtEndOfFile -> InsertNewlineAtEOF (correct key for clang-format 16+).

* Update AGENTS.md with the new test layout, naming rules, description style and run commands.

* Update CI to use xmake test and xmake f --memcheck=y instead of per-lib runs.
2026-08-05 22:41:12 +08:00
Liu e6506fca90 feat(app): add lcui_request_frame and animation timer driver 2026-08-05 22:40:07 +08:00
Liu a0a1669176 fix(ptk): initialize steptimer last_time to wall clock
The first call to ptk_steptimer_tick observed a huge delta because
last_time was zero-initialized. In fixed-step mode this caused the
handler to be invoked hundreds of times in a single tick.

- Set last_time to get_time_ms() in ptk_steptimer_init.
- Remove the duplicate is_fixed_time_step assignment.
- Drop the unused frequency field; LCUI uses millisecond time base
  and never read it.
- Document in the header that StepTimer is intended for
  animation/simulation timing, not render throttling.
- Add test_steptimer covering init timing, variable-step,
  fixed-step catch-up, and max_delta clamping.
2026-05-20 22:32:52 +08:00
rewine cf23a967bb fix(ptk): fix window size constraints mapping 2026-03-31 21:20:02 +08:00
Liu a69f2b1bd7 feat(ptk): add Windows implemention for clipboard 2025-08-16 11:18:51 +08:00
Liu d3197db425 fix(ptk): ignore special characters entered with Ctrl key combination 2025-08-16 11:18:51 +08:00
Liu a9ab79a338 fix(ptk): request text failed when clipboard content is empty (#318) 2025-08-16 11:18:51 +08:00
Liu ae9b228f48 fix(ptk): incorrect window minmaxinfo 2025-04-30 18:54:20 +08:00
Liu 940a0fc33a chore: update copyright 2025-01-05 23:29:56 +08:00
Liu 24f3192b9a refactor: update LCUI's dependencies on ui-widgets and ui-router 2024-12-29 23:37:24 +08:00
Liu 6851e9aef3 refactor: change type naming style 2024-12-22 23:14:13 +08:00
Liu bdd7cb5f75 feat: merge libtimer into libptk
BREAKING CHANGE: lcui_set_timeout -> ptk_set_timeout, lcui_set_interval -> ptk_set_interval
2024-12-07 13:30:29 +08:00
Liu 20ae97a1a2 feat: lib/platform -> lib/ptk
BREAKING CHANGE: lib/platform -> lib/ptk, and the naming style of
libplatform has changed to have a `ptk_` prefix.
2024-12-07 13:30:29 +08:00