core: layout 模块添加 wm_layout_registry_move 函数

This commit is contained in:
2026-03-23 01:18:06 +08:00
parent ac22a2b529
commit 6c77d9f151
2 changed files with 17 additions and 0 deletions

View File

@@ -52,6 +52,21 @@ void wm_layout_registry_cleanup(wm_layout_registry_t *registry) {
registry->slot_capacity = 0;
}
bool wm_layout_registry_move(wm_layout_registry_t *src,
wm_layout_registry_t *dest) {
if (!src || !dest) return false;
dest->slots = src->slots;
dest->slot_count = src->slot_count;
dest->slot_capacity = src->slot_capacity;
src->slots = nullptr;
src->slot_count = 0;
src->slot_capacity = 0;
return true;
}
size_t wm_layout_registry_count(const wm_layout_registry_t *registry) {
return registry->slot_count;
}

View File

@@ -99,6 +99,8 @@ void wm_layout_result_push(wm_layout_result_t *result, wm_layout_item_t item);
*/
void wm_layout_registry_init(wm_layout_registry_t *registry);
void wm_layout_registry_cleanup(wm_layout_registry_t *registry);
bool wm_layout_registry_move(wm_layout_registry_t *src,
wm_layout_registry_t *dest);
size_t wm_layout_registry_count(const wm_layout_registry_t *registry);
const wm_layout_slot_t *wm_layout_registry_at(
const wm_layout_registry_t *registry, size_t index);