# window_add_pane

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

```c
struct window_pane * window_add_pane(struct window *w, struct window_pane *other, u_int hlimit, int flags)
```

## Parameters

- `w` (`struct window *`)
- `other` (`struct window_pane *`)
- `hlimit` (`u_int`)
- `flags` (`int`)

## Paths through the source

Arrows name source relationships, not a runtime execution order.

### Create a session and its first pane

[`cmd_new_session_exec`](/en/tmux/3.2a/reference/c-function-cmd-new-session-c-cmd_new_session_exec/) — calls → [`spawn_window`](/en/tmux/3.2a/reference/c-function-spawn_window/) — calls → [`spawn_pane`](/en/tmux/3.2a/reference/c-function-spawn_pane/) — calls → [`window_add_pane`](/en/tmux/3.2a/reference/c-function-window_add_pane/) — calls → [`window_pane_create`](/en/tmux/3.2a/reference/c-function-window-c-window_pane_create/)

### Split a window

[`cmd_split_window_exec`](/en/tmux/3.2a/reference/c-function-cmd-split-window-c-cmd_split_window_exec/) — references → [`spawn_pane`](/en/tmux/3.2a/reference/c-function-spawn_pane/) — calls → [`window_add_pane`](/en/tmux/3.2a/reference/c-function-window_add_pane/) — calls → [`window_pane_create`](/en/tmux/3.2a/reference/c-function-window-c-window_pane_create/)

## Called by

- [`spawn_pane`](/en/tmux/3.2a/reference/c-function-spawn_pane/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/spawn.c#L258)

## Calls

- [`log_debug`](/en/tmux/3.2a/reference/c-function-log_debug/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window.c#L666)
- [`window_pane_create`](/en/tmux/3.2a/reference/c-function-window-c-window_pane_create/) (function) [Call site](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/window.c#L664)

## Referenced by

- [`server_client_push_stderr`](/en/tmux/3.2a/reference/c-function-server_client_push_stderr/) (function)

## Referenced declarations

- [`window.active`](/en/tmux/3.2a/reference/c-struct-window-active/) (attribute)
- [`window_pane.entry`](/en/tmux/3.2a/reference/c-struct-window_pane-entry/) (attribute)
- [`window_pane.flags`](/en/tmux/3.2a/reference/c-struct-window_pane-flags/) (attribute)
- [`window_pane.id`](/en/tmux/3.2a/reference/c-struct-window_pane-id/) (attribute)
- [`window.id`](/en/tmux/3.2a/reference/c-struct-window-id/) (attribute)
- [`window.panes`](/en/tmux/3.2a/reference/c-struct-window-panes/) (attribute)
- [`SPAWN_BEFORE`](/en/tmux/3.2a/reference/c-define-tmux-h-spawn_before/) (constant)
- [`SPAWN_FULLSIZE`](/en/tmux/3.2a/reference/c-define-tmux-h-spawn_fullsize/) (constant)
- [`window.sx`](/en/tmux/3.2a/reference/c-struct-window-sx/) (attribute)
- [`window.sy`](/en/tmux/3.2a/reference/c-struct-window-sy/) (attribute)
- [`window`](/en/tmux/3.2a/reference/c-struct-window/) (struct)
- [`window_pane`](/en/tmux/3.2a/reference/c-struct-window_pane/) (struct)
