diff options
author | Alexander Orzechowski <alex@ozal.ski> | 2023-02-21 20:58:17 -0500 |
---|---|---|
committer | Kirill Primak <vyivel@eclair.cafe> | 2024-01-18 18:36:54 +0300 |
commit | 5f0801b6f245cc789ea93b9449dd0c573ef36e66 (patch) | |
tree | 657615d28252b0b3bd01ef240ac6ae49dad15f74 /sway/tree/container.c | |
parent | Delete old damage tracking code (diff) | |
download | sway-5f0801b6f245cc789ea93b9449dd0c573ef36e66.tar.gz sway-5f0801b6f245cc789ea93b9449dd0c573ef36e66.tar.zst sway-5f0801b6f245cc789ea93b9449dd0c573ef36e66.zip |
container: Don't track outputs
The scene graph abstraction does this for us
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r-- | sway/tree/container.c | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index cde9dff5..b19081fc 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include "sway/sway_text_node.h" | 17 | #include "sway/sway_text_node.h" |
18 | #include "sway/output.h" | 18 | #include "sway/output.h" |
19 | #include "sway/server.h" | 19 | #include "sway/server.h" |
20 | #include "sway/surface.h" | ||
21 | #include "sway/tree/arrange.h" | 20 | #include "sway/tree/arrange.h" |
22 | #include "sway/tree/view.h" | 21 | #include "sway/tree/view.h" |
23 | #include "sway/tree/workspace.h" | 22 | #include "sway/tree/workspace.h" |
@@ -113,7 +112,6 @@ struct sway_container *container_create(struct sway_view *view) { | |||
113 | c->view = view; | 112 | c->view = view; |
114 | c->alpha = 1.0f; | 113 | c->alpha = 1.0f; |
115 | c->marks = create_list(); | 114 | c->marks = create_list(); |
116 | c->outputs = create_list(); | ||
117 | 115 | ||
118 | wl_signal_init(&c->events.destroy); | 116 | wl_signal_init(&c->events.destroy); |
119 | wl_signal_emit_mutable(&root->events.new_node, &c->node); | 117 | wl_signal_emit_mutable(&root->events.new_node, &c->node); |
@@ -453,7 +451,6 @@ void container_destroy(struct sway_container *con) { | |||
453 | free(con->formatted_title); | 451 | free(con->formatted_title); |
454 | list_free(con->pending.children); | 452 | list_free(con->pending.children); |
455 | list_free(con->current.children); | 453 | list_free(con->current.children); |
456 | list_free(con->outputs); | ||
457 | 454 | ||
458 | list_free_items_and_destroy(con->marks); | 455 | list_free_items_and_destroy(con->marks); |
459 | 456 | ||
@@ -597,18 +594,6 @@ bool container_has_ancestor(struct sway_container *descendant, | |||
597 | return false; | 594 | return false; |
598 | } | 595 | } |
599 | 596 | ||
600 | |||
601 | /** | ||
602 | * Return the output which will be used for scale purposes. | ||
603 | * This is the most recently entered output. | ||
604 | */ | ||
605 | struct sway_output *container_get_effective_output(struct sway_container *con) { | ||
606 | if (con->outputs->length == 0) { | ||
607 | return NULL; | ||
608 | } | ||
609 | return con->outputs->items[con->outputs->length - 1]; | ||
610 | } | ||
611 | |||
612 | /** | 597 | /** |
613 | * Calculate and return the length of the tree representation. | 598 | * Calculate and return the length of the tree representation. |
614 | * An example tree representation is: V[Terminal, Firefox] | 599 | * An example tree representation is: V[Terminal, Firefox] |
@@ -1267,63 +1252,6 @@ bool container_is_fullscreen_or_child(struct sway_container *container) { | |||
1267 | return false; | 1252 | return false; |
1268 | } | 1253 | } |
1269 | 1254 | ||
1270 | static void surface_send_enter_iterator(struct wlr_surface *surface, | ||
1271 | int x, int y, void *data) { | ||
1272 | struct sway_output *output = data; | ||
1273 | surface_enter_output(surface, output); | ||
1274 | } | ||
1275 | |||
1276 | static void surface_send_leave_iterator(struct wlr_surface *surface, | ||
1277 | int x, int y, void *data) { | ||
1278 | struct sway_output *output = data; | ||
1279 | surface_leave_output(surface, output); | ||
1280 | } | ||
1281 | |||
1282 | void container_discover_outputs(struct sway_container *con) { | ||
1283 | struct wlr_box con_box = { | ||
1284 | .x = con->current.x, | ||
1285 | .y = con->current.y, | ||
1286 | .width = con->current.width, | ||
1287 | .height = con->current.height, | ||
1288 | }; | ||
1289 | |||
1290 | for (int i = 0; i < root->outputs->length; ++i) { | ||
1291 | struct sway_output *output = root->outputs->items[i]; | ||
1292 | struct wlr_box output_box; | ||
1293 | output_get_box(output, &output_box); | ||
1294 | struct wlr_box intersection; | ||
1295 | bool intersects = | ||
1296 | wlr_box_intersection(&intersection, &con_box, &output_box); | ||
1297 | int index = list_find(con->outputs, output); | ||
1298 | |||
1299 | if (intersects && index == -1) { | ||
1300 | // Send enter | ||
1301 | sway_log(SWAY_DEBUG, "Container %p entered output %p", con, output); | ||
1302 | if (con->view) { | ||
1303 | view_for_each_surface(con->view, | ||
1304 | surface_send_enter_iterator, output); | ||
1305 | if (con->view->foreign_toplevel) { | ||
1306 | wlr_foreign_toplevel_handle_v1_output_enter( | ||
1307 | con->view->foreign_toplevel, output->wlr_output); | ||
1308 | } | ||
1309 | } | ||
1310 | list_add(con->outputs, output); | ||
1311 | } else if (!intersects && index != -1) { | ||
1312 | // Send leave | ||
1313 | sway_log(SWAY_DEBUG, "Container %p left output %p", con, output); | ||
1314 | if (con->view) { | ||
1315 | view_for_each_surface(con->view, | ||
1316 | surface_send_leave_iterator, output); | ||
1317 | if (con->view->foreign_toplevel) { | ||
1318 | wlr_foreign_toplevel_handle_v1_output_leave( | ||
1319 | con->view->foreign_toplevel, output->wlr_output); | ||
1320 | } | ||
1321 | } | ||
1322 | list_del(con->outputs, index); | ||
1323 | } | ||
1324 | } | ||
1325 | } | ||
1326 | |||
1327 | enum sway_container_layout container_parent_layout(struct sway_container *con) { | 1255 | enum sway_container_layout container_parent_layout(struct sway_container *con) { |
1328 | if (con->pending.parent) { | 1256 | if (con->pending.parent) { |
1329 | return con->pending.parent->pending.layout; | 1257 | return con->pending.parent->pending.layout; |