From becd07cca99c21be55c5ec417ca4b0073d1abc81 Mon Sep 17 00:00:00 2001 From: Lily Nikitin <53998902+boringlily@users.noreply.github.com> Date: Fri, 1 Aug 2025 09:43:07 -0700 Subject: [PATCH 1/2] Added a new field to simplify creating and rendering custom elements. --- clay.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clay.h b/clay.h index 938683a..fede469 100644 --- a/clay.h +++ b/clay.h @@ -512,6 +512,7 @@ CLAY__WRAPPER_STRUCT(Clay_FloatingElementConfig); typedef struct Clay_CustomElementConfig { // A transparent pointer through which you can pass custom data to the renderer. // Generates CUSTOM render commands. + uint32_t customCommandId; void* customData; } Clay_CustomElementConfig; @@ -598,6 +599,8 @@ typedef struct Clay_CustomRenderData { // Controls the "radius", or corner rounding of this custom element. // The rounding is determined by drawing a circle inset into the element corner by (radius, radius) pixels. Clay_CornerRadius cornerRadius; + + uint32_t customCommandId; // A pointer transparently passed through from the original element definition. void* customData; } Clay_CustomRenderData; @@ -2919,6 +2922,7 @@ void Clay__CalculateFinalLayout(void) { .backgroundColor = sharedConfig->backgroundColor, .cornerRadius = sharedConfig->cornerRadius, .customData = elementConfig->config.customElementConfig->customData, + .customCommandId = elementConfig->config.customElementConfig->customCommandId } }; emitRectangle = false; From bac3ca8b1d1d5c94cc4f6b8470ea6d1973a24fbe Mon Sep 17 00:00:00 2001 From: Lily Nikitin <53998902+boringlily@users.noreply.github.com> Date: Fri, 1 Aug 2025 10:09:07 -0700 Subject: [PATCH 2/2] Added Comments and fixed initialization order. --- clay.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/clay.h b/clay.h index fede469..0e0f307 100644 --- a/clay.h +++ b/clay.h @@ -512,8 +512,10 @@ CLAY__WRAPPER_STRUCT(Clay_FloatingElementConfig); typedef struct Clay_CustomElementConfig { // A transparent pointer through which you can pass custom data to the renderer. // Generates CUSTOM render commands. - uint32_t customCommandId; void* customData; + + // An integer Dd value to help identify the custom data element during the rendering stage. + uint32_t customCommandId; } Clay_CustomElementConfig; CLAY__WRAPPER_STRUCT(Clay_CustomElementConfig); @@ -600,9 +602,10 @@ typedef struct Clay_CustomRenderData { // The rounding is determined by drawing a circle inset into the element corner by (radius, radius) pixels. Clay_CornerRadius cornerRadius; - uint32_t customCommandId; // A pointer transparently passed through from the original element definition. void* customData; + // An id value transparently passed through from the original element definition. + uint32_t customCommandId; } Clay_CustomRenderData; // Render command data when commandType == CLAY_RENDER_COMMAND_TYPE_SCISSOR_START || commandType == CLAY_RENDER_COMMAND_TYPE_SCISSOR_END