1 #include "sway/tree/container.h"
2 #include "sway/desktop.h"
3 #include "sway/output.h"
4 
desktop_damage_surface(struct wlr_surface * surface,double lx,double ly,bool whole)5 void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly,
6 		bool whole) {
7 	for (int i = 0; i < root->outputs->length; ++i) {
8 		struct sway_output *output = root->outputs->items[i];
9 		struct wlr_box *output_box = wlr_output_layout_get_box(
10 			root->output_layout, output->wlr_output);
11 		output_damage_surface(output, lx - output_box->x,
12 			ly - output_box->y, surface, whole);
13 	}
14 }
15 
desktop_damage_whole_container(struct sway_container * con)16 void desktop_damage_whole_container(struct sway_container *con) {
17 	for (int i = 0; i < root->outputs->length; ++i) {
18 		struct sway_output *output = root->outputs->items[i];
19 		output_damage_whole_container(output, con);
20 	}
21 }
22 
desktop_damage_box(struct wlr_box * box)23 void desktop_damage_box(struct wlr_box *box) {
24 	for (int i = 0; i < root->outputs->length; ++i) {
25 		struct sway_output *output = root->outputs->items[i];
26 		output_damage_box(output, box);
27 	}
28 }
29 
desktop_damage_view(struct sway_view * view)30 void desktop_damage_view(struct sway_view *view) {
31 	desktop_damage_whole_container(view->container);
32 	struct wlr_box box = {
33 		.x = view->container->current.content_x - view->geometry.x,
34 		.y = view->container->current.content_y - view->geometry.y,
35 		.width = view->surface->current.width,
36 		.height = view->surface->current.height,
37 	};
38 	desktop_damage_box(&box);
39 }
40