From c4e370b4f068320e6fee03065bcd3f5deacfcbbe Mon Sep 17 00:00:00 2001 From: sleeptightAnsiC <91839286+sleeptightAnsiC@users.noreply.github.com> Date: Sat, 15 Nov 2025 21:09:09 +0100 Subject: [PATCH] Fix(nk_property): property widget not updating 'win->edit.active' state Other "editable" widgets are updating the its window 'edit.active' state, but not nk_property. SDL3 demo needs this in order to hook SDL_SetTextInput. This patch was initially proposed by https://github.com/rswinkle The only thing I changed in it, was a removal of 'edit.name' update, nk_property is not using the name hash, so there is no reason to set it. Origin: https://github.com/Immediate-Mode-UI/Nuklear/pull/852#issuecomment-3518277340 Co-authored-by: Robert Winkler --- nuklear.h | 3 +++ src/CHANGELOG | 1 + src/nuklear_property.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/nuklear.h b/nuklear.h index a1fa9d1c..1c4417a7 100644 --- a/nuklear.h +++ b/nuklear.h @@ -29073,6 +29073,7 @@ nk_property(struct nk_context *ctx, const char *name, struct nk_property_variant win->property.name = hash; win->property.select_start = *select_begin; win->property.select_end = *select_end; + win->edit.active = nk_true; if (*state == NK_PROPERTY_DRAG) { ctx->input.mouse.grab = nk_true; ctx->input.mouse.grabbed = nk_true; @@ -29088,6 +29089,7 @@ nk_property(struct nk_context *ctx, const char *name, struct nk_property_variant win->property.select_start = 0; win->property.select_end = 0; win->property.active = 0; + win->edit.active = nk_false; } } NK_API void @@ -30729,6 +30731,7 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args) /// - [y]: Minor version with non-breaking API and library changes /// - [z]: Patch version with no direct changes to the API /// +/// - 2025/11/08 (4.13.0) - Fix: nk_property not updating 'win->edit.active' /// - 2025/10/08 (4.12.8) - Fix nk_widget_text to use NK_TEXT_ALIGN_LEFT by default, /// instead of silently failing when no x-axis alignment is provided, /// and refactor this function to keep the code style consistent diff --git a/src/CHANGELOG b/src/CHANGELOG index fa81dc46..feed1066 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -7,6 +7,7 @@ /// - [y]: Minor version with non-breaking API and library changes /// - [z]: Patch version with no direct changes to the API /// +/// - 2025/11/08 (4.13.0) - Fix: nk_property not updating 'win->edit.active' /// - 2025/10/08 (4.12.8) - Fix nk_widget_text to use NK_TEXT_ALIGN_LEFT by default, /// instead of silently failing when no x-axis alignment is provided, /// and refactor this function to keep the code style consistent diff --git a/src/nuklear_property.c b/src/nuklear_property.c index 68b47ba7..668b78c8 100644 --- a/src/nuklear_property.c +++ b/src/nuklear_property.c @@ -405,6 +405,7 @@ nk_property(struct nk_context *ctx, const char *name, struct nk_property_variant win->property.name = hash; win->property.select_start = *select_begin; win->property.select_end = *select_end; + win->edit.active = nk_true; if (*state == NK_PROPERTY_DRAG) { ctx->input.mouse.grab = nk_true; ctx->input.mouse.grabbed = nk_true; @@ -420,6 +421,7 @@ nk_property(struct nk_context *ctx, const char *name, struct nk_property_variant win->property.select_start = 0; win->property.select_end = 0; win->property.active = 0; + win->edit.active = nk_false; } } NK_API void