i3
con.c File Reference
#include "all.h"
#include "yajl_utils.h"
Include dependency graph for con.c:

Go to the source code of this file.

Data Structures

struct  bfs_entry
 

Macros

#define SWAP_CONS_IN_TREE(headname, field)
 

Functions

static void con_on_remove_child (Con *con)
 
void con_force_split_parents_redraw (Con *con)
 force parent split containers to be redrawn
 
Concon_new_skeleton (Con *parent, i3Window *window)
 Create a new container (and attach it to the given parent, if not NULL).
 
Concon_new (Con *parent, i3Window *window)
 A wrapper for con_new_skeleton, to retain the old con_new behaviour.
 
void con_free (Con *con)
 Frees the specified container.
 
static void _con_attach (Con *con, Con *parent, Con *previous, bool ignore_focus)
 
void con_attach (Con *con, Con *parent, bool ignore_focus)
 Attaches the given container to the given parent.
 
void con_detach (Con *con)
 Detaches the given container from its current parent.
 
void con_focus (Con *con)
 Sets input focus to the given container.
 
static void con_raise (Con *con)
 
void con_activate (Con *con)
 Sets input focus to the given container and raises it to the top.
 
void con_activate_unblock (Con *con)
 Activates the container like in con_activate but removes fullscreen restrictions and properly warps the pointer if needed.
 
void con_close (Con *con, kill_window_t kill_window)
 Closes the given container.
 
bool con_is_leaf (Con *con)
 Returns true when this node is a leaf node (has no children)
 
bool con_has_managed_window (Con *con)
 Returns true when this con is a leaf node with a managed X11 window (e.g., excluding dock containers)
 
bool con_has_children (Con *con)
 Returns true if this node has regular or floating children.
 
bool con_is_split (Con *con)
 Returns true if a container should be considered split.
 
bool con_is_hidden (Con *con)
 This will only return true for containers which have some parent with a tabbed / stacked parent of which they are not the currently focused child.
 
bool con_is_maximized (Con *con, orientation_t orientation)
 Returns true if the container is maximized in the given orientation.
 
bool con_is_sticky (Con *con)
 Returns whether the container or any of its children is sticky.
 
bool con_accepts_window (Con *con)
 Returns true if this node accepts a window (if the node swallows windows, it might already have swallowed enough and cannot hold any more).
 
Concon_get_output (Con *con)
 Gets the output container (first container with CT_OUTPUT in hierarchy) this node is on.
 
Concon_get_workspace (Con *con)
 Gets the workspace container this node is on.
 
Concon_parent_with_orientation (Con *con, orientation_t orientation)
 Searches parents of the given 'con' until it reaches one with the specified 'orientation'.
 
Concon_get_fullscreen_con (Con *con, fullscreen_mode_t fullscreen_mode)
 Returns the first fullscreen node below this node.
 
Concon_get_fullscreen_covering_ws (Con *ws)
 Returns the fullscreen node that covers the given workspace if it exists.
 
bool con_is_internal (Con *con)
 Returns true if the container is internal, such as __i3_scratch.
 
bool con_is_floating (Con *con)
 Returns true if the node is floating.
 
bool con_is_docked (Con *con)
 Returns true if the container is a docked container.
 
Concon_inside_floating (Con *con)
 Checks if the given container is either floating or inside some floating container.
 
bool con_inside_focused (Con *con)
 Checks if the given container is inside a focused container.
 
bool con_has_parent (Con *con, Con *parent)
 Checks if the container has the given parent as an actual parent.
 
Concon_by_window_id (xcb_window_t window)
 Returns the container with the given client window ID or NULL if no such container exists.
 
Concon_by_con_id (long target)
 Returns the container with the given container ID or NULL if no such container exists.
 
bool con_exists (Con *con)
 Returns true if the given container (still) exists.
 
Concon_by_frame_id (xcb_window_t frame)
 Returns the container with the given frame ID or NULL if no such container exists.
 
Concon_by_mark (const char *mark)
 Returns the container with the given mark or NULL if no such container exists.
 
bool con_find_transient_for_window (Con *start, xcb_window_t target)
 Start from a container and traverse the transient_for linked list.
 
bool con_has_mark (Con *con, const char *mark)
 Returns true if and only if the given containers holds the mark.
 
void con_mark_toggle (Con *con, const char *mark, mark_mode_t mode)
 Toggles the mark on a container.
 
void con_mark (Con *con, const char *mark, mark_mode_t mode)
 Assigns a mark to the container.
 
void con_unmark (Con *con, const char *name)
 Removes marks from containers.
 
Concon_for_window (Con *con, i3Window *window, Match **store_match)
 Returns the first container below 'con' which wants to swallow this window TODO: priority.
 
static int num_focus_heads (Con *con)
 
Con ** get_focus_order (Con *con)
 Iterate over the container's focus stack and return an array with the containers inside it, ordered from higher focus order to lowest.
 
void set_focus_order (Con *con, Con **focus_order)
 Clear the container's focus stack and re-add it using the provided container array.
 
int con_num_children (Con *con)
 Returns the number of children of this container.
 
int con_num_visible_children (Con *con)
 Returns the number of visible non-floating children of this container.
 
int con_num_windows (Con *con)
 Count the number of windows (i.e., leaf containers).
 
void con_fix_percent (Con *con)
 Updates the percent attribute of the children of the given container.
 
void con_toggle_fullscreen (Con *con, int fullscreen_mode)
 Toggles fullscreen mode for the given container.
 
static void con_set_fullscreen_mode (Con *con, fullscreen_mode_t fullscreen_mode)
 
void con_enable_fullscreen (Con *con, fullscreen_mode_t fullscreen_mode)
 Enables fullscreen mode for the given container, if necessary.
 
void con_disable_fullscreen (Con *con)
 Disables fullscreen mode for the given container, if necessary.
 
static bool _con_move_to_con (Con *con, Con *target, bool behind_focused, bool fix_coordinates, bool dont_warp, bool ignore_focus, bool fix_percentage)
 
bool con_move_to_target (Con *con, Con *target)
 
