diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-03-29 23:29:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-29 23:29:29 -0400 |
commit | d0c7f66e950689b70196a890b62b82ff3c66e103 (patch) | |
tree | b8b52173a9791e3b13a0316ab9d316a80a6adc20 /sway/desktop | |
parent | Merge pull request #1647 from acrisci/refactor-tree (diff) | |
download | sway-d0c7f66e950689b70196a890b62b82ff3c66e103.tar.gz sway-d0c7f66e950689b70196a890b62b82ff3c66e103.tar.zst sway-d0c7f66e950689b70196a890b62b82ff3c66e103.zip |
Revert "Refactor tree"
Diffstat (limited to 'sway/desktop')
-rw-r--r-- | sway/desktop/layer_shell.c | 2 | ||||
-rw-r--r-- | sway/desktop/output.c | 20 | ||||
-rw-r--r-- | sway/desktop/wl_shell.c | 12 | ||||
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 12 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 24 |
5 files changed, 35 insertions, 35 deletions
diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index 137b3260..bd62f84a 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <wlr/types/wlr_output.h> | 7 | #include <wlr/types/wlr_output.h> |
8 | #include <wlr/util/log.h> | 8 | #include <wlr/util/log.h> |
9 | #include "sway/layers.h" | 9 | #include "sway/layers.h" |
10 | #include "sway/tree/layout.h" | 10 | #include "sway/layout.h" |
11 | #include "sway/output.h" | 11 | #include "sway/output.h" |
12 | #include "sway/server.h" | 12 | #include "sway/server.h" |
13 | 13 | ||
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index ba778f4c..b8253ace 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -11,14 +11,14 @@ | |||
11 | #include <wlr/types/wlr_surface.h> | 11 | #include <wlr/types/wlr_surface.h> |
12 | #include <wlr/types/wlr_wl_shell.h> | 12 | #include <wlr/types/wlr_wl_shell.h> |
13 | #include "log.h" | 13 | #include "log.h" |
14 | #include "sway/tree/container.h" | 14 | #include "sway/container.h" |
15 | #include "sway/input/input-manager.h" | 15 | #include "sway/input/input-manager.h" |
16 | #include "sway/input/seat.h" | 16 | #include "sway/input/seat.h" |
17 | #include "sway/layers.h" | 17 | #include "sway/layers.h" |
18 | #include "sway/tree/layout.h" | 18 | #include "sway/layout.h" |
19 | #include "sway/output.h" | 19 | #include "sway/output.h" |
20 | #include "sway/server.h" | 20 | #include "sway/server.h" |
21 | #include "sway/tree/view.h" | 21 | #include "sway/view.h" |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * Rotate a child's position relative to a parent. The parent size is (pw, ph), | 24 | * Rotate a child's position relative to a parent. The parent size is (pw, ph), |
@@ -145,7 +145,7 @@ struct render_data { | |||
145 | struct timespec *now; | 145 | struct timespec *now; |
146 | }; | 146 | }; |
147 | 147 | ||
148 | static void output_frame_view(struct sway_container *view, void *data) { | 148 | static void output_frame_view(swayc_t *view, void *data) { |
149 | struct render_data *rdata = data; | 149 | struct render_data *rdata = data; |
150 | struct sway_output *output = rdata->output; | 150 | struct sway_output *output = rdata->output; |
151 | struct timespec *now = rdata->now; | 151 | struct timespec *now = rdata->now; |
@@ -219,16 +219,16 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { | |||
219 | &soutput->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]); | 219 | &soutput->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM]); |
220 | 220 | ||
221 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 221 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
222 | struct sway_container *focus = sway_seat_get_focus_inactive(seat, soutput->swayc); | 222 | swayc_t *focus = sway_seat_get_focus_inactive(seat, soutput->swayc); |
223 | struct sway_container *workspace = (focus->type == C_WORKSPACE ? | 223 | swayc_t *workspace = (focus->type == C_WORKSPACE ? |
224 | focus : | 224 | focus : |
225 | container_parent(focus, C_WORKSPACE)); | 225 | swayc_parent_by_type(focus, C_WORKSPACE)); |
226 | 226 | ||
227 | struct render_data rdata = { | 227 | struct render_data rdata = { |
228 | .output = soutput, | 228 | .output = soutput, |
229 | .now = &now, | 229 | .now = &now, |
230 | }; | 230 | }; |
231 | container_descendents(workspace, C_VIEW, output_frame_view, &rdata); | 231 | swayc_descendants_of_type(workspace, C_VIEW, output_frame_view, &rdata); |
232 | 232 | ||
233 | // render unmanaged views on top | 233 | // render unmanaged views on top |
234 | struct sway_view *view; | 234 | struct sway_view *view; |
@@ -259,7 +259,7 @@ static void handle_output_destroy(struct wl_listener *listener, void *data) { | |||
259 | struct wlr_output *wlr_output = data; | 259 | struct wlr_output *wlr_output = data; |
260 | wlr_log(L_DEBUG, "Output %p %s removed", wlr_output, wlr_output->name); | 260 | wlr_log(L_DEBUG, "Output %p %s removed", wlr_output, wlr_output->name); |
261 | 261 | ||
262 | container_output_destroy(output->swayc); | 262 | destroy_output(output->swayc); |
263 | } | 263 | } |
264 | 264 | ||
265 | static void handle_output_mode(struct wl_listener *listener, void *data) { | 265 | static void handle_output_mode(struct wl_listener *listener, void *data) { |
@@ -287,7 +287,7 @@ void handle_new_output(struct wl_listener *listener, void *data) { | |||
287 | wlr_output_set_mode(wlr_output, mode); | 287 | wlr_output_set_mode(wlr_output, mode); |
288 | } | 288 | } |
289 | 289 | ||
290 | output->swayc = container_output_create(output); | 290 | output->swayc = new_output(output); |
291 | if (!output->swayc) { | 291 | if (!output->swayc) { |
292 | free(output); | 292 | free(output); |
293 | return; | 293 | return; |
diff --git a/sway/desktop/wl_shell.c b/sway/desktop/wl_shell.c index 4d4d1ed7..0356aa81 100644 --- a/sway/desktop/wl_shell.c +++ b/sway/desktop/wl_shell.c | |||
@@ -3,10 +3,10 @@ | |||
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #include <wayland-server.h> | 4 | #include <wayland-server.h> |
5 | #include <wlr/types/wlr_wl_shell.h> | 5 | #include <wlr/types/wlr_wl_shell.h> |
6 | #include "sway/tree/container.h" | 6 | #include "sway/container.h" |
7 | #include "sway/tree/layout.h" | 7 | #include "sway/layout.h" |
8 | #include "sway/server.h" | 8 | #include "sway/server.h" |
9 | #include "sway/tree/view.h" | 9 | #include "sway/view.h" |
10 | #include "sway/input/seat.h" | 10 | #include "sway/input/seat.h" |
11 | #include "sway/input/input-manager.h" | 11 | #include "sway/input/input-manager.h" |
12 | #include "log.h" | 12 | #include "log.h" |
@@ -74,7 +74,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) { | |||
74 | wl_container_of(listener, sway_surface, destroy); | 74 | wl_container_of(listener, sway_surface, destroy); |
75 | wl_list_remove(&sway_surface->commit.link); | 75 | wl_list_remove(&sway_surface->commit.link); |
76 | wl_list_remove(&sway_surface->destroy.link); | 76 | wl_list_remove(&sway_surface->destroy.link); |
77 | struct sway_container *parent = container_view_destroy(sway_surface->view->swayc); | 77 | swayc_t *parent = destroy_view(sway_surface->view->swayc); |
78 | free(sway_surface->view); | 78 | free(sway_surface->view); |
79 | free(sway_surface); | 79 | free(sway_surface); |
80 | arrange_windows(parent, -1, -1); | 80 | arrange_windows(parent, -1, -1); |
@@ -132,8 +132,8 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) { | |||
132 | wl_signal_add(&shell_surface->events.destroy, &sway_surface->destroy); | 132 | wl_signal_add(&shell_surface->events.destroy, &sway_surface->destroy); |
133 | 133 | ||
134 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 134 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
135 | struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container); | 135 | swayc_t *focus = sway_seat_get_focus_inactive(seat, &root_container); |
136 | struct sway_container *cont = container_view_create(focus, sway_view); | 136 | swayc_t *cont = new_view(focus, sway_view); |
137 | sway_view->swayc = cont; | 137 | sway_view->swayc = cont; |
138 | 138 | ||
139 | arrange_windows(cont->parent, -1, -1); | 139 | arrange_windows(cont->parent, -1, -1); |
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 25c0cbca..18e7d399 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c | |||
@@ -3,10 +3,10 @@ | |||
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #include <wayland-server.h> | 4 | #include <wayland-server.h> |
5 | #include <wlr/types/wlr_xdg_shell_v6.h> | 5 | #include <wlr/types/wlr_xdg_shell_v6.h> |
6 | #include "sway/tree/container.h" | 6 | #include "sway/container.h" |
7 | #include "sway/tree/layout.h" | 7 | #include "sway/layout.h" |
8 | #include "sway/server.h" | 8 | #include "sway/server.h" |
9 | #include "sway/tree/view.h" | 9 | #include "sway/view.h" |
10 | #include "sway/input/seat.h" | 10 | #include "sway/input/seat.h" |
11 | #include "sway/input/input-manager.h" | 11 | #include "sway/input/input-manager.h" |
12 | #include "log.h" | 12 | #include "log.h" |
@@ -83,7 +83,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) { | |||
83 | wl_container_of(listener, sway_xdg_surface, destroy); | 83 | wl_container_of(listener, sway_xdg_surface, destroy); |
84 | wl_list_remove(&sway_xdg_surface->commit.link); | 84 | wl_list_remove(&sway_xdg_surface->commit.link); |
85 | wl_list_remove(&sway_xdg_surface->destroy.link); | 85 | wl_list_remove(&sway_xdg_surface->destroy.link); |
86 | struct sway_container *parent = container_view_destroy(sway_xdg_surface->view->swayc); | 86 | swayc_t *parent = destroy_view(sway_xdg_surface->view->swayc); |
87 | free(sway_xdg_surface->view); | 87 | free(sway_xdg_surface->view); |
88 | free(sway_xdg_surface); | 88 | free(sway_xdg_surface); |
89 | arrange_windows(parent, -1, -1); | 89 | arrange_windows(parent, -1, -1); |
@@ -137,8 +137,8 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { | |||
137 | wl_signal_add(&xdg_surface->events.destroy, &sway_surface->destroy); | 137 | wl_signal_add(&xdg_surface->events.destroy, &sway_surface->destroy); |
138 | 138 | ||
139 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 139 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
140 | struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container); | 140 | swayc_t *focus = sway_seat_get_focus_inactive(seat, &root_container); |
141 | struct sway_container *cont = container_view_create(focus, sway_view); | 141 | swayc_t *cont = new_view(focus, sway_view); |
142 | sway_view->swayc = cont; | 142 | sway_view->swayc = cont; |
143 | 143 | ||
144 | arrange_windows(cont->parent, -1, -1); | 144 | arrange_windows(cont->parent, -1, -1); |
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index fd0bcaca..f9b5242b 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -5,10 +5,10 @@ | |||
5 | #include <wlr/xwayland.h> | 5 | #include <wlr/xwayland.h> |
6 | #include <wlr/types/wlr_output_layout.h> | 6 | #include <wlr/types/wlr_output_layout.h> |
7 | #include <wlr/types/wlr_output.h> | 7 | #include <wlr/types/wlr_output.h> |
8 | #include "sway/tree/container.h" | 8 | #include "sway/container.h" |
9 | #include "sway/tree/layout.h" | 9 | #include "sway/layout.h" |
10 | #include "sway/server.h" | 10 | #include "sway/server.h" |
11 | #include "sway/tree/view.h" | 11 | #include "sway/view.h" |
12 | #include "sway/output.h" | 12 | #include "sway/output.h" |
13 | #include "sway/input/seat.h" | 13 | #include "sway/input/seat.h" |
14 | #include "sway/input/input-manager.h" | 14 | #include "sway/input/input-manager.h" |
@@ -49,11 +49,11 @@ static void set_position(struct sway_view *view, double ox, double oy) { | |||
49 | if (!assert_xwayland(view)) { | 49 | if (!assert_xwayland(view)) { |
50 | return; | 50 | return; |
51 | } | 51 | } |
52 | struct sway_container *output = container_parent(view->swayc, C_OUTPUT); | 52 | swayc_t *output = swayc_parent_by_type(view->swayc, C_OUTPUT); |
53 | if (!sway_assert(output, "view must be within tree to set position")) { | 53 | if (!sway_assert(output, "view must be within tree to set position")) { |
54 | return; | 54 | return; |
55 | } | 55 | } |
56 | struct sway_container *root = container_parent(output, C_ROOT); | 56 | swayc_t *root = swayc_parent_by_type(output, C_ROOT); |
57 | if (!sway_assert(root, "output must be within tree to set position")) { | 57 | if (!sway_assert(root, "output must be within tree to set position")) { |
58 | return; | 58 | return; |
59 | } | 59 | } |
@@ -114,7 +114,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) { | |||
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | struct sway_container *parent = container_view_destroy(sway_surface->view->swayc); | 117 | swayc_t *parent = destroy_view(sway_surface->view->swayc); |
118 | if (parent) { | 118 | if (parent) { |
119 | arrange_windows(parent, -1, -1); | 119 | arrange_windows(parent, -1, -1); |
120 | } | 120 | } |
@@ -132,7 +132,7 @@ static void handle_unmap_notify(struct wl_listener *listener, void *data) { | |||
132 | } | 132 | } |
133 | 133 | ||
134 | // take it out of the tree | 134 | // take it out of the tree |
135 | struct sway_container *parent = container_view_destroy(sway_surface->view->swayc); | 135 | swayc_t *parent = destroy_view(sway_surface->view->swayc); |
136 | if (parent) { | 136 | if (parent) { |
137 | arrange_windows(parent, -1, -1); | 137 | arrange_windows(parent, -1, -1); |
138 | } | 138 | } |
@@ -155,12 +155,12 @@ static void handle_map_notify(struct wl_listener *listener, void *data) { | |||
155 | &sway_surface->view->unmanaged_view_link); | 155 | &sway_surface->view->unmanaged_view_link); |
156 | } else { | 156 | } else { |
157 | struct sway_view *view = sway_surface->view; | 157 | struct sway_view *view = sway_surface->view; |
158 | container_view_destroy(view->swayc); | 158 | destroy_view(view->swayc); |
159 | 159 | ||
160 | struct sway_container *parent = root_container.children->items[0]; | 160 | swayc_t *parent = root_container.children->items[0]; |
161 | parent = parent->children->items[0]; // workspace | 161 | parent = parent->children->items[0]; // workspace |
162 | 162 | ||
163 | struct sway_container *cont = container_view_create(parent, view); | 163 | swayc_t *cont = new_view(parent, view); |
164 | view->swayc = cont; | 164 | view->swayc = cont; |
165 | 165 | ||
166 | arrange_windows(cont->parent, -1, -1); | 166 | arrange_windows(cont->parent, -1, -1); |
@@ -238,8 +238,8 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { | |||
238 | } | 238 | } |
239 | 239 | ||
240 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 240 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
241 | struct sway_container *focus = sway_seat_get_focus_inactive(seat, &root_container); | 241 | swayc_t *focus = sway_seat_get_focus_inactive(seat, &root_container); |
242 | struct sway_container *cont = container_view_create(focus, sway_view); | 242 | swayc_t *cont = new_view(focus, sway_view); |
243 | sway_view->swayc = cont; | 243 | sway_view->swayc = cont; |
244 | 244 | ||
245 | arrange_windows(cont->parent, -1, -1); | 245 | arrange_windows(cont->parent, -1, -1); |