# window_tree_build_window

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

```c
static int window_tree_build_window(struct session *s, struct winlink *wl, void *modedata, struct mode_tree_sort_criteria *sort_crit, struct mode_tree_item *parent, const char *filter)
```

## Parameters

- `s` (`struct session *`)
- `wl` (`struct winlink *`)
- `modedata` (`void *`)
- `sort_crit` (`struct mode_tree_sort_criteria *`)
- `parent` (`struct mode_tree_item *`)
- `filter` (`const char *`)

## Called by

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

## 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#L354)
- [`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#L362)
- [`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#L398)
- [`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#L348)
- [`window_tree_build_pane`](/en/tmux/3.2a/reference/c-function-window-tree-c-window_tree_build_pane/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-tree.c#L391)
- [`window_tree_filter_pane`](/en/tmux/3.2a/reference/c-function-window-tree-c-window_tree_filter_pane/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-tree.c#L370)
- [`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#L396)
- [`xasprintf`](/en/tmux/3.2a/reference/c-function-xasprintf/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-tree.c#L355)
- [`xreallocarray`](/en/tmux/3.2a/reference/c-function-xreallocarray/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window-tree.c#L381)

## Other function references

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

## Referenced declarations

- [`window_tree_modedata.data`](/en/tmux/3.2a/reference/c-struct-window_tree_modedata-data/) (attribute)
- [`window_pane.entry`](/en/tmux/3.2a/reference/c-struct-window_pane-entry/) (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)
- [`winlink.idx`](/en/tmux/3.2a/reference/c-struct-winlink-idx/) (attribute)
- [`window_tree_modedata.item_size`](/en/tmux/3.2a/reference/c-struct-window_tree_modedata-item_size/) (attribute)
- [`mode_tree_item`](/en/tmux/3.2a/reference/c-struct-mode_tree_item/) (struct)
- [`mode_tree_sort_criteria`](/en/tmux/3.2a/reference/c-struct-mode_tree_sort_criteria/) (struct)
- [`mode_tree_item.name`](/en/tmux/3.2a/reference/c-struct-mode_tree_item-name/) (attribute)
- [`window_tree_itemdata.pane`](/en/tmux/3.2a/reference/c-struct-window_tree_itemdata-pane/) (attribute)
- [`window.panes`](/en/tmux/3.2a/reference/c-struct-window-panes/) (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)
- [`winlink.window`](/en/tmux/3.2a/reference/c-struct-winlink-window/) (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)
- [`WINDOW_TREE_WINDOW`](/en/tmux/3.2a/reference/c-enum-window_tree_type-window_tree_window/) (constant)
- [`window_tree_itemdata.winlink`](/en/tmux/3.2a/reference/c-struct-window_tree_itemdata-winlink/) (attribute)
- [`winlink`](/en/tmux/3.2a/reference/c-struct-winlink/) (struct)