bool con_move_to_mark (Con *con, const char *mark)
 Moves the given container to the given mark.
 
void con_move_to_workspace (Con *con, Con *workspace, bool fix_coordinates, bool dont_warp, bool ignore_focus)
 Moves the given container to the currently focused container on the given workspace.
 
void con_move_to_output (Con *con, Output *output, bool fix_coordinates)
 Moves the given container to the currently focused container on the visible workspace on the given output.
 
bool con_move_to_output_name (Con *con, const char *name, bool fix_coordinates)
 Moves the given container to the currently focused container on the visible workspace on the output specified by the given name.
 
orientation_t con_orientation (Con *con)
 Returns the orientation of the given container (for stacked containers, vertical orientation is used regardless of the actual orientation of the container).
 
Concon_next_focused (Con *con)
 Returns the container which will be focused next when the given container is not available anymore.
 
Concon_descend_focused (Con *con)
 Returns the focused con inside this client, descending the tree as far as possible.
 
Concon_descend_tiling_focused (Con *con)
 Returns the focused con inside this client, descending the tree as far as possible.
 
Concon_descend_direction (Con *con, direction_t direction)
 Returns the leftmost, rightmost, etc.
 
static bool has_outer_gaps (gaps_t gaps)
 
bool con_draw_decoration_into_frame (Con *con)
 Returns whether the window decoration (title bar) should be drawn into the X11 frame window of this container (default) or into the X11 frame window of the parent container (for stacked/tabbed containers).
 
static Rect con_border_style_rect_without_title (Con *con)
 
Rect con_border_style_rect (Con *con)
 Returns a "relative" Rect which contains the amount of pixels that need to be added to the original Rect to get the final position (obviously the amount of pixels for normal, 1pixel and borderless are different).
 
adjacent_t con_adjacent_borders (Con *con)
 Returns adjacent borders of the window.
 
int con_border_style (Con *con)
 Use this function to get a container’s border style.
 
void con_set_border_style (Con *con, border_style_t border_style, int border_width)
 Sets the given border style on con, correctly keeping the position/size of a floating window.
 
void con_set_layout (Con *con, layout_t layout)
 This function changes the layout of a given container.
 
void con_toggle_layout (Con *con, const char *toggle_mode)
 This function toggles the layout of a given container.
 
Rect con_minimum_size (Con *con)
 Determines the minimum size of the given con by looking at its children (for split/stacked/tabbed cons).
 
bool con_fullscreen_permits_focusing (Con *con)
 Returns true if changing the focus to con would be allowed considering the fullscreen focus constraints.
 
bool con_has_urgent_child (Con *con)
 Checks if the given container has an urgent child.
 
void con_update_parents_urgency (Con *con)
 Make all parent containers urgent if con is urgent or clear the urgent flag of all parent containers if there are no more urgent children left.
 
void con_set_urgency (Con *con, bool urgent)
 Set urgency flag to the container, all the parent containers and the workspace.
 
char * con_get_tree_representation (Con *con)
 Create a string representing the subtree under con.
 
i3Stringcon_parse_title_format (Con *con)
 Returns the window title considering the current title format.
 
bool con_swap (Con *first, Con *second)
 Swaps the two containers.
 
uint32_t con_rect_size_in_orientation (Con *con)
 Returns given container's rect size depending on its orientation.
 
void con_merge_into (Con *old, Con *new)
 Merges container specific data that should move with the window (e.g.
 
bool con_inside_stacked_or_tabbed (Con *con)
 Returns true if the container is within any stacked/tabbed split container.
 

Macro Definition Documentation

◆ SWAP_CONS_IN_TREE

#define SWAP_CONS_IN_TREE ( headname,
field )
Value:
do { \
struct headname *head1 = &(first->parent->headname); \
struct headname *head2 = &(second->parent->headname); \
Con *first_prev = TAILQ_PREV(first, headname, field); \
Con *second_prev = TAILQ_PREV(second, headname, field); \
if (second_prev == first) { \
TAILQ_SWAP(first, second, head1, field); \
} else if (first_prev == second) { \
TAILQ_SWAP(second, first, head1, field); \
} else { \
TAILQ_REMOVE(head1, first, field); \
TAILQ_REMOVE(head2, second, field); \
if (second_prev == NULL) { \
TAILQ_INSERT_HEAD(head2, first, field); \
} else { \
TAILQ_INSERT_AFTER(head2, second_prev, first, field); \
} \
if (first_prev == NULL) { \
TAILQ_INSERT_HEAD(head1, second, field); \
} else { \
TAILQ_INSERT_AFTER(head1, first_prev, second, field); \
} \
} \
} while (0)
#define TAILQ_PREV(elm, headname, field)
Definition queue.h:342
A 'Con' represents everything from the X11 root window down to a single X11 window.
Definition data.h:643

Referenced by con_swap().

Function Documentation

◆ _con_attach()

◆ _con_move_to_con()

◆ con_accepts_window()

bool con_accepts_window ( Con * con)

Returns true if this node accepts a window (if the node swallows windows, it might already have swallowed enough and cannot hold any more).

Definition at line 512 of file con.c.

References con_is_split(), DLOG, Con::type, and Con::window.

Referenced by cmd_append_layout(), and manage_window().

Here is the call graph for this function:

◆ con_activate()

void con_activate ( Con * con)

◆ con_activate_unblock()

void con_activate_unblock ( Con * con)

Activates the container like in con_activate but removes fullscreen restrictions and properly warps the pointer if needed.

Definition at line 302 of file con.c.

References con_activate(), con_disable_fullscreen(), con_get_fullscreen_covering_ws(), con_get_workspace(), con_has_parent(), focused, and workspace_show().

Referenced by cmd_focus(), cmd_focus_window_mode(), handle_client_message(), handle_configure_request(), and handle_focus_in().

Here is the call graph for this function:

◆ con_adjacent_borders()

adjacent_t con_adjacent_borders ( Con * con)

Returns adjacent borders of the window.

We need this if hide_edge_borders is enabled.

Definition at line 1902 of file con.c.

