mirror of
https://github.com/cage-kiosk/cage.git
synced 2026-02-17 22:06:00 -05:00
Output: abstract away a view switch statement
We have our view abstraction, so why not use it?
This commit is contained in:
parent
431320443a
commit
9a99ba604f
5 changed files with 29 additions and 21 deletions
20
output.c
20
output.c
|
|
@ -73,24 +73,6 @@ render_surface(struct wlr_surface *surface, int sx, int sy, void *data)
|
|||
wlr_surface_send_frame_done(surface, rdata->when);
|
||||
}
|
||||
|
||||
static void
|
||||
view_for_each_surface(struct cg_view *view, struct render_data *rdata,
|
||||
wlr_surface_iterator_func_t iterator)
|
||||
{
|
||||
switch(view->type) {
|
||||
case CAGE_XDG_SHELL_VIEW:
|
||||
wlr_xdg_surface_for_each_surface(view->xdg_surface, iterator, rdata);
|
||||
break;
|
||||
#ifdef CAGE_HAS_XWAYLAND
|
||||
case CAGE_XWAYLAND_VIEW:
|
||||
wlr_surface_for_each_surface(view->wlr_surface, iterator, rdata);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
wlr_log(WLR_ERROR, "Unrecognized view type: %d", view->type);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
handle_output_frame(struct wl_listener *listener, void *data)
|
||||
{
|
||||
|
|
@ -122,7 +104,7 @@ handle_output_frame(struct wl_listener *listener, void *data)
|
|||
struct cg_view *view;
|
||||
wl_list_for_each_reverse(view, &output->server->views, link) {
|
||||
rdata.view = view;
|
||||
view_for_each_surface(view, &rdata, render_surface);
|
||||
view_for_each_surface(view, render_surface, &rdata);
|
||||
}
|
||||
|
||||
wlr_renderer_end(renderer);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue