i3
|
#include "all.h"
Go to the source code of this file.
Functions | |
static Con * | _create___i3 (void) |
bool | tree_restore (const char *path, xcb_get_geometry_reply_t *geometry) |
Loads tree from ~/.i3/_restart.json (used for in-place restarts). | |
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. | |
Con * | tree_open_con (Con *con, i3Window *window) |
Opens an empty container in the current container. | |
static bool | _is_con_mapped (Con *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. | |
void | tree_close_con (kill_window_t kill_window) |
Closes the current container using tree_close(). | |
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. | |
void | level_up (void) |
Moves focus one level up. | |
void | level_down (void) |
Moves focus one level down. | |
static void | mark_unmapped (Con *con) |
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(). | |
static bool | _tree_next (Con *con, char way, orientation_t orientation, bool wrap) |
void | tree_next (char way, orientation_t orientation) |
Changes focus in the given way (next/previous) and given orientation (horizontal/vertical). | |
void | tree_flatten (Con *con) |
tree_flatten() removes pairs of redundant split containers, e.g. | |
Variables | |
struct Con * | croot |
struct Con * | focused |
struct all_cons_head | all_cons = TAILQ_HEAD_INITIALIZER(all_cons) |
static Con* _create___i3 | ( | void | ) | [static] |
Definition at line 22 of file tree.c.
References con_attach(), con_fix_percent(), con_new(), DLOG, FREE, Con::fullscreen_mode, Rect::height, Con::layout, Con::name, Con::num, Con::rect, sstrdup(), Con::type, Rect::width, and x_set_name().
Referenced by tree_init(), and tree_restore().
static bool _is_con_mapped | ( | Con * | con | ) | [static] |
Definition at line 161 of file tree.c.
References Con::mapped, and TAILQ_FOREACH.
Referenced by tree_close().
static bool _tree_next | ( | Con * | con, |
char | way, | ||
orientation_t | orientation, | ||
bool | wrap | ||
) | [static] |
Definition at line 451 of file tree.c.
References xoutput::con, con_descend_direction(), con_descend_focused(), con_focus(), con_num_children(), con_orientation(), config, D_DOWN, D_LEFT, D_RIGHT, D_UP, DLOG, Config::force_focus_wrapping, get_output_containing(), get_output_next(), GREP_FIRST, HORIZ, xoutput::name, output_get_content(), Con::parent, Con::rect, TAILQ_EMPTY, TAILQ_FIRST, TAILQ_LAST, TAILQ_NEXT, TAILQ_PREV, Con::type, VERT, workspace_is_visible(), workspace_show(), Rect::x, x_set_warp_to(), and Rect::y.
Referenced by tree_next().
void level_down | ( | void | ) |
Moves focus one level down.
Definition at line 402 of file tree.c.
References con_focus(), TAILQ_END, and TAILQ_FIRST.
Referenced by cmd_focus_level().
void level_up | ( | void | ) |
Moves focus one level up.
Definition at line 381 of file tree.c.
References con_focus(), Con::fullscreen_mode, LOG, Con::parent, and Con::type.
Referenced by cmd_focus_level().
static void mark_unmapped | ( | Con * | con | ) | [static] |
Definition at line 412 of file tree.c.
References Con::mapped, TAILQ_FOREACH, and Con::type.
Referenced by tree_render().
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 184 of file tree.c.
References _is_con_mapped(), add_ignore_event(), all_cons, CALL, Window::class_class, Window::class_instance, con_descend_focused(), con_detach(), con_fix_percent(), con_focus(), con_get_workspace(), con_is_floating(), con_next_focused(), conn, Con::deco_render_params, DLOG, DONT_KILL_WINDOW, FREE, Window::id, Con::mapped, Con::name, Window::name_json, Window::name_x, output_get_content(), Con::parent, root, TAILQ_FIRST, TAILQ_NEXT, TAILQ_REMOVE, tree_close(), Con::type, Con::window, x_con_kill(), 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().
void tree_close_con | ( | kill_window_t | kill_window | ) |
Closes the current container using tree_close().
Definition at line 316 of file tree.c.
References LOG, tree_close(), and Con::type.
Referenced by cmd_kill().
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 592 of file tree.c.
References con_detach(), DLOG, DONT_KILL_WINDOW, Con::name, NO_ORIENTATION, Con::orientation, 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(), tree_flatten(), and tree_move().
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 110 of file tree.c.
References _create___i3(), con_new(), FREE, Con::name, Con::rect, Con::type, and Rect::x.
Referenced by main().
void tree_next | ( | char | way, |
orientation_t | orientation | ||
) |
Changes focus in the given way (next/previous) and given orientation (horizontal/vertical).
Definition at line 575 of file tree.c.
References _tree_next().
Referenced by cmd_focus_direction(), and route_click().
Con* tree_open_con | ( | Con * | con, |
i3Window * | window | ||
) |
Opens an empty container in the current container.
Definition at line 129 of file tree.c.
References con_descend_tiling_focused(), con_fix_percent(), con_new(), DLOG, focused, Con::parent, and Con::type.
Referenced by cmd_open(), and manage_window().
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().
Definition at line 431 of file tree.c.
References DLOG, Con::mapped, mark_unmapped(), render_con(), and x_push_changes().
Referenced by check_crossing_screen_boundary(), cmd_workspace_name(), DRAGGING_CB(), floating_drag_window(), floating_reposition(), handle_client_message(), handle_configure_request(), handle_enter_notify(), handle_hints(), handle_key_press(), handle_normal_hints(), handle_unmap_notify_event(), IPC_HANDLER(), main(), manage_window(), randr_query_outputs(), route_click(), run_assignments(), and tiling_resize_for_border().
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 62 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().
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 336 of file tree.c.
References con_attach(), con_new(), con_num_children(), Con::deco_render_params, DLOG, FREE, Con::layout, Con::orientation, Con::parent, Con::percent, TAILQ_REPLACE, and Con::type.
Referenced by cmd_split().
struct all_cons_head all_cons = TAILQ_HEAD_INITIALIZER(all_cons) |
Definition at line 15 of file tree.c.
Referenced by cmd_criteria_init(), cmd_mark(), con_by_frame_id(), con_by_window_id(), con_new(), IPC_HANDLER(), load_configuration(), match_matches_window(), restore_geometry(), and tree_close().
Definition at line 12 of file tree.c.
Referenced by cmd_move_con_to_workspace_number(), cmd_move_window_to_center(), cmd_move_workspace_to_output(), cmd_rename_workspace(), cmd_workspace_number(), con_set_layout(), con_toggle_fullscreen(), create_workspace_on_output(), DRAGGING_CB(), ewmh_update_current_desktop(), ewmh_update_workarea(), handle_client_message(), handle_focus_in(), handle_map_request(), handle_motion_notify(), handle_unmap_notify_event(), handle_windowname_change(), handle_windowname_change_legacy(), init_ws_for_output(), IPC_HANDLER(), load_configuration(), manage_window(), output_init_con(), randr_query_outputs(), store_restart_layout(), tree_move(), tree_restore(), workspace_get(), workspace_next(), and workspace_prev().
Definition at line 13 of file tree.c.
Referenced by _workspace_show(), attach_to_workspace(), check_crossing_screen_boundary(), cmd_focus(), cmd_focus_direction(), cmd_focus_level(), cmd_focus_window_mode(), cmd_layout(), cmd_move_con_to_workspace_name(), cmd_move_con_to_workspace_number(), cmd_move_direction(), cmd_move_window_to_center(), cmd_move_window_to_position(), cmd_rename_workspace(), cmd_resize(), cmd_resize_tiling_direction(), cmd_resize_tiling_width_height(), cmd_split(), cmd_workspace_name(), con_attach(), con_descend_focused(), con_descend_tiling_focused(), con_detach(), con_focus(), con_inside_focused(), con_next_focused(), dump_node(), ewmh_update_current_desktop(), floating_disable(), floating_enable(), handle_enter_notify(), handle_focus_in(), handle_hints(), init_ws_for_output(), insert_con_into(), IPC_HANDLER(), json_end_array(), manage_window(), randr_query_outputs(), render_con(), route_click(), scratchpad_move(), scratchpad_show(), start_application(), tree_append_json(), tree_move(), tree_open_con(), workspace_get(), workspace_next(), workspace_next_on_output(), workspace_prev(), workspace_prev_on_output(), x_draw_decoration(), x_push_changes(), and x_push_node().