References ADJ_LEFT_SCREEN_EDGE, ADJ_LOWER_SCREEN_EDGE, ADJ_NONE, ADJ_RIGHT_SCREEN_EDGE, ADJ_UPPER_SCREEN_EDGE, bfs_entry::con, con_get_workspace(), con_is_floating(), Rect::height, Con::rect, Rect::width, Rect::x, and Rect::y.

Referenced by con_border_style_rect_without_title(), and x_get_border_rectangles().

Here is the call graph for this function:

◆ con_attach()

void con_attach ( Con * con,
Con * parent,
bool ignore_focus )

Attaches the given container to the given parent.

This happens when moving a container or when inserting a new container at a specific place in the tree.

ignore_focus is to just insert the Con at the end (useful when creating a new split container around some containers, that is, detaching and attaching them in order without wanting to mess with the focus in between).

Definition at line 226 of file con.c.

References _con_attach().

Referenced by _create___i3(), cmd_rename_workspace(), con_new_skeleton(), con_set_layout(), create_workspace_on_output(), floating_disable(), handle_configure_request(), handle_strut_partial_change(), insert_con_into(), json_end_map(), move_content(), output_init_con(), tree_split(), workspace_attach_to(), workspace_encapsulate(), workspace_get(), workspace_move_to_output(), and ws_force_orientation().

Here is the call graph for this function:

◆ con_border_style()

int con_border_style ( Con * con)

Use this function to get a container’s border style.

This is important because when inside a stack, the border style is always BS_NORMAL. For tabbed mode, the same applies, with one exception: when the container is borderless and the only element in the tabbed container, the border is not rendered.

For children of a CT_DOCKAREA, the border style is always none.

Definition at line 1936 of file con.c.

References Con::border_style, BS_NONE, BS_NORMAL, CF_GLOBAL, CF_OUTPUT, bfs_entry::con, con_num_children(), DLOG, Con::fullscreen_mode, L_STACKED, L_TABBED, Con::layout, Con::parent, and Con::type.

Referenced by con_border_style_rect(), con_border_style_rect_without_title(), con_draw_decoration_into_frame(), x_draw_decoration(), x_get_border_rectangles(), and x_push_node().

Here is the call graph for this function:

◆ con_border_style_rect()

Rect con_border_style_rect ( Con * con)

Returns a "relative" Rect which contains the amount of pixels that need to be added to the original Rect to get the final position (obviously the amount of pixels for normal, 1pixel and borderless are different).

Definition at line 1887 of file con.c.

References BS_NORMAL, bfs_entry::con, con_border_style(), con_border_style_rect_without_title(), con_draw_decoration_into_frame(), Rect::height, render_deco_height(), and Rect::y.

Referenced by con_set_border_style(), floating_check_size(), floating_enable(), handle_configure_request(), render_con(), tiling_resize(), x_draw_decoration(), and x_get_border_rectangles().

Here is the call graph for this function:

◆ con_border_style_rect_without_title()

◆ con_by_con_id()

Con * con_by_con_id ( long target)

Returns the container with the given container ID or NULL if no such container exists.

Definition at line 767 of file con.c.

References all_cons, bfs_entry::con, and TAILQ_FOREACH.

Referenced by cmd_swap(), and con_exists().

◆ con_by_frame_id()

Con * con_by_frame_id ( xcb_window_t frame)

Returns the container with the given frame ID or NULL if no such container exists.

Definition at line 792 of file con.c.

References all_cons, bfs_entry::con, Con::frame, surface_t::id, and TAILQ_FOREACH.

Referenced by handle_button_press(), handle_enter_notify(), handle_expose_event(), handle_motion_notify(), and handle_unmap_notify_event().

◆ con_by_mark()

Con * con_by_mark ( const char * mark)

Returns the container with the given mark or NULL if no such container exists.

Definition at line 807 of file con.c.

References all_cons, bfs_entry::con, con_has_mark(), and TAILQ_FOREACH.

Referenced by cmd_swap(), con_move_to_mark(), and con_unmark().

Here is the call graph for this function:

◆ con_by_window_id()

◆ con_close()

void con_close ( Con * con,
kill_window_t kill_window )

Closes the given container.

Definition at line 336 of file con.c.

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

Referenced by cmd_kill().

Here is the call graph for this function:

◆ con_descend_direction()

Con * con_descend_direction ( Con * con,
direction_t direction )

Returns the leftmost, rightmost, etc.

container in sub-tree. For example, if direction is D_LEFT, then we return the rightmost container and if direction is D_RIGHT, we return the leftmost container. This is because if we are moving D_LEFT, and thus want the rightmost container.

Definition at line 1742 of file con.c.

References bfs_entry::con, con_descend_direction(), con_orientation(), D_DOWN, D_LEFT, D_RIGHT, D_UP, DLOG, focused, HORIZ, TAILQ_FIRST, TAILQ_FOREACH, TAILQ_LAST, Con::type, and VERT.

Referenced by con_descend_direction(), con_on_side_of_parent(), and tree_move().

Here is the call graph for this function:

◆ con_descend_focused()

Con * con_descend_focused ( Con * con)

Returns the focused con inside this client, descending the tree as far as possible.

This comes in handy when attaching a con to a workspace at the currently focused position, for example.

Definition at line 1698 of file con.c.

References bfs_entry::con, focused, TAILQ_EMPTY, and TAILQ_FIRST.

Referenced by _con_move_to_con(), check_crossing_screen_boundary(), cmd_focus_window_mode(), cmd_resize_floating(), con_move_to_workspace(), con_next_focused(), floating_check_size(), floating_maybe_reassign_ws(), floating_resize(), fullscreen_blocks_floating_render(), handle_enter_notify(), main(), output_push_sticky_windows(), resize_graphical_handler(), route_click(), scratchpad_show(), tree_next(), workspace_show(), and x_draw_decoration().

◆ con_descend_tiling_focused()

Con * con_descend_tiling_focused ( Con * con)

Returns the focused con inside this client, descending the tree as far as possible.

This comes in handy when attaching a con to a workspace at the currently focused position, for example.

Works like con_descend_focused but considers only tiling cons.

Definition at line 1714 of file con.c.

