+-------------------+ +------------------+ +------------------+ +--------------+ | session | +------| winlink | +--| window | +--| layout_cell |---+ |-------------------| | |------------------| | | -------------- | | | ------------ | | | - idx | | | - idx | | | - name | | | - type | | | - name | | | - window @-----------+ | - name_timer | +----@ parent | | | - cwd | | | - status_width | | - silence_timer | | - sx, sy | | | - creation time | | | - status_cell | +----@ active | | - xoff, yoff | | | - activity time | | | - status_text | |.---@ last | +---@ wp | | | - sx, sy | | | - flags | |.---O panes | | | - cells O--------+ | - curw @----------'| +------------------+ | | - lastlayout | | +--------------+ | - lastw O----------'| | | - layout_root @----------)--' | | - windows O-----------+ | | - sx, sy | | | | - options @---------------+ ;------+ | | - flags | | | | - flags | | +-----------+ | ,---)--+-@ options | | | | - tio | +---| options |---)---' | | - references | | | | - environ | |-----------| | | +------------------+ | | | - wlmouse | +-----O tree | | | | | | | - references | | | - parent @----+ | | | | +-------------------+ | +-----------+ | | | | | | | | | | | | | | | | +---+ | | | | | | | +---------------+ | | +----------------+ | | +----------------+ +--| options_entry | +-------+--)---| window_pane | | | | session_group | | ------------- | | | | ------------ | | | | ------------- | | - name | | | | - id | | +---O sessions | | - type | | +-----@ window | | +----------------+ | - str | | | - layout_cell @-----+ | - num | | | - sx, sy | | - data | | | - xoff, yoff | +---------------+ | | - flags | | | - cmd | +-------------+ +-------------------------+---+ | - pid | | window_mode | +------------------+ | | | | - tty | | ----------- | | screen |----------+ +------------------+ | | | - fd | | - init() | |------------------| | input_ctx | | | | - event | | - free() | | - title | |------------------|-)---)----@ ictx | | - resize() | +-----@ grid | | - wp @-----------+-+ | | - pipe_fd | | - key() | | | - cx, cy | +-----------@ ctx | | | - pipe_event | | - mouse() | | | - rupper, rlower | | +-----@ cell | | | - pipe_off | | - timer() | | | - mode | | | | - old_cx, old_cy | |`---@ screen | +-------------+ | | - tabs | | | | - interm_buf,len | +----@ base | | | | - sel @---+ | | | | - param_buf,len | | - saved_cx | | | +-----------|------+ | | | - input_buf,len | | - saved_cy | | | | | | | | - param_list,len | +----@ saved_grid | | | | | | | | - utf8data | | | - saved_cell @--------+ | | | +------------+ | | | - ch | | | - mode @-------+------)----+ | | | screen_sel | | | | - flags | | | - modedata | | | | | ---------- | | | | - state | | +----------------+ | | | | - flag | | | +------------------+ | | | | | | - rectflag | | | +----------------+ | | | | | - sx | | | | | +------------+ | | | - sy | | +-----------)----------------------)----------------| grid_cell | | | | - ex | | | | |------------| | | | - ey | | +---------------)----------------------+ | - attr | | | | - cell | | | | | - flags | | | +------------+ | | +------------+ | - fg | | | | | | grid | +------------+ | - bg | | | +--+ | |------------| +------| grid_line | | - data | | | | | | - flags | | | ---------- | +------------+ | | +------------------+ | | - sx, sy | | | - cellsize | | | | | screen_write_ctx | | | - hsize | | | - celldata O-----------+ | | | ---------------- | | | - hlimit | | | - utf8size | | | | - wp @---------------+ | - linedata @-----+ | - utf8data O-------+ | +----@ s | +------------+ | - flags | | +-----------+ | +------------------+ | +------------+ +---| grid_utf8 | | | |-----------| +--------------------------------------+ | - width | | - data | +-----------+ -------------------------------------------------------------------------------------------------------------- A higher level view of the same: ,-------------------------------------. ,----| client | | | Represents a connected tmux client. |<<--[clients global array, may have null pointers] | | tmux client. | | | | | | ,------------------------------. | | | | tty | | | | | Info about client's display. | | | | `------------------------------' | | `----.--------------------------------' | | | | | V | ,-----------------------------------. | | session |<<--[sessions global array] | | All that a single client may see. | | | termios | | `----.------------------------------' | | | V | V | .---------------------. ,------------------. | | window |. | layout_cell |. | | Full-screen view. |-------->>| || | `----.----------------'| ,-->>| Describes panes. || | `--|-----------------' | `------------------'| | | | `------------------' | | ,------------------' | | | | | | ,---------------------------------. | V | | | | V | V | | .-------'-----. ,-----------. ,-------------------. | | window_pane |<<---->| input_ctx |----->| screen_write_ctx | | | || | | | | | | One child. || | State for | | Joins window_pane | | | tty, fd, || | parsing | | and screen. | | | etc. || | input | | | | `-.-----------'| `-----------' `--.----------------' | `|------------' | | | | | | ,---------------------------------------' | | | | V V | ,------------------. ,--------------. ,----------. ,---------. `---->| screen |---------->| grid |----->|grid_lines|------>|grid_cell| | Backing store of | | Screen chars.| `----------' `---------' | screen contents. | | Screen size. | | Cursor pos'n. | `--------------' | Scroll region. | `------------------'