From 43b41f92bd411c67c920b5f6526b1acd7a80c7e6 Mon Sep 17 00:00:00 2001 From: vurtun Date: Thu, 14 Sep 2017 14:09:33 +0200 Subject: [PATCH] Fixed window closing behavior If a window was closed the remaining windows remain in read only mode. This wrong behavior is now fixed. --- CHANGELOG.txt | 1 + nuklear.h | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 297bdbe..5283815 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -11,6 +11,7 @@ Changes: -------- +- 2017/09/14 (2.00.1) - Fixed window closing behavior - 2017/09/14 (2.00.0) - BREAKING CHANGE: Modifing window position and size funtions now require the name of the window and must happen outside the window building process (between function call nk_begin and nk_end). diff --git a/nuklear.h b/nuklear.h index ef466e9..f57366b 100644 --- a/nuklear.h +++ b/nuklear.h @@ -17375,8 +17375,12 @@ nk_clear(struct nk_context *ctx) /* remove hotness from hidden or closed windows*/ if (((iter->flags & NK_WINDOW_HIDDEN) || (iter->flags & NK_WINDOW_CLOSED)) && - iter == ctx->active) - ctx->active = iter->next; + iter == ctx->active) { + ctx->active = iter->prev; + ctx->end = iter->prev; + if (ctx->active) + ctx->active->flags &= ~NK_WINDOW_ROM; + } /* free unused popup windows */ if (iter->popup.win && iter->popup.win->seq != ctx->seq) { @@ -18577,8 +18581,10 @@ nk_begin_titled(struct nk_context *ctx, const char *name, const char *title, * provided demo backends). */ NK_ASSERT(win->seq != ctx->seq); win->seq = ctx->seq; - if (!ctx->active && !(win->flags & NK_WINDOW_HIDDEN)) + if (!ctx->active && !(win->flags & NK_WINDOW_HIDDEN)) { ctx->active = win; + ctx->end = win; + } } if (win->flags & NK_WINDOW_HIDDEN) { ctx->current = win;