References bfs_entry::con, focused, TAILQ_FOREACH, and Con::type.

Referenced by find_drop_target(), floating_disable(), manage_window(), scratchpad_show(), tree_next(), and tree_open_con().

◆ con_detach()

◆ con_disable_fullscreen()

void con_disable_fullscreen ( Con * con)

Disables fullscreen mode for the given container, if necessary.

Definition at line 1299 of file con.c.

References CF_NONE, bfs_entry::con, con_set_fullscreen_mode(), DLOG, Con::fullscreen_mode, Con::name, and Con::type.

Referenced by cmd_fullscreen(), con_activate_unblock(), con_enable_fullscreen(), con_swap(), con_toggle_fullscreen(), disable_global_fullscreen(), manage_window(), scratchpad_move(), and tiling_drag().

Here is the call graph for this function:

◆ con_draw_decoration_into_frame()

bool con_draw_decoration_into_frame ( Con * con)

Returns whether the window decoration (title bar) should be drawn into the X11 frame window of this container (default) or into the X11 frame window of the parent container (for stacked/tabbed containers).

Definition at line 1818 of file con.c.

References BS_NORMAL, bfs_entry::con, con_border_style(), con_is_leaf(), L_STACKED, L_TABBED, Con::layout, and Con::parent.

Referenced by con_border_style_rect(), dump_node(), and x_draw_decoration().

Here is the call graph for this function:

◆ con_enable_fullscreen()

void con_enable_fullscreen ( Con * con,
fullscreen_mode_t fullscreen_mode )

Enables fullscreen mode for the given container, if necessary.

Definition at line 1248 of file con.c.

References CF_GLOBAL, CF_OUTPUT, bfs_entry::con, con_activate(), con_disable_fullscreen(), con_get_fullscreen_con(), con_get_workspace(), con_set_fullscreen_mode(), croot, DLOG, focused, Con::fullscreen_mode, Con::name, Con::type, and workspace_show().

Referenced by cmd_fullscreen(), con_swap(), con_toggle_fullscreen(), and tiling_drag().

Here is the call graph for this function:

◆ con_exists()

bool con_exists ( Con * con)

Returns true if the given container (still) exists.

This can be used, e.g., to make sure a container hasn't been closed in the meantime.

Definition at line 783 of file con.c.

References bfs_entry::con, and con_by_con_id().

Referenced by drain_drag_events(), floating_drag_window(), floating_resize_window(), and tiling_drag().

Here is the call graph for this function:

◆ con_find_transient_for_window()

bool con_find_transient_for_window ( Con * start,
xcb_window_t target )

Start from a container and traverse the transient_for linked list.

Returns true if target window is found in the list. Protects againsts potential cycles.

Definition at line 824 of file con.c.

References con_by_window_id(), con_num_windows(), croot, DLOG, Window::id, Window::transient_for, and Con::window.

Referenced by fullscreen_blocks_floating_render(), and manage_window().

Here is the call graph for this function:

◆ con_fix_percent()

void con_fix_percent ( Con * con)

Updates the percent attribute of the children of the given container.

This function needs to be called when a window is added or removed from a container.

Definition at line 1144 of file con.c.

References bfs_entry::con, con_num_children(), Con::percent, and TAILQ_FOREACH.

Referenced by _con_move_to_con(), _create___i3(), attach_to_workspace(), con_swap(), floating_disable(), floating_enable(), insert_con_into(), json_end_array(), output_init_con(), resize_neighboring_cons(), tree_append_json(), tree_close_internal(), tree_open_con(), workspace_attach_to(), and ws_force_orientation().

Here is the call graph for this function:

◆ con_focus()

◆ con_for_window()

Con * con_for_window ( Con * con,
i3Window * window,
Match ** store_match )

Returns the first container below 'con' which wants to swallow this window TODO: priority.

Definition at line 976 of file con.c.

References bfs_entry::con, con_for_window(), match_matches_window(), and TAILQ_FOREACH.

Referenced by con_for_window(), handle_configure_request(), handle_strut_partial_change(), manage_window(), move_content(), and placeholder_for_con().

Here is the call graph for this function:

◆ con_force_split_parents_redraw()

void con_force_split_parents_redraw ( Con * con)

force parent split containers to be redrawn

Definition at line 21 of file con.c.

References con_is_leaf(), Con::deco_render_params, FREE, Con::parent, and Con::type.

Referenced by _con_attach(), con_detach(), con_on_remove_child(), con_set_layout(), con_swap(), tree_move(), and tree_split().

Here is the call graph for this function:

◆ con_free()

void con_free ( Con * con)

Frees the specified container.

Definition at line 80 of file con.c.

References all_cons, Con::deco_render_params, DLOG, FREE, marks, match_free(), Con::name, mark_t::name, TAILQ_EMPTY, TAILQ_FIRST, and TAILQ_REMOVE.

Referenced by tree_append_json(), and tree_close_internal().

Here is the call graph for this function:

◆ con_fullscreen_permits_focusing()

bool con_fullscreen_permits_focusing ( Con * con)

Returns true if changing the focus to con would be allowed considering the fullscreen focus constraints.

Specifically, if a fullscreen container or any of its descendants is focused, this function returns true if and only if focusing con would mean that focus would still be visible on screen, i.e., the newly focused container would not be obscured by a fullscreen container.

In the simplest case, if a fullscreen container or any of its descendants is fullscreen, this functions returns true if con is the fullscreen container itself or any of its descendants, as this means focus wouldn't escape the boundaries of the fullscreen container.

In case the fullscreen container is of type CF_OUTPUT, this function returns true if con is on a different workspace, as focus wouldn't be obscured by the fullscreen container that is constrained to a different workspace.

Note that this same logic can be applied to moving containers. If a container can be focused under the fullscreen focus constraints, it can also become a parent or sibling to the currently focused container.

Definition at line 2334 of file con.c.

References CF_NONE, CF_OUTPUT, bfs_entry::con, con_get_workspace(), con_has_parent(), focused, Con::fullscreen_mode, Con::parent, and Con::type.

Referenced by _con_move_to_con(), cmd_focus_level(), get_tree_next(), get_tree_next_sibling(), and tree_move().

