mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-10-17 04:48:15 +00:00
[client] all: remove ll_walk
and migrate over to ll_forEachNL
This commit is contained in:
@@ -182,7 +182,8 @@ static int config_render(void * udata, bool interactive, struct Rect * windowRec
|
||||
|
||||
if (igBeginTabItem("Settings", NULL, 0))
|
||||
{
|
||||
for (ll_reset(cfg.callbacks); ll_walk(cfg.callbacks, (void **)&cb); )
|
||||
ll_lock(cfg.callbacks);
|
||||
ll_forEachNL(cfg.callbacks, item, cb)
|
||||
{
|
||||
if (!igCollapsingHeader_BoolPtr(cb->title, NULL, 0))
|
||||
continue;
|
||||
@@ -191,10 +192,12 @@ static int config_render(void * udata, bool interactive, struct Rect * windowRec
|
||||
cb->callback(cb->udata, &id);
|
||||
igPopID();
|
||||
}
|
||||
ll_unlock(cfg.callbacks);
|
||||
igEndTabItem();
|
||||
}
|
||||
|
||||
for (ll_reset(cfg.tabCallbacks); ll_walk(cfg.tabCallbacks, (void **)&cb); )
|
||||
ll_lock(cfg.tabCallbacks);
|
||||
ll_forEachNL(cfg.tabCallbacks, item, cb)
|
||||
{
|
||||
if (!igBeginTabItem(cb->title, NULL, 0))
|
||||
continue;
|
||||
@@ -204,6 +207,7 @@ static int config_render(void * udata, bool interactive, struct Rect * windowRec
|
||||
igPopID();
|
||||
igEndTabItem();
|
||||
}
|
||||
ll_unlock(cfg.tabCallbacks);
|
||||
|
||||
igEndTabBar();
|
||||
|
||||
|
@@ -53,11 +53,13 @@ static void configCallback(void * udata, int * id)
|
||||
igBeginTable("split", 2, 0, (ImVec2){}, 0);
|
||||
|
||||
GraphHandle graph;
|
||||
for (ll_reset(gs.graphs); ll_walk(gs.graphs, (void **)&graph); )
|
||||
ll_lock(gs.graphs);
|
||||
ll_forEachNL(gs.graphs, item, graph)
|
||||
{
|
||||
igTableNextColumn();
|
||||
igCheckbox(graph->name, &graph->enabled);
|
||||
}
|
||||
ll_unlock(gs.graphs);
|
||||
|
||||
igEndTable();
|
||||
}
|
||||
@@ -127,9 +129,12 @@ static int graphs_render(void * udata, bool interactive,
|
||||
|
||||
GraphHandle graph;
|
||||
int graphCount = 0;
|
||||
for (ll_reset(gs.graphs); ll_walk(gs.graphs, (void **)&graph); )
|
||||
ll_lock(gs.graphs);
|
||||
ll_forEachNL(gs.graphs, item, graph)
|
||||
{
|
||||
if (graph->enabled)
|
||||
++graphCount;
|
||||
}
|
||||
|
||||
ImVec2 pos = {0.0f, 0.0f};
|
||||
igSetNextWindowBgAlpha(0.4f);
|
||||
@@ -152,7 +157,7 @@ static int graphs_render(void * udata, bool interactive,
|
||||
const float height = (winSize.y / graphCount)
|
||||
- igGetStyle()->ItemSpacing.y;
|
||||
|
||||
for (ll_reset(gs.graphs); ll_walk(gs.graphs, (void **)&graph); )
|
||||
ll_forEachNL(gs.graphs, item, graph)
|
||||
{
|
||||
if (!graph->enabled)
|
||||
continue;
|
||||
@@ -182,6 +187,7 @@ static int graphs_render(void * udata, bool interactive,
|
||||
(ImVec2){ winSize.x, height },
|
||||
sizeof(float));
|
||||
};
|
||||
ll_unlock(gs.graphs);
|
||||
|
||||
overlayGetImGuiRect(windowRects);
|
||||
igEnd();
|
||||
@@ -217,6 +223,8 @@ void overlayGraph_iterate(void (*callback)(GraphHandle handle, const char * name
|
||||
bool * enabled, void * udata), void * udata)
|
||||
{
|
||||
GraphHandle graph;
|
||||
for (ll_reset(gs.graphs); ll_walk(gs.graphs, (void **)&graph); )
|
||||
ll_lock(gs.graphs);
|
||||
ll_forEachNL(gs.graphs, item, graph)
|
||||
callback(graph, graph->name, &graph->enabled, udata);
|
||||
ll_unlock(gs.graphs);
|
||||
}
|
||||
|
Reference in New Issue
Block a user