aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Vyivel <vyivel@posteo.net>2021-02-06 13:01:18 +0300
committerLibravatar Simon Ser <contact@emersion.fr>2021-03-11 10:55:25 +0100
commitba6c0eb18bd87938c7fba72236129c9ba949b007 (patch)
tree64458aa71be95e43d78edfb801148f0fd31ca512
parentcontainer: Add view_container_content_at (diff)
downloadsway-ba6c0eb18bd87938c7fba72236129c9ba949b007.tar.gz
sway-ba6c0eb18bd87938c7fba72236129c9ba949b007.tar.zst
sway-ba6c0eb18bd87938c7fba72236129c9ba949b007.zip
output: simplify layer surface iteration
-rw-r--r--sway/desktop/output.c93
1 files changed, 28 insertions, 65 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 7871a136..cf4a9607 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -206,40 +206,20 @@ void output_layer_for_each_surface(struct sway_output *output,
206 wl_list_for_each(layer_surface, layer_surfaces, link) { 206 wl_list_for_each(layer_surface, layer_surfaces, link) {
207 struct wlr_layer_surface_v1 *wlr_layer_surface_v1 = 207 struct wlr_layer_surface_v1 *wlr_layer_surface_v1 =
208 layer_surface->layer_surface; 208 layer_surface->layer_surface;
209 output_surface_for_each_surface(output, wlr_layer_surface_v1->surface, 209 struct wlr_surface *surface = wlr_layer_surface_v1->surface;
210 layer_surface->geo.x, layer_surface->geo.y, iterator, 210 struct surface_iterator_data data = {
211 user_data); 211 .user_iterator = iterator,
212 212 .user_data = user_data,
213 struct wlr_xdg_popup *state; 213 .output = output,
214 wl_list_for_each(state, &wlr_layer_surface_v1->popups, link) { 214 .view = NULL,
215 struct wlr_xdg_surface *popup = state->base; 215 .ox = layer_surface->geo.x,
216 if (!popup->configured) { 216 .oy = layer_surface->geo.y,
217 continue; 217 .width = surface->current.width,
218 } 218 .height = surface->current.height,
219 219 .rotation = 0,
220 double popup_sx, popup_sy; 220 };
221 popup_sx = layer_surface->geo.x + 221 wlr_layer_surface_v1_for_each_surface(wlr_layer_surface_v1,
222 popup->popup->geometry.x - popup->geometry.x; 222 output_for_each_surface_iterator, &data);
223 popup_sy = layer_surface->geo.y +
224 popup->popup->geometry.y - popup->geometry.y;
225
226 struct wlr_surface *surface = popup->surface;
227
228 struct surface_iterator_data data = {
229 .user_iterator = iterator,
230 .user_data = user_data,
231 .output = output,
232 .view = NULL,
233 .ox = popup_sx,
234 .oy = popup_sy,
235 .width = surface->current.width,
236 .height = surface->current.height,
237 .rotation = 0,
238 };
239
240 wlr_xdg_surface_for_each_surface(
241 popup, output_for_each_surface_iterator, &data);
242 }
243 } 223 }
244} 224}
245 225
@@ -264,37 +244,20 @@ void output_layer_for_each_popup_surface(struct sway_output *output,
264 wl_list_for_each(layer_surface, layer_surfaces, link) { 244 wl_list_for_each(layer_surface, layer_surfaces, link) {
265 struct wlr_layer_surface_v1 *wlr_layer_surface_v1 = 245 struct wlr_layer_surface_v1 *wlr_layer_surface_v1 =
266 layer_surface->layer_surface; 246 layer_surface->layer_surface;
267 247 struct wlr_surface *surface = wlr_layer_surface_v1->surface;
268 struct wlr_xdg_popup *state; 248 struct surface_iterator_data data = {
269 wl_list_for_each(state, &wlr_layer_surface_v1->popups, link) { 249 .user_iterator = iterator,
270 struct wlr_xdg_surface *popup = state->base; 250 .user_data = user_data,
271 if (!popup->configured) { 251 .output = output,
272 continue; 252 .view = NULL,
273 } 253 .ox = layer_surface->geo.x,
274 254 .oy = layer_surface->geo.y,
275 double popup_sx, popup_sy; 255 .width = surface->current.width,
276 popup_sx = layer_surface->geo.x + 256 .height = surface->current.height,
277 popup->popup->geometry.x - popup->geometry.x; 257 .rotation = 0,
278 popup_sy = layer_surface->geo.y + 258 };
279 popup->popup->geometry.y - popup->geometry.y; 259 wlr_layer_surface_v1_for_each_popup_surface(wlr_layer_surface_v1,
280 260 output_for_each_surface_iterator, &data);
281 struct wlr_surface *surface = popup->surface;
282
283 struct surface_iterator_data data = {
284 .user_iterator = iterator,
285 .user_data = user_data,
286 .output = output,
287 .view = NULL,
288 .ox = popup_sx,
289 .oy = popup_sy,
290 .width = surface->current.width,
291 .height = surface->current.height,
292 .rotation = 0,
293 };
294
295 wlr_xdg_surface_for_each_surface(
296 popup, output_for_each_surface_iterator, &data);
297 }
298 } 261 }
299} 262}
300 263