Here is the call graph for this function:

◆ con_get_fullscreen_con()

◆ con_get_fullscreen_covering_ws()

Con * con_get_fullscreen_covering_ws ( Con * ws)

Returns the fullscreen node that covers the given workspace if it exists.

This is either a CF_GLOBAL fullscreen container anywhere or a CF_OUTPUT fullscreen container in the workspace.

Definition at line 647 of file con.c.

References CF_GLOBAL, CF_OUTPUT, con_get_fullscreen_con(), and croot.

Referenced by con_activate_unblock(), find_drop_target(), handle_configure_request(), is_tiling_drop_target(), manage_window(), render_root(), route_click(), and tiling_drag().

Here is the call graph for this function:

◆ con_get_output()

◆ con_get_tree_representation()

char * con_get_tree_representation ( Con * con)

Create a string representing the subtree under con.

Definition at line 2473 of file con.c.

References Window::class_instance, bfs_entry::con, con_get_tree_representation(), con_is_leaf(), ELOG, L_DEFAULT, L_SPLITH, L_SPLITV, L_STACKED, L_TABBED, Con::layout, sasprintf(), sstrdup(), TAILQ_FIRST, TAILQ_FOREACH, and Con::window.

Referenced by con_get_tree_representation(), con_parse_title_format(), and x_draw_decoration().

Here is the call graph for this function:

◆ con_get_workspace()

Con * con_get_workspace ( Con * con)

Gets the workspace container this node is on.

Definition at line 547 of file con.c.

References Con::parent, and Con::type.

Referenced by _con_move_to_con(), calculate_effective_gaps(), check_crossing_screen_boundary(), cmd_focus(), cmd_focus_direction(), cmd_focus_output(), cmd_focus_sibling(), cmd_focus_window_mode(), cmd_move_con_to_output(), cmd_move_con_to_workspace(), cmd_move_window_to_center(), cmd_rename_workspace(), con_activate_unblock(), con_adjacent_borders(), con_border_style_rect_without_title(), con_enable_fullscreen(), con_focus(), con_fullscreen_permits_focusing(), con_has_managed_window(), con_move_to_target(), con_move_to_workspace(), con_set_urgency(), con_swap(), drain_drag_events(), ewmh_get_workspace_index(), ewmh_update_wm_desktop_recursively(), find_drop_target(), floating_disable(), floating_enable(), floating_maybe_reassign_ws(), gaps_has_adjacent_container(), gaps_update(), get_tree_next(), handle_button_press(), handle_client_message(), handle_configure_request(), handle_enter_notify(), init_ws_for_output(), IPC_HANDLER(), is_tiling_drop_target(), json_end_map(), manage_window(), match_matches_window(), maybe_auto_back_and_forth_workspace(), maybe_back_and_forth(), move_content(), move_to_output_directed(), output_push_sticky_windows(), remanage_window(), route_click(), scratchpad_move(), scratchpad_show(), start_application(), tiling_drag(), tree_close_internal(), tree_move(), tree_next(), workspace_defer_update_urgent_hint_cb(), workspace_next(), workspace_next_on_output(), workspace_prev(), workspace_prev_on_output(), and workspace_show().

◆ con_has_children()

bool con_has_children ( Con * con)

Returns true if this node has regular or floating children.

Definition at line 382 of file con.c.

References con_is_leaf(), and TAILQ_EMPTY.

Here is the call graph for this function:

◆ con_has_managed_window()

bool con_has_managed_window ( Con * con)

Returns true when this con is a leaf node with a managed X11 window (e.g., excluding dock containers)

Definition at line 374 of file con.c.

References con_get_workspace(), Window::id, and Con::window.

Referenced by con_num_windows(), ewmh_update_wm_desktop_recursively(), is_tiling_drop_target(), and x_push_changes().

Here is the call graph for this function:

◆ con_has_mark()

bool con_has_mark ( Con * con,
const char * mark )

Returns true if and only if the given containers holds the mark.

Definition at line 857 of file con.c.

References bfs_entry::con, marks, mark_t::name, and TAILQ_FOREACH.

Referenced by con_by_mark(), and con_mark_toggle().

◆ con_has_parent()

bool con_has_parent ( Con * con,
Con * parent )

Checks if the container has the given parent as an actual parent.

Definition at line 734 of file con.c.

References bfs_entry::con, con_has_parent(), and Con::parent.

Referenced by _con_move_to_con(), con_activate_unblock(), con_fullscreen_permits_focusing(), con_has_parent(), con_move_to_target(), con_swap(), fullscreen_blocks_floating_render(), gaps_has_adjacent_container(), and route_click().

Here is the call graph for this function:

◆ con_has_urgent_child()

bool con_has_urgent_child ( Con * con)

Checks if the given container has an urgent child.

Definition at line 2378 of file con.c.

References bfs_entry::con, con_has_urgent_child(), con_is_leaf(), TAILQ_FOREACH, and Con::urgent.

Referenced by con_has_urgent_child(), con_on_remove_child(), and con_update_parents_urgency().

Here is the call graph for this function:

◆ con_inside_floating()

Con * con_inside_floating ( Con * con)

Checks if the given container is either floating or inside some floating container.

It returns the FLOATING_CON container.

Definition at line 696 of file con.c.

References bfs_entry::con, con_inside_floating(), Con::floating, Con::parent, and Con::type.

Referenced by border_width_from_style(), cmd_focus_window_mode(), cmd_move_window_to_center(), cmd_move_window_to_mouse(), cmd_resize(), cmd_resize_set(), con_inside_floating(), con_raise(), gaps_should_inset_con(), handle_focus_in(), handle_normal_hints(), match_matches_window(), route_click(), scratchpad_move(), scratchpad_show(), set_focus_order(), and tree_move().

Here is the call graph for this function:

◆ con_inside_focused()

bool con_inside_focused ( Con * con)

Checks if the given container is inside a focused container.

Definition at line 720 of file con.c.

References bfs_entry::con, con_inside_focused(), focused, and Con::parent.

