mirror of
https://github.com/labwc/labwc.git
synced 2025-11-05 13:29:58 -05:00
Handle wlr_surface->events.new_subsurface
Add view-child.c, xdg-popup.c, subsurface.c in order to track damage associated with new XDG subsurfaces.
This commit is contained in:
parent
15a7910a02
commit
d54a998dd8
7 changed files with 196 additions and 78 deletions
46
src/view-child.c
Normal file
46
src/view-child.c
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (C) 2020 the sway authors
|
||||
* This file is only needed in support of tracking damage
|
||||
*/
|
||||
|
||||
#include "labwc.h"
|
||||
|
||||
static void
|
||||
view_child_handle_commit(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct view_child *child = wl_container_of(listener, child, commit);
|
||||
damage_view_part(child->parent);
|
||||
}
|
||||
|
||||
static void
|
||||
view_child_handle_new_subsurface(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct view_child *child;
|
||||
child = wl_container_of(listener, child, new_subsurface);
|
||||
struct wlr_subsurface *wlr_subsurface = data;
|
||||
subsurface_create(child->parent, wlr_subsurface);
|
||||
}
|
||||
|
||||
void
|
||||
view_child_finish(struct view_child *child)
|
||||
{
|
||||
if (!child) {
|
||||
return;
|
||||
}
|
||||
damage_view_whole(child->parent);
|
||||
wl_list_remove(&child->commit.link);
|
||||
wl_list_remove(&child->new_subsurface.link);
|
||||
}
|
||||
|
||||
void
|
||||
view_child_init(struct view_child *child, struct view *view,
|
||||
struct wlr_surface *wlr_surface)
|
||||
{
|
||||
child->parent = view;
|
||||
child->surface = wlr_surface;
|
||||
|
||||
child->commit.notify = view_child_handle_commit;
|
||||
wl_signal_add(&wlr_surface->events.commit, &child->commit);
|
||||
child->new_subsurface.notify = view_child_handle_new_subsurface;
|
||||
wl_signal_add(&wlr_surface->events.new_subsurface, &child->new_subsurface);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue