feat(settings): schema-driven serialization and window state persistence#330
Merged
Conversation
Copilot
AI
changed the title
[WIP] feat: add persistent window state management and settings binding
feat: add persistent window state management and settings binding
Jun 8, 2026
lc-soft
requested changes
Jun 8, 2026
Contributor
Author
已按审核意见完成调整,最新提交:3cceafa。 |
lc-soft
requested changes
Jun 8, 2026
Contributor
Author
已修改,提交:3371dc6、3c47c0e。 |
lc-soft
requested changes
Jun 9, 2026
Contributor
Author
|
已修改,提交:9db7483。 |
lc-soft
requested changes
Jun 9, 2026
Contributor
Author
|
已修改,提交:95512dc、07f93b2、e80636e。 |
lc-soft
requested changes
Jun 9, 2026
Contributor
Author
已按评审意见修改,最新提交:9a7fe1d。 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #330 +/- ##
===========================================
+ Coverage 62.99% 63.70% +0.71%
===========================================
Files 195 199 +4
Lines 18573 19112 +539
Branches 2481 2598 +117
===========================================
+ Hits 11700 12176 +476
+ Misses 5950 5946 -4
- Partials 923 990 +67 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- 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
- Use project-local clang-format from node_modules/.bin instead of system PATH to avoid version mismatches between CI and development environments - Print clang-format version and binary path in CI logs for debugging - Add format:check script to package.json so `npm run format:check` works - Add `needs: format` to build job so formatting failures block the build and don't waste CI resources
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds schema-driven config serialization and persistent window state management on top of the settings infrastructure introduced in #329.
Architecture
setting_field_def_tschema +DEFINE_SETTING_{INT,BOOL}_FIELDmacros; out-of-range or missing values fall back to defaults and are rewritten to file on flushini_doc_t*access and two callback lists (deserializeon load,serializeon flush), without reverse dependencies on concrete modulesPublic API
Settings lifecycle (
include/LCUI/settings/base.h)bool lcui_settings_is_loaded(void);bool lcui_settings_load(void);bool lcui_settings_flush(void);void lcui_settings_unload(void);Rendering (
include/LCUI/settings/rendering.h)bool lcui_get_rendering(lcui_rendering_settings_t *out);bool lcui_set_rendering(const lcui_rendering_settings_t *in);Fields:
fps_cap,parallel_threads,paint_flashing. Out-of-range values are rejected.Window state (
include/LCUI/settings/window_state.h)bool lcui_get_window_state(const char *id, lcui_window_state_t *out);bool lcui_set_window_state(const char *id, const lcui_window_state_t *in);bool lcui_bind_window_state(ui_widget_t *widget, const char *id);Fields:
x,y,width,height,maximized, stored under[window.<id>]sections. Invalid or out-of-bounds sections are dropped from file on flush.App identification (
include/LCUI/app.h)bool lcui_set_app_id(const char *app_id);� reverse-domain format recommended, e.g."com.example.myapp". Allowed characters: alphanumeric,.,_,-.PTK changes
PTK_EVENT_CREATEevent dispatched after native window creation, enabling deferred state restore for display-mode switches that rebuild the windowptk_window_get_position/ptk_window_set_maximized/ptk_window_is_maximizedfor geometry and maximized-state access_NET_WM_STATEwith_NET_WM_STATE_MAXIMIZED_HORZand_NET_WM_STATE_MAXIMIZED_VERTTest coverage (new
test_settingssuite)Examples
The widget is resized to the saved dimensions immediately (before native window creation), and the new window has geometry/maximized applied once the
PTK_EVENT_CREATEfires. OnPTK_EVENT_CLOSE, the current state is saved back to[window.main].