2021-09-24 21:45:48 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2021-03-02 20:37:23 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2020 the sway authors
|
|
|
|
|
* This file is only needed in support of tracking damage
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "labwc.h"
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
subsurface_handle_destroy(struct wl_listener *listener, void *data)
|
|
|
|
|
{
|
|
|
|
|
struct view_subsurface *subsurface = wl_container_of(listener,
|
|
|
|
|
subsurface, destroy);
|
|
|
|
|
struct view_child *view_child = (struct view_child *)subsurface;
|
|
|
|
|
if (!view_child) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
wl_list_remove(&subsurface->destroy.link);
|
|
|
|
|
view_child_finish(&subsurface->view_child);
|
|
|
|
|
free(subsurface);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2021-11-08 20:17:08 +02:00
|
|
|
view_subsurface_create(struct view *view, struct wlr_subsurface *wlr_subsurface)
|
2021-03-02 20:37:23 +00:00
|
|
|
{
|
2021-09-21 22:05:56 +01:00
|
|
|
struct view_subsurface *subsurface =
|
|
|
|
|
calloc(1, sizeof(struct view_subsurface));
|
2021-03-02 20:37:23 +00:00
|
|
|
if (!subsurface) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
view_child_init(&subsurface->view_child, view, wlr_subsurface->surface);
|
|
|
|
|
subsurface->subsurface = wlr_subsurface;
|
|
|
|
|
|
|
|
|
|
subsurface->destroy.notify = subsurface_handle_destroy;
|
|
|
|
|
wl_signal_add(&wlr_subsurface->events.destroy, &subsurface->destroy);
|
|
|
|
|
}
|