# window_tree_build_session

- **Language:** C
- **Kind:** function
- **Source:** https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-tree.c#L403
- **Page:** https://libtmux.org/en/tmux/3.2a/reference/c-function-window-tree-c-window_tree_build_session/

```c
static void window_tree_build_session(struct session *s, void *modedata, struct mode_tree_sort_criteria *sort_crit, const char *filter)
```

## Parameters

- `s` (`struct session *`)
- `modedata` (`void *`)
- `sort_crit` (`struct mode_tree_sort_criteria *`)
- `filter` (`const char *`)

## Called by

- [`window_tree_build`](/en/tmux/3.2a/reference/c-function-window-tree-c-window_tree_build/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-tree.c#L486)

## Calls

- [`format_single`](/en/tmux/3.2a/reference/c-function-format_single/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-tree.c#L420)
- [`mode_tree_add`](/en/tmux/3.2a/reference/c-function-mode_tree_add/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-tree.c#L426)
- [`mode_tree_remove`](/en/tmux/3.2a/reference/c-function-mode_tree_remove/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-tree.c#L448)
- [`window_tree_add_item`](/en/tmux/3.2a/reference/c-function-window-tree-c-window_tree_add_item/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-tree.c#L414)
- [`window_tree_build_window`](/en/tmux/3.2a/reference/c-function-window-tree-c-window_tree_build_window/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-tree.c#L441)
- [`window_tree_free_item`](/en/tmux/3.2a/reference/c-function-window-tree-c-window_tree_free_item/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-tree.c#L446)
- [`xreallocarray`](/en/tmux/3.2a/reference/c-function-xreallocarray/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-tree.c#L433)

## Other function references

- [`window_tree_cmp_window`](/en/tmux/3.2a/reference/c-function-window-tree-c-window_tree_cmp_window/) (function)

## Referenced declarations

- [`window_tree_modedata.data`](/en/tmux/3.2a/reference/c-struct-window_tree_modedata-data/) (attribute)
- [`window_tree_modedata.format`](/en/tmux/3.2a/reference/c-struct-window_tree_modedata-format/) (attribute)
- [`session.id`](/en/tmux/3.2a/reference/c-struct-session-id/) (attribute)
- [`window_tree_modedata.item_size`](/en/tmux/3.2a/reference/c-struct-window_tree_modedata-item_size/) (attribute)
- [`mode_tree_sort_criteria`](/en/tmux/3.2a/reference/c-struct-mode_tree_sort_criteria/) (struct)
- [`session.name`](/en/tmux/3.2a/reference/c-struct-session-name/) (attribute)
- [`window_tree_itemdata.pane`](/en/tmux/3.2a/reference/c-struct-window_tree_itemdata-pane/) (attribute)
- [`session`](/en/tmux/3.2a/reference/c-struct-session/) (struct)
- [`window_tree_itemdata.session`](/en/tmux/3.2a/reference/c-struct-window_tree_itemdata-session/) (attribute)
- [`mode_tree_item.text`](/en/tmux/3.2a/reference/c-struct-mode_tree_item-text/) (attribute)
- [`window_tree_itemdata.type`](/en/tmux/3.2a/reference/c-struct-window_tree_itemdata-type/) (attribute)
- [`window_tree_modedata.type`](/en/tmux/3.2a/reference/c-struct-window_tree_modedata-type/) (attribute)
- [`WINDOW_TREE_SESSION`](/en/tmux/3.2a/reference/c-enum-window_tree_type-window_tree_session/) (constant)
- [`window_tree_sort`](/en/tmux/3.2a/reference/c-variable-window-tree-c-window_tree_sort/) (attribute)
- [`session.windows`](/en/tmux/3.2a/reference/c-struct-session-windows/) (attribute)
- [`window_tree_itemdata.winlink`](/en/tmux/3.2a/reference/c-struct-window_tree_itemdata-winlink/) (attribute)
