Implement damage tracking

Fixes #5.
This commit is contained in:
Jente Hidskes 2019-01-20 13:42:36 +01:00
parent f0eb115bda
commit e981cb8a1c
10 changed files with 271 additions and 28 deletions

View file

@ -107,12 +107,22 @@ wlr_surface_at(struct cg_view *view, double sx, double sy, double *sub_x, double
return wlr_surface_surface_at(view->wlr_surface, sx, sy, sub_x, sub_y);
}
static void
handle_xwayland_surface_commit(struct wl_listener *listener, void *data)
{
struct cg_xwayland_view *xwayland_view = wl_container_of(listener, xwayland_view, commit);
struct cg_view *view = &xwayland_view->view;
view_damage_surface(view);
}
static void
handle_xwayland_surface_unmap(struct wl_listener *listener, void *data)
{
struct cg_xwayland_view *xwayland_view = wl_container_of(listener, xwayland_view, unmap);
struct cg_view *view = &xwayland_view->view;
wl_list_remove(&xwayland_view->commit.link);
view_unmap(view);
}
@ -127,6 +137,9 @@ handle_xwayland_surface_map(struct wl_listener *listener, void *data)
view->y = xwayland_view->xwayland_surface->y;
}
xwayland_view->commit.notify = handle_xwayland_surface_commit;
wl_signal_add(&xwayland_view->xwayland_surface->surface->events.commit, &xwayland_view->commit);
xwayland_view->ever_been_mapped = true;
view_map(view, xwayland_view->xwayland_surface->surface);
}