diff options
author | emersion <contact@emersion.fr> | 2018-10-02 11:26:40 +0200 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-10-04 22:00:23 +0200 |
commit | ba63d77ec19b84c9bf9be24cc4d91f3bfa856dba (patch) | |
tree | 1578bf334f7327d1c38e2dc3719e133cb8a195c1 /rootston/output.c | |
parent | 0aafd6e234ff921e2b41126e22c426f928877cc4 (diff) |
rootston: add output_for_each_surface
Diffstat (limited to 'rootston/output.c')
-rw-r--r-- | rootston/output.c | 78 |
1 files changed, 45 insertions, 33 deletions
diff --git a/rootston/output.c b/rootston/output.c index e8a1b60f..1707be3a 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -129,7 +129,7 @@ static void drag_icons_for_each_surface(struct roots_input *input, static void layer_for_each_surface(struct wl_list *layer, const struct wlr_box *output_layout_box, - wlr_surface_iterator_func_t iterator, struct layout_data *layout_data, + wlr_surface_iterator_func_t iterator, struct layout_data *layout_data, void *user_data) { struct roots_layer_surface *roots_surface; wl_list_for_each(roots_surface, layer, link) { @@ -144,6 +144,48 @@ static void layer_for_each_surface(struct wl_list *layer, } } +static void output_for_each_surface(struct roots_output *output, + wlr_surface_iterator_func_t iterator, struct layout_data *layout_data, + void *user_data) { + struct wlr_output *wlr_output = output->wlr_output; + struct roots_desktop *desktop = output->desktop; + struct roots_server *server = desktop->server; + + const struct wlr_box *output_box = + wlr_output_layout_get_box(desktop->layout, wlr_output); + + if (output->fullscreen_view != NULL) { + struct roots_view *view = output->fullscreen_view; + if (wlr_output->fullscreen_surface == view->wlr_surface) { + // The surface is managed by the wlr_output + return; + } + + view_for_each_surface(view, layout_data, iterator, user_data); + +#ifdef WLR_HAS_XWAYLAND + if (view->type == ROOTS_XWAYLAND_VIEW) { + xwayland_children_for_each_surface(view->xwayland_surface, + iterator, layout_data, user_data); + } +#endif + } else { + struct roots_view *view; + wl_list_for_each_reverse(view, &desktop->views, link) { + view_for_each_surface(view, layout_data, iterator, user_data); + } + + drag_icons_for_each_surface(server->input, iterator, + layout_data, user_data); + } + + size_t len = sizeof(output->layers) / sizeof(output->layers[0]); + for (size_t i = 0; i < len; ++i) { + layer_for_each_surface(&output->layers[i], output_box, + iterator, layout_data, user_data); + } +} + struct render_data { struct layout_data layout; @@ -530,38 +572,8 @@ damage_finish: pixman_region32_fini(&damage); // Send frame done events to all surfaces - if (output->fullscreen_view != NULL) { - struct roots_view *view = output->fullscreen_view; - if (wlr_output->fullscreen_surface == view->wlr_surface) { - // The surface is managed by the wlr_output - return; - } - - view_for_each_surface(view, &data.layout, surface_send_frame_done, - &data); - -#ifdef WLR_HAS_XWAYLAND - if (view->type == ROOTS_XWAYLAND_VIEW) { - xwayland_children_for_each_surface(view->xwayland_surface, - surface_send_frame_done, &data.layout, &data); - } -#endif - } else { - struct roots_view *view; - wl_list_for_each_reverse(view, &desktop->views, link) { - view_for_each_surface(view, &data.layout, surface_send_frame_done, - &data); - } - - drag_icons_for_each_surface(server->input, surface_send_frame_done, - &data.layout, &data); - } - - size_t len = sizeof(output->layers) / sizeof(output->layers[0]); - for (size_t i = 0; i < len; ++i) { - layer_for_each_surface(&output->layers[i], output_box, - surface_send_frame_done, &data.layout, &data); - } + output_for_each_surface(output, surface_send_frame_done, + &data.layout, &data); } void output_damage_whole(struct roots_output *output) { |