diff --git a/ugui.c b/ugui.c index f30d572..bb4346f 100644 --- a/ugui.c +++ b/ugui.c @@ -283,8 +283,6 @@ static ug_container_t *get_container(ug_ctx_t *ctx, ug_id_t id) // if the container was not already there allocate a new one if (!c) { GET_FROM_STACK(ctx->cnt_stack, c); - // the stack is not sorted - ctx->cnt_stack.sorted = 0; } return c; @@ -295,9 +293,6 @@ static ug_container_t *get_container(ug_ctx_t *ctx, ug_id_t id) // the active floating conatiner i son top of everything static void sort_containers(ug_ctx_t *ctx) { - if (ctx->cnt_stack.sorted) - return; - int tot = ctx->cnt_stack.idx; if (!tot) return; @@ -321,7 +316,6 @@ static void sort_containers(ug_ctx_t *ctx) s[y-1] = c; } } - ctx->cnt_stack.sorted = 1; } // update the container dimensions and position according to the context information, @@ -783,7 +777,6 @@ int ug_frame_end(ug_ctx_t *ctx) TEST_CTX(ctx); // before drawing floating contaners need to be drawn on top of the others - printf("sorted %d\n", ctx->cnt_stack.sorted); sort_containers(ctx); for (int i = 0; i < ctx->cnt_stack.idx; i++) draw_container(ctx, &ctx->cnt_stack.items[i]); diff --git a/ugui.h b/ugui.h index 540ba89..c0b2eed 100644 --- a/ugui.h +++ b/ugui.h @@ -1,7 +1,7 @@ #ifndef _UG_HEADER #define _UG_HEADER -#define UG_STACK(T) struct { T *items; int idx, size, sorted } +#define UG_STACK(T) struct { T *items; int idx, size, sorted; } #define BIT(n) (1 << n) #define RGBA_FORMAT(x) { .a=x&0xff, .b=(x>>8)&0xff, .g=(x>>16)&0xff, .r=(x>>24)&0xff } #define RGB_FORMAT(x) { .a=0xff, .b=x&0xff, .g=(x>>8)&0xff, .r=(x>>16)&0xff }