i3
Functions | Variables
tree.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 TAILQ_HEAD (all_cons_head, Con)
 
void tree_init (xcb_get_geometry_reply_t *geometry)
 Initializes the tree by creating the root node, adding all RandR outputs to the tree (that means randr_init() has to be called before) and assigning a workspace to each RandR output. More...
 
Contree_open_con (Con *con, i3Window *window)
 Opens an empty container in the current container. More...
 
void tree_split (Con *con, orientation_t orientation)
 Splits (horizontally or vertically) the given container by creating a new container which contains the old one and the future ones. More...
 
bool level_up (void)
 Moves focus one level up. More...
 
bool level_down (void)
 Moves focus one level down. More...
 
void tree_render (void)
 Renders the tree, that is rendering all outputs using render_con() and pushing the changes to X11 using x_push_changes(). More...
 
void tree_close_con (kill_window_t kill_window)
 Closes the current container using tree_close(). More...
 
void tree_next (char way, orientation_t orientation)
 Changes focus in the given way (next/previous) and given orientation (horizontal/vertical). More...
 
bool tree_close (Con *con, kill_window_t kill_window, bool dont_kill_parent, bool force_set_focus)
 Closes the given container including all children. More...
 
bool tree_restore (const char *path, xcb_get_geometry_reply_t *geometry)
 Loads tree from ~/.i3/_restart.json (used for in-place restarts). More...
 
void tree_flatten (Con *child)
 tree_flatten() removes pairs of redundant split containers, e.g. More...
 

Variables

Concroot
 
Confocused
 
struct all_cons_head all_cons
 

Function Documentation

bool level_down ( void  )

Moves focus one level down.

Returns true if focus changed.

Definition at line 468 of file tree.c.

References con_focus(), DLOG, TAILQ_END, TAILQ_FIRST, and Con::type.

Referenced by cmd_focus_level().

Here is the call graph for this function:

bool level_up ( void  )

Moves focus one level up.

Returns true if focus changed.

Definition at line 445 of file tree.c.

References con_focus(), ELOG, Con::parent, and Con::type.

Referenced by cmd_focus_level().

Here is the call graph for this function:

TAILQ_HEAD ( all_cons_head  ,
Con   
)
bool tree_close ( Con con,
kill_window_t  kill_window,
bool  dont_kill_parent,
bool  force_set_focus 
)

Closes the given container including all children.

Returns true if the container was killed or false if just WM_DELETE was sent and the window is expected to kill itself.

The dont_kill_parent flag is specified when the function calls itself recursively while deleting a containers children.

The force_set_focus flag is specified in the case of killing a floating window: tree_close() will be invoked for the CT_FLOATINGCON (the parent container) and focus should be set there.

Definition at line 192 of file tree.c.

References _is_con_mapped(), add_ignore_event(), Window::class_class, Window::class_instance, con_get_workspace(), con_next_focused(), con_update_parents_urgency(), conn, DLOG, DONT_KILL_WINDOW, FREE, i3string_free(), Window::id, Con::mapped, Window::name, Con::parent, root, TAILQ_FIRST, TAILQ_NEXT, tree_close(), Con::urgent, Con::window, workspace_update_urgent_flag(), x_window_kill(), and XCB_ICCCM_WM_STATE_WITHDRAWN.

Referenced by _workspace_show(), cmd_kill(), con_on_remove_child(), floating_disable(), floating_enable(), handle_unmap_notify_event(), randr_query_outputs(), tree_close(), tree_close_con(), and tree_flatten().

Here is the call graph for this function:

void tree_close_con ( kill_window_t  kill_window)

Closes the current container using tree_close().

Definition at line 360 of file tree.c.

References DLOG, TAILQ_FIRST, TAILQ_NEXT, tree_close(), and Con::type.

Referenced by cmd_kill().

Here is the call graph for this function:

void tree_flatten ( Con child)

tree_flatten() removes pairs of redundant split containers, e.g.

: [workspace, horizontal] [v-split] [child3] [h-split] [child1] [child2] In this example, the v-split and h-split container are redundant. Such a situation can be created by moving containers in a direction which is not the orientation of their parent container. i3 needs to create a new split container then and if you move containers this way multiple times, redundant chains of split-containers can be the result.

Definition at line 693 of file tree.c.

References con_detach(), con_is_split(), con_orientation(), DLOG, DONT_KILL_WINDOW, L_OUTPUT, L_SPLITH, L_SPLITV, Con::layout, Con::name, Con::parent, Con::percent, TAILQ_EMPTY, TAILQ_FIRST, TAILQ_INSERT_BEFORE, TAILQ_INSERT_HEAD, TAILQ_INSERT_TAIL, TAILQ_NEXT, TAILQ_REMOVE, tree_close(), tree_flatten(), Con::type, and Con::window.

Referenced by con_set_layout(), move_to_output_directed(), tree_flatten(), and tree_move().

Here is the call graph for this function:

void tree_init ( xcb_get_geometry_reply_t *  geometry)

Initializes the tree by creating the root node, adding all RandR outputs to the tree (that means randr_init() has to be called before) and assigning a workspace to each RandR output.

Definition at line 116 of file tree.c.

References _create___i3(), con_new(), FREE, L_SPLITH, Con::layout, Con::name, Con::rect, Con::type, and Rect::x.

Referenced by main().

Here is the call graph for this function:

void tree_next ( char  way,
orientation_t  orientation 
)

Changes focus in the given way (next/previous) and given orientation (horizontal/vertical).

Definition at line 676 of file tree.c.

References _tree_next().

Referenced by cmd_focus_direction(), and route_click().

Here is the call graph for this function:

Con* tree_open_con ( Con con,
i3Window window 
)

Opens an empty container in the current container.

Definition at line 136 of file tree.c.

References con_descend_tiling_focused(), con_fix_percent(), con_new(), DLOG, focused, L_SPLITH, Con::parent, and Con::type.

Referenced by cmd_open(), and manage_window().

Here is the call graph for this function:

void tree_render ( void  )
bool tree_restore ( const char *  path,
xcb_get_geometry_reply_t *  geometry 
)

Loads tree from ~/.i3/_restart.json (used for in-place restarts).

Definition at line 68 of file tree.c.

References _create___i3(), con_new(), croot, DLOG, LOG, Con::name, path_exists(), Con::rect, resolve_tilde(), TAILQ_FIRST, TAILQ_INSERT_HEAD, TAILQ_REMOVE, tree_append_json(), and Rect::x.

Referenced by main().

Here is the call graph for this function:

void tree_split ( Con con,
orientation_t  orientation 
)

Splits (horizontally or vertically) the given container by creating a new container which contains the old one and the future ones.

Definition at line 389 of file tree.c.

References con_attach(), con_new(), con_num_children(), Con::deco_render_params, DLOG, FREE, HORIZ, L_SPLITH, L_SPLITV, Con::layout, Con::parent, Con::percent, TAILQ_REPLACE, Con::type, and workspace_encapsulate().

Referenced by cmd_split().

Here is the call graph for this function:

Variable Documentation

struct all_cons_head all_cons
Con* croot
Con* focused

Definition at line 15 of file tree.c.