diff options
author | 2018-04-04 00:26:31 -0400 | |
---|---|---|
committer | 2018-04-04 00:26:31 -0400 | |
commit | dee71871d7a37cfa1e53f3f1f60e6e93d21beda4 (patch) | |
tree | 1565ba1fede2da35b170353f895c34205216dc38 /include | |
parent | Merge pull request #1722 from swaywm/swaybar-hidpi (diff) | |
parent | fix double free (diff) | |
download | sway-dee71871d7a37cfa1e53f3f1f60e6e93d21beda4.tar.gz sway-dee71871d7a37cfa1e53f3f1f60e6e93d21beda4.tar.zst sway-dee71871d7a37cfa1e53f3f1f60e6e93d21beda4.zip |
Merge pull request #1702 from acrisci/split-containers2
properly close container containers
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/tree/container.h | 22 | ||||
-rw-r--r-- | include/sway/tree/layout.h | 17 | ||||
-rw-r--r-- | include/sway/tree/output.h | 0 | ||||
-rw-r--r-- | include/sway/tree/workspace.h | 2 |
4 files changed, 12 insertions, 29 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 464f80c4..277165ea 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -91,13 +91,11 @@ struct sway_container { | |||
91 | } events; | 91 | } events; |
92 | }; | 92 | }; |
93 | 93 | ||
94 | // TODO make private and use the container-specific create functions | ||
95 | struct sway_container *container_create(enum sway_container_type type); | 94 | struct sway_container *container_create(enum sway_container_type type); |
96 | 95 | ||
97 | const char *container_type_to_str(enum sway_container_type type); | 96 | const char *container_type_to_str(enum sway_container_type type); |
98 | 97 | ||
99 | // TODO only one container create function and pass the type? | 98 | struct sway_container *output_create( |
100 | struct sway_container *container_output_create( | ||
101 | struct sway_output *sway_output); | 99 | struct sway_output *sway_output); |
102 | 100 | ||
103 | /** | 101 | /** |
@@ -110,35 +108,26 @@ struct sway_container *container_container_create(); | |||
110 | * Create a new output. Outputs are children of the root container and have no | 108 | * Create a new output. Outputs are children of the root container and have no |
111 | * order in the tree structure. | 109 | * order in the tree structure. |
112 | */ | 110 | */ |
113 | struct sway_container *container_output_create(struct sway_output *sway_output); | 111 | struct sway_container *output_create(struct sway_output *sway_output); |
114 | 112 | ||
115 | /** | 113 | /** |
116 | * Create a new workspace container. Workspaces are children of an output | 114 | * Create a new workspace container. Workspaces are children of an output |
117 | * container and are ordered alphabetically by name. | 115 | * container and are ordered alphabetically by name. |
118 | */ | 116 | */ |
119 | struct sway_container *container_workspace_create(struct sway_container *output, const char *name); | 117 | struct sway_container *workspace_create(struct sway_container *output, const char *name); |
120 | 118 | ||
121 | /* | 119 | /* |
122 | * Create a new view container. A view can be a child of a workspace container | 120 | * Create a new view container. A view can be a child of a workspace container |
123 | * or a container container and are rendered in the order and structure of | 121 | * or a container container and are rendered in the order and structure of |
124 | * how they are attached to the tree. | 122 | * how they are attached to the tree. |
125 | */ | 123 | */ |
126 | // TODO view containers should be created in a detached state. | ||
127 | struct sway_container *container_view_create( | 124 | struct sway_container *container_view_create( |
128 | struct sway_container *sibling, struct sway_view *sway_view); | 125 | struct sway_container *sibling, struct sway_view *sway_view); |
129 | 126 | ||
130 | // TODO don't return the parent on destroy | ||
131 | struct sway_container *container_destroy(struct sway_container *container); | 127 | struct sway_container *container_destroy(struct sway_container *container); |
132 | 128 | ||
133 | struct sway_container *container_workspace_destroy(struct sway_container *container); | 129 | struct sway_container *container_close(struct sway_container *container); |
134 | struct sway_container *container_output_destroy(struct sway_container *container); | ||
135 | struct sway_container *container_view_destroy(struct sway_container *container); | ||
136 | 130 | ||
137 | // TODO move to layout.c | ||
138 | struct sway_container *container_set_layout(struct sway_container *container, | ||
139 | enum sway_container_layout layout); | ||
140 | |||
141 | // TODO rename to container_descendants_for_each() | ||
142 | void container_descendants(struct sway_container *root, | 131 | void container_descendants(struct sway_container *root, |
143 | enum sway_container_type type, | 132 | enum sway_container_type type, |
144 | void (*func)(struct sway_container *item, void *data), void *data); | 133 | void (*func)(struct sway_container *item, void *data), void *data); |
@@ -153,7 +142,6 @@ struct sway_container *container_find(struct sway_container *container, | |||
153 | /** | 142 | /** |
154 | * Finds a parent container with the given struct sway_containerype. | 143 | * Finds a parent container with the given struct sway_containerype. |
155 | */ | 144 | */ |
156 | // TODO rename to container_parent_of_type() | ||
157 | struct sway_container *container_parent(struct sway_container *container, | 145 | struct sway_container *container_parent(struct sway_container *container, |
158 | enum sway_container_type type); | 146 | enum sway_container_type type); |
159 | 147 | ||
@@ -190,4 +178,6 @@ bool container_has_anscestor(struct sway_container *container, | |||
190 | bool container_has_child(struct sway_container *con, | 178 | bool container_has_child(struct sway_container *con, |
191 | struct sway_container *child); | 179 | struct sway_container *child); |
192 | 180 | ||
181 | void container_create_notify(struct sway_container *container); | ||
182 | |||
193 | #endif | 183 | #endif |
diff --git a/include/sway/tree/layout.h b/include/sway/tree/layout.h index 8badb244..784dcc9b 100644 --- a/include/sway/tree/layout.h +++ b/include/sway/tree/layout.h | |||
@@ -29,42 +29,37 @@ struct sway_root { | |||
29 | 29 | ||
30 | void layout_init(void); | 30 | void layout_init(void); |
31 | 31 | ||
32 | // TODO move to tree.h | ||
33 | void container_add_child(struct sway_container *parent, | 32 | void container_add_child(struct sway_container *parent, |
34 | struct sway_container *child); | 33 | struct sway_container *child); |
35 | 34 | ||
36 | // TODO move to tree.h | ||
37 | struct sway_container *container_add_sibling(struct sway_container *parent, | 35 | struct sway_container *container_add_sibling(struct sway_container *parent, |
38 | struct sway_container *child); | 36 | struct sway_container *child); |
39 | 37 | ||
40 | // TODO move to tree.h | ||
41 | struct sway_container *container_remove_child(struct sway_container *child); | 38 | struct sway_container *container_remove_child(struct sway_container *child); |
42 | 39 | ||
43 | // TODO PRIVATE in tree.h | 40 | struct sway_container *container_replace_child(struct sway_container *child, |
44 | struct sway_container *container_reap_empty(struct sway_container *container); | 41 | struct sway_container *new_child); |
42 | |||
43 | struct sway_container *container_set_layout(struct sway_container *container, | ||
44 | enum sway_container_layout layout); | ||
45 | 45 | ||
46 | // TODO move to tree.h | ||
47 | void container_move_to(struct sway_container* container, | 46 | void container_move_to(struct sway_container* container, |
48 | struct sway_container* destination); | 47 | struct sway_container* destination); |
49 | 48 | ||
50 | void container_move(struct sway_container *container, | 49 | void container_move(struct sway_container *container, |
51 | enum movement_direction dir, int move_amt); | 50 | enum movement_direction dir, int move_amt); |
52 | 51 | ||
53 | // TODO move to output.c | ||
54 | enum sway_container_layout container_get_default_layout( | 52 | enum sway_container_layout container_get_default_layout( |
55 | struct sway_container *output); | 53 | struct sway_container *con); |
56 | 54 | ||
57 | // TODO move to output.c | ||
58 | void container_sort_workspaces(struct sway_container *output); | 55 | void container_sort_workspaces(struct sway_container *output); |
59 | 56 | ||
60 | void arrange_windows(struct sway_container *container, | 57 | void arrange_windows(struct sway_container *container, |
61 | double width, double height); | 58 | double width, double height); |
62 | 59 | ||
63 | // TODO move to container.h | ||
64 | struct sway_container *container_get_in_direction(struct sway_container | 60 | struct sway_container *container_get_in_direction(struct sway_container |
65 | *container, struct sway_seat *seat, enum movement_direction dir); | 61 | *container, struct sway_seat *seat, enum movement_direction dir); |
66 | 62 | ||
67 | // TODO move to tree.h | ||
68 | struct sway_container *container_split(struct sway_container *child, | 63 | struct sway_container *container_split(struct sway_container *child, |
69 | enum sway_container_layout layout); | 64 | enum sway_container_layout layout); |
70 | 65 | ||
diff --git a/include/sway/tree/output.h b/include/sway/tree/output.h new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/include/sway/tree/output.h | |||
diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h index 4e4c3450..8d49fefb 100644 --- a/include/sway/tree/workspace.h +++ b/include/sway/tree/workspace.h | |||
@@ -7,8 +7,6 @@ extern char *prev_workspace_name; | |||
7 | 7 | ||
8 | char *workspace_next_name(const char *output_name); | 8 | char *workspace_next_name(const char *output_name); |
9 | 9 | ||
10 | struct sway_container *workspace_create(const char *name); | ||
11 | |||
12 | bool workspace_switch(struct sway_container *workspace); | 10 | bool workspace_switch(struct sway_container *workspace); |
13 | 11 | ||
14 | struct sway_container *workspace_by_number(const char* name); | 12 | struct sway_container *workspace_by_number(const char* name); |