Referenced by con_inside_focused(), floating_maybe_reassign_ws(), and x_draw_decoration().

Here is the call graph for this function:

◆ con_inside_stacked_or_tabbed()

bool con_inside_stacked_or_tabbed ( Con * con)

Returns true if the container is within any stacked/tabbed split container.

Definition at line 2752 of file con.c.

References con_inside_stacked_or_tabbed(), L_STACKED, L_TABBED, Con::layout, and Con::parent.

Referenced by con_inside_stacked_or_tabbed(), and gaps_should_inset_con().

Here is the call graph for this function:

◆ con_is_docked()

bool con_is_docked ( Con * con)

Returns true if the container is a docked container.

Definition at line 679 of file con.c.

References bfs_entry::con, con_is_docked(), Con::parent, and Con::type.

Referenced by cmd_layout(), cmd_split(), con_is_docked(), and floating_enable().

Here is the call graph for this function:

◆ con_is_floating()

◆ con_is_hidden()

bool con_is_hidden ( Con * con)

This will only return true for containers which have some parent with a tabbed / stacked parent of which they are not the currently focused child.

Definition at line 410 of file con.c.

References L_STACKED, L_TABBED, Con::layout, Con::parent, TAILQ_FIRST, and Con::type.

Referenced by con_num_visible_children(), is_tiling_drop_target(), and set_hidden_state().

◆ con_is_internal()

◆ con_is_leaf()

◆ con_is_maximized()

bool con_is_maximized ( Con * con,
orientation_t orientation )

Returns true if the container is maximized in the given orientation.

If the container is floating or fullscreen, it is not considered maximized. Otherwise, it is maximized if it doesn't share space with any other container in the given orientation. For example, if a workspace contains a single splitv container with three children, none of them are considered vertically maximized, but they are all considered horizontally maximized.

Passing "maximized" hints to the application can help it make the right choices about how to draw its borders. See discussion in https://github.com/i3/i3/pull/2380.

Definition at line 442 of file con.c.

References CF_NONE, con_num_children(), Con::fullscreen_mode, HORIZ, L_SPLITH, L_SPLITV, Con::layout, Con::parent, Con::type, and VERT.

Referenced by set_maximized_state().

Here is the call graph for this function:

◆ con_is_split()

bool con_is_split ( Con * con)

Returns true if a container should be considered split.

Definition at line 390 of file con.c.

References con_is_leaf(), L_DOCKAREA, L_OUTPUT, and Con::layout.

Referenced by con_accepts_window(), con_minimum_size(), con_move_to_target(), dump_node(), json_end_map(), and tree_flatten().

Here is the call graph for this function:

◆ con_is_sticky()

bool con_is_sticky ( Con * con)

Returns whether the container or any of its children is sticky.

Definition at line 492 of file con.c.

References con_is_sticky(), Con::sticky, and TAILQ_FOREACH.

Referenced by con_is_sticky(), ewmh_update_wm_desktop_recursively(), and output_push_sticky_windows().

Here is the call graph for this function:

◆ con_mark()

void con_mark ( Con * con,
const char * mark,
mark_mode_t mode )

Assigns a mark to the container.

Definition at line 889 of file con.c.

References bfs_entry::con, con_unmark(), DLOG, ipc_send_window_event(), Con::mark_changed, marks, MM_REPLACE, mark_t::name, scalloc(), sstrdup(), TAILQ_EMPTY, TAILQ_FIRST, and TAILQ_INSERT_TAIL.

Referenced by cmd_mark(), con_mark_toggle(), json_end_map(), and json_string().

Here is the call graph for this function:

◆ con_mark_toggle()

void con_mark_toggle ( Con * con,
const char * mark,
mark_mode_t mode )

Toggles the mark on a container.

If the container already has this mark, the mark is removed. Otherwise, the mark is assigned to the container.

Definition at line 874 of file con.c.

References bfs_entry::con, con_has_mark(), con_mark(), con_unmark(), and DLOG.

Referenced by cmd_mark().

Here is the call graph for this function:

◆ con_merge_into()

void con_merge_into ( Con * old,
Con * new )

Merges container specific data that should move with the window (e.g.

marks, title format, and the window itself) into another container, and closes the old container.

Definition at line 2717 of file con.c.

References con_set_urgency(), DONT_KILL_WINDOW, FREE, ipc_send_window_event(), marks, Con::sticky, Con::sticky_group, TAILQ_FIRST, TAILQ_FOREACH, TAILQ_INIT, TAILQ_INSERT_TAIL, Con::title_format, tree_close_internal(), Con::urgent, and Con::window.

Referenced by remanage_window().

Here is the call graph for this function:

◆ con_minimum_size()

Rect con_minimum_size ( Con * con)

Determines the minimum size of the given con by looking at its children (for split/stacked/tabbed cons).

Will be called when resizing floating cons

Definition at line 2260 of file con.c.

References bfs_entry::con, con_is_leaf(), con_is_split(), con_minimum_size(), Con::deco_rect, DLOG, ELOG, Rect::height, L_SPLITH, L_STACKED, L_TABBED, Con::layout, max(), min(), TAILQ_FIRST, TAILQ_FOREACH, and Con::type.

Referenced by con_minimum_size().

Here is the call graph for this function:

◆ con_move_to_mark()

bool con_move_to_mark ( Con * con,
const char * mark )

Moves the given container to the given mark.

Definition at line 1544 of file con.c.

References bfs_entry::con, con_by_mark(), con_move_to_target(), and DLOG.

Referenced by cmd_move_con_to_mark().

Here is the call graph for this function:

◆ con_move_to_output()

void con_move_to_output ( Con * con,
Output * output,
bool fix_coordinates )

Moves the given container to the currently focused container on the visible workspace on the given output.

Definition at line 1592 of file con.c.

References bfs_entry::con, xoutput::con, con_move_to_workspace(), DLOG, GREP_FIRST, output_get_content(), output_primary_name(), and workspace_is_visible().

Referenced by cmd_move_con_to_output(), con_move_to_output_name(), and manage_window().

Here is the call graph for this function:

◆ con_move_to_output_name()

