render: track subsurfaces created before role assignment

This commit is contained in:
Isaac Freund 2021-06-05 19:30:43 +00:00
parent aaf5a190fc
commit 0e9dc089d1
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11
4 changed files with 25 additions and 5 deletions

View File

@ -69,6 +69,11 @@ pub fn init(self: *Self, output: *Output, wlr_layer_surface: *wlr.LayerSurfaceV1
wlr_layer_surface.events.unmap.add(&self.unmap);
wlr_layer_surface.events.new_popup.add(&self.new_popup);
wlr_layer_surface.surface.events.new_subsurface.add(&self.new_subsurface);
// There may already be subsurfaces present on this surface that we
// aren't aware of and won't receive a new_subsurface event for.
var it = wlr_layer_surface.surface.subsurfaces.iterator(.forward);
while (it.next()) |s| Subsurface.create(s, .{ .layer_surface = self });
}
fn handleDestroy(listener: *wl.Listener(*wlr.LayerSurfaceV1), wlr_layer_surface: *wlr.LayerSurfaceV1) void {

View File

@ -63,6 +63,11 @@ pub fn create(wlr_subsurface: *wlr.Subsurface, parent: Parent) void {
wlr_subsurface.events.map.add(&subsurface.map);
wlr_subsurface.events.unmap.add(&subsurface.unmap);
wlr_subsurface.surface.events.new_subsurface.add(&subsurface.new_subsurface);
// There may already be subsurfaces present on this surface that we
// aren't aware of and won't receive a new_subsurface event for.
var it = wlr_subsurface.surface.subsurfaces.iterator(.forward);
while (it.next()) |s| Subsurface.create(s, parent);
}
fn handleDestroy(listener: *wl.Listener(*wlr.Subsurface), wlr_subsurface: *wlr.Subsurface) void {

View File

@ -74,6 +74,11 @@ pub fn create(wlr_xdg_popup: *wlr.XdgPopup, parent: Parent) void {
wlr_xdg_popup.base.events.unmap.add(&self.unmap);
wlr_xdg_popup.base.events.new_popup.add(&self.new_popup);
wlr_xdg_popup.base.surface.events.new_subsurface.add(&self.new_subsurface);
// There may already be subsurfaces present on this surface that we
// aren't aware of and won't receive a new_subsurface event for.
var it = wlr_xdg_popup.base.surface.subsurfaces.iterator(.forward);
while (it.next()) |s| Subsurface.create(s, parent);
}
fn handleDestroy(listener: *wl.Listener(*wlr.XdgSurface), wlr_xdg_surface: *wlr.XdgSurface) void {

View File

@ -64,11 +64,16 @@ pub fn init(self: *Self, view: *View, xdg_surface: *wlr.XdgSurface) void {
xdg_surface.data = @ptrToInt(self);
// Add listeners that are active over the view's entire lifetime
self.xdg_surface.events.destroy.add(&self.destroy);
self.xdg_surface.events.map.add(&self.map);
self.xdg_surface.events.unmap.add(&self.unmap);
self.xdg_surface.events.new_popup.add(&self.new_popup);
self.xdg_surface.surface.events.new_subsurface.add(&self.new_subsurface);
xdg_surface.events.destroy.add(&self.destroy);
xdg_surface.events.map.add(&self.map);
xdg_surface.events.unmap.add(&self.unmap);
xdg_surface.events.new_popup.add(&self.new_popup);
xdg_surface.surface.events.new_subsurface.add(&self.new_subsurface);
// There may already be subsurfaces present on this surface that we
// aren't aware of and won't receive a new_subsurface event for.
var it = xdg_surface.surface.subsurfaces.iterator(.forward);
while (it.next()) |s| Subsurface.create(s, .{ .view = view });
}
pub fn deinit(self: *Self) void {