diff options
author | Simon Ser <contact@emersion.fr> | 2021-01-08 10:46:12 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-01-12 11:25:34 +0100 |
commit | 5438cc158a1b9fa3bf76445a6dc986e30c5e78f6 (patch) | |
tree | 7feb4dce6441803e7ddd50b7747ebb6a46a2a485 /sway | |
parent | Fix #5940 (diff) | |
download | sway-5438cc158a1b9fa3bf76445a6dc986e30c5e78f6.tar.gz sway-5438cc158a1b9fa3bf76445a6dc986e30c5e78f6.tar.zst sway-5438cc158a1b9fa3bf76445a6dc986e30c5e78f6.zip |
Switch to wlr_xdg_surface_for_each_popup_surface
Instead of calling wlr_xdg_surface_for_each_popup and then
wlr_surface_for_each_surface, use the new for_each_popup_surface helper
introduced in [1] that does it in one go.
[1]: https://github.com/swaywm/wlroots/pull/2609
Diffstat (limited to 'sway')
-rw-r--r-- | sway/desktop/output.c | 4 | ||||
-rw-r--r-- | sway/desktop/render.c | 14 | ||||
-rw-r--r-- | sway/desktop/xdg_shell.c | 7 | ||||
-rw-r--r-- | sway/tree/view.c | 6 |
4 files changed, 11 insertions, 20 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 06acb868..7921d597 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -179,7 +179,7 @@ void output_view_for_each_surface(struct sway_output *output, | |||
179 | view_for_each_surface(view, output_for_each_surface_iterator, &data); | 179 | view_for_each_surface(view, output_for_each_surface_iterator, &data); |
180 | } | 180 | } |
181 | 181 | ||
182 | void output_view_for_each_popup(struct sway_output *output, | 182 | void output_view_for_each_popup_surface(struct sway_output *output, |
183 | struct sway_view *view, sway_surface_iterator_func_t iterator, | 183 | struct sway_view *view, sway_surface_iterator_func_t iterator, |
184 | void *user_data) { | 184 | void *user_data) { |
185 | struct surface_iterator_data data = { | 185 | struct surface_iterator_data data = { |
@@ -196,7 +196,7 @@ void output_view_for_each_popup(struct sway_output *output, | |||
196 | .rotation = 0, // TODO | 196 | .rotation = 0, // TODO |
197 | }; | 197 | }; |
198 | 198 | ||
199 | view_for_each_popup(view, output_for_each_surface_iterator, &data); | 199 | view_for_each_popup_surface(view, output_for_each_surface_iterator, &data); |
200 | } | 200 | } |
201 | 201 | ||
202 | void output_layer_for_each_surface(struct sway_output *output, | 202 | void output_layer_for_each_surface(struct sway_output *output, |
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 3a422293..acf503a4 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c | |||
@@ -265,24 +265,14 @@ static void render_view_toplevels(struct sway_view *view, | |||
265 | render_surface_iterator, &data); | 265 | render_surface_iterator, &data); |
266 | } | 266 | } |
267 | 267 | ||
268 | static void render_popup_iterator(struct sway_output *output, struct sway_view *view, | ||
269 | struct wlr_surface *surface, struct wlr_box *box, float rotation, | ||
270 | void *data) { | ||
271 | // Render this popup's surface | ||
272 | render_surface_iterator(output, view, surface, box, rotation, data); | ||
273 | |||
274 | // Render this popup's child toplevels | ||
275 | output_surface_for_each_surface(output, surface, box->x, box->y, | ||
276 | render_surface_iterator, data); | ||
277 | } | ||
278 | |||
279 | static void render_view_popups(struct sway_view *view, | 268 | static void render_view_popups(struct sway_view *view, |
280 | struct sway_output *output, pixman_region32_t *damage, float alpha) { | 269 | struct sway_output *output, pixman_region32_t *damage, float alpha) { |
281 | struct render_data data = { | 270 | struct render_data data = { |
282 | .damage = damage, | 271 | .damage = damage, |
283 | .alpha = alpha, | 272 | .alpha = alpha, |
284 | }; | 273 | }; |
285 | output_view_for_each_popup(output, view, render_popup_iterator, &data); | 274 | output_view_for_each_popup_surface(output, view, |
275 | render_surface_iterator, &data); | ||
286 | } | 276 | } |
287 | 277 | ||
288 | static void render_saved_view(struct sway_view *view, | 278 | static void render_saved_view(struct sway_view *view, |
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index fdac6171..667fb9e5 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c | |||
@@ -211,12 +211,13 @@ static void for_each_surface(struct sway_view *view, | |||
211 | user_data); | 211 | user_data); |
212 | } | 212 | } |
213 | 213 | ||
214 | static void for_each_popup(struct sway_view *view, | 214 | static void for_each_popup_surface(struct sway_view *view, |
215 | wlr_surface_iterator_func_t iterator, void *user_data) { | 215 | wlr_surface_iterator_func_t iterator, void *user_data) { |
216 | if (xdg_shell_view_from_view(view) == NULL) { | 216 | if (xdg_shell_view_from_view(view) == NULL) { |
217 | return; | 217 | return; |
218 | } | 218 | } |
219 | wlr_xdg_surface_for_each_popup(view->wlr_xdg_surface, iterator, user_data); | 219 | wlr_xdg_surface_for_each_popup_surface(view->wlr_xdg_surface, iterator, |
220 | user_data); | ||
220 | } | 221 | } |
221 | 222 | ||
222 | static bool is_transient_for(struct sway_view *child, | 223 | static bool is_transient_for(struct sway_view *child, |
@@ -271,7 +272,7 @@ static const struct sway_view_impl view_impl = { | |||
271 | .set_resizing = set_resizing, | 272 | .set_resizing = set_resizing, |
272 | .wants_floating = wants_floating, | 273 | .wants_floating = wants_floating, |
273 | .for_each_surface = for_each_surface, | 274 | .for_each_surface = for_each_surface, |
274 | .for_each_popup = for_each_popup, | 275 | .for_each_popup_surface = for_each_popup_surface, |
275 | .is_transient_for = is_transient_for, | 276 | .is_transient_for = is_transient_for, |
276 | .close = _close, | 277 | .close = _close, |
277 | .close_popups = close_popups, | 278 | .close_popups = close_popups, |
diff --git a/sway/tree/view.c b/sway/tree/view.c index e690c334..07ca3dff 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -449,13 +449,13 @@ void view_for_each_surface(struct sway_view *view, | |||
449 | } | 449 | } |
450 | } | 450 | } |
451 | 451 | ||
452 | void view_for_each_popup(struct sway_view *view, | 452 | void view_for_each_popup_surface(struct sway_view *view, |
453 | wlr_surface_iterator_func_t iterator, void *user_data) { | 453 | wlr_surface_iterator_func_t iterator, void *user_data) { |
454 | if (!view->surface) { | 454 | if (!view->surface) { |
455 | return; | 455 | return; |
456 | } | 456 | } |
457 | if (view->impl->for_each_popup) { | 457 | if (view->impl->for_each_popup_surface) { |
458 | view->impl->for_each_popup(view, iterator, user_data); | 458 | view->impl->for_each_popup_surface(view, iterator, user_data); |
459 | } | 459 | } |
460 | } | 460 | } |
461 | 461 | ||