MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / nk_clear

Function nk_clear

extern/glfw/deps/nuklear.h:14972–15037  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14970 ctx->count = 0;
14971}
14972NK_API void
14973nk_clear(struct nk_context *ctx)
14974{
14975 struct nk_window *iter;
14976 struct nk_window *next;
14977 NK_ASSERT(ctx);
14978
14979 if (!ctx) return;
14980 if (ctx->use_pool)
14981 nk_buffer_clear(&ctx->memory);
14982 else nk_buffer_reset(&ctx->memory, NK_BUFFER_FRONT);
14983
14984 ctx->build = 0;
14985 ctx->memory.calls = 0;
14986 ctx->last_widget_state = 0;
14987 ctx->style.cursor_active = ctx->style.cursors[NK_CURSOR_ARROW];
14988 NK_MEMSET(&ctx->overlay, 0, sizeof(ctx->overlay));
14989
14990 /* garbage collector */
14991 iter = ctx->begin;
14992 while (iter) {
14993 /* make sure valid minimized windows do not get removed */
14994 if ((iter->flags & NK_WINDOW_MINIMIZED) &&
14995 !(iter->flags & NK_WINDOW_CLOSED) &&
14996 iter->seq == ctx->seq) {
14997 iter = iter->next;
14998 continue;
14999 }
15000 /* remove hotness from hidden or closed windows*/
15001 if (((iter->flags & NK_WINDOW_HIDDEN) ||
15002 (iter->flags & NK_WINDOW_CLOSED)) &&
15003 iter == ctx->active) {
15004 ctx->active = iter->prev;
15005 ctx->end = iter->prev;
15006 if (!ctx->end)
15007 ctx->begin = 0;
15008 if (ctx->active)
15009 ctx->active->flags &= ~(unsigned)NK_WINDOW_ROM;
15010 }
15011 /* free unused popup windows */
15012 if (iter->popup.win && iter->popup.win->seq != ctx->seq) {
15013 nk_free_window(ctx, iter->popup.win);
15014 iter->popup.win = 0;
15015 }
15016 /* remove unused window state tables */
15017 {struct nk_table *n, *it = iter->tables;
15018 while (it) {
15019 n = it->next;
15020 if (it->seq != ctx->seq) {
15021 nk_remove_table(iter, it);
15022 nk_zero(it, sizeof(union nk_page_data));
15023 nk_free_table(ctx, it);
15024 if (it == iter->tables)
15025 iter->tables = n;
15026 } it = n;
15027 }}
15028 /* window itself is not used anymore so free */
15029 if (iter->seq != ctx->seq || iter->flags & NK_WINDOW_CLOSED) {

Callers 1

nk_glfw3_renderFunction · 0.85

Calls 7

nk_buffer_clearFunction · 0.85
nk_buffer_resetFunction · 0.85
nk_free_windowFunction · 0.85
nk_remove_tableFunction · 0.85
nk_zeroFunction · 0.85
nk_free_tableFunction · 0.85
nk_remove_windowFunction · 0.85

Tested by

no test coverage detected