*/
#pragma once
+#include <config.h>
+
/**
* Create a new container (and attach it to the given parent, if not NULL).
* This function only initializes the data structures.
*/
Con *con_new(Con *parent, i3Window *window);
+/**
+ * Frees the specified container.
+ *
+ */
+void con_free(Con *con);
+
/**
* Sets input focus to the given container. Will be updated in X11 in the next
* run of x_push_changes().
*/
void con_focus(Con *con);
+/**
+ * Sets input focus to the given container and raises it to the top.
+ *
+ */
+void con_activate(Con *con);
+
+/**
+ * Closes the given container.
+ *
+ */
+void con_close(Con *con, kill_window_t kill_window);
+
/**
* Returns true when this node is a leaf node (has no children)
*
Con *con_get_workspace(Con *con);
/**
- * Searches parenst of the given 'con' until it reaches one with the specified
+ * Searches parents of the given 'con' until it reaches one with the specified
* 'orientation'. Aborts when it comes across a floating_con.
*
*/
*/
bool con_is_floating(Con *con);
+/**
+ * Returns true if the container is a docked container.
+ *
+ */
+bool con_is_docked(Con *con);
+
/**
* Checks if the given container is either floating or inside some floating
* container. It returns the FLOATING_CON container.
*/
bool con_inside_focused(Con *con);
+/**
+ * Checks if the container has the given parent as an actual parent.
+ *
+ */
+bool con_has_parent(Con *con, Con *parent);
+
/**
* Returns the container with the given client window ID or NULL if no such
* container exists.
*/
Con *con_by_window_id(xcb_window_t window);
+/**
+ * Returns the container with the given container ID or NULL if no such
+ * container exists.
+ *
+ */
+Con *con_by_con_id(long target);
+
+/**
+ * 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.
+ *
+ */
+bool con_exists(Con *con);
+
/**
* Returns the container with the given frame ID or NULL if no such container
* exists.
*/
Con *con_by_mark(const char *mark);
+/**
+ * Returns true if and only if the given containers holds the mark.
+ *
+ */
+bool con_has_mark(Con *con, const char *mark);
+
/**
* 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.
*
*/
-void con_mark_toggle(Con *con, const char *mark);
+void con_mark_toggle(Con *con, const char *mark, mark_mode_t mode);
/**
* Assigns a mark to the container.
*
*/
-void con_mark(Con *con, const char *mark);
+void con_mark(Con *con, const char *mark, mark_mode_t mode);
-/**
- * If mark is NULL, this removes all existing marks.
+/*
+ * 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).
*
*/
-void con_unmark(const char *mark);
+void con_unmark(Con *con, const char *name);
/**
* Returns the first container below 'con' which wants to swallow this window
*/
Con *con_for_window(Con *con, i3Window *window, Match **store_match);
+/**
+ * Iterate over the container's focus stack and return an array with the
+ * containers inside it, ordered from higher focus order to lowest.
+ *
+ */
+Con **get_focus_order(Con *con);
+
+/**
+ * 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.
+ *
+ */
+void set_focus_order(Con *con, Con **focus_order);
+
/**
* Returns the number of children of this container.
*
*/
int con_num_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.
+ */
+int con_num_visible_children(Con *con);
+
+/**
+ * Count the number of windows (i.e., leaf containers).
+ *
+ */
+int con_num_windows(Con *con);
+
/**
* 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
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
+ * visible workspace on the given 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 output specified by the given name.
+ * The current output for the container is used to resolve relative names
+ * such as left, right, up, down.
+ *
+ */
+bool con_move_to_output_name(Con *con, const char *name, bool fix_coordinates);
+
/**
* Moves the given container to the given mark.
*
/**
* 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
+ * is not available anymore. Called in tree_close_internal and con_move_to_workspace
* to properly restore focus.
*
*/
*
*/
void con_force_split_parents_redraw(Con *con);
+
+/**
+ * Returns the window title considering the current title format.
+ *
+ */
+i3String *con_parse_title_format(Con *con);
+
+/**
+ * Swaps the two containers.
+ *
+ */
+bool con_swap(Con *first, Con *second);