From 6c77d9f151aa89aeb57cf8226a6c27ea10cac02f Mon Sep 17 00:00:00 2001 From: Zedhugh Chen Date: Mon, 23 Mar 2026 01:18:06 +0800 Subject: [PATCH] =?UTF-8?q?core:=20layout=20=E6=A8=A1=E5=9D=97=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=20wm=5Flayout=5Fregistry=5Fmove=20=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/layout.c | 15 +++++++++++++++ src/core/layout.h | 2 ++ 2 files changed, 17 insertions(+) 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);