chckIterPool* sortMouseAreasByElementOrder(guihckContext* ctx, chckIterPool* mouseAreas) { size_t n; guihckMouseAreaId* m = chckIterPoolToCArray(mouseAreas, &n); if(n < 2) return mouseAreas; int left = n; int i; for(i = chckIterPoolCount(ctx->renderOrder) - 1; i >= 0 && left > 0; --i) { guihckElementId* id = chckIterPoolGet(ctx->renderOrder, i); size_t j; for(j = n - left; j < n; ++j) { _guihckMouseArea* ma = chckPoolGet(ctx->mouseAreas, m[j]); if(ma->elementId == *id) { if(n - left != j) { guihckMouseAreaId temp = m[n - left]; m[n - left] = m[j]; m[j] = temp; } left -= 1; } } } for(i = 0; i < left; ++i) { chckIterPoolRemove(mouseAreas, n - i); } return mouseAreas; }
void* chckIterPoolGetLast(const chckIterPool *pool) { return chckIterPoolGet(pool, pool->items.count - 1); }