bool con_move_to_output_name ( Con * con,
const char * name,
bool fix_coordinates )

Moves the given container to the currently focused container on the visible workspace on the output specified by the given name.

The current output for the container is used to resolve relative names such as left, right, up, down.

Definition at line 1607 of file con.c.

References bfs_entry::con, con_move_to_output(), ELOG, get_output_for_con(), and get_output_from_string().

Referenced by manage_window().

Here is the call graph for this function:

◆ con_move_to_target()

bool con_move_to_target ( Con * con,
Con * target )

◆ con_move_to_workspace()

void con_move_to_workspace ( Con * con,
Con * workspace,
bool fix_coordinates,
bool dont_warp,
bool ignore_focus )

Moves the given container to the currently focused container on the given workspace.

The fix_coordinates flag will translate the current coordinates (offset from the monitor position basically) to appropriate coordinates on the destination workspace. Not enabling this behaviour comes in handy when this function gets called by floating_maybe_reassign_ws, which will only "move" a floating window when it already changed its coordinates to a different output.

The dont_warp flag disables pointer warping and will be set when this function is called while dragging a floating window.

If ignore_focus is set, the container will be moved without modifying focus at all.

TODO: is there a better place for this function?

Definition at line 1574 of file con.c.

References _con_move_to_con(), bfs_entry::con, con_descend_focused(), con_get_workspace(), DLOG, and Con::type.

Referenced by _con_move_to_con(), con_move_to_output(), con_move_to_target(), floating_maybe_reassign_ws(), handle_client_message(), move_matches_to_workspace(), output_push_sticky_windows(), scratchpad_move(), and scratchpad_show().

Here is the call graph for this function:

◆ con_new()

Con * con_new ( Con * parent,
i3Window * window )

A wrapper for con_new_skeleton, to retain the old con_new behaviour.

Definition at line 70 of file con.c.

References con_new_skeleton(), and x_con_init().

Referenced by _create___i3(), con_set_layout(), create_workspace_on_output(), floating_enable(), output_init_con(), tree_init(), tree_open_con(), tree_restore(), tree_split(), workspace_attach_to(), workspace_encapsulate(), workspace_get(), and ws_force_orientation().

Here is the call graph for this function:

◆ con_new_skeleton()

Con * con_new_skeleton ( Con * parent,
i3Window * window )

Create a new container (and attach it to the given parent, if not NULL).

This function only initializes the data structures.

Definition at line 38 of file con.c.

References all_cons, con_attach(), con_on_remove_child(), config, Config::default_border, Window::depth, DLOG, root_depth, scalloc(), TAILQ_INIT, and TAILQ_INSERT_TAIL.

Referenced by con_new().

Here is the call graph for this function:

◆ con_next_focused()

Con * con_next_focused ( Con * con)

Returns the container which will be focused next when the given container is not available anymore.

Called in tree_close_internal and con_move_to_workspace to properly restore focus.

Definition at line 1656 of file con.c.

References bfs_entry::con, con_descend_focused(), con_is_floating(), DLOG, focused, output_get_content(), Con::parent, TAILQ_EMPTY, TAILQ_FIRST, TAILQ_NEXT, and Con::type.

Referenced by _con_move_to_con(), and tree_close_internal().

Here is the call graph for this function:

◆ con_num_children()

◆ con_num_visible_children()

int con_num_visible_children ( Con * con)

Returns the number of visible non-floating children of this container.

For example, if the container contains a hsplit which has two children, this will return 2 instead of 1.

Definition at line 1091 of file con.c.

References bfs_entry::con, con_is_hidden(), con_is_leaf(), con_num_visible_children(), and TAILQ_FOREACH.

Referenced by calculate_effective_gaps(), con_border_style_rect_without_title(), and con_num_visible_children().

Here is the call graph for this function:

◆ con_num_windows()

int con_num_windows ( Con * con)

Count the number of windows (i.e., leaf containers).

Definition at line 1116 of file con.c.

References bfs_entry::con, con_has_managed_window(), con_num_windows(), and TAILQ_FOREACH.

Referenced by con_find_transient_for_window(), con_num_windows(), and manage_window().

Here is the call graph for this function:

◆ con_on_remove_child()

◆ con_orientation()

orientation_t con_orientation ( Con * con)

Returns the orientation of the given container (for stacked containers, vertical orientation is used regardless of the actual orientation of the container).

Definition at line 1625 of file con.c.

References bfs_entry::con, ELOG, HORIZ, L_DEFAULT, L_DOCKAREA, L_OUTPUT, L_SPLITH, L_SPLITV, L_STACKED, L_TABBED, Con::layout, and VERT.

Referenced by cmd_focus_direction(), con_descend_direction(), con_on_side_of_parent(), con_parent_with_orientation(), con_rect_size_in_orientation(), dump_node(), get_tree_next(), percent_for_1px(), resize_find_tiling_participants(), tiling_drag(), tree_flatten(), and tree_move().

◆ con_parent_with_orientation()

Con * con_parent_with_orientation ( Con * con,
orientation_t orientation )

Searches parents of the given 'con' until it reaches one with the specified 'orientation'.

Aborts when it comes across a floating_con.

Definition at line 560 of file con.c.

References con_orientation(), DLOG, Con::parent, and Con::type.

Referenced by tree_move().

Here is the call graph for this function:

◆ con_parse_title_format()

i3String * con_parse_title_format ( Con * con)

Returns the window title considering the current title format.

Definition at line 2538 of file con.c.

References bfs_entry::con, con_get_tree_representation(), font_is_pango(), format_placeholders(), i3string_as_utf8(), i3string_from_utf8(), i3string_set_markup(), Window::name, pango_escape_markup(), sstrdup(), Con::title_format, and Con::window.

Referenced by cmd_title_format(), window_update_name(), window_update_name_legacy(), and x_draw_decoration().

Here is the call graph for this function:

◆ con_raise()

static void con_raise ( Con * con)
static

Definition at line 281 of file con.c.

References con_inside_floating(), and floating_raise_con().

Referenced by con_activate().

Here is the call graph for this function:

◆ con_rect_size_in_orientation()

