Use the wlroots scene-graph API

References: https://github.com/swaywm/wlroots/pull/1966
This commit is contained in:
Simon Ser 2021-08-09 20:06:57 +02:00 committed by Jente Hidskes
parent 395189fb05
commit f544483340
11 changed files with 61 additions and 149 deletions

14
view.c
View file

@ -13,6 +13,7 @@
#include <string.h>
#include <wayland-server-core.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_scene.h>
#include <wlr/types/wlr_surface.h>
#include "output.h"
@ -173,6 +174,9 @@ view_maximize(struct cg_view *view, struct wlr_box *layout_box)
{
view->lx = layout_box->x;
view->ly = layout_box->y;
wlr_scene_node_set_position(&view->scene_surface->node, view->lx, view->ly);
view->impl->maximize(view, layout_box->width, layout_box->height);
}
@ -184,6 +188,8 @@ view_center(struct cg_view *view, struct wlr_box *layout_box)
view->lx = (layout_box->width - width) / 2;
view->ly = (layout_box->height - height) / 2;
wlr_scene_node_set_position(&view->scene_surface->node, view->lx, view->ly);
}
void
@ -225,6 +231,8 @@ view_unmap(struct cg_view *view)
child->destroy(child);
}
wlr_scene_node_destroy(&view->scene_surface->node);
view->wlr_surface = NULL;
}
@ -233,6 +241,12 @@ view_map(struct cg_view *view, struct wlr_surface *surface)
{
view->wlr_surface = surface;
view->scene_surface = wlr_scene_surface_create(&view->server->scene->node, surface);
if (!view->scene_surface) {
wl_resource_post_no_memory(surface->resource);
return;
}
struct wlr_subsurface *subsurface;
wl_list_for_each (subsurface, &view->wlr_surface->current.subsurfaces_below, current.link) {
subsurface_create(view, subsurface);