i3
|
Go to the source code of this file.
Functions | |
Con * | con_new (Con *parent, i3Window *window) |
Create a new container (and attach it to the given parent, if not NULL). | |
void | con_focus (Con *con) |
Sets input focus to the given container. | |
bool | con_is_leaf (Con *con) |
Returns true when this node is a leaf node (has no children) | |
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). | |
Con * | con_get_output (Con *con) |
Gets the output container (first container with CT_OUTPUT in hierarchy) this node is on. | |
Con * | con_get_workspace (Con *con) |
Gets the workspace container this node is on. | |
Con * | con_parent_with_orientation (Con *con, orientation_t orientation) |
Searches parenst of the given 'con' until it reaches one with the specified 'orientation'. | |
Con * | con_get_fullscreen_con (Con *con, int fullscreen_mode) |
Returns the first fullscreen node below this node. | |
bool | con_is_floating (Con *con) |
Returns true if the node is floating. | |
Con * | con_inside_floating (Con *con) |
Checks if the given container is either floating or inside some floating container. | |
Con * | con_by_window_id (xcb_window_t window) |
Returns the container with the given client window ID or NULL if no such container exists. | |
Con * | con_by_frame_id (xcb_window_t frame) |
Returns the container with the given frame ID or NULL if no such container exists. | |
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. | |
int | con_num_children (Con *con) |
Returns the number of children of this container. | |
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_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. | |
void | con_move_to_workspace (Con *con, Con *workspace) |
Moves the given container to the currently focused container on the given workspace. | |
int | 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). | |
Con * | con_next_focused (Con *con) |
Returns the container which will be focused next when the given container is not available anymore. | |
Con * | con_get_next (Con *con, char way, orientation_t orientation) |
Get the next/previous container in the specified orientation. | |
Con * | con_descend_focused (Con *con) |
Returns the focused con inside this client, descending the tree as far as possible. | |
Con * | con_descend_tiling_focused (Con *con) |
Returns the focused con inside this client, descending the tree as far as possible. | |
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). | |
int | con_border_style (Con *con) |
Use this function to get a container’s border style. | |
void | con_set_layout (Con *con, int layout) |
This function changes 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_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 212 of file con.c.
References DLOG, NO_ORIENTATION, Con::orientation, Con::type, and Con::window.
Referenced by manage_window().
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 76 of file con.c.
References DLOG, focused, Con::num, Con::parent, TAILQ_EMPTY, TAILQ_END, TAILQ_FIRST, TAILQ_FOREACH, TAILQ_INSERT_AFTER, TAILQ_INSERT_BEFORE, TAILQ_INSERT_HEAD, TAILQ_INSERT_TAIL, TAILQ_NEXT, Con::type, Con::window, and workspace_attach_to().
Referenced by con_move_to_workspace(), con_new(), con_set_layout(), floating_enable(), init_ws_for_output(), insert_con_into(), json_end_map(), output_init_con(), randr_query_outputs(), tree_split(), workspace_attach_to(), workspace_get(), and ws_force_orientation().
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 809 of file con.c.
References Con::border_style, BS_NONE, BS_NORMAL, con_get_fullscreen_con(), con_num_children(), DLOG, Con::layout, Con::parent, and Con::type.
Referenced by con_border_style_rect(), and x_draw_decoration().
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 783 of file con.c.
References BS_1PIXEL, BS_NONE, BS_NORMAL, and con_border_style().
Referenced by handle_configure_request(), render_con(), tiling_resize(), and x_draw_decoration().
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 379 of file con.c.
References all_cons, bfs_entry::con, Con::frame, and TAILQ_FOREACH.
Referenced by handle_button_press(), handle_enter_notify(), handle_expose_event(), handle_motion_notify(), and handle_unmap_notify_event().
Con* con_by_window_id | ( | xcb_window_t | window | ) |
Returns the container with the given client window ID or NULL if no such container exists.
Definition at line 366 of file con.c.
References all_cons, bfs_entry::con, Window::id, TAILQ_FOREACH, and Con::window.
Referenced by floating_enable(), handle_button_press(), handle_client_message(), handle_clientleader_change(), handle_configure_request(), handle_enter_notify(), handle_focus_in(), handle_hints(), handle_normal_hints(), handle_transient_for(), handle_unmap_notify_event(), handle_windowname_change(), handle_windowname_change_legacy(), and manage_window().
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 744 of file con.c.
References bfs_entry::con, TAILQ_EMPTY, and TAILQ_FIRST.
Referenced by _tree_next(), check_crossing_screen_boundary(), con_move_to_workspace(), con_next_focused(), floating_maybe_reassign_ws(), handle_enter_notify(), manage_window(), randr_query_outputs(), tree_close(), tree_move(), and workspace_show().
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 759 of file con.c.
References bfs_entry::con, focused, TAILQ_FOREACH, and Con::type.
Referenced by floating_disable(), and tree_open_con().
void con_detach | ( | Con * | con | ) |
Detaches the given container from its current parent.
Definition at line 165 of file con.c.
References focused, Con::parent, TAILQ_REMOVE, and Con::type.
Referenced by attach_to_workspace(), con_move_to_workspace(), con_set_layout(), floating_enable(), init_ws_for_output(), insert_con_into(), randr_query_outputs(), tree_close(), tree_flatten(), and ws_force_orientation().
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 447 of file con.c.
References con_num_children(), Con::percent, and TAILQ_FOREACH.
Referenced by attach_to_workspace(), con_move_to_workspace(), floating_disable(), floating_enable(), insert_con_into(), output_init_con(), resize_graphical_handler(), tree_close(), tree_open_con(), and ws_force_orientation().
void con_focus | ( | Con * | con | ) |
Sets input focus to the given container.
Will be updated in X11 in the next run of x_push_changes().
Definition at line 180 of file con.c.
References con_focus(), con_get_workspace(), DLOG, focused, Con::parent, TAILQ_INSERT_HEAD, TAILQ_REMOVE, Con::urgent, and workspace_update_urgent_flag().
Referenced by _tree_next(), check_crossing_screen_boundary(), con_focus(), con_move_to_workspace(), con_set_layout(), floating_disable(), floating_enable(), floating_maybe_reassign_ws(), handle_enter_notify(), handle_focus_in(), handle_motion_notify(), init_ws_for_output(), level_down(), level_up(), manage_window(), randr_query_outputs(), route_click(), tree_append_json(), tree_close(), tree_move(), workspace_show(), and ws_force_orientation().
Returns the first container below 'con' which wants to swallow this window TODO: priority.
Definition at line 392 of file con.c.
References Window::class_class, con_for_window(), DLOG, match_matches_window(), and TAILQ_FOREACH.
Referenced by con_for_window(), manage_window(), and randr_query_outputs().
Returns the first fullscreen node below this node.
Definition at line 290 of file con.c.
References bfs_entry::con, Con::fullscreen_mode, smalloc(), TAILQ_EMPTY, TAILQ_FIRST, TAILQ_FOREACH, TAILQ_HEAD, TAILQ_HEAD_INITIALIZER, TAILQ_INSERT_TAIL, and TAILQ_REMOVE.
Referenced by con_border_style(), con_toggle_fullscreen(), IPC_HANDLER(), manage_window(), render_con(), render_l_output(), and workspace_is_visible().
Con* con_get_next | ( | Con * | con, |
char | way, | ||
orientation_t | orientation | ||
) |
Get the next/previous container in the specified orientation.
This may travel up until it finds a container with suitable orientation.
Definition at line 707 of file con.c.
References bfs_entry::con, con_orientation(), DLOG, LOG, Con::parent, TAILQ_END, TAILQ_NEXT, TAILQ_PREV, and Con::type.
Gets the output container (first container with CT_OUTPUT in hierarchy) this node is on.
Definition at line 231 of file con.c.
References Con::parent, and Con::type.
Referenced by con_move_to_workspace(), floating_maybe_reassign_ws(), init_ws_for_output(), resize_graphical_handler(), workspace_get(), workspace_is_visible(), and workspace_reassign_sticky().
Gets the workspace container this node is on.
Definition at line 245 of file con.c.
References Con::parent, and Con::type.
Referenced by con_focus(), con_move_to_workspace(), con_next_focused(), con_toggle_fullscreen(), ewmh_update_current_desktop(), floating_disable(), floating_enable(), handle_hints(), IPC_HANDLER(), json_start_map(), manage_window(), tree_close(), tree_move(), workspace_next(), workspace_prev(), and workspace_show().
Checks if the given container is either floating or inside some floating container.
It returns the FLOATING_CON container.
Definition at line 347 of file con.c.
References bfs_entry::con, con_inside_floating(), Con::floating, Con::parent, and Con::type.
Referenced by con_inside_floating(), con_move_to_workspace(), route_click(), and tree_move().
bool con_is_floating | ( | Con * | con | ) |
Returns true if the node is floating.
Definition at line 336 of file con.c.
References DLOG, and Con::floating.
Referenced by con_move_to_workspace(), floating_disable(), floating_enable(), handle_configure_request(), toggle_floating_mode(), tree_close(), and tree_move().
bool con_is_leaf | ( | Con * | con | ) |
Returns true when this node is a leaf node (has no children)
Definition at line 203 of file con.c.
References TAILQ_EMPTY.
Referenced by con_minimum_size(), handle_configure_request(), render_con(), tree_move(), and x_draw_decoration().
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 919 of file con.c.
References con_is_leaf(), con_minimum_size(), Con::deco_rect, DLOG, ELOG, height, Rect::height, HORIZ, Con::layout, max(), min(), Con::orientation, TAILQ_FIRST, TAILQ_FOREACH, Con::type, VERT, width, and Rect::width.
Referenced by con_minimum_size(), and DRAGGING_CB().
Moves the given container to the currently focused container on the given workspace.
TODO: is there a better place for this function?
Definition at line 546 of file con.c.
References CALL, con_attach(), con_descend_focused(), con_detach(), con_fix_percent(), con_focus(), con_get_output(), con_get_workspace(), con_inside_floating(), con_is_floating(), con_next_focused(), DLOG, Con::name, Con::parent, Con::percent, Con::type, and workspace_is_visible().
Referenced by floating_maybe_reassign_ws().
Create a new container (and attach it to the given parent, if not NULL).
This function initializes the data structures and creates the appropriate X11 IDs using x_con_init().
Definition at line 35 of file con.c.
References all_cons, colors, con_attach(), con_on_remove_child(), config, Config::default_border, DLOG, scalloc(), TAILQ_INIT, TAILQ_INSERT_TAIL, and x_con_init().
Referenced by con_set_layout(), floating_enable(), init_ws_for_output(), json_start_map(), output_init_con(), tree_init(), tree_open_con(), tree_restore(), tree_split(), workspace_attach_to(), workspace_get(), and ws_force_orientation().
Returns the container which will be focused next when the given container is not available anymore.
Called in tree_close and con_move_to_workspace to properly restore focus.
Definition at line 639 of file con.c.
References con_descend_focused(), con_get_workspace(), DLOG, focused, output_get_content(), Con::parent, TAILQ_EMPTY, TAILQ_END, TAILQ_FIRST, TAILQ_NEXT, TAILQ_PREV, and Con::type.
Referenced by con_move_to_workspace(), randr_query_outputs(), and tree_close().
int con_num_children | ( | Con * | con | ) |
Returns the number of children of this container.
Definition at line 431 of file con.c.
References TAILQ_FOREACH.
Referenced by _tree_next(), con_border_style(), con_fix_percent(), con_on_remove_child(), floating_enable(), output_change_mode(), render_con(), tree_move(), and tree_split().
int 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 622 of file con.c.
References HORIZ, Con::layout, Con::orientation, and VERT.
Referenced by _tree_next(), con_get_next(), and con_parent_with_orientation().
Con* con_parent_with_orientation | ( | Con * | con, |
orientation_t | orientation | ||
) |
Searches parenst of the given 'con' until it reaches one with the specified 'orientation'.
Aborts when it comes across a floating_con.
Definition at line 257 of file con.c.
References con_orientation(), DLOG, Con::parent, and Con::type.
Referenced by tree_move().
void con_set_layout | ( | Con * | con, |
int | 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 834 of file con.c.
References bfs_entry::con, con_attach(), con_detach(), con_focus(), con_new(), config, croot, Config::default_orientation, DLOG, Rect::height, HORIZ, Con::layout, NO_ORIENTATION, Con::orientation, Con::rect, TAILQ_EMPTY, TAILQ_END, TAILQ_FIRST, tree_flatten(), Con::type, VERT, and Rect::width.
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 490 of file con.c.
References con_get_fullscreen_con(), con_get_workspace(), conn, croot, DLOG, Con::fullscreen_mode, Window::id, LOG, Con::name, Con::type, and Con::window.
Referenced by handle_client_message(), and manage_window().