From 109e9bde19eb443cfa572631404bfbefe8b5f81b Mon Sep 17 00:00:00 2001 From: PavelSharp Date: Thu, 11 Sep 2025 19:04:02 +0300 Subject: [PATCH 1/2] fix: use ctx->current->flags instead of ctx->begin->flags when checking state in nk_window_is_hovered fix: allow len == NK_UTF_SIZE in nk_utf_decode by adjusting NK_BETWEEN upper bound --- src/nuklear_utf8.c | 2 +- src/nuklear_window.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nuklear_utf8.c b/src/nuklear_utf8.c index 56e0e1223..0f390c7b9 100644 --- a/src/nuklear_utf8.c +++ b/src/nuklear_utf8.c @@ -47,7 +47,7 @@ nk_utf_decode(const char *c, nk_rune *u, int clen) *u = NK_UTF_INVALID; udecoded = nk_utf_decode_byte(c[0], &len); - if (!NK_BETWEEN(len, 1, NK_UTF_SIZE)) + if (!NK_BETWEEN(len, 1, NK_UTF_SIZE+1)) /* +1 because NK_BETWEEN uses strict upper bound ((a) <= (x) && (x) < (b)) */ return 1; for (i = 1, j = 1; i < clen && j < len; ++i, ++j) { diff --git a/src/nuklear_window.c b/src/nuklear_window.c index 8c286e44e..4cd0c19f3 100644 --- a/src/nuklear_window.c +++ b/src/nuklear_window.c @@ -436,7 +436,7 @@ nk_window_is_hovered(const struct nk_context *ctx) return 0; else { struct nk_rect actual_bounds = ctx->current->bounds; - if (ctx->begin->flags & NK_WINDOW_MINIMIZED) { + if (ctx->current->flags & NK_WINDOW_MINIMIZED) { actual_bounds.h = ctx->current->layout->header_height; } return nk_input_is_mouse_hovering_rect(&ctx->input, actual_bounds); From c2f210a26ed57019e13823c25eec6ef21f2e397f Mon Sep 17 00:00:00 2001 From: PavelSharp Date: Fri, 12 Sep 2025 02:22:45 +0300 Subject: [PATCH 2/2] Update CHANGELOG and Rebuild nuklear.h --- clib.json | 2 +- nuklear.h | 6 ++++-- src/CHANGELOG | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/clib.json b/clib.json index a3b05f86a..e704fda77 100644 --- a/clib.json +++ b/clib.json @@ -1,6 +1,6 @@ { "name": "nuklear", - "version": "4.12.7", + "version": "4.12.8", "repo": "Immediate-Mode-UI/Nuklear", "description": "A small ANSI C gui toolkit", "keywords": ["gl", "ui", "toolkit"], diff --git a/nuklear.h b/nuklear.h index 71b55a242..7b1fc49de 100644 --- a/nuklear.h +++ b/nuklear.h @@ -8383,7 +8383,7 @@ nk_utf_decode(const char *c, nk_rune *u, int clen) *u = NK_UTF_INVALID; udecoded = nk_utf_decode_byte(c[0], &len); - if (!NK_BETWEEN(len, 1, NK_UTF_SIZE)) + if (!NK_BETWEEN(len, 1, NK_UTF_SIZE+1)) /* +1 because NK_BETWEEN uses strict upper bound ((a) <= (x) && (x) < (b)) */ return 1; for (i = 1, j = 1; i < clen && j < len; ++i, ++j) { @@ -20953,7 +20953,7 @@ nk_window_is_hovered(const struct nk_context *ctx) return 0; else { struct nk_rect actual_bounds = ctx->current->bounds; - if (ctx->begin->flags & NK_WINDOW_MINIMIZED) { + if (ctx->current->flags & NK_WINDOW_MINIMIZED) { actual_bounds.h = ctx->current->layout->header_height; } return nk_input_is_mouse_hovering_rect(&ctx->input, actual_bounds); @@ -30716,6 +30716,8 @@ 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/09/12 (4.12.8) - Fix nk_window_is_hovered to use current window flags + - Fix nk_utf_decode length check (allow len == NK_UTF_SIZE) /// - 2025/04/06 (4.12.7) - Fix text input navigation and mouse scrolling /// - 2025/03/29 (4.12.6) - Fix unitialized data in nk_input_char /// - 2025/03/05 (4.12.5) - Fix scrolling knob also scrolling parent window, remove dead code diff --git a/src/CHANGELOG b/src/CHANGELOG index 300c3d40a..57e628a64 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -7,6 +7,8 @@ /// - [y]: Minor version with non-breaking API and library changes /// - [z]: Patch version with no direct changes to the API /// +/// - 2025/09/12 (4.12.8) - Fix nk_window_is_hovered to use current window flags + - Fix nk_utf_decode length check (allow len == NK_UTF_SIZE) /// - 2025/04/06 (4.12.7) - Fix text input navigation and mouse scrolling /// - 2025/03/29 (4.12.6) - Fix unitialized data in nk_input_char /// - 2025/03/05 (4.12.5) - Fix scrolling knob also scrolling parent window, remove dead code