SceneNodeData: allow access from wlr_surfaces

This replaces the old View.fromWlrSurface function and is more general.

This commit also moves the xdg activation request_activate listener to
Server as it has no reason to be in View.
This commit is contained in:
Isaac Freund
2023-03-04 22:41:35 +01:00
parent ea4e589fdc
commit 44004e2d28
11 changed files with 80 additions and 53 deletions

View File

@ -159,8 +159,10 @@ pub fn handleMap(listener: *wl.Listener(*wlr.XwaylandSurface), xwayland_surface:
const self = @fieldParentPtr(Self, "map", listener);
const view = self.view;
// Add listeners that are only active while mapped
const surface = xwayland_surface.surface.?;
surface.data = @ptrToInt(&view.tree.node);
// Add listeners that are only active while mapped
xwayland_surface.events.set_title.add(&self.set_title);
xwayland_surface.events.set_class.add(&self.set_class);
xwayland_surface.events.request_fullscreen.add(&self.request_fullscreen);
@ -206,6 +208,8 @@ pub fn handleMap(listener: *wl.Listener(*wlr.XwaylandSurface), xwayland_surface:
fn handleUnmap(listener: *wl.Listener(*wlr.XwaylandSurface), _: *wlr.XwaylandSurface) void {
const self = @fieldParentPtr(Self, "unmap", listener);
self.xwayland_surface.surface.?.data = 0;
// Remove listeners that are only active while mapped
self.set_title.link.remove();
self.set_class.link.remove();