diff --git a/src/core/layout.c b/src/core/layout.c index 138b781..9245ce6 100644 --- a/src/core/layout.c +++ b/src/core/layout.c @@ -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; } diff --git a/src/core/layout.h b/src/core/layout.h index 7bc3e52..49a30a0 100644 --- a/src/core/layout.h +++ b/src/core/layout.h @@ -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);