Kaynağa Gözat

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
PavelSharp 3 ay önce
ebeveyn
işleme
109e9bde19
2 değiştirilmiş dosya ile 2 ekleme ve 2 silme
  1. 1 1
      src/nuklear_utf8.c
  2. 1 1
      src/nuklear_window.c

+ 1 - 1
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) {

+ 1 - 1
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);