# window_add_pane

- **Language:** C
- **Kind:** function
- **Source:** https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/window.c#L798
- **Page:** https://libtmux.org/en/tmux/latest/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/latest/reference/c-function-cmd-new-session-c-cmd_new_session_exec/) — calls → [`spawn_window`](/en/tmux/latest/reference/c-function-spawn_window/) — calls → [`spawn_pane`](/en/tmux/latest/reference/c-function-spawn_pane/) — calls → [`window_add_pane`](/en/tmux/latest/reference/c-function-window_add_pane/) — calls → [`window_pane_create`](/en/tmux/latest/reference/c-function-window-c-window_pane_create/)

### Split a window

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

## Called by

- [`popup_make_pane`](/en/tmux/latest/reference/c-function-popup-c-popup_make_pane/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/popup.c#L429)
- [`spawn_pane`](/en/tmux/latest/reference/c-function-spawn_pane/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/spawn.c#L268)

## Calls

- [`log_debug`](/en/tmux/latest/reference/c-function-log_debug/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/window.c#L808)
- [`window_pane_create`](/en/tmux/latest/reference/c-function-window-c-window_pane_create/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/window.c#L806)

## Referenced declarations

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