diff options
-rw-r--r-- | include/sway/desktop.h | 13 | ||||
-rw-r--r-- | include/sway/output.h | 29 | ||||
-rw-r--r-- | include/sway/tree/container.h | 7 | ||||
-rw-r--r-- | include/sway/tree/view.h | 18 | ||||
-rw-r--r-- | sway/commands/client.c | 5 | ||||
-rw-r--r-- | sway/commands/opacity.c | 1 | ||||
-rw-r--r-- | sway/commands/show_marks.c | 5 | ||||
-rw-r--r-- | sway/commands/title_align.c | 5 | ||||
-rw-r--r-- | sway/commands/titlebar_border_thickness.c | 1 | ||||
-rw-r--r-- | sway/commands/titlebar_padding.c | 1 | ||||
-rw-r--r-- | sway/config/output.c | 4 | ||||
-rw-r--r-- | sway/desktop/desktop.c | 40 | ||||
-rw-r--r-- | sway/desktop/output.c | 240 | ||||
-rw-r--r-- | sway/desktop/transaction.c | 18 | ||||
-rw-r--r-- | sway/desktop/xdg_shell.c | 20 | ||||
-rw-r--r-- | sway/input/seatop_move_floating.c | 3 | ||||
-rw-r--r-- | sway/meson.build | 1 | ||||
-rw-r--r-- | sway/tree/container.c | 6 | ||||
-rw-r--r-- | sway/tree/view.c | 30 | ||||
-rw-r--r-- | sway/tree/workspace.c | 1 |
20 files changed, 0 insertions, 448 deletions
diff --git a/include/sway/desktop.h b/include/sway/desktop.h deleted file mode 100644 index 7f2f5b3e..00000000 --- a/include/sway/desktop.h +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | #include <wlr/types/wlr_compositor.h> | ||
2 | |||
3 | struct sway_container; | ||
4 | struct sway_view; | ||
5 | |||
6 | void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly, | ||
7 | bool whole); | ||
8 | |||
9 | void desktop_damage_whole_container(struct sway_container *con); | ||
10 | |||
11 | void desktop_damage_box(struct wlr_box *box); | ||
12 | |||
13 | void desktop_damage_view(struct sway_view *view); | ||
diff --git a/include/sway/output.h b/include/sway/output.h index e2023306..30595f54 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -45,8 +45,6 @@ struct sway_output { | |||
45 | 45 | ||
46 | struct wlr_box usable_area; | 46 | struct wlr_box usable_area; |
47 | 47 | ||
48 | struct wlr_damage_ring damage_ring; | ||
49 | |||
50 | int lx, ly; // layout coords | 48 | int lx, ly; // layout coords |
51 | int width, height; // transformed buffer size | 49 | int width, height; // transformed buffer size |
52 | enum wl_output_subpixel detected_subpixel; | 50 | enum wl_output_subpixel detected_subpixel; |
@@ -99,19 +97,6 @@ typedef void (*sway_surface_iterator_func_t)(struct sway_output *output, | |||
99 | struct sway_view *view, struct wlr_surface *surface, struct wlr_box *box, | 97 | struct sway_view *view, struct wlr_surface *surface, struct wlr_box *box, |
100 | void *user_data); | 98 | void *user_data); |
101 | 99 | ||
102 | void output_damage_whole(struct sway_output *output); | ||
103 | |||
104 | void output_damage_surface(struct sway_output *output, double ox, double oy, | ||
105 | struct wlr_surface *surface, bool whole); | ||
106 | |||
107 | void output_damage_from_view(struct sway_output *output, | ||
108 | struct sway_view *view); | ||
109 | |||
110 | void output_damage_box(struct sway_output *output, struct wlr_box *box); | ||
111 | |||
112 | void output_damage_whole_container(struct sway_output *output, | ||
113 | struct sway_container *con); | ||
114 | |||
115 | bool output_match_name_or_id(struct sway_output *output, | 100 | bool output_match_name_or_id(struct sway_output *output, |
116 | const char *name_or_id); | 101 | const char *name_or_id); |
117 | 102 | ||
@@ -129,18 +114,6 @@ void output_disable(struct sway_output *output); | |||
129 | 114 | ||
130 | struct sway_workspace *output_get_active_workspace(struct sway_output *output); | 115 | struct sway_workspace *output_get_active_workspace(struct sway_output *output); |
131 | 116 | ||
132 | void output_surface_for_each_surface(struct sway_output *output, | ||
133 | struct wlr_surface *surface, double ox, double oy, | ||
134 | sway_surface_iterator_func_t iterator, void *user_data); | ||
135 | |||
136 | void output_view_for_each_surface(struct sway_output *output, | ||
137 | struct sway_view *view, sway_surface_iterator_func_t iterator, | ||
138 | void *user_data); | ||
139 | |||
140 | void output_view_for_each_popup_surface(struct sway_output *output, | ||
141 | struct sway_view *view, sway_surface_iterator_func_t iterator, | ||
142 | void *user_data); | ||
143 | |||
144 | void output_for_each_workspace(struct sway_output *output, | 117 | void output_for_each_workspace(struct sway_output *output, |
145 | void (*f)(struct sway_workspace *ws, void *data), void *data); | 118 | void (*f)(struct sway_workspace *ws, void *data), void *data); |
146 | 119 | ||
@@ -158,8 +131,6 @@ void output_get_box(struct sway_output *output, struct wlr_box *box); | |||
158 | enum sway_container_layout output_get_default_layout( | 131 | enum sway_container_layout output_get_default_layout( |
159 | struct sway_output *output); | 132 | struct sway_output *output); |
160 | 133 | ||
161 | void scale_box(struct wlr_box *box, float scale); | ||
162 | |||
163 | enum wlr_direction opposite_direction(enum wlr_direction d); | 134 | enum wlr_direction opposite_direction(enum wlr_direction d); |
164 | 135 | ||
165 | void handle_output_layout_change(struct wl_listener *listener, void *data); | 136 | void handle_output_layout_change(struct wl_listener *listener, void *data); |
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 4920e064..4cd4c847 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -125,11 +125,6 @@ struct sway_container { | |||
125 | double child_total_width; | 125 | double child_total_width; |
126 | double child_total_height; | 126 | double child_total_height; |
127 | 127 | ||
128 | // In most cases this is the same as the content x and y, but if the view | ||
129 | // refuses to resize to the content dimensions then it can be smaller. | ||
130 | // These are in layout coordinates. | ||
131 | double surface_x, surface_y; | ||
132 | |||
133 | // Outputs currently being intersected | 128 | // Outputs currently being intersected |
134 | list_t *outputs; // struct sway_output | 129 | list_t *outputs; // struct sway_output |
135 | 130 | ||
@@ -181,8 +176,6 @@ bool container_has_ancestor(struct sway_container *container, | |||
181 | 176 | ||
182 | void container_update_textures_recursive(struct sway_container *con); | 177 | void container_update_textures_recursive(struct sway_container *con); |
183 | 178 | ||
184 | void container_damage_whole(struct sway_container *container); | ||
185 | |||
186 | void container_reap_empty(struct sway_container *con); | 179 | void container_reap_empty(struct sway_container *con); |
187 | 180 | ||
188 | struct sway_container *container_flatten(struct sway_container *container); | 181 | struct sway_container *container_flatten(struct sway_container *container); |
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 66d6db1c..80097dd3 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -46,10 +46,6 @@ struct sway_view_impl { | |||
46 | void (*set_fullscreen)(struct sway_view *view, bool fullscreen); | 46 | void (*set_fullscreen)(struct sway_view *view, bool fullscreen); |
47 | void (*set_resizing)(struct sway_view *view, bool resizing); | 47 | void (*set_resizing)(struct sway_view *view, bool resizing); |
48 | bool (*wants_floating)(struct sway_view *view); | 48 | bool (*wants_floating)(struct sway_view *view); |
49 | void (*for_each_surface)(struct sway_view *view, | ||
50 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
51 | void (*for_each_popup_surface)(struct sway_view *view, | ||
52 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
53 | bool (*is_transient_for)(struct sway_view *child, | 49 | bool (*is_transient_for)(struct sway_view *child, |
54 | struct sway_view *ancestor); | 50 | struct sway_view *ancestor); |
55 | void (*close)(struct sway_view *view); | 51 | void (*close)(struct sway_view *view); |
@@ -254,20 +250,6 @@ void view_close(struct sway_view *view); | |||
254 | 250 | ||
255 | void view_close_popups(struct sway_view *view); | 251 | void view_close_popups(struct sway_view *view); |
256 | 252 | ||
257 | void view_damage_from(struct sway_view *view); | ||
258 | |||
259 | /** | ||
260 | * Iterate all surfaces of a view (toplevels + popups). | ||
261 | */ | ||
262 | void view_for_each_surface(struct sway_view *view, | ||
263 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
264 | |||
265 | /** | ||
266 | * Iterate all popup surfaces of a view. | ||
267 | */ | ||
268 | void view_for_each_popup_surface(struct sway_view *view, | ||
269 | wlr_surface_iterator_func_t iterator, void *user_data); | ||
270 | |||
271 | // view implementation | 253 | // view implementation |
272 | 254 | ||
273 | bool view_init(struct sway_view *view, enum sway_view_type type, | 255 | bool view_init(struct sway_view *view, enum sway_view_type type, |
diff --git a/sway/commands/client.c b/sway/commands/client.c index 7a9cff2c..fd2ac7a8 100644 --- a/sway/commands/client.c +++ b/sway/commands/client.c | |||
@@ -51,11 +51,6 @@ static struct cmd_results *handle_command(int argc, char **argv, char *cmd_name, | |||
51 | 51 | ||
52 | if (config->active) { | 52 | if (config->active) { |
53 | root_for_each_container(container_update_iterator, NULL); | 53 | root_for_each_container(container_update_iterator, NULL); |
54 | |||
55 | for (int i = 0; i < root->outputs->length; ++i) { | ||
56 | struct sway_output *output = root->outputs->items[i]; | ||
57 | output_damage_whole(output); | ||
58 | } | ||
59 | } | 54 | } |
60 | 55 | ||
61 | return cmd_results_new(CMD_SUCCESS, NULL); | 56 | return cmd_results_new(CMD_SUCCESS, NULL); |
diff --git a/sway/commands/opacity.c b/sway/commands/opacity.c index 96e6228e..1c44a646 100644 --- a/sway/commands/opacity.c +++ b/sway/commands/opacity.c | |||
@@ -37,6 +37,5 @@ struct cmd_results *cmd_opacity(int argc, char **argv) { | |||
37 | } | 37 | } |
38 | 38 | ||
39 | con->alpha = val; | 39 | con->alpha = val; |
40 | container_damage_whole(con); | ||
41 | return cmd_results_new(CMD_SUCCESS, NULL); | 40 | return cmd_results_new(CMD_SUCCESS, NULL); |
42 | } | 41 | } |
diff --git a/sway/commands/show_marks.c b/sway/commands/show_marks.c index f738144f..fecb5ade 100644 --- a/sway/commands/show_marks.c +++ b/sway/commands/show_marks.c | |||
@@ -26,10 +26,5 @@ struct cmd_results *cmd_show_marks(int argc, char **argv) { | |||
26 | root_for_each_container(title_bar_update_iterator, NULL); | 26 | root_for_each_container(title_bar_update_iterator, NULL); |
27 | } | 27 | } |
28 | 28 | ||
29 | for (int i = 0; i < root->outputs->length; ++i) { | ||
30 | struct sway_output *output = root->outputs->items[i]; | ||
31 | output_damage_whole(output); | ||
32 | } | ||
33 | |||
34 | return cmd_results_new(CMD_SUCCESS, NULL); | 29 | return cmd_results_new(CMD_SUCCESS, NULL); |
35 | } | 30 | } |
diff --git a/sway/commands/title_align.c b/sway/commands/title_align.c index 7f5dd3ae..be298a29 100644 --- a/sway/commands/title_align.c +++ b/sway/commands/title_align.c | |||
@@ -27,10 +27,5 @@ struct cmd_results *cmd_title_align(int argc, char **argv) { | |||
27 | 27 | ||
28 | root_for_each_container(arrange_title_bar_iterator, NULL); | 28 | root_for_each_container(arrange_title_bar_iterator, NULL); |
29 | 29 | ||
30 | for (int i = 0; i < root->outputs->length; ++i) { | ||
31 | struct sway_output *output = root->outputs->items[i]; | ||
32 | output_damage_whole(output); | ||
33 | } | ||
34 | |||
35 | return cmd_results_new(CMD_SUCCESS, NULL); | 30 | return cmd_results_new(CMD_SUCCESS, NULL); |
36 | } | 31 | } |
diff --git a/sway/commands/titlebar_border_thickness.c b/sway/commands/titlebar_border_thickness.c index 7c27c163..fa3db3c5 100644 --- a/sway/commands/titlebar_border_thickness.c +++ b/sway/commands/titlebar_border_thickness.c | |||
@@ -27,7 +27,6 @@ struct cmd_results *cmd_titlebar_border_thickness(int argc, char **argv) { | |||
27 | "Expected output to have a workspace"); | 27 | "Expected output to have a workspace"); |
28 | } | 28 | } |
29 | arrange_workspace(ws); | 29 | arrange_workspace(ws); |
30 | output_damage_whole(output); | ||
31 | } | 30 | } |
32 | 31 | ||
33 | return cmd_results_new(CMD_SUCCESS, NULL); | 32 | return cmd_results_new(CMD_SUCCESS, NULL); |
diff --git a/sway/commands/titlebar_padding.c b/sway/commands/titlebar_padding.c index 29ce59ff..6999f7a2 100644 --- a/sway/commands/titlebar_padding.c +++ b/sway/commands/titlebar_padding.c | |||
@@ -33,7 +33,6 @@ struct cmd_results *cmd_titlebar_padding(int argc, char **argv) { | |||
33 | for (int i = 0; i < root->outputs->length; ++i) { | 33 | for (int i = 0; i < root->outputs->length; ++i) { |
34 | struct sway_output *output = root->outputs->items[i]; | 34 | struct sway_output *output = root->outputs->items[i]; |
35 | arrange_workspace(output_get_active_workspace(output)); | 35 | arrange_workspace(output_get_active_workspace(output)); |
36 | output_damage_whole(output); | ||
37 | } | 36 | } |
38 | 37 | ||
39 | return cmd_results_new(CMD_SUCCESS, NULL); | 38 | return cmd_results_new(CMD_SUCCESS, NULL); |
diff --git a/sway/config/output.c b/sway/config/output.c index 3316085a..66baf194 100644 --- a/sway/config/output.c +++ b/sway/config/output.c | |||
@@ -538,10 +538,6 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) { | |||
538 | return true; | 538 | return true; |
539 | } | 539 | } |
540 | 540 | ||
541 | if (config->reloading) { | ||
542 | output_damage_whole(output); | ||
543 | } | ||
544 | |||
545 | if (oc) { | 541 | if (oc) { |
546 | enum scale_filter_mode scale_filter_old = output->scale_filter; | 542 | enum scale_filter_mode scale_filter_old = output->scale_filter; |
547 | switch (oc->scale_filter) { | 543 | switch (oc->scale_filter) { |
diff --git a/sway/desktop/desktop.c b/sway/desktop/desktop.c deleted file mode 100644 index c8d4502c..00000000 --- a/sway/desktop/desktop.c +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | #include "sway/tree/container.h" | ||
2 | #include "sway/desktop.h" | ||
3 | #include "sway/output.h" | ||
4 | |||
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; | ||
10 | wlr_output_layout_get_box(root->output_layout, | ||
11 | output->wlr_output, &output_box); | ||
12 | output_damage_surface(output, lx - output_box.x, | ||
13 | ly - output_box.y, surface, whole); | ||
14 | } | ||
15 | } | ||
16 | |||
17 | void desktop_damage_whole_container(struct sway_container *con) { | ||
18 | for (int i = 0; i < root->outputs->length; ++i) { | ||
19 | struct sway_output *output = root->outputs->items[i]; | ||
20 | output_damage_whole_container(output, con); | ||
21 | } | ||
22 | } | ||
23 | |||
24 | void desktop_damage_box(struct wlr_box *box) { | ||
25 | for (int i = 0; i < root->outputs->length; ++i) { | ||
26 | struct sway_output *output = root->outputs->items[i]; | ||
27 | output_damage_box(output, box); | ||
28 | } | ||
29 | } | ||
30 | |||
31 | void desktop_damage_view(struct sway_view *view) { | ||
32 | desktop_damage_whole_container(view->container); | ||
33 | struct wlr_box box = { | ||
34 | .x = view->container->current.content_x - view->geometry.x, | ||
35 | .y = view->container->current.content_y - view->geometry.y, | ||
36 | .width = view->surface->current.width, | ||
37 | .height = view->surface->current.height, | ||
38 | }; | ||
39 | desktop_damage_box(&box); | ||
40 | } | ||
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 36c8f52c..aea2a8d7 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -71,127 +71,6 @@ struct sway_output *all_output_by_name_or_id(const char *name_or_id) { | |||
71 | return NULL; | 71 | return NULL; |
72 | } | 72 | } |
73 | 73 | ||
74 | struct surface_iterator_data { | ||
75 | sway_surface_iterator_func_t user_iterator; | ||
76 | void *user_data; | ||
77 | |||
78 | struct sway_output *output; | ||
79 | struct sway_view *view; | ||
80 | double ox, oy; | ||
81 | int width, height; | ||
82 | }; | ||
83 | |||
84 | static bool get_surface_box(struct surface_iterator_data *data, | ||
85 | struct wlr_surface *surface, int sx, int sy, | ||
86 | struct wlr_box *surface_box) { | ||
87 | struct sway_output *output = data->output; | ||
88 | |||
89 | if (!wlr_surface_has_buffer(surface)) { | ||
90 | return false; | ||
91 | } | ||
92 | |||
93 | int sw = surface->current.width; | ||
94 | int sh = surface->current.height; | ||
95 | |||
96 | struct wlr_box box = { | ||
97 | .x = floor(data->ox + sx), | ||
98 | .y = floor(data->oy + sy), | ||
99 | .width = sw, | ||
100 | .height = sh, | ||
101 | }; | ||
102 | if (surface_box != NULL) { | ||
103 | memcpy(surface_box, &box, sizeof(struct wlr_box)); | ||
104 | } | ||
105 | |||
106 | struct wlr_box output_box = { | ||
107 | .width = output->width, | ||
108 | .height = output->height, | ||
109 | }; | ||
110 | |||
111 | struct wlr_box intersection; | ||
112 | return wlr_box_intersection(&intersection, &output_box, &box); | ||
113 | } | ||
114 | |||
115 | static void output_for_each_surface_iterator(struct wlr_surface *surface, | ||
116 | int sx, int sy, void *_data) { | ||
117 | struct surface_iterator_data *data = _data; | ||
118 | |||
119 | struct wlr_box box; | ||
120 | bool intersects = get_surface_box(data, surface, sx, sy, &box); | ||
121 | if (!intersects) { | ||
122 | return; | ||
123 | } | ||
124 | |||
125 | data->user_iterator(data->output, data->view, surface, &box, | ||
126 | data->user_data); | ||
127 | } | ||
128 | |||
129 | void output_surface_for_each_surface(struct sway_output *output, | ||
130 | struct wlr_surface *surface, double ox, double oy, | ||
131 | sway_surface_iterator_func_t iterator, void *user_data) { | ||
132 | struct surface_iterator_data data = { | ||
133 | .user_iterator = iterator, | ||
134 | .user_data = user_data, | ||
135 | .output = output, | ||
136 | .view = NULL, | ||
137 | .ox = ox, | ||
138 | .oy = oy, | ||
139 | .width = surface->current.width, | ||
140 | .height = surface->current.height, | ||
141 | }; | ||
142 | |||
143 | wlr_surface_for_each_surface(surface, | ||
144 | output_for_each_surface_iterator, &data); | ||
145 | } | ||
146 | |||
147 | void output_view_for_each_surface(struct sway_output *output, | ||
148 | struct sway_view *view, sway_surface_iterator_func_t iterator, | ||
149 | void *user_data) { | ||
150 | struct surface_iterator_data data = { | ||
151 | .user_iterator = iterator, | ||
152 | .user_data = user_data, | ||
153 | .output = output, | ||
154 | .view = view, | ||
155 | .ox = view->container->surface_x - output->lx | ||
156 | - view->geometry.x, | ||
157 | .oy = view->container->surface_y - output->ly | ||
158 | - view->geometry.y, | ||
159 | .width = view->container->current.content_width, | ||
160 | .height = view->container->current.content_height, | ||
161 | }; | ||
162 | |||
163 | view_for_each_surface(view, output_for_each_surface_iterator, &data); | ||
164 | } | ||
165 | |||
166 | void output_view_for_each_popup_surface(struct sway_output *output, | ||
167 | struct sway_view *view, sway_surface_iterator_func_t iterator, | ||
168 | void *user_data) { | ||
169 | struct surface_iterator_data data = { | ||
170 | .user_iterator = iterator, | ||
171 | .user_data = user_data, | ||
172 | .output = output, | ||
173 | .view = view, | ||
174 | .ox = view->container->surface_x - output->lx | ||
175 | - view->geometry.x, | ||
176 | .oy = view->container->surface_y - output->ly | ||
177 | - view->geometry.y, | ||
178 | .width = view->container->current.content_width, | ||
179 | .height = view->container->current.content_height, | ||
180 | }; | ||
181 | |||
182 | view_for_each_popup_surface(view, output_for_each_surface_iterator, &data); | ||
183 | } | ||
184 | |||
185 | static int scale_length(int length, int offset, float scale) { | ||
186 | return roundf((offset + length) * scale) - roundf(offset * scale); | ||
187 | } | ||
188 | |||
189 | void scale_box(struct wlr_box *box, float scale) { | ||
190 | box->width = scale_length(box->width, box->x, scale); | ||
191 | box->height = scale_length(box->height, box->y, scale); | ||
192 | box->x = roundf(box->x * scale); | ||
193 | box->y = roundf(box->y * scale); | ||
194 | } | ||
195 | 74 | ||
196 | struct sway_workspace *output_get_active_workspace(struct sway_output *output) { | 75 | struct sway_workspace *output_get_active_workspace(struct sway_output *output) { |
197 | struct sway_seat *seat = input_manager_current_seat(); | 76 | struct sway_seat *seat = input_manager_current_seat(); |
@@ -339,9 +218,6 @@ static int output_repaint_timer_handler(void *data) { | |||
339 | } | 218 | } |
340 | 219 | ||
341 | wlr_scene_output_commit(output->scene_output, NULL); | 220 | wlr_scene_output_commit(output->scene_output, NULL); |
342 | |||
343 | wlr_damage_ring_rotate(&output->damage_ring); | ||
344 | |||
345 | return 0; | 221 | return 0; |
346 | } | 222 | } |
347 | 223 | ||
@@ -409,107 +285,6 @@ static void handle_frame(struct wl_listener *listener, void *user_data) { | |||
409 | wlr_scene_output_for_each_buffer(output->scene_output, send_frame_done_iterator, &data); | 285 | wlr_scene_output_for_each_buffer(output->scene_output, send_frame_done_iterator, &data); |
410 | } | 286 | } |
411 | 287 | ||
412 | void output_damage_whole(struct sway_output *output) { | ||
413 | // The output can exist with no wlr_output if it's just been disconnected | ||
414 | // and the transaction to evacuate it has't completed yet. | ||
415 | if (output != NULL && output->wlr_output != NULL) { | ||
416 | wlr_damage_ring_add_whole(&output->damage_ring); | ||
417 | wlr_output_schedule_frame(output->wlr_output); | ||
418 | } | ||
419 | } | ||
420 | |||
421 | static void damage_surface_iterator(struct sway_output *output, | ||
422 | struct sway_view *view, struct wlr_surface *surface, | ||
423 | struct wlr_box *_box, void *_data) { | ||
424 | bool *data = _data; | ||
425 | bool whole = *data; | ||
426 | |||
427 | struct wlr_box box = *_box; | ||
428 | scale_box(&box, output->wlr_output->scale); | ||
429 | |||
430 | pixman_region32_t damage; | ||
431 | pixman_region32_init(&damage); | ||
432 | wlr_surface_get_effective_damage(surface, &damage); | ||
433 | wlr_region_scale(&damage, &damage, output->wlr_output->scale); | ||
434 | if (ceilf(output->wlr_output->scale) > surface->current.scale) { | ||
435 | // When scaling up a surface, it'll become blurry so we need to | ||
436 | // expand the damage region | ||
437 | wlr_region_expand(&damage, &damage, | ||
438 | ceilf(output->wlr_output->scale) - surface->current.scale); | ||
439 | } | ||
440 | pixman_region32_translate(&damage, box.x, box.y); | ||
441 | if (wlr_damage_ring_add(&output->damage_ring, &damage)) { | ||
442 | wlr_output_schedule_frame(output->wlr_output); | ||
443 | } | ||
444 | pixman_region32_fini(&damage); | ||
445 | |||
446 | if (whole) { | ||
447 | if (wlr_damage_ring_add_box(&output->damage_ring, &box)) { | ||
448 | wlr_output_schedule_frame(output->wlr_output); | ||
449 | } | ||
450 | } | ||
451 | |||
452 | if (!wl_list_empty(&surface->current.frame_callback_list)) { | ||
453 | wlr_output_schedule_frame(output->wlr_output); | ||
454 | } | ||
455 | } | ||
456 | |||
457 | void output_damage_surface(struct sway_output *output, double ox, double oy, | ||
458 | struct wlr_surface *surface, bool whole) { | ||
459 | output_surface_for_each_surface(output, surface, ox, oy, | ||
460 | damage_surface_iterator, &whole); | ||
461 | } | ||
462 | |||
463 | void output_damage_from_view(struct sway_output *output, | ||
464 | struct sway_view *view) { | ||
465 | if (!view_is_visible(view)) { | ||
466 | return; | ||
467 | } | ||
468 | bool whole = false; | ||
469 | output_view_for_each_surface(output, view, damage_surface_iterator, &whole); | ||
470 | } | ||
471 | |||
472 | // Expecting an unscaled box in layout coordinates | ||
473 | void output_damage_box(struct sway_output *output, struct wlr_box *_box) { | ||
474 | struct wlr_box box; | ||
475 | memcpy(&box, _box, sizeof(struct wlr_box)); | ||
476 | box.x -= output->lx; | ||
477 | box.y -= output->ly; | ||
478 | scale_box(&box, output->wlr_output->scale); | ||
479 | if (wlr_damage_ring_add_box(&output->damage_ring, &box)) { | ||
480 | wlr_output_schedule_frame(output->wlr_output); | ||
481 | } | ||
482 | } | ||
483 | |||
484 | static void damage_child_views_iterator(struct sway_container *con, | ||
485 | void *data) { | ||
486 | if (!con->view || !view_is_visible(con->view)) { | ||
487 | return; | ||
488 | } | ||
489 | struct sway_output *output = data; | ||
490 | bool whole = true; | ||
491 | output_view_for_each_surface(output, con->view, damage_surface_iterator, | ||
492 | &whole); | ||
493 | } | ||
494 | |||
495 | void output_damage_whole_container(struct sway_output *output, | ||
496 | struct sway_container *con) { | ||
497 | // Pad the box by 1px, because the width is a double and might be a fraction | ||
498 | struct wlr_box box = { | ||
499 | .x = con->current.x - output->lx - 1, | ||
500 | .y = con->current.y - output->ly - 1, | ||
501 | .width = con->current.width + 2, | ||
502 | .height = con->current.height + 2, | ||
503 | }; | ||
504 | scale_box(&box, output->wlr_output->scale); | ||
505 | // Damage subsurfaces as well, which may extend outside the box | ||
506 | if (con->view) { | ||
507 | damage_child_views_iterator(con, output); | ||
508 | } else { | ||
509 | container_for_each_child(con, damage_child_views_iterator, output); | ||
510 | } | ||
511 | } | ||
512 | |||
513 | static void update_output_manager_config(struct sway_server *server) { | 288 | static void update_output_manager_config(struct sway_server *server) { |
514 | struct wlr_output_configuration_v1 *config = | 289 | struct wlr_output_configuration_v1 *config = |
515 | wlr_output_configuration_v1_create(); | 290 | wlr_output_configuration_v1_create(); |
@@ -553,8 +328,6 @@ static void begin_destroy(struct sway_output *output) { | |||
553 | wl_list_remove(&output->frame.link); | 328 | wl_list_remove(&output->frame.link); |
554 | wl_list_remove(&output->request_state.link); | 329 | wl_list_remove(&output->request_state.link); |
555 | 330 | ||
556 | wlr_damage_ring_finish(&output->damage_ring); | ||
557 | |||
558 | wlr_scene_output_destroy(output->scene_output); | 331 | wlr_scene_output_destroy(output->scene_output); |
559 | output->scene_output = NULL; | 332 | output->scene_output = NULL; |
560 | output->wlr_output->data = NULL; | 333 | output->wlr_output->data = NULL; |
@@ -594,15 +367,6 @@ static void handle_commit(struct wl_listener *listener, void *data) { | |||
594 | update_output_manager_config(output->server); | 367 | update_output_manager_config(output->server); |
595 | } | 368 | } |
596 | 369 | ||
597 | if (event->state->committed & ( | ||
598 | WLR_OUTPUT_STATE_MODE | | ||
599 | WLR_OUTPUT_STATE_TRANSFORM)) { | ||
600 | int width, height; | ||
601 | wlr_output_transformed_resolution(output->wlr_output, &width, &height); | ||
602 | wlr_damage_ring_set_bounds(&output->damage_ring, width, height); | ||
603 | wlr_output_schedule_frame(output->wlr_output); | ||
604 | } | ||
605 | |||
606 | // Next time the output is enabled, try to re-apply the gamma LUT | 370 | // Next time the output is enabled, try to re-apply the gamma LUT |
607 | if ((event->state->committed & WLR_OUTPUT_STATE_ENABLED) && !output->wlr_output->enabled) { | 371 | if ((event->state->committed & WLR_OUTPUT_STATE_ENABLED) && !output->wlr_output->enabled) { |
608 | output->gamma_lut_changed = true; | 372 | output->gamma_lut_changed = true; |
@@ -684,7 +448,6 @@ void handle_new_output(struct wl_listener *listener, void *data) { | |||
684 | 448 | ||
685 | output->server = server; | 449 | output->server = server; |
686 | output->scene_output = scene_output; | 450 | output->scene_output = scene_output; |
687 | wlr_damage_ring_init(&output->damage_ring); | ||
688 | 451 | ||
689 | wl_signal_add(&root->output_layout->events.destroy, &output->layout_destroy); | 452 | wl_signal_add(&root->output_layout->events.destroy, &output->layout_destroy); |
690 | output->layout_destroy.notify = handle_layout_destroy; | 453 | output->layout_destroy.notify = handle_layout_destroy; |
@@ -712,9 +475,6 @@ void handle_new_output(struct wl_listener *listener, void *data) { | |||
712 | 475 | ||
713 | transaction_commit_dirty(); | 476 | transaction_commit_dirty(); |
714 | 477 | ||
715 | int width, height; | ||
716 | wlr_output_transformed_resolution(output->wlr_output, &width, &height); | ||
717 | wlr_damage_ring_set_bounds(&output->damage_ring, width, height); | ||
718 | update_output_manager_config(server); | 478 | update_output_manager_config(server); |
719 | } | 479 | } |
720 | 480 | ||
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 1ae6642b..5f104aa3 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c | |||
@@ -5,7 +5,6 @@ | |||
5 | #include <time.h> | 5 | #include <time.h> |
6 | #include <wlr/types/wlr_buffer.h> | 6 | #include <wlr/types/wlr_buffer.h> |
7 | #include "sway/config.h" | 7 | #include "sway/config.h" |
8 | #include "sway/desktop.h" | ||
9 | #include "sway/desktop/idle_inhibit_v1.h" | 8 | #include "sway/desktop/idle_inhibit_v1.h" |
10 | #include "sway/desktop/transaction.h" | 9 | #include "sway/desktop/transaction.h" |
11 | #include "sway/input/cursor.h" | 10 | #include "sway/input/cursor.h" |
@@ -214,19 +213,15 @@ static void transaction_add_node(struct sway_transaction *transaction, | |||
214 | 213 | ||
215 | static void apply_output_state(struct sway_output *output, | 214 | static void apply_output_state(struct sway_output *output, |
216 | struct sway_output_state *state) { | 215 | struct sway_output_state *state) { |
217 | output_damage_whole(output); | ||
218 | list_free(output->current.workspaces); | 216 | list_free(output->current.workspaces); |
219 | memcpy(&output->current, state, sizeof(struct sway_output_state)); | 217 | memcpy(&output->current, state, sizeof(struct sway_output_state)); |
220 | output_damage_whole(output); | ||
221 | } | 218 | } |
222 | 219 | ||
223 | static void apply_workspace_state(struct sway_workspace *ws, | 220 | static void apply_workspace_state(struct sway_workspace *ws, |
224 | struct sway_workspace_state *state) { | 221 | struct sway_workspace_state *state) { |
225 | output_damage_whole(ws->current.output); | ||
226 | list_free(ws->current.floating); | 222 | list_free(ws->current.floating); |
227 | list_free(ws->current.tiling); | 223 | list_free(ws->current.tiling); |
228 | memcpy(&ws->current, state, sizeof(struct sway_workspace_state)); | 224 | memcpy(&ws->current, state, sizeof(struct sway_workspace_state)); |
229 | output_damage_whole(ws->current.output); | ||
230 | } | 225 | } |
231 | 226 | ||
232 | static void apply_container_state(struct sway_container *container, | 227 | static void apply_container_state(struct sway_container *container, |
@@ -256,19 +251,6 @@ static void apply_container_state(struct sway_container *container, | |||
256 | } | 251 | } |
257 | } | 252 | } |
258 | 253 | ||
259 | // Damage the new location | ||
260 | desktop_damage_whole_container(container); | ||
261 | if (view && view->surface) { | ||
262 | struct wlr_surface *surface = view->surface; | ||
263 | struct wlr_box box = { | ||
264 | .x = container->current.content_x - view->geometry.x, | ||
265 | .y = container->current.content_y - view->geometry.y, | ||
266 | .width = surface->current.width, | ||
267 | .height = surface->current.height, | ||
268 | }; | ||
269 | desktop_damage_box(&box); | ||
270 | } | ||
271 | |||
272 | if (!container->node.destroying) { | 254 | if (!container->node.destroying) { |
273 | container_discover_outputs(container); | 255 | container_discover_outputs(container); |
274 | } | 256 | } |
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index 95b5cb9d..48b7b4c7 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c | |||
@@ -214,24 +214,6 @@ static bool wants_floating(struct sway_view *view) { | |||
214 | || toplevel->parent; | 214 | || toplevel->parent; |
215 | } | 215 | } |
216 | 216 | ||
217 | static void for_each_surface(struct sway_view *view, | ||
218 | wlr_surface_iterator_func_t iterator, void *user_data) { | ||
219 | if (xdg_shell_view_from_view(view) == NULL) { | ||
220 | return; | ||
221 | } | ||
222 | wlr_xdg_surface_for_each_surface(view->wlr_xdg_toplevel->base, iterator, | ||
223 | user_data); | ||
224 | } | ||
225 | |||
226 | static void for_each_popup_surface(struct sway_view *view, | ||
227 | wlr_surface_iterator_func_t iterator, void *user_data) { | ||
228 | if (xdg_shell_view_from_view(view) == NULL) { | ||
229 | return; | ||
230 | } | ||
231 | wlr_xdg_surface_for_each_popup_surface(view->wlr_xdg_toplevel->base, | ||
232 | iterator, user_data); | ||
233 | } | ||
234 | |||
235 | static bool is_transient_for(struct sway_view *child, | 217 | static bool is_transient_for(struct sway_view *child, |
236 | struct sway_view *ancestor) { | 218 | struct sway_view *ancestor) { |
237 | if (xdg_shell_view_from_view(child) == NULL) { | 219 | if (xdg_shell_view_from_view(child) == NULL) { |
@@ -279,8 +261,6 @@ static const struct sway_view_impl view_impl = { | |||
279 | .set_fullscreen = set_fullscreen, | 261 | .set_fullscreen = set_fullscreen, |
280 | .set_resizing = set_resizing, | 262 | .set_resizing = set_resizing, |
281 | .wants_floating = wants_floating, | 263 | .wants_floating = wants_floating, |
282 | .for_each_surface = for_each_surface, | ||
283 | .for_each_popup_surface = for_each_popup_surface, | ||
284 | .is_transient_for = is_transient_for, | 264 | .is_transient_for = is_transient_for, |
285 | .close = _close, | 265 | .close = _close, |
286 | .close_popups = close_popups, | 266 | .close_popups = close_popups, |
diff --git a/sway/input/seatop_move_floating.c b/sway/input/seatop_move_floating.c index ddcd4c53..21d048ce 100644 --- a/sway/input/seatop_move_floating.c +++ b/sway/input/seatop_move_floating.c | |||
@@ -1,6 +1,5 @@ | |||
1 | #define _POSIX_C_SOURCE 200809L | 1 | #define _POSIX_C_SOURCE 200809L |
2 | #include <wlr/types/wlr_cursor.h> | 2 | #include <wlr/types/wlr_cursor.h> |
3 | #include "sway/desktop.h" | ||
4 | #include "sway/desktop/transaction.h" | 3 | #include "sway/desktop/transaction.h" |
5 | #include "sway/input/cursor.h" | 4 | #include "sway/input/cursor.h" |
6 | #include "sway/input/seat.h" | 5 | #include "sway/input/seat.h" |
@@ -39,9 +38,7 @@ static void handle_tablet_tool_tip(struct sway_seat *seat, | |||
39 | static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec) { | 38 | static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec) { |
40 | struct seatop_move_floating_event *e = seat->seatop_data; | 39 | struct seatop_move_floating_event *e = seat->seatop_data; |
41 | struct wlr_cursor *cursor = seat->cursor->cursor; | 40 | struct wlr_cursor *cursor = seat->cursor->cursor; |
42 | desktop_damage_whole_container(e->con); | ||
43 | container_floating_move_to(e->con, cursor->x - e->dx, cursor->y - e->dy); | 41 | container_floating_move_to(e->con, cursor->x - e->dx, cursor->y - e->dy); |
44 | desktop_damage_whole_container(e->con); | ||
45 | transaction_commit_dirty(); | 42 | transaction_commit_dirty(); |
46 | } | 43 | } |
47 | 44 | ||
diff --git a/sway/meson.build b/sway/meson.build index 110de58c..1079c749 100644 --- a/sway/meson.build +++ b/sway/meson.build | |||
@@ -15,7 +15,6 @@ sway_sources = files( | |||
15 | 'xdg_activation_v1.c', | 15 | 'xdg_activation_v1.c', |
16 | 'xdg_decoration.c', | 16 | 'xdg_decoration.c', |
17 | 17 | ||
18 | 'desktop/desktop.c', | ||
19 | 'desktop/idle_inhibit_v1.c', | 18 | 'desktop/idle_inhibit_v1.c', |
20 | 'desktop/layer_shell.c', | 19 | 'desktop/layer_shell.c', |
21 | 'desktop/output.c', | 20 | 'desktop/output.c', |
diff --git a/sway/tree/container.c b/sway/tree/container.c index 4aae4d32..cde9dff5 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -597,12 +597,6 @@ bool container_has_ancestor(struct sway_container *descendant, | |||
597 | return false; | 597 | return false; |
598 | } | 598 | } |
599 | 599 | ||
600 | void container_damage_whole(struct sway_container *container) { | ||
601 | for (int i = 0; i < root->outputs->length; ++i) { | ||
602 | struct sway_output *output = root->outputs->items[i]; | ||
603 | output_damage_whole_container(output, container); | ||
604 | } | ||
605 | } | ||
606 | 600 | ||
607 | /** | 601 | /** |
608 | * Return the output which will be used for scale purposes. | 602 | * Return the output which will be used for scale purposes. |
diff --git a/sway/tree/view.c b/sway/tree/view.c index 402fa179..2874e88b 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include "log.h" | 16 | #include "log.h" |
17 | #include "sway/criteria.h" | 17 | #include "sway/criteria.h" |
18 | #include "sway/commands.h" | 18 | #include "sway/commands.h" |
19 | #include "sway/desktop.h" | ||
20 | #include "sway/desktop/transaction.h" | 19 | #include "sway/desktop/transaction.h" |
21 | #include "sway/desktop/idle_inhibit_v1.h" | 20 | #include "sway/desktop/idle_inhibit_v1.h" |
22 | #include "sway/desktop/launcher.h" | 21 | #include "sway/desktop/launcher.h" |
@@ -456,34 +455,6 @@ void view_close_popups(struct sway_view *view) { | |||
456 | } | 455 | } |
457 | } | 456 | } |
458 | 457 | ||
459 | void view_damage_from(struct sway_view *view) { | ||
460 | for (int i = 0; i < root->outputs->length; ++i) { | ||
461 | struct sway_output *output = root->outputs->items[i]; | ||
462 | output_damage_from_view(output, view); | ||
463 | } | ||
464 | } | ||
465 | |||
466 | void view_for_each_surface(struct sway_view *view, | ||
467 | wlr_surface_iterator_func_t iterator, void *user_data) { | ||
468 | if (!view->surface) { | ||
469 | return; | ||
470 | } | ||
471 | if (view->impl->for_each_surface) { | ||
472 | view->impl->for_each_surface(view, iterator, user_data); | ||
473 | } else { | ||
474 | wlr_surface_for_each_surface(view->surface, iterator, user_data); | ||
475 | } | ||
476 | } | ||
477 | |||
478 | void view_for_each_popup_surface(struct sway_view *view, | ||
479 | wlr_surface_iterator_func_t iterator, void *user_data) { | ||
480 | if (!view->surface) { | ||
481 | return; | ||
482 | } | ||
483 | if (view->impl->for_each_popup_surface) { | ||
484 | view->impl->for_each_popup_surface(view, iterator, user_data); | ||
485 | } | ||
486 | } | ||
487 | static bool view_has_executed_criteria(struct sway_view *view, | 458 | static bool view_has_executed_criteria(struct sway_view *view, |
488 | struct criteria *criteria) { | 459 | struct criteria *criteria) { |
489 | for (int i = 0; i < view->executed_criteria->length; ++i) { | 460 | for (int i = 0; i < view->executed_criteria->length; ++i) { |
@@ -1143,7 +1114,6 @@ void view_set_urgent(struct sway_view *view, bool enable) { | |||
1143 | view->urgent_timer = NULL; | 1114 | view->urgent_timer = NULL; |
1144 | } | 1115 | } |
1145 | } | 1116 | } |
1146 | container_damage_whole(view->container); | ||
1147 | 1117 | ||
1148 | ipc_event_window(view->container, "urgent"); | 1118 | ipc_event_window(view->container, "urgent"); |
1149 | 1119 | ||
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index f60b2366..40d33435 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -686,7 +686,6 @@ void workspace_detect_urgent(struct sway_workspace *workspace) { | |||
686 | if (workspace->urgent != new_urgent) { | 686 | if (workspace->urgent != new_urgent) { |
687 | workspace->urgent = new_urgent; | 687 | workspace->urgent = new_urgent; |
688 | ipc_event_workspace(NULL, workspace, "urgent"); | 688 | ipc_event_workspace(NULL, workspace, "urgent"); |
689 | output_damage_whole(workspace->output); | ||
690 | } | 689 | } |
691 | } | 690 | } |
692 | 691 | ||