aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/output.c
diff options
context:
space:
mode:
authorLibravatar Alexander Orzechowski <alex@ozal.ski>2024-01-18 10:04:51 -0500
committerLibravatar Kirill Primak <vyivel@eclair.cafe>2024-01-18 18:36:54 +0300
commit188811f80861caacd016b857b0d07f6d2d62d15a (patch)
treedc68ea00b707b25ce398c71fe1ad996f0eb820ea /sway/desktop/output.c
parentinput: Query scene graph for relevant surface/node intersections (diff)
downloadsway-188811f80861caacd016b857b0d07f6d2d62d15a.tar.gz
sway-188811f80861caacd016b857b0d07f6d2d62d15a.tar.zst
sway-188811f80861caacd016b857b0d07f6d2d62d15a.zip
scene_graph: Port layer_shell
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r--sway/desktop/output.c85
1 files changed, 0 insertions, 85 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 1e4474ce..942bc780 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -182,66 +182,6 @@ void output_view_for_each_popup_surface(struct sway_output *output,
182 view_for_each_popup_surface(view, output_for_each_surface_iterator, &data); 182 view_for_each_popup_surface(view, output_for_each_surface_iterator, &data);
183} 183}
184 184
185void output_layer_for_each_surface(struct sway_output *output,
186 struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator,
187 void *user_data) {
188 struct sway_layer_surface *layer_surface;
189 wl_list_for_each(layer_surface, layer_surfaces, link) {
190 struct wlr_layer_surface_v1 *wlr_layer_surface_v1 =
191 layer_surface->layer_surface;
192 struct wlr_surface *surface = wlr_layer_surface_v1->surface;
193 struct surface_iterator_data data = {
194 .user_iterator = iterator,
195 .user_data = user_data,
196 .output = output,
197 .view = NULL,
198 .ox = layer_surface->geo.x,
199 .oy = layer_surface->geo.y,
200 .width = surface->current.width,
201 .height = surface->current.height,
202 };
203 wlr_layer_surface_v1_for_each_surface(wlr_layer_surface_v1,
204 output_for_each_surface_iterator, &data);
205 }
206}
207
208void output_layer_for_each_toplevel_surface(struct sway_output *output,
209 struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator,
210 void *user_data) {
211 struct sway_layer_surface *layer_surface;
212 wl_list_for_each(layer_surface, layer_surfaces, link) {
213 struct wlr_layer_surface_v1 *wlr_layer_surface_v1 =
214 layer_surface->layer_surface;
215 output_surface_for_each_surface(output, wlr_layer_surface_v1->surface,
216 layer_surface->geo.x, layer_surface->geo.y, iterator,
217 user_data);
218 }
219}
220
221
222void output_layer_for_each_popup_surface(struct sway_output *output,
223 struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator,
224 void *user_data) {
225 struct sway_layer_surface *layer_surface;
226 wl_list_for_each(layer_surface, layer_surfaces, link) {
227 struct wlr_layer_surface_v1 *wlr_layer_surface_v1 =
228 layer_surface->layer_surface;
229 struct wlr_surface *surface = wlr_layer_surface_v1->surface;
230 struct surface_iterator_data data = {
231 .user_iterator = iterator,
232 .user_data = user_data,
233 .output = output,
234 .view = NULL,
235 .ox = layer_surface->geo.x,
236 .oy = layer_surface->geo.y,
237 .width = surface->current.width,
238 .height = surface->current.height,
239 };
240 wlr_layer_surface_v1_for_each_popup_surface(wlr_layer_surface_v1,
241 output_for_each_surface_iterator, &data);
242 }
243}
244
245#if HAVE_XWAYLAND 185#if HAVE_XWAYLAND
246void output_unmanaged_for_each_surface(struct sway_output *output, 186void output_unmanaged_for_each_surface(struct sway_output *output,
247 struct wl_list *unmanaged, sway_surface_iterator_func_t iterator, 187 struct wl_list *unmanaged, sway_surface_iterator_func_t iterator,
@@ -282,31 +222,6 @@ struct sway_workspace *output_get_active_workspace(struct sway_output *output) {
282 return focus->sway_workspace; 222 return focus->sway_workspace;
283} 223}
284 224
285bool output_has_opaque_overlay_layer_surface(struct sway_output *output) {
286 struct sway_layer_surface *sway_layer_surface;
287 wl_list_for_each(sway_layer_surface,
288 &output->shell_layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], link) {
289 struct wlr_surface *wlr_surface = sway_layer_surface->layer_surface->surface;
290 pixman_box32_t output_box = {
291 .x2 = output->width,
292 .y2 = output->height,
293 };
294 pixman_region32_t surface_opaque_box;
295 pixman_region32_init(&surface_opaque_box);
296 pixman_region32_copy(&surface_opaque_box, &wlr_surface->opaque_region);
297 pixman_region32_translate(&surface_opaque_box,
298 sway_layer_surface->geo.x, sway_layer_surface->geo.y);
299 pixman_region_overlap_t contains =
300 pixman_region32_contains_rectangle(&surface_opaque_box, &output_box);
301 pixman_region32_fini(&surface_opaque_box);
302
303 if (contains == PIXMAN_REGION_IN) {
304 return true;
305 }
306 }
307 return false;
308}
309
310struct send_frame_done_data { 225struct send_frame_done_data {
311 struct timespec when; 226 struct timespec when;
312 int msec_until_refresh; 227 int msec_until_refresh;