uint32_t con_rect_size_in_orientation ( Con * con)

Returns given container's rect size depending on its orientation.

i.e. its width when horizontal, its height when vertical.

Definition at line 2707 of file con.c.

References con_orientation(), Rect::height, HORIZ, Con::rect, and Rect::width.

Referenced by cmd_resize_tiling_width_height(), percent_for_1px(), precalculate_sizes(), and resize_neighboring_cons().

Here is the call graph for this function:

◆ con_set_border_style()

void con_set_border_style ( Con * con,
border_style_t border_style,
int border_width )

Sets the given border style on con, correctly keeping the position/size of a floating window.

Definition at line 1964 of file con.c.

References Con::border_style, bfs_entry::con, con_border_style_rect(), con_is_floating(), Con::current_border_width, Con::max_user_border_style, Con::parent, Con::rect, rect_add(), and rect_sub().

Referenced by cmd_border(), handle_motif_hints_change(), and manage_window().

Here is the call graph for this function:

◆ con_set_fullscreen_mode()

static void con_set_fullscreen_mode ( Con * con,
fullscreen_mode_t fullscreen_mode )
static

◆ con_set_layout()

void con_set_layout ( Con * con,
layout_t layout )

This function changes the layout of a given container.

Use it to handle special cases like changing a whole workspace to stacked/tabbed (creates a new split container before).

Definition at line 2002 of file con.c.

References bfs_entry::con, con_attach(), con_detach(), con_force_split_parents_redraw(), con_new(), con_num_children(), croot, DLOG, DONT_KILL_WINDOW, get_focus_order(), L_DEFAULT, L_SPLITH, L_SPLITV, L_STACKED, L_TABBED, Con::last_split_layout, Con::layout, Con::parent, set_focus_order(), TAILQ_EMPTY, TAILQ_FIRST, tree_close_internal(), tree_flatten(), Con::type, and Con::workspace_layout.

Referenced by cmd_layout(), and con_toggle_layout().

Here is the call graph for this function:

◆ con_set_urgency()

void con_set_urgency ( Con * con,
bool urgent )

◆ con_swap()

◆ con_toggle_fullscreen()

void con_toggle_fullscreen ( Con * con,
int fullscreen_mode )

Toggles fullscreen mode for the given container.

Fullscreen mode will not be entered when there already is a fullscreen container on this workspace.

Definition at line 1192 of file con.c.

References CF_NONE, bfs_entry::con, con_disable_fullscreen(), con_enable_fullscreen(), DLOG, Con::fullscreen_mode, Con::name, and Con::type.

Referenced by _con_move_to_con(), cmd_fullscreen(), handle_net_wm_state_change(), manage_window(), and scratchpad_show().

Here is the call graph for this function:

◆ con_toggle_layout()

void con_toggle_layout ( Con * con,
const char * toggle_mode )

This function toggles the layout of a given container.

toggle_mode can be either 'default' (toggle only between stacked/tabbed/last_split_layout), 'split' (toggle only between splitv/splith) or 'all' (toggle between all layouts).

Definition at line 2115 of file con.c.

References bfs_entry::con, con_set_layout(), DLOG, ELOG, L_DEFAULT, L_SPLITH, L_SPLITV, L_STACKED, L_TABBED, Con::last_split_layout, Con::layout, layout_from_name(), Con::parent, sstrdup(), and Con::type.

Referenced by cmd_layout_toggle().

Here is the call graph for this function:

◆ con_unmark()

void con_unmark ( Con * con,
const char * name )

Removes marks from containers.

If con is NULL, all containers are considered. If name is NULL, this removes all existing marks. Otherwise, it will only remove the given mark (if it is present).

Definition at line 919 of file con.c.

References all_cons, bfs_entry::con, con_by_mark(), DLOG, FREE, ipc_send_window_event(), Con::mark_changed, marks, mark_t::name, TAILQ_EMPTY, TAILQ_FIRST, TAILQ_FOREACH, and TAILQ_REMOVE.

Referenced by cmd_unmark(), con_mark(), and con_mark_toggle().

Here is the call graph for this function:

◆ con_update_parents_urgency()

void con_update_parents_urgency ( Con * con)

Make all parent containers urgent if con is urgent or clear the urgent flag of all parent containers if there are no more urgent children left.

Definition at line 2401 of file con.c.

References bfs_entry::con, con_has_urgent_child(), Con::parent, Con::type, and Con::urgent.

Referenced by con_focus(), con_on_remove_child(), con_set_urgency(), tree_close_internal(), and workspace_defer_update_urgent_hint_cb().

Here is the call graph for this function:

◆ get_focus_order()

Con ** get_focus_order ( Con * con)

Iterate over the container's focus stack and return an array with the containers inside it, ordered from higher focus order to lowest.

Definition at line 1031 of file con.c.

References bfs_entry::con, focused, num_focus_heads(), smalloc(), and TAILQ_FOREACH.

Referenced by con_set_layout(), workspace_encapsulate(), and ws_force_orientation().

Here is the call graph for this function:

◆ has_outer_gaps()

static bool has_outer_gaps ( gaps_t gaps)
static

Definition at line 1805 of file con.c.

References gaps_t::bottom, gaps_t::left, gaps_t::right, and gaps_t::top.

Referenced by con_border_style_rect_without_title().

◆ num_focus_heads()

static int num_focus_heads ( Con * con)
static

Definition at line 1015 of file con.c.

References bfs_entry::con, focused, and TAILQ_FOREACH.

Referenced by get_focus_order().

◆ set_focus_order()

void set_focus_order ( Con * con,
Con ** focus_order )

Clear the container's focus stack and re-add it using the provided container array.

The function doesn't check if the provided array contains the same containers with the previous focus stack but will not add floating containers in the new focus stack if container is not a workspace.

Definition at line 1051 of file con.c.

References bfs_entry::con, con_inside_floating(), focused, TAILQ_EMPTY, TAILQ_FIRST, TAILQ_INSERT_TAIL, TAILQ_REMOVE, and Con::type.

Referenced by con_set_layout(), workspace_encapsulate(), and ws_force_orientation().

Here is the call